OS
v7.3.3
Documentation
|
API for the AT Command Line Interface extension. More...
Data Structures | |
struct | qATCLI_Handler_t |
The command argument with all the regarding information of the incoming AT command. More... | |
struct | qATCLI_t |
An AT Command Line Interface (CLI) object. More... | |
struct | qATCLI_Command_t |
An AT-Command object. More... | |
Macros | |
#define | qATCLI_ERROR_CODE(ecode) |
Used to indicate an error code as return value inside a command-callback. This code is defined by the application writer and should be a value between 1 and 32766 . | |
Typedefs | |
typedef qATCLI_Response_t(* | qATCLI_CommandCallback_t) (qATCLI_Handler_t arg1) |
Pointer to function : An AT-Command callback. | |
typedef qUINT16_t | qATCLI_Options_t |
A typedef that holds the options for an AT-Command object. | |
Enumerations | |
enum | qATCLI_Response_t { qATCLI_ERROR , qATCLI_NOTALLOWED , qATCLI_NORESPONSE , qATCLI_OK , qATCLI_DEVID , qATCLI_NOTFOUND , qATCLI_OUTPUT } |
an enumeration to define the possible values that can be returned from the callback of a command. More... | |
enum | qATCLI_CommandType_t { qATCLI_CMDTYPE_UNDEF , qATCLI_CMDTYPE_PARA , qATCLI_CMDTYPE_TEST , qATCLI_CMDTYPE_READ , qATCLI_CMDTYPE_ACT } |
An enum to describe the available AT command types. More... | |
enum | qATCLI_BuiltInString_t { QATCLI_BUILTIN_STR_IDENTIFIER , QATCLI_BUILTIN_STR_OK_RESPONSE , QATCLI_BUILTIN_STR_ERROR_RESPONSE , QATCLI_BUILTIN_STR_NOTFOUND_RESPONSE , QATCLI_BUILTIN_STR_TERM_EOL } |
Possible values for built-in string identifiers. More... | |
Functions | |
qBool_t | qATCLI_SetBuiltInString (qATCLI_t *const cli, qATCLI_BuiltInString_t which, const char *str) |
Set a CLI built-in string to a custom one. | |
qBool_t | qATCLI_Setup (qATCLI_t *const cli, const qPutChar_t outFcn, char *pInput, const size_t sizeInput, char *pOutput, const size_t sizeOutput) |
Setup an instance of the AT Command Line Interface. | |
qBool_t | qATCLI_CmdSubscribe (qATCLI_t *const cli, qATCLI_Command_t *const cmd, char *textCommand, const qATCLI_CommandCallback_t cFcn, qATCLI_Options_t cmdOpt, void *param) |
This function subscribes the CLI instance to a specific command with an associated Callback function, so that next time the required command is sent to the CLI input, the callback function will be executed. The CLI parser only analyze commands that follows the extended AT-Commands syntax (the + char can be ignored). | |
qATCLI_Command_t * | qATCLI_CmdIterate (const qATCLI_t *const cli, const qBool_t reload) |
Iterate between the commands available inside the AT-CLI instance. | |
qBool_t | qATCLI_ISRHandler (qATCLI_t *const cli, const char c) |
Feed the CLI input with a single character. This call is mandatory from an interrupt context. Put it inside the desired peripheral's ISR. If your ISR get a block of data, use instead qATCLI_ISRHandlerBlock() | |
qBool_t | qATCLI_ISRHandlerBlock (qATCLI_t *const cli, char *pData, const size_t n) |
Feed the CLI input with a string. This call is mandatory from an interrupt context. Put it inside the desired peripheral's ISR. If your ISR only get a single char, use instead qATCLI_ISRHandler() | |
qBool_t | qATCLI_Raise (qATCLI_t *const cli, const char *cmd) |
Sends a command to the specified AT Command Line Interface instance. | |
qATCLI_Response_t | qATCLI_Exec (qATCLI_t *const cli, char *cmd) |
Try to execute the requested command. | |
qBool_t | qATCLI_Input_Flush (qATCLI_t *const cli) |
Flush the CLI input buffer. | |
qBool_t | qATCLI_Run (qATCLI_t *const cli) |
Run the AT Command Line Interface when the input is ready. | |
API for the AT Command Line Interface extension.
#define qATCLI_ERROR_CODE | ( | ecode | ) |
Used to indicate an error code as return value inside a command-callback. This code is defined by the application writer and should be a value between 1
and 32766
.
For example, a return value of qATCLI_ERROR_CODE(15), will print out the string ERROR:15
.
typedef qATCLI_Response_t(* qATCLI_CommandCallback_t) (qATCLI_Handler_t arg1) |
Pointer to function : An AT-Command callback.
Example :
arg1 | A pointer to the public data of the CLI instance where the command its subscribed to. |
Possible values for built-in string identifiers.
Enumerator | |
---|---|
QATCLI_BUILTIN_STR_IDENTIFIER | To select the device identifier string. This string will be printed-out after a call to the |
QATCLI_BUILTIN_STR_OK_RESPONSE | To select the output message when a command callback returns qATCLI_OK. |
QATCLI_BUILTIN_STR_ERROR_RESPONSE | To select the output message when a command callback returns qATCLI_ERROR or any qATCLI_ERROR_CODE(#) |
QATCLI_BUILTIN_STR_NOTFOUND_RESPONSE | To select the output message when input does not match with any of the available commands |
QATCLI_BUILTIN_STR_TERM_EOL | To select the End-Of-Line string printed out after any of the CLI messages |
enum qATCLI_CommandType_t |
An enum to describe the available AT command types.
enum qATCLI_Response_t |
an enumeration to define the possible values that can be returned from the callback of a command.
qATCLI_Command_t * qATCLI_CmdIterate | ( | const qATCLI_t *const | cli, |
const qBool_t | reload ) |
Iterate between the commands available inside the AT-CLI instance.
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | reload | If qTrue, the iterator will set their position at the beginning of the list of subscribed commands. |
NULL
when no more commands are available. qBool_t qATCLI_CmdSubscribe | ( | qATCLI_t *const | cli, |
qATCLI_Command_t *const | cmd, | ||
char * | textCommand, | ||
const qATCLI_CommandCallback_t | cFcn, | ||
qATCLI_Options_t | cmdOpt, | ||
void * | param ) |
This function subscribes the CLI instance to a specific command with an associated Callback function, so that next time the required command is sent to the CLI input, the callback function will be executed. The CLI parser only analyze commands that follows the extended AT-Commands syntax (the + char can be ignored).
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | cmd | A pointer to the AT command object. |
[in] | textCommand | The string (name) of the command we want to subscribe to. Since this service only handles AT commands, this string has to begin by the "at" characters and should be in lower case. |
[in] | cFcn | The handler of the callback function associated to the command. Prototype: qATCLI_Response_t xCallback( qATCLI_Handler_t )
|
[in] | cmdOpt | This flag combines with a bitwise OR the following information: |
qATCLI_CMDTYPE_PARA : AT+cmd=x
,y is allowed. The execution of the callback function also depends on whether the number of argument is valid or not. Information about number of arguments is combined with a bitwise 'OR' : qATCLI_CMDTYPE_PARA | 0xXY , where X which defines maximum argument number for incoming command and Y which defines minimum argument number for incoming command
qATCLI_CMDTYPE_TEST : "AT+cmd=?"
is allowed.
qATCLI_CMDTYPE_READ : "AT+cmd?"
is allowed.
qATCLI_CMDTYPE_ACT : AT+cmd
is allowed.
[in] | param | User storage pointer. |
qATCLI_Response_t qATCLI_Exec | ( | qATCLI_t *const | cli, |
char * | cmd ) |
Try to execute the requested command.
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | cmd | The command string, including arguments if required. |
Feed the CLI input with a single character. This call is mandatory from an interrupt context. Put it inside the desired peripheral's ISR. If your ISR get a block of data, use instead qATCLI_ISRHandlerBlock()
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | c | The incoming byte/char to the input. |
Feed the CLI input with a string. This call is mandatory from an interrupt context. Put it inside the desired peripheral's ISR. If your ISR only get a single char, use instead qATCLI_ISRHandler()
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | pData | The incoming string. |
[in] | n | The length of the string. |
Run the AT Command Line Interface when the input is ready.
[in] | cli | A pointer to the AT Command Line Interface instance |
qBool_t qATCLI_SetBuiltInString | ( | qATCLI_t *const | cli, |
qATCLI_BuiltInString_t | which, | ||
const char * | str ) |
Set a CLI built-in string to a custom one.
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | which | To select which built-in string will be changed. |
[in] | str | The value of the selected string. |
qBool_t qATCLI_Setup | ( | qATCLI_t *const | cli, |
const qPutChar_t | outFcn, | ||
char * | pInput, | ||
const size_t | sizeInput, | ||
char * | pOutput, | ||
const size_t | sizeOutput ) |
Setup an instance of the AT Command Line Interface.
[in] | cli | A pointer to the AT Command Line Interface instance |
[in] | outFcn | The basic output-char wrapper function. All the CLI responses will be printed-out through this function. |
[in] | pInput | A memory location to store the cli input (Mandatory) |
[in] | sizeInput | The size of the memory allocated in pInput |
[in] | pOutput | A memory location to store the CLI output |
[in] | sizeOutput | The size of the memory allocated in pOutput |