AT CMD API 参考
Macros
-
WM_ATCMD_QUESTION_MARK
Question mark character
-
WM_ATCMD_EQUAL_MARK
Equal mark character
-
WM_ATCMD_L_SQ_BRACKET
Left square bracket
-
WM_ATCMD_R_SQ_BRACKET
Right square bracket
-
WM_ATCMD_L_ANGLE_BRACKET
Left angle bracket
-
WM_ATCMD_R_ANGLE_BRACKET
Right angle bracket
-
WM_ATCMD_DOUBLE_QUOTAION_MARKS
Double quotation marks
-
WM_ATCMD_COMMA_MARK
Comma
-
WM_ATCMD_CR
Carriage return
-
WM_ATCMD_LF
Line feed
-
WM_ATCMD_PLUS_MARK
Plus mark
-
WM_ATCMD_ESCAPE_CHR
Escape character
-
MAX_ARGC
Maximum number of command line parameters
-
AT_CMD_START_STR_LEN
Start the length of the at command
-
AT_CMD_START_STR
Start the string of the at command
-
AT_CMD_END_STR_LEN
End the length of the at command
-
AT_CMD_END_STR
At command end string
-
AT_CMD_LEN
At command length
-
AT_CMD_RECV_BUFF_LEN
At command receive buf length
-
AT_RESULT_BUFFER_SIZE
At size of the result buffer
-
WM_AT_DUMP_BUFF(buf, len)
-
WM_ATCMD_GET_WIFI_CTL(at_server)
-
WM_ATCMD_GET_TCPIP_CTL(at_server)
-
WM_ATCMD_GET_BT_CTL(at_server)
-
WM_ATCMD_GET_SYS_CTL(at_server)
-
WM_ATCMD_SET_ERRNO(at_server, errno)
-
WM_AT_ERRCOD_BASE_OFFSET
-
WM_AT_ERRCODE_SUBTYPE_OFFSET(subtype)
-
WM_AT_ERRCODE_SUBTYPE(subtype)
-
WM_AT_SUBTYPE_OK
-
WM_AT_SUBTYPE_COMMON_ERROR
-
WM_AT_SUBTYPE_NO_TERMINATOR
-
WM_AT_SUBTYPE_NO_AT
-
WM_AT_SUBTYPE_PARA_LENGTH_MISMATCH
-
WM_AT_SUBTYPE_PARA_TYPE_MISMATCH
-
WM_AT_SUBTYPE_PARA_NUM_MISMATCH
-
WM_AT_SUBTYPE_PARA_INVALID
-
WM_AT_SUBTYPE_PARA_PARSE_FAIL
-
WM_AT_SUBTYPE_UNSUPPORT_CMD
-
WM_AT_SUBTYPE_CMD_EXEC_FAIL
-
WM_AT_SUBTYPE_CMD_PROCESSING
-
WM_AT_SUBTYPE_CMD_OP_ERROR
-
AT_WAITING_FOREVER
-
WM_ATCMD_SECTION
-
WM_ATCMD_DEFINE(cmd, func, usage)
Enumerations
-
enum wm_at_msg_type_e
AT message types enumeration.
This enumeration defines the different types of messages that can be processed by the AT command module.
Values:
-
enumerator WM_ATCMD_BASE
Base value for AT command message types.
-
enumerator WM_ATCMD_MSG_RECVCMD
Triggered when a command is received.
-
enumerator WM_ATCMD_MSG_PASSTHROUGH_RECV
Triggered when unvarnished transmission data is received.
-
enumerator WM_ATCMD_MSG_EXIT_PASSTHROUGH
Triggered when exiting passthrough mode.
-
enumerator WM_ATCMD_MSG_NUM_MAX
Maximum number of message types.
-
enumerator WM_ATCMD_BASE
-
enum wm_atcmd_exit_passthrough_reason
Reasons for exiting passthrough mode.
This enumeration lists the possible reasons for exiting passthrough mode.
Values:
-
enumerator WM_ATCMD_EXIT_REASON_USER_ACTIVE
User actively exits passthrough mode.
-
enumerator WM_ATCMD_EXIT_REASON_RECV_EXIT_CODE
Exits due to receiving an exit code.
-
enumerator WM_ATCMD_EXIT_REASON_TIMEOUT
Exits due to a timeout.
-
enumerator WM_ATCMD_EXIT_REASON_NO_MEM
Exits due to lack of memory.
-
enumerator WM_ATCMD_EXIT_REASON_MAX
Maximum number of exit reasons.
-
enumerator WM_ATCMD_EXIT_REASON_USER_ACTIVE
-
enum wm_atcmd_dev_type
Device types for AT commands.
This enumeration specifies the different types of devices that can be used with AT commands.
Values:
-
enumerator WM_ATCMD_DEV_TYPE_UART
UART device type.
-
enumerator WM_ATCMD_DEV_TYPE_SPI
SPI device type.
-
enumerator WM_ATCMD_DEV_TYPE_I2C
I2C device type.
-
enumerator WM_ATCMD_DEV_TYPE_NET
Network device type.
-
enumerator WM_ATCMD_DEV_TYPE_BT
Bluetooth device type.
-
enumerator WM_ATCMD_DEV_TYPE_BLE
Bluetooth Low Energy device type.
-
enumerator WM_ATCMD_DEV_TYPE_MAX
Maximum number of device types.
-
enumerator WM_ATCMD_DEV_TYPE_UART
-
enum wm_at_type
Types of AT commands.
This enumeration distinguishes between different types of AT commands based on their functionality.
Values:
-
enumerator AT_TYPE_QUERY
Query type AT command, indicated by ‘?’.
-
enumerator AT_TYPE_TEST
Test type AT command, indicated by ‘=?’.
-
enumerator AT_TYPE_EXEC
Execute type AT command.
-
enumerator AT_TYPE_MAX
Maximum number of AT command types.
-
enumerator AT_TYPE_QUERY
-
enum wm_at_result
Results of AT command processing.
This enumeration lists the possible results that can be returned after processing an AT command.
Values:
-
enumerator WM_AT_RESULT_OK
AT command executed successfully.
-
enumerator WM_AT_RESULT_FAIL
AT command resulted in a generic error.
-
enumerator WM_AT_RESULT_NULL
No string returned as a result of the AT command.
-
enumerator WM_AT_RESULT_CMD_ERR
AT command not found.
-
enumerator WM_AT_RESULT_PARSE_FAIL
Failed to parse the AT command.
-
enumerator AT_RESULT_MAX
Maximum number of result types.
-
enumerator WM_AT_RESULT_OK
-
typedef enum wm_atcmd_exit_passthrough_reason wm_atcmd_exit_passthrough_reason_e
Reasons for exiting passthrough mode.
This enumeration lists the possible reasons for exiting passthrough mode.
-
typedef enum wm_atcmd_dev_type wm_atcmd_dev_type_e
Device types for AT commands.
This enumeration specifies the different types of devices that can be used with AT commands.
-
typedef enum wm_at_type wm_at_type_e
Types of AT commands.
This enumeration distinguishes between different types of AT commands based on their functionality.
-
typedef enum wm_at_result wm_at_result_e
Results of AT command processing.
This enumeration lists the possible results that can be returned after processing an AT command.
Structures
-
typedef struct wm_at_msg wm_at_msg_t
AT message structure.
This structure represents an AT command message and includes message ID, length, data, and handler.
-
typedef struct wm_dev_ops wm_dev_ops_t
Device operations structure.
This structure defines the operations for an AT command device, including sending and receiving functions.
-
typedef struct wm_atcmd_dev wm_atcmd_dev_t
AT command device structure.
This structure represents an AT command device, including its type and operations.
-
typedef struct wm_atcmd_result_str wm_atcmd_result_str_t
AT command result structure.
This structure contains the result of an AT command, including the result type and a string message.
-
typedef struct wm_atcmd_item wm_atcmd_item_t
AT command item structure.
This structure defines an individual AT command, including its name, handler, and usage description.
-
typedef struct wm_at_passthrough_param wm_at_passthrough_param_t
Passthrough parameter structure.
This structure contains parameters related to passthrough mode, including timeout, handlers, and buffers.
-
typedef struct wm_at_server_ctl wm_at_server_ctl_t
AT command server control structure.
This structure contains control information for the AT command server, including tasks, queues, and device parameters.
-
struct wm_at_msg
AT message structure.
This structure represents an AT command message and includes message ID, length, data, and handler.
-
struct wm_dev_ops
Device operations structure.
This structure defines the operations for an AT command device, including sending and receiving functions.
-
struct wm_atcmd_dev
AT command device structure.
This structure represents an AT command device, including its type and operations.
Public Members
-
wm_atcmd_dev_type_e type
Type of the device
-
wm_dev_ops_t ops
Operations associated with the device
-
wm_atcmd_dev_type_e type
-
struct wm_atcmd_result_str
AT command result structure.
This structure contains the result of an AT command, including the result type and a string message.
Public Members
-
wm_at_result_e result_type
Type of the result
-
char *result_str
String message associated with the result
-
wm_at_result_e result_type
-
struct wm_atcmd_item
AT command item structure.
This structure defines an individual AT command, including its name, handler, and usage description.
Public Members
-
char *cmd_name
Name of the AT command
-
wm_atcmd_act cmd_handle
Function to handle the AT command
-
char *cmd_usg
Usage description of the AT command
-
char *cmd_name
-
struct wm_at_passthrough_param
Passthrough parameter structure.
This structure contains parameters related to passthrough mode, including timeout, handlers, and buffers.
Public Members
-
char is_passthrough
Flag indicating if in passthrough mode
-
uint32_t timeout
Timeout for passthrough mode
-
uint32_t time
Timestamp for passthrough mode entry
-
wm_atcmd_tx_passthrough tx_handle
Function to handle passthrough data transmission
-
void *priv
Private data for passthrough handling
-
wm_atcmd_tx_passthrough_exit_notify exit_notify
Notification function when exiting passthrough mode
-
void *pt_exit_priv
Private data for exit notification
-
char *recv_buffer
Buffer for receiving passthrough data
-
short recv_buffer_len
Length of the receive buffer
-
char is_passthrough
-
struct wm_at_server_ctl
AT command server control structure.
This structure contains control information for the AT command server, including tasks, queues, and device parameters.
Public Members
-
wm_os_task_t at_comm_recv_task
Task for receiving AT commands
-
wm_os_task_t at_comm_proc_task
Task for processing AT commands
-
wm_os_queue_t *queue
Queue for managing AT command messages
-
wm_os_timer_t *timer
Timer for message processing delay
-
wm_atcmd_dev_t dev
Device for AT commands
-
wm_os_mutex_t *mutex
Mutex for synchronizing AT command access
-
short atcmd_num
Number of AT commands
-
wm_atcmd_item_t *at_cmd_table
Table of AT command items
-
uint32_t errno
Error number for AT command processing
-
wm_at_passthrough_param_t passthrough_param
Parameters for passthrough mode
-
char recv_buffer[256]
Buffer for receiving AT command data
-
short cur_recv_len
Current length of received data
-
char start_str[4]
Start string for AT commands
-
char end_str[4]
End string for AT commands
-
wm_atcmd_entry atcmd_enter
Entry function for AT commands
-
uint16_t at_recv_listnum
Number of received AT commands
-
wm_os_task_t at_comm_recv_task
Type Definitions
-
typedef void (*wm_atcmd_msg_func)(void *param)
AT command message handler function pointer type definition.
This type definition represents a function pointer that handles AT command messages.
- Param param:
A pointer to the parameter associated with the message.
-
typedef int (*wm_atcmd_act)(wm_at_type_e type, int argc, char **argv)
AT command action function pointer type definition.
This type definition represents a function pointer that performs an action based on the AT command type.
- Param type:
The type of the AT command.
- Param argc:
The number of arguments for the command.
- Param argv:
The arguments for the command.
- Return:
An integer value indicating the result of the action.
-
typedef int (*wm_atcmd_entry)(wm_atcmd_dev_t *dev, char *atcmd_buf)
AT command entry function pointer type definition.
This type definition represents a function pointer that serves as an entry point for processing AT commands.
- Param dev:
A pointer to the AT command device structure.
- Param atcmd_buf:
A pointer to the buffer containing the AT command.
- Return:
An integer value indicating the result of the entry action.
-
typedef int (*wm_atcmd_tx_passthrough)(void *buffer, int size, void *priv)
Passthrough transmit function pointer type definition.
This type definition represents a function pointer that handles the transmission of passthrough data.
- Param buffer:
A pointer to the buffer containing the data to transmit.
- Param size:
The size of the data to transmit.
- Param priv:
A pointer to private data associated with the transmission.
- Return:
An integer value indicating the result of the transmission.
-
typedef int (*wm_atcmd_tx_passthrough_exit_notify)(wm_atcmd_exit_passthrough_reason_e reason, void *priv)
Passthrough exit notification function pointer type definition.
This type definition represents a function pointer that is notified when exiting passthrough mode.
- Param reason:
The reason for exiting passthrough mode.
- Param priv:
A pointer to private data associated with the notification.
- Return:
An integer value indicating the result of the notification.
Functions
-
int wm_atcmd_init(void)
init atcmd model
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_atcmd_dev_register(wm_atcmd_dev_type_e dev_type, wm_dev_ops_t ops)
register atcmd dev ops
- 参数:
dev_type – [in] device type
ops – [in] device ops func
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_print_result(char *format, ...)
print result, max size is defined as “AT_RESULT_BUFFER_SIZE”
- 参数:
format – [in] format str
- 返回:
None
-
void wm_atcmd_print_raw_data(const void *data, int len)
print raw data
- 参数:
data – [in] raw data buffer
len – [in] raw data len
- 返回:
None
-
int wm_atcmd_enter_passthrough(wm_atcmd_tx_passthrough pt_tx_handle, wm_atcmd_tx_passthrough_exit_notify pt_exit_notify, void *priv, uint32_t timeout)
enter passthrough mode
- 参数:
pt_tx_handle – [in] passthrough tx func
priv – [in] user private data
pt_exit_notify – [in] passthrough exit notify func
timeout – [in] passthrough timeout
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_exit_passthrough(wm_atcmd_exit_passthrough_reason_e reason)
exit passthrough mode
- 参数:
reason – [in] exit reason
- 返回:
None