This function should be called only once, before any other AT functions are called.
Parameters
netconn_max
: the maximum number of the link in the at module
custom_version
: version information by custom
esp_at_get_para_as_digit
( int32_t
para_index , int32_t *
value
)
Parse digit parameter from command string.
ESP_AT_PARA_PARSE_RESULT_OK : succeed
ESP_AT_PARA_PARSE_RESULT_FAIL : fail
ESP_AT_PARA_PARSE_RESULT_OMITTED : this parameter is OMITTED
para_index
: the index of parameter
value
: the value parsed
esp_at_get_para_as_str
(
int32_t
para_index
, uint8_t **
result
)
Parse string parameter from command string.
ESP_AT_PARA_PARSE_RESULT_OK : succeed
ESP_AT_PARA_PARSE_RESULT_FAIL : fail
ESP_AT_PARA_PARSE_RESULT_OMITTED : this parameter is OMITTED
para_index
: the index of parameter
result
: the pointer that point to the result.
esp_at_port_recv_data_notify_from_isr
(
int32_t
len
)
Calling the esp_at_port_recv_data_notify_from_isr to notify at module that at port received data. When received this notice,at task will get data by calling get_data_length and read_data in esp_at_device_ops. This function MUST be used in isr.
len
: data length
esp_at_port_recv_data_notify
(
int32_t
len
, uint32_t
msec
)
Calling the esp_at_port_recv_data_notify to notify at module that at port received data. When received this notice,at task will get data by calling get_data_length and read_data in esp_at_device_ops. This function MUST NOT be used in isr.
true : succeed
false : fail
len
: data length
msec
: timeout time,The unit is millisecond. It waits forever,if msec is portMAX_DELAY.
esp_at_transmit_terminal_from_isr
(
void
)
terminal transparent transmit mode,This function MUST be used in isr.
esp_at_transmit_terminal
(
void
)
terminal transparent transmit mode,This function MUST NOT be used in isr.
esp_at_custom_cmd_array_regist
(
const
esp_at_cmd_struct
*
custom_at_cmd_array
, uint32_t
cmd_num
)
regist at command set, which defined by custom,
custom_at_cmd_array
: at command set
cmd_num
: command number
esp_at_device_ops_regist
(
esp_at_device_ops_struct
*
ops
)
regist device operate functions set,
ops
: device operate functions set
esp_at_custom_net_ops_regist
(
int32_t
link_id
,
esp_at_custom_net_ops_struct
*
ops
)
esp_at_custom_ble_ops_regist
(
int32_t
conn_index
,
esp_at_custom_ble_ops_struct
*
ops
)
esp_at_custom_ops_regist
(
esp_at_custom_ops_struct
*
ops
)
regist custom operate functions set interacting with AT,
ops
: custom operate functions set
esp_at_get_version
( void
)
get at module version number,
at version bit31~bit24: at main version bit23~bit16: at sub version bit15~bit8 : at test version bit7~bit0 : at custom version
esp_at_response_result
(
uint8_t
result_code
)
response AT process result,
result_code
: see esp_at_result_code_string_index
esp_at_port_write_data
(
uint8_t *
data
, int32_t
len
)
write data into device,
>= 0 : the real length of the data written
others : fail.
data
: data buffer to be written
len
: data length
esp_at_port_active_write_data
(
uint8_t *
data
, int32_t
len
)
call pre_active_write_data_callback() first and then write data into device,
>= 0 : the real length of the data written
others : fail.
data
: data buffer to be written
len
: data length
esp_at_port_read_data
(
uint8_t *
data
, int32_t
len
)
read data from device,
>= 0 : the real length of the data read from device
others : fail
data
: data buffer
len
: data length
esp_at_port_wait_write_complete
(
int32_t
timeout_msec
)
wait for transmitting data completely to peer device,
true : succeed,transmit data completely
false : fail
timeout_msec
: timeout time,The unit is millisecond.
esp_at_port_get_data_length
( void
)
get the length of the data received,
>= 0 : the length of the data received
others : fail
esp_at_base_cmd_regist
( void
)
regist at base command set. If not,you can not use AT base command
esp_at_user_cmd_regist
( void
)
regist at user command set. If not,you can not use AT user command
esp_at_wifi_cmd_regist
( void
)
regist at wifi command set. If not,you can not use AT wifi command
esp_at_net_cmd_regist
( void
)
regist at net command set. If not,you can not use AT net command
esp_at_mdns_cmd_regist
( void
)
regist at mdns command set. If not,you can not use AT mdns command
esp_at_driver_cmd_regist
( void
)
regist at driver command set. If not,you can not use AT driver command
esp_at_wps_cmd_regist
( void
)
regist at wps command set. If not,you can not use AT wps command
esp_at_smartconfig_cmd_regist
( void
)
regist at smartconfig command set. If not,you can not use AT smartconfig command
esp_at_ping_cmd_regist
( void
)
regist at ping command set. If not,you can not use AT ping command
esp_at_http_cmd_regist
( void
)
regist at http command set. If not,you can not use AT http command
esp_at_mqtt_cmd_regist
( void
)
regist at mqtt command set. If not,you can not use AT mqtt command
esp_at_ble_cmd_regist
( void
)
regist at ble command set. If not,you can not use AT ble command
esp_at_ble_hid_cmd_regist
( void
)
regist at ble hid command set. If not,you can not use AT ble hid command
esp_at_blufi_cmd_regist
( void
)
regist at blufi command set. If not,you can not use AT blufi command
esp_at_bt_cmd_regist
( void
)
regist at bt command set. If not,you can not use AT bt command
esp_at_bt_spp_cmd_regist
( void
)
regist at bt spp command set. If not,you can not use AT bt spp command
esp_at_bt_a2dp_cmd_regist
( void
)
regist at bt a2dp command set. If not,you can not use AT bt a2dp command
esp_at_fs_cmd_regist
( void
)
regist at fs command set. If not,you can not use AT fs command
esp_at_eap_cmd_regist
( void
)
regist at WPA2 Enterprise AP command set. If not,you can not use AT EAP command
esp_at_eth_cmd_regist
( void
)
regist at ethernet command set. If not,you can not use AT ethernet command
esp_at_custom_cmd_line_terminator_set
( uint8_t *
terminator
)
Set AT command terminator, by default, the terminator is “\r\n” You can change it by calling this function, but it just supports one character now.
true : succeed,transmit data completely
false : fail
terminator
: the line terminator
esp_at_custom_cmd_line_terminator_get
( void
)
Get AT command line terminator,by default, the return string is “\r\n”.
the command line terminator
esp_at_custom_partition_find
(
esp_partition_type_t
type , esp_partition_subtype_t
subtype ,
const char *
label
)
Find the partition which is defined in at_customize.csv.
pointer to esp_partition_t structure, or NULL if no partition is found. This pointer is valid for the lifetime of the application
type
: the type of the partition
subtype
: the subtype of the partition
label
: Partition label
esp_at_port_enter_specific
(
esp_at_port_specific_callback_t
callback
)
Set AT core as specific status, it will call callback if receiving data. for example:
/*F******************************************************************** * **********************************************************************/ static void wait_data_callback( void ) { xSemaphoreGive( sync_sema ); } /*F******************************************************************** * **********************************************************************/ void process_task( void *para ) { vSemaphoreCreateBinary( sync_sema ); xSemaphoreTake( sync_sema , portMAX_DELAY ); esp_at_port_write_data( (uint8_t*) ">", strlen( ">") ); esp_at_port_enter_specific ( wait_data_callback); while( xSemaphoreTake( sync_sema , port MAX_DELAY) ) { len = esp_at_port_read_data( data, data_len ); // TODO : } }
callback
: which will be called when received data from AT port
esp_at_port_exit_specific
( void
)
Exit AT core as specific status.
esp_at_get_current_cmd_name
( void
)
Get current AT command name.
esp_at_wifi_event_handler
( void *
ctx , system_event_t * event
)
Wi-Fi event handler callback, which used in AT core.
ESP_OK: succeed
others: fail
ctx
: reserved for user
event
: event type defined in this file
at_handle_result_code
(
esp_at_result_code_string_index
code , void * pbuf
)
esp_at_cmd_struct
esp_at_cmd_struct used for define at command
Public Members
at_cmdName
at command name
at_testCmd
)
( uint8_t *cmd_name
)
Test Command function pointer
at_queryCmd
)
( uint8_t *cmd_name
)
Query Command function pointer
at_setupCmd
)
( uint8_t para_num
)
Setup Command function pointer
at_exeCmd
)
( uint8_t *cmd_name
)
Execute Command function pointer
esp_at_device_ops_struct
esp_at_device_ops_struct device operate functions struct for AT
Public Members
read_data
)
( uint8_t *data, int32_t len
)
read data from device
write_data
)
( uint8_t *data, int32_t len
)
write data into device
get_data_length
)
( void
)
get the length of data received
wait_write_complete
)
( int32_t timeout_msec
)
wait write finish
esp_at_custom_net_ops_struct
esp_at_custom_net_ops_struct custom socket callback for AT
Public Members
recv_data
)
( uint8_t *data, int32_t len
)
callback when socket received data
connect_cb
)
( void
)
callback when socket connection is built
disconnect_cb
)
( void
)
callback when socket connection is disconnected
esp_at_custom_ble_ops_struct
esp_at_custom_ble_ops_struct custom ble callback for AT
Public Members
recv_data
)
( uint8_t *data, int32_t len
)
callback when ble received data
connect_cb
)
( void
)
callback when ble connection is built
disconnect_cb
)
( void
)
callback when ble connection is disconnected
esp_at_custom_ops_struct
esp_at_ops_struct some custom function interacting with AT
Public Members
status_callback
)
(
esp_at_status_type status
)
callback when AT status changes
pre_sleep_callback
)
(
at_sleep_mode_t mode
)
callback before enter modem sleep and light sleep
pre_deepsleep_callback
)
( void
)
callback before enter deep sleep
pre_restart_callback
)
( void
)
callback before restart
pre_active_write_data_callback
)
(
at_write_data_fn_t
)
callback before write data
at_min
( x, y
)
at_max
( x, y
)
ESP_AT_ERROR_NO
( subcategory, extension
)
ESP_AT_CMD_ERROR_OK
No Error
ESP_AT_CMD_ERROR_NON_FINISH
terminator character not found (“\r\n” expected)
ESP_AT_CMD_ERROR_NOT_FOUND_AT
Starting “AT” not found (or at, At or aT entered)
ESP_AT_CMD_ERROR_PARA_LENGTH
( which_para
)
parameter length mismatch
ESP_AT_CMD_ERROR_PARA_TYPE
( which_para
)
parameter type mismatch
ESP_AT_CMD_ERROR_PARA_NUM
( need, given
)
parameter number mismatch
ESP_AT_CMD_ERROR_PARA_INVALID
( which_para
)
the parameter is invalid
ESP_AT_CMD_ERROR_PARA_PARSE_FAIL
( which_para
)
parse parameter fail
ESP_AT_CMD_ERROR_CMD_UNSUPPORT
the command is not supported
ESP_AT_CMD_ERROR_CMD_EXEC_FAIL
( result
)
the command execution failed
ESP_AT_CMD_ERROR_CMD_PROCESSING
processing of previous command is in progress
ESP_AT_CMD_ERROR_CMD_OP_ERROR
the command operation type is error
at_write_data_fn_t
)
( uint8_t *data, int32_t len
)
esp_at_port_specific_callback_t
)
( void
)
AT specific callback type.
esp_at_status_type
esp_at_status some custom function interacting with AT
Values:
ESP_AT_STATUS_NORMAL
= 0x0
Normal mode.Now mcu can send AT command
ESP_AT_STATUS_TRANSMIT
Transparent Transmition mode
at_sleep_mode_t
Values:
AT_DISABLE_SLEEP
= 0
AT_MIN_MODEM_SLEEP
AT_LIGHT_SLEEP
AT_MAX_MODEM_SLEEP
AT_SLEEP_MAX
esp_at_module
module number,Now just AT module
Values:
ESP_AT_MODULE_NUM
= 0x01
AT module
esp_at_error_code
subcategory number
Values:
ESP_AT_SUB_OK
= 0x00
OK
ESP_AT_SUB_COMMON_ERROR
= 0x01
reserved
ESP_AT_SUB_NO_TERMINATOR
= 0x02
terminator character not found (“\r\n” expected)
ESP_AT_SUB_NO_AT
= 0x03
Starting “AT” not found (or at, At or aT entered)
ESP_AT_SUB_PARA_LENGTH_MISMATCH
= 0x04
parameter length mismatch
ESP_AT_SUB_PARA_TYPE_MISMATCH
= 0x05
parameter type mismatch
ESP_AT_SUB_PARA_NUM_MISMATCH
= 0x06
parameter number mismatch
ESP_AT_SUB_PARA_INVALID
= 0x07
the parameter is invalid
ESP_AT_SUB_PARA_PARSE_FAIL
= 0x08
parse parameter fail
ESP_AT_SUB_UNSUPPORT_CMD
= 0x09
the command is not supported
ESP_AT_SUB_CMD_EXEC_FAIL
= 0x0A
the command execution failed
ESP_AT_SUB_CMD_PROCESSING
= 0x0B
processing of previous command is in progress
ESP_AT_SUB_CMD_OP_ERROR
= 0x0C
the command operation type is error
esp_at_para_parse_result_type
the result of AT parse
Values:
ESP_AT_PARA_PARSE_RESULT_FAIL
= -1
parse fail,Maybe the type of parameter is mismatched,or out of range
ESP_AT_PARA_PARSE_RESULT_OK
= 0
Successful
ESP_AT_PARA_PARSE_RESULT_OMITTED
the parameter is OMITTED.
esp_at_result_code_string_index
the result code of AT command processing
Values:
ESP_AT_RESULT_CODE_OK
= 0x00
“OK”
ESP_AT_RESULT_CODE_ERROR
= 0x01
“ERROR”
ESP_AT_RESULT_CODE_FAIL
= 0x02
“ERROR”
ESP_AT_RESULT_CODE_SEND_OK
= 0x03
“SEND OK”
ESP_AT_RESULT_CODE_SEND_FAIL
= 0x04
“SEND FAIL”
ESP_AT_RESULT_CODE_IGNORE
= 0x05
response nothing, just change internal status
ESP_AT_RESULT_CODE_PROCESS_DONE
= 0x06
response nothing, just change internal status
ESP_AT_RESULT_CODE_OK_AND_INPUT_PROMPT
= 0x07
response nothing, just change internal status
ESP_AT_RESULT_CODE_MAX
esp_at_get_current_module_name
( void
)
get current module name
esp_at_get_module_name_by_id
( uint32_t
id
)
get module name by index
esp_at_get_module_id
( void
)
get current module id
esp_at_board_init
( void
)
init peripheral and default parameters in factory_param.bin
esp_at_web_server_cmd_regist
( void
)
regist WiFi config via web command. If not,you can not use web server to config wifi connect
ESP_AT_PORT_TX_WAIT_MS_MAX
ESP_AT_FACTORY_PARAMETER_SIZE