AT CMD API Reference
API reference
-
int wm_atcmd_init(void)
init atcmd model
- Returns:
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
- Parameters:
dev_type – [in] device type
ops – [in] device ops func
- Returns:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_print_result(char *format, ...)
print result, max size is defined as “AT_RESULT_BUFFER_SIZE”
- Parameters:
format – [in] format str
- Returns:
None
-
void wm_atcmd_print_raw_data(const void *data, int len)
print raw data
- Parameters:
data – [in] raw data buffer
len – [in] raw data len
- Returns:
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
- Parameters:
pt_tx_handle – [in] passthrough tx func
priv – [in] user private data
pt_exit_notify – [in] passthrough exit notify func
timeout – [in] passthrough timeout
- Returns:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_exit_passthrough(wm_atcmd_exit_passthrough_reason_e reason)
exit passthrough mode
- Parameters:
reason – [in] exit reason
- Returns:
None
Data Structure Reference
Defines
-
WM_ATCMD_QUESTION_MARK
-
WM_ATCMD_EQUAL_MARK
-
WM_ATCMD_L_SQ_BRACKET
-
WM_ATCMD_R_SQ_BRACKET
-
WM_ATCMD_L_ANGLE_BRACKET
-
WM_ATCMD_R_ANGLE_BRACKET
-
WM_ATCMD_DOUBLE_QUOTAION_MARKS
-
WM_ATCMD_COMMA_MARK
-
WM_ATCMD_CR
-
WM_ATCMD_LF
-
WM_ATCMD_PLUS_MARK
-
WM_ATCMD_ESCAPE_CHR
-
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_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)
Typedefs
-
typedef void (*wm_atcmd_msg_func)(void *param)
-
typedef enum wm_atcmd_exit_passthrough_reason wm_atcmd_exit_passthrough_reason_e
-
typedef enum wm_atcmd_dev_type wm_atcmd_dev_type_e
-
typedef struct wm_dev_ops wm_dev_ops_t
-
typedef struct wm_atcmd_dev wm_atcmd_dev_t
-
typedef enum wm_at_type wm_at_type_e
-
typedef int (*wm_atcmd_act)(wm_at_type_e type, int argc, char **argv)
-
typedef int (*wm_atcmd_entry)(wm_atcmd_dev_t *dev, char *atcmd_buf)
-
typedef int (*wm_atcmd_tx_passthrough)(void *buffer, int size, void *priv)
-
typedef int (*wm_atcmd_tx_passthrough_exit_notify)(wm_atcmd_exit_passthrough_reason_e reason, void *priv)
-
typedef enum wm_at_result wm_at_result_e
-
typedef struct wm_atcmd_result_str wm_atcmd_result_str_t
-
typedef struct wm_atcmd_item wm_atcmd_item_t
-
typedef struct wm_at_passthrough_param wm_at_passthrough_param_t
-
typedef struct wm_at_server_ctl wm_at_server_ctl_t
A structure used to manage AT servers.
Enums
-
enum wm_at_msg_type_e
Values:
-
enumerator WM_ATCMD_BASE
-
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
-
enumerator WM_ATCMD_MSG_NUM_MAX
-
enumerator WM_ATCMD_BASE
-
enum wm_atcmd_exit_passthrough_reason
Values:
-
enumerator WM_ATCMD_EXIT_REASON_USER_ACTIVE
-
enumerator WM_ATCMD_EXIT_REASON_RECV_EXIT_CODE
-
enumerator WM_ATCMD_EXIT_REASON_TIMEOUT
-
enumerator WM_ATCMD_EXIT_REASON_NO_MEM
-
enumerator WM_ATCMD_EXIT_REASON_MAX
-
enumerator WM_ATCMD_EXIT_REASON_USER_ACTIVE
-
enum wm_atcmd_dev_type
Values:
-
enumerator WM_ATCMD_DEV_TYPE_UART
-
enumerator WM_ATCMD_DEV_TYPE_SPI
-
enumerator WM_ATCMD_DEV_TYPE_I2C
-
enumerator WM_ATCMD_DEV_TYPE_NET
-
enumerator WM_ATCMD_DEV_TYPE_BT
-
enumerator WM_ATCMD_DEV_TYPE_BLE
-
enumerator WM_ATCMD_DEV_TYPE_MAX
-
enumerator WM_ATCMD_DEV_TYPE_UART
Functions
-
int wm_atcmd_init(void)
init atcmd model
- Returns:
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
- Parameters:
dev_type – [in] device type
ops – [in] device ops func
- Returns:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_print_result(char *format, ...)
print result, max size is defined as “AT_RESULT_BUFFER_SIZE”
- Parameters:
format – [in] format str
- Returns:
None
-
void wm_atcmd_print_raw_data(const void *data, int len)
print raw data
- Parameters:
data – [in] raw data buffer
len – [in] raw data len
- Returns:
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
- Parameters:
pt_tx_handle – [in] passthrough tx func
priv – [in] user private data
pt_exit_notify – [in] passthrough exit notify func
timeout – [in] passthrough timeout
- Returns:
WM_ERR_SUCCESS: succeed
others: failed
-
void wm_atcmd_exit_passthrough(wm_atcmd_exit_passthrough_reason_e reason)
exit passthrough mode
- Parameters:
reason – [in] exit reason
- Returns:
None
-
struct wm_at_msg
At processes the struct of the message.
-
struct wm_dev_ops
-
struct wm_atcmd_dev
-
struct wm_atcmd_result_str
-
struct wm_atcmd_item
-
struct wm_at_passthrough_param
Public Members
-
char is_passthrough
Passthrough message
-
uint32_t timeout
Passthrough timeout
-
uint32_t time
Passthrough timestamp, set time if recv
-
wm_atcmd_tx_passthrough tx_handle
Handles passthrough messages
-
void *priv
-
wm_atcmd_tx_passthrough_exit_notify exit_notify
Notification when exiting Passthrough transmission
-
void *pt_exit_priv
-
char *recv_buffer
Passthough receive buffer
-
short recv_buffer_len
Passthough receive buffer length
-
char is_passthrough
-
struct wm_at_server_ctl
A structure used to manage AT servers.
Public Members
-
wm_os_task_t at_comm_recv_task
At command receive task
-
wm_os_task_t at_comm_proc_task
-
wm_os_queue_t *queue
Servers queue
-
wm_os_timer_t *timer
Message processing delay time , used by passthrough send
-
wm_atcmd_dev_t dev
-
wm_os_mutex_t *mutex
-
short atcmd_num
At command number
-
wm_atcmd_item_t *at_cmd_table
-
uint32_t errno
AT err number
-
wm_at_passthrough_param_t passthrough_param
AT passthrough param
-
char recv_buffer[AT_CMD_RECV_BUFF_LEN]
At command receive buffer
-
short cur_recv_len
-
char start_str[AT_CMD_START_STR_LEN]
Start the string of the at command
-
char end_str[AT_CMD_END_STR_LEN]
At command end string
-
wm_atcmd_entry atcmd_enter
-
uint16_t at_recv_listnum
-
wm_os_task_t at_comm_recv_task