data
stringlengths
512
2.99k
When the operation is complete, the callback function will be called with ESP_HIDD_CLOSE_EVT. Note The disconnect operation will not remove the virtually cabled device. If the connect request from the different HID Host, it will reject the request. - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_hid_device_send_report(esp_hidd_report_type_t type, uint8_t id, uint16_t len, uint8_t *data) Sends HID report to the currently connected HID Host. This function should be called after esp_bluedroid_init()/esp_bluedroid_init_with_cfg() and esp_bluedroid_enable() success, and should be called after esp_bt_hid_device_init().
[in] type of report id -- [in] report id as defined by descriptor len -- [in] length of report data -- [in] report data - - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_hid_device_report_error(esp_hidd_handshake_error_t error) Sends HID Handshake with error info for invalid set_report to the currently connected HID Host. This function should be called after esp_bluedroid_init()/esp_bluedroid_init_with_cfg() and esp_bluedroid_enable() success, and should be called after esp_bt_hid_device_init().
Classic Bluetooth® L2CAP API Application Example Check bluetooth/bluedroid/classic_bt folder in ESP-IDF examples, which contains the following application: This is a BT_L2CAP demo. This demo can connect, send and receive L2CAP data bluetooth/bluedroid/classic_bt/bt_l2cap_client, bluetooth/bluedroid/classic_bt/bt_l2cap_server API Reference Header File components/bt/host/bluedroid/api/include/api/esp_l2cap_bt_api.h This header file can be included with: #include "esp_l2cap_bt_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_bt_l2cap_register_callback(esp_bt_l2cap_cb_t callback) This function is called to init callbacks with L2CAP module. - Parameters callback -- [in] pointer to the init callback function. - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_init(void) This function is called to init L2CAP module. When the operation is completed, the callback function will be called with ESP_BT_L2CAP_INIT_EVT. This function should be called after esp_bluedroid_enable() completes successfully. - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_deinit(void) This function is called to uninit l2cap module. The operation will close all active L2CAP connection first, then the callback function will be called with ESP_BT_L2CAP_CLOSE_EVT, and the number of ESP_BT_L2CAP_CLOSE_EVT is equal to the number of connection. When the operation is completed, the callback function will be called with ESP_BT_L2CAP_UNINIT_EVT. This function should be called after esp_bt_l2cap_init() completes successfully. - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_connect(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t remote_psm, esp_bd_addr_t peer_bd_addr) This function makes an L2CAP connection to a remote BD Address. When the connection is initiated or failed to initiate, the callback is called with ESP_BT_L2CAP_CL_INIT_EVT. When the connection is established or failed, the callback is called with ESP_BT_L2CAP_OPEN_EVT. This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit(). - Parameters cntl_flag -- [in] Lower 16-bit security settings mask.
[in] Remote device bluetooth device address. - - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_start_srv(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t local_psm) This function create a L2CAP server and starts listening for an L2CAP connection request from a remote Bluetooth device. When the server is started successfully, the callback is called with ESP_BT_L2CAP_START_EVT. When the connection is established, the callback is called with ESP_BT_L2CAP_OPEN_EVT. This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit(). - Parameters cntl_flag -- [in] Lower 16-bit security settings mask.
This function stops all L2CAP servers. The operation will close all active L2CAP connection first, then the callback function will be called with ESP_BT_L2CAP_CLOSE_EVT, and the number of ESP_BT_L2CAP_CLOSE_EVT is equal to the number of connection. When the operation is completed, the callback is called with ESP_BT_L2CAP_SRV_STOP_EVT. This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit(). - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_stop_srv(uint16_t local_psm) This function stops a specific L2CAP server. The operation will close all active L2CAP connection first on the specific L2CAP server, then the callback function will be called with ESP_BT_L2CAP_CLOSE_EVT, and the number of ESP_BT_L2CAP_CLOSE_EVT is equal to the number of connection. When the operation is completed, the callback is called with ESP_BT_L2CAP_SRV_STOP_EVT. This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit(). - Parameters local_psm -- [in] Dynamic PSM. - Returns ESP_OK: success other: failed - - esp_err_t esp_bt_l2cap_vfs_register(void)
This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit(). - Returns ESP_OK: success other: failed - Unions - union esp_bt_l2cap_cb_param_t - #include <esp_l2cap_bt_api.h> L2CAP callback parameters union. Public Members - struct esp_bt_l2cap_cb_param_t::l2cap_init_evt_param init L2CAP callback param of ESP_BT_L2CAP_INIT_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_uninit_evt_param uninit L2CAP callback param of ESP_BT_L2CAP_UNINIT_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_open_evt_param open L2CAP callback param of ESP_BT_L2CAP_OPEN_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_close_evt_param close L2CAP callback param of ESP_BT_L2CAP_CLOSE_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_start_evt_param start L2CAP callback param of ESP_BT_L2CAP_START_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_cl_init_evt_param cl_init L2CAP callback param of ESP_BT_L2CAP_CL_INIT_EVT - struct esp_bt_l2cap_cb_param_t::l2cap_srv_stop_evt_param srv_stop L2CAP callback param of ESP_BT_L2CAP_SRV_STOP_EVT - struct l2cap_cl_init_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_CL_INIT_EVT. Public Members - esp_bt_l2cap_status_t status status - uint32_t handle The connection handle - uint8_t sec_id security ID used by this server - esp_bt_l2cap_status_t status - struct l2cap_close_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_CLOSE_EVT. Public Members - esp_bt_l2cap_status_t status status - uint32_t handle The connection handle - bool async FALSE, if local initiates disconnect - esp_bt_l2cap_status_t status - struct l2cap_init_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_INIT_EVT. Public Members - esp_bt_l2cap_status_t status status - esp_bt_l2cap_status_t status - struct l2cap_open_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_OPEN_EVT. Public Members - esp_bt_l2cap_status_t status status - uint32_t handle The connection handle - int fd File descriptor - esp_bd_addr_t rem_bda The peer address - int32_t tx_mtu The transmit MTU - esp_bt_l2cap_status_t status - struct l2cap_srv_stop_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_SRV_STOP_EVT. Public Members - esp_bt_l2cap_status_t status status - uint8_t psm local psm - esp_bt_l2cap_status_t status - struct l2cap_start_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_START_EVT. Public Members - esp_bt_l2cap_status_t status status - uint32_t handle The connection handle - uint8_t sec_id security ID used by this server - esp_bt_l2cap_status_t status - struct l2cap_uninit_evt_param - #include <esp_l2cap_bt_api.h> ESP_BT_L2CAP_UNINIT_EVT. Public Members - esp_bt_l2cap_status_t status status - esp_bt_l2cap_status_t status - struct esp_bt_l2cap_cb_param_t::l2cap_init_evt_param init Macros - ESP_BT_L2CAP_SEC_NONE Security Setting Mask.
No security - - ESP_BT_L2CAP_SEC_AUTHORIZE Authorization required - ESP_BT_L2CAP_SEC_AUTHENTICATE Authentication required - ESP_BT_L2CAP_SEC_ENCRYPT Encryption required Type Definitions - typedef uint32_t esp_bt_l2cap_cntl_flags_t - typedef void (*esp_bt_l2cap_cb_t)(esp_bt_l2cap_cb_event_t event, esp_bt_l2cap_cb_param_t *param) L2CAP callback function type. - Param event Event type - Param param Point to callback parameter, currently is union type Enumerations - enum esp_bt_l2cap_status_t L2CAP operation success and failure codes. Values: - enumerator ESP_BT_L2CAP_SUCCESS Successful operation. - enumerator ESP_BT_L2CAP_FAILURE Generic failure. - enumerator ESP_BT_L2CAP_BUSY Temporarily can not handle this request. - enumerator ESP_BT_L2CAP_NO_RESOURCE No more resource - enumerator ESP_BT_L2CAP_NEED_INIT L2CAP module shall init first - enumerator ESP_BT_L2CAP_NEED_DEINIT L2CAP module shall deinit first - enumerator ESP_BT_L2CAP_NO_CONNECTION Connection may have been closed - enumerator ESP_BT_L2CAP_NO_SERVER No server - enumerator ESP_BT_L2CAP_SUCCESS - enum esp_bt_l2cap_cb_event_t L2CAP callback function events. Values: - enumerator ESP_BT_L2CAP_INIT_EVT When L2CAP is initialized, the event comes - enumerator ESP_BT_L2CAP_UNINIT_EVT When L2CAP is deinitialized, the event comes - enumerator ESP_BT_L2CAP_OPEN_EVT When L2CAP Client connection open, the event comes - enumerator ESP_BT_L2CAP_CLOSE_EVT When L2CAP connection closed, the event comes - enumerator ESP_BT_L2CAP_START_EVT When L2CAP server started, the event comes - enumerator ESP_BT_L2CAP_CL_INIT_EVT When L2CAP client initiated a connection, the event comes - enumerator ESP_BT_L2CAP_SRV_STOP_EVT When L2CAP server stopped, the event comes - enumerator ESP_BT_L2CAP_INIT_EVT
API Reference Header File This header file can be included with: #include "esp_sdp_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_sdp_register_callback(esp_sdp_cb_t callback) This function is called to init callbacks with SDP module. - Parameters callback -- [in] pointer to the init callback function. - Returns ESP_OK: success other: failed - - esp_err_t esp_sdp_init(void) This function is called to init SDP module. When the operation is completed, the callback function will be called with ESP_SDP_INIT_EVT.
This function should be called after esp_bluedroid_enable() completes successfully. - Returns ESP_OK: success other: failed - - esp_err_t esp_sdp_deinit(void) This function is called to de-initialize SDP module. The operation will remove all SDP records, then the callback function will be called with ESP_SDP_REMOVE_RECORD_COMP_EVT, and the number of ESP_SDP_REMOVE_RECORD_COMP_EVT is equal to the number of SDP records. When the operation is completed, the callback function will be called with ESP_SDP_DEINIT_EVT. This function should be called after esp_sdp_init() completes successfully. - Returns ESP_OK: success other: failed - - esp_err_t esp_sdp_search_record(esp_bd_addr_t bd_addr, esp_bt_uuid_t uuid) This function is called to performs service discovery for the services provided by the given peer device. When the operation is completed, the callback function will be called with ESP_SDP_SEARCH_COMP_EVT.
For compatible of API, retain this argument. This mode must be equal as the mode in "cfg" of esp_bt_controller_init(). - Returns ESP_OK - success, other - failed - esp_err_t esp_bt_controller_disable(void) Disable BT controller. - Returns ESP_OK - success, other - failed - esp_bt_controller_status_t esp_bt_controller_get_status(void) Get BT controller is initialised/de-initialised/enabled/disabled. - Returns status value - bool esp_vhci_host_check_send_available(void) esp_vhci_host_check_send_available used for check actively if the host can send packet to controller or not. - Returns true for ready to send, false means cannot send packet - void esp_vhci_host_send_packet(uint8_t
In case of NimBLE host, to release BSS and data memory to heap, the mode needs to be set to ESP_BT_MODE_BTDM as controller is dual mode. - Parameters mode -- : the mode whose memory is to be released - Returns ESP_OK - success, other - failed - esp_err_t esp_bt_sleep_enable(void) enable bluetooth to enter modem sleep Note that this function shall not be invoked before esp_bt_controller_enable() There are currently two options for bluetooth modem sleep, one is ORIG mode, and another is EVED Mode. EVED Mode is intended for BLE only. For ORIG mode: Bluetooth modem sleep is enabled in controller start up by default if CONFIG_CTRL_BTDM_MODEM_SLEEP is set and "ORIG mode" is selected. In ORIG modem sleep mode, bluetooth controller will switch off some components and pause to work every now and then, if there is no event to process; and wakeup according to the scheduled interval and resume the work. It can also wakeup earlier upon external request using function "esp_bt_controller_wakeup_request". - Returns ESP_OK : success other : failed - - esp_err_t esp_bt_sleep_disable(void) disable bluetooth modem sleep Note that this function shall not be invoked before esp_bt_controller_enable() If esp_bt_sleep_disable() is called, bluetooth controller will not be allowed to enter modem sleep; If ORIG modem sleep mode is in use, if this function is called, bluetooth controller may not immediately wake up if it is dormant then. In this case, esp_bt_controller_wakeup_request() can be used to shorten the time for wakeup. - Returns ESP_OK : success other : failed - - esp_err_t esp_ble_scan_dupilcate_list_flush(void) Manually clear scan duplicate list. Note that scan duplicate list will be automatically cleared when the maximum amount of device in the filter is reached the amount of device in the filter can be configured in menuconfig. Note This function name is incorrectly spelled, it will be fixed in release 5.x version. - Returns ESP_OK : success other : failed - - void esp_wifi_bt_power_domain_on(void) bt Wi-Fi power domain power on - void esp_wifi_bt_power_domain_off(void) bt Wi-Fi power domain power off Structures - struct esp_bt_controller_config_t Controller config options, depend on config mask. Config mask indicate which functions enabled, this means some options or parameters of some functions enabled by config mask. Public Members - uint16_t controller_task_stack_size Bluetooth controller task stack size - uint8_t controller_task_prio Bluetooth controller task priority - uint8_t hci_uart_no If use UART1/2 as HCI IO interface, indicate
UART number - uint32_t hci_uart_baudrate If use UART1/2 as HCI IO interface, indicate UART baudrate - uint8_t scan_duplicate_mode scan duplicate mode - uint8_t scan_duplicate_type scan duplicate type - uint16_t normal_adv_size Normal adv size for scan duplicate - uint16_t mesh_adv_size Mesh adv size for scan duplicate - uint16_t send_adv_reserved_size Controller minimum memory value - uint32_t controller_debug_flag Controller debug log flag - uint8_t mode Controller mode: BR/EDR, BLE or Dual Mode - uint8_t ble_max_conn BLE maximum connection numbers - uint8_t bt_max_acl_conn BR/EDR maximum ACL connection numbers - uint8_t bt_sco_datapath SCO data path, i.e. HCI or PCM module - bool auto_latency BLE auto latency, used to enhance classic BT performance - bool bt_legacy_auth_vs_evt BR/EDR Legacy auth complete event required to protect from BIAS attack - uint8_t bt_max_sync_conn BR/EDR maximum ACL connection numbers. Effective in menuconfig - uint8_t ble_sca BLE low power crystal accuracy index - uint8_t pcm_role PCM role (master & slave) - uint8_t pcm_polar PCM polar trig (falling clk edge & rising clk edge) - bool hli Using high level interrupt or not - uint16_t dup_list_refresh_period Duplicate scan list refresh period - uint32_t magic Magic number - uint16_t controller_task_stack_size - struct esp_vhci_host_callback esp_vhci_host_callback used for vhci call host function to notify what host need to do Macros - ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL - BT_CONTROLLER_INIT_CONFIG_DEFAULT() Type Definitions - typedef struct esp_vhci_host_callback esp_vhci_host_callback_t esp_vhci_host_callback used for vhci call host function to notify what host need to do Enumerations - enum esp_bt_mode_t Bluetooth mode for controller enable/disable. Values: - enumerator ESP_BT_MODE_IDLE Bluetooth is not running - enumerator ESP_BT_MODE_BLE Run BLE mode - enumerator ESP_BT_MODE_CLASSIC_BT Run Classic BT mode - enumerator ESP_BT_MODE_BTDM Run dual mode - enumerator ESP_BT_MODE_IDLE - enum
Values: - enumerator ESP_BLE_SCA_500PPM BLE SCA at 500ppm - enumerator ESP_BLE_SCA_250PPM BLE SCA at 250ppm - enumerator ESP_BLE_SCA_150PPM BLE SCA at 150ppm - enumerator ESP_BLE_SCA_100PPM BLE SCA at 100ppm - enumerator ESP_BLE_SCA_75PPM BLE SCA at 75ppm - enumerator ESP_BLE_SCA_50PPM BLE SCA at 50ppm - enumerator ESP_BLE_SCA_30PPM BLE SCA at 30ppm - enumerator ESP_BLE_SCA_20PPM BLE SCA at 20ppm - enumerator ESP_BLE_SCA_500PPM - enum esp_bt_controller_status_t Bluetooth controller enable/disable/initialised/de-initialised status. Values: - enumerator ESP_BT_CONTROLLER_STATUS_IDLE - enumerator ESP_BT_CONTROLLER_STATUS_INITED - enumerator ESP_BT_CONTROLLER_STATUS_ENABLED - enumerator ESP_BT_CONTROLLER_STATUS_NUM - enumerator ESP_BT_CONTROLLER_STATUS_IDLE - enum esp_ble_power_type_t BLE tx power type ESP_BLE_PWR_TYPE_CONN_HDL0-8: for each connection, and only be set after connection completed.
if each connection's TX power is not set, it will use this default value. if neither in scan mode nor in adv mode, it will use this default value. If none of power type is set, system will use ESP_PWR_LVL_P3 as default for ADV/SCAN/CONN0-9. Values: - enumerator ESP_BLE_PWR_TYPE_CONN_HDL0 For connection handle 0 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL1 For connection handle 1 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL2 For connection handle 2 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL3 For connection handle 3 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL4 For connection handle 4 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL5 For connection handle 5 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL6 For connection handle 6 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL7 For connection handle 7 - enumerator ESP_BLE_PWR_TYPE_CONN_HDL8 For connection handle 8 - enumerator ESP_BLE_PWR_TYPE_ADV For advertising - enumerator ESP_BLE_PWR_TYPE_SCAN For scan - enumerator ESP_BLE_PWR_TYPE_DEFAULT For default, if not set other, it will use default value - enumerator ESP_BLE_PWR_TYPE_NUM TYPE numbers - enumerator ESP_BLE_PWR_TYPE_CONN_HDL0 - enum esp_power_level_t Bluetooth TX power level(index), it's just a index corresponding to power(dbm). Values: - enumerator ESP_PWR_LVL_N12 Corresponding to -12dbm - enumerator ESP_PWR_LVL_N9 Corresponding to -9dbm - enumerator ESP_PWR_LVL_N6 Corresponding to -6dbm - enumerator ESP_PWR_LVL_N3 Corresponding to -3dbm - enumerator ESP_PWR_LVL_N0 Corresponding to 0dbm - enumerator ESP_PWR_LVL_P3 Corresponding to +3dbm - enumerator ESP_PWR_LVL_P6 Corresponding to +6dbm - enumerator ESP_PWR_LVL_P9 Corresponding to +9dbm - enumerator ESP_PWR_LVL_N14 Backward compatibility! Setting to -14dbm will actually result to -12dbm - enumerator ESP_PWR_LVL_N11 Backward compatibility! Setting to -11dbm will actually result to -9dbm - enumerator ESP_PWR_LVL_N8 Backward compatibility! Setting to -8dbm will actually result to -6dbm - enumerator ESP_PWR_LVL_N5 Backward compatibility! Setting to -5dbm will actually result to -3dbm - enumerator ESP_PWR_LVL_N2 Backward compatibility! Setting to -2dbm will actually result to 0dbm - enumerator ESP_PWR_LVL_P1 Backward compatibility! Setting to +1dbm will actually result to +3dbm - enumerator ESP_PWR_LVL_P4 Backward compatibility! Setting to +4dbm will actually result to +6dbm - enumerator ESP_PWR_LVL_P7 Backward compatibility! Setting to +7dbm will actually result to +9dbm - enumerator ESP_PWR_LVL_N12
Event parameter of ESP_BLE_MESH_PROXY_CLIENT_SEND_SOLIC_PDU_COMP_EVT - struct esp_ble_mesh_prov_cb_param_t::ble_mesh_model_sub_group_addr_comp_param model_sub_group_addr_comp Event parameters of ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT - struct esp_ble_mesh_prov_cb_param_t::ble_mesh_model_unsub_group_addr_comp_param model_unsub_group_addr_comp Event parameters of ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT - struct esp_ble_mesh_prov_cb_param_t::ble_mesh_deinit_mesh_comp_param deinit_mesh_comp Event parameter of ESP_BLE_MESH_DEINIT_MESH_COMP_EVT - struct ble_mesh_deinit_mesh_comp_param - #include <esp_ble_mesh_defs.h> ESP_BLE_MESH_DEINIT_MESH_COMP_EVT. Public Members - int err_code Indicate the result of BLE Mesh deinitialization - int err_code - struct ble_mesh_friend_friendship_establish_param - #include <esp_ble_mesh_defs.h> ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT. Public Members - uint16_t lpn_addr Low Power Node unicast address - uint16_t lpn_addr - struct ble_mesh_friend_friendship_terminate_param - #include <esp_ble_mesh_defs.h> ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT. Public Types - enum [anonymous] This enum value is the reason of friendship termination on the friend node side Values: - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_ESTABLISH_FAIL Friend Offer has been sent, but Friend Offer is not received within 1 second, friendship fails to be established - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_POLL_TIMEOUT Friendship is established, PollTimeout timer expires and no Friend Poll/Sub Add/Sub Remove is received - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_REQ Receive Friend Request from existing Low Power Node - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_CLEAR Receive Friend Clear from other friend node - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_DISABLE Friend feature disabled or corresponding NetKey is deleted - enumerator ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_ESTABLISH_FAIL Public Members - uint16_t lpn_addr Low Power Node unicast address - enum esp_ble_mesh_prov_cb_param_t::ble_mesh_friend_friendship_terminate_param::[anonymous] reason This enum value is the reason of friendship termination on the friend node side Friendship terminated reason - enum
send_ttl TTL, or ESP_BLE_MESH_TTL_DEFAULT for default TTL. - uint8_t send_cred Security credentials used for sending the message - uint8_t send_tag Tag used for sending the message. - esp_ble_mesh_model_t *model Model corresponding to the message, no need to be initialized before sending message - bool srv_send Indicate if the message is sent by a node server model, no need to be initialized before sending message - uint16_t net_idx - struct esp_ble_mesh_prov_t Provisioning properties & capabilities. This structure is associated with struct bt_mesh_prov in mesh_access.h - struct esp_ble_mesh_comp_t Node Composition data context. This structure is associated with struct bt_mesh_comp in mesh_access.h - struct esp_ble_mesh_unprov_dev_add_t Information of the device which is going to be added for provisioning. Public Members - esp_ble_mesh_bd_addr_t addr Device address - esp_ble_mesh_addr_type_t addr_type Device address type - uint8_t uuid[16] Device UUID - uint16_t oob_info Device OOB Info ADD_DEV_START_PROV_NOW_FLAG shall not be set if the bearer has both PB-ADV and PB-GATT enabled - esp_ble_mesh_prov_bearer_t bearer Provisioning Bearer - esp_ble_mesh_bd_addr_t addr - struct esp_ble_mesh_device_delete_t Information of the device which is going to be deleted. Public Members - esp_ble_mesh_bd_addr_t addr Device address - esp_ble_mesh_addr_type_t addr_type Device address type - uint8_t uuid[16] Device UUID - union esp_ble_mesh_device_delete_t::[anonymous] [anonymous] Union of Device information - uint8_t flag BIT0: device address; BIT1: device UUID - esp_ble_mesh_bd_addr_t addr - struct esp_ble_mesh_prov_data_info_t Information of the provisioner which is going to be updated. - struct esp_ble_mesh_node_t Information of the provisioned node Public Members - esp_ble_mesh_bd_addr_t addr Node device address - esp_ble_mesh_addr_type_t addr_type Node device address type - uint8_t dev_uuid[16] Device UUID - uint16_t oob_info Node OOB information - uint16_t unicast_addr Node unicast address - uint8_t element_num Node element number - uint16_t net_idx Node NetKey Index - uint8_t flags Node key refresh flag and iv update flag - uint32_t iv_index Node IV Index - uint8_t dev_key[16] Node device key - char name[ESP_BLE_MESH_NODE_NAME_MAX_LEN + 1] Node name - uint16_t comp_length Length of Composition Data - uint8_t
The maximum length of a BLE Mesh message, including Opcode, Payload and TransMIC Length of a short Mesh MIC. - ESP_BLE_MESH_MIC_SHORT Length of a long Mesh MIC. - ESP_BLE_MESH_MIC_LONG The maximum length of a BLE Mesh provisioned node name - ESP_BLE_MESH_NODE_NAME_MAX_LEN The maximum length of a BLE Mesh unprovisioned device name - ESP_BLE_MESH_DEVICE_NAME_MAX_LEN The maximum length of settings user id - ESP_BLE_MESH_SETTINGS_UID_SIZE The default value of Random Update Interval Steps - ESP_BLE_MESH_RAND_UPDATE_INTERVAL_DEFAULT Invalid settings index - ESP_BLE_MESH_INVALID_SETTINGS_IDX Define the BLE Mesh octet 16 bytes size - ESP_BLE_MESH_OCTET16_LEN - ESP_BLE_MESH_OCTET8_LEN - ESP_BLE_MESH_CID_NVAL Special TTL value to request using configured default TTL - ESP_BLE_MESH_TTL_DEFAULT Maximum allowed TTL value - ESP_BLE_MESH_TTL_MAX - ESP_BLE_MESH_ADDR_UNASSIGNED - ESP_BLE_MESH_ADDR_ALL_NODES - ESP_BLE_MESH_ADDR_PROXIES - ESP_BLE_MESH_ADDR_FRIENDS - ESP_BLE_MESH_ADDR_RELAYS - ESP_BLE_MESH_KEY_UNUSED - ESP_BLE_MESH_KEY_DEV - ESP_BLE_MESH_KEY_PRIMARY - ESP_BLE_MESH_KEY_ANY Internal macros used to initialize array members - ESP_BLE_MESH_KEY_UNUSED_ELT_(IDX, _) - ESP_BLE_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) - ESP_BLE_MESH_MODEL_KEYS_UNUSED - ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED Primary Network Key index - ESP_BLE_MESH_NET_PRIMARY Relay state value - ESP_BLE_MESH_RELAY_DISABLED - ESP_BLE_MESH_RELAY_ENABLED - ESP_BLE_MESH_RELAY_NOT_SUPPORTED Beacon state value - ESP_BLE_MESH_BEACON_DISABLED - ESP_BLE_MESH_BEACON_ENABLED - ESP_BLE_MESH_PRIVATE_BEACON_DISABLE - ESP_BLE_MESH_PRIVATE_BEACON_ENABLE GATT Proxy state value - ESP_BLE_MESH_GATT_PROXY_DISABLED - ESP_BLE_MESH_GATT_PROXY_ENABLED - ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED - ESP_BLE_MESH_PRIVATE_GATT_PROXY_DISABLED - ESP_BLE_MESH_PRIVATE_GATT_PROXY_ENABLED - ESP_BLE_MESH_PRIVATE_GATT_PROXY_NOT_SUPPORTED - ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_DISABLED - ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_ENABLED - ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_NOT_SUPPORTED Friend state value - ESP_BLE_MESH_FRIEND_DISABLED - ESP_BLE_MESH_FRIEND_ENABLED - ESP_BLE_MESH_FRIEND_NOT_SUPPORTED Node identity state value - ESP_BLE_MESH_NODE_IDENTITY_STOPPED - ESP_BLE_MESH_NODE_IDENTITY_RUNNING - ESP_BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED Subnet Bridge state value - ESP_BLE_MESH_SUBNET_BRIDGE_DISABLED - ESP_BLE_MESH_SUBNET_BRIDGE_ENABLED Supported features - ESP_BLE_MESH_FEATURE_RELAY - ESP_BLE_MESH_FEATURE_PROXY - ESP_BLE_MESH_FEATURE_FRIEND - ESP_BLE_MESH_FEATURE_LOW_POWER - ESP_BLE_MESH_FEATURE_ALL_SUPPORTED - ESP_BLE_MESH_ADDR_IS_UNICAST(addr) - ESP_BLE_MESH_ADDR_IS_GROUP(addr) - ESP_BLE_MESH_ADDR_IS_VIRTUAL(addr) - ESP_BLE_MESH_ADDR_IS_RFU(addr) - ESP_BLE_MESH_INVALID_NODE_INDEX - ESP_BLE_MESH_PROV_RECORD_MAX_ID - ESP_BLE_MESH_TRANSMIT(count, int_ms) Encode transmission count & interval steps.
int_ms -- Interval steps in milliseconds. Must be greater than 0 and a multiple of 10. - - Returns BLE Mesh transmit value that can be used e.g. for the default values of the Configuration Model data. - ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit) Decode transmit count from a transmit value. - Parameters transmit -- Encoded transmit count & interval value. - - Returns Transmission count (actual transmissions equal to N + 1). - ESP_BLE_MESH_GET_TRANSMIT_INTERVAL(transmit) Decode transmit interval from a transmit value. - Parameters transmit -- Encoded transmit count & interval value. - - Returns Transmission interval in milliseconds. - ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms) Encode Publish Retransmit count & interval steps. - Parameters count -- Number of retransmissions (first transmission is excluded).
net_idx -- [in] NetKey Index. app_idx -- [in] AppKey Index. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_bind_app_key_to_local_model(uint16_t element_addr, uint16_t company_id, uint16_t model_id, uint16_t app_idx) This function is called by Node to bind AppKey to model locally. Note If going to bind app_key with local vendor model, the company_id shall be set to 0xFFFF. This function can only be called after the device is provisioned. - Parameters element_addr -- [in] Node local element address company_id -- [in] Node local company id model_id -- [in] Node local model id app_idx -- [in] Node local appkey index - - Returns ESP_OK on success or error code otherwise. Low Power Operation (Updating) Header File components/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_low_power_api.h This header file can be included with: #include "esp_ble_mesh_low_power_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_ble_mesh_lpn_enable(void) Enable BLE Mesh device LPN functionality. Note This API enables LPN functionality. Once called, the proper Friend Request will be sent. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_lpn_disable(bool force) Disable BLE Mesh device LPN functionality. - Parameters force -- [in] when disabling LPN functionality, use this flag to indicate whether directly clear corresponding information or just send friend clear to disable it if friendship has already been established. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_lpn_poll(void) LPN tries to poll messages from the Friend Node. Note The Friend Poll message is sent by a Low Power node to ask the Friend node to send a message that it has stored for the Low Power node. Users can call this API to send Friend Poll message manually. If this API is not invoked, the bottom layer of the Low Power node will send Friend Poll before the PollTimeout timer expires. If the corresponding Friend Update is received and MD is set to 0, which means there are no messages for the Low Power node, then the Low Power node will stop scanning. - Returns ESP_OK on success or error code otherwise.
data -- [in] Parameters of Access Payload (exclude the message opcode) to be sent. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model, esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode, uint16_t length, uint8_t *data, int32_t msg_timeout, bool need_rsp, esp_ble_mesh_dev_role_t device_role) Send client model message (such as model get, set, etc). - Parameters model -- [in] BLE Mesh Client Model to which the message belongs. ctx -- [in] Message context, includes keys, TTL, etc. opcode -- [in] Message opcode. length -- [in] Message length (exclude the message opcode).
[in] TRUE if the opcode requires the peer device to reply, FALSE otherwise. device_role -- [in] Role of the device (Node/Provisioner) that sends the message. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcode, uint16_t length, uint8_t *data, esp_ble_mesh_dev_role_t device_role) Send a model publication message. Note Before calling this function, the user needs to ensure that the model publication message (esp_ble_mesh_model_pub_t::msg) contains a valid message to be sent. And if users want to update the publishing message, this API should be called in ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT with the message updated. - Parameters model --
[in] Role of the device (node/provisioner) publishing the message of the type esp_ble_mesh_dev_role_t. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model, esp_ble_mesh_server_state_type_t type, esp_ble_mesh_server_state_value_t *value) Update a server model state value. If the model publication state is set properly (e.g. publish address is set to a valid address), it will publish corresponding status message. Note Currently this API is used to update bound state value, not for all server model states. - Parameters model -- [in] Server model which is going to update the state. type -- [in] Server model state type. value -- [in] Server model state value. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_local_reset(void) Reset the provisioning procedure of the local BLE Mesh node. Note All provisioning information in this node will be deleted and the node needs to be re-provisioned. The API function esp_ble_mesh_node_prov_enable() needs to be called to start a new provisioning procedure. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_set_node_name(uint16_t index, const char *name) This function is called to set the node (provisioned device) name. Note index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT. - Parameters index -- [in] Index of the node in the node queue. name -- [in] Name (end by '\0') to be set for the node. - - Returns ESP_OK on success or error code otherwise. - const char *esp_ble_mesh_provisioner_get_node_name(uint16_t index) This function is called to get the node (provisioned device) name. Note index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT. - Parameters index -- [in] Index of the node in the node queue. - Returns Node name on success, or NULL on failure. - uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name) This function is called to get the node (provisioned device) index. - Parameters name -- [in] Name of the node (end by '\0'). - Returns Node index on success, or an invalid value (0xFFFF) on failure. - esp_err_t
*data, uint16_t length) This function is called to store the Composition Data of the node. - Parameters unicast_addr -- [in] Element address of the node data -- [in] Pointer of Composition Data length -- [in] Length of Composition Data - - Returns ESP_OK on success or error code otherwise. - esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16]) This function is called to get the provisioned node information with the node device uuid. - Parameters uuid -- [in] Device UUID of the node - Returns Pointer of the node info struct or NULL on failure. - esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr) This function is called to get the provisioned node information with the node unicast address. - Parameters unicast_addr -- [in] Unicast address of the node - Returns Pointer of the node info struct or NULL on failure. - esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_name(const char *name) This function is called to get the provisioned node information with the node name. - Parameters name -- [in] Name of the node (end by '\0'). - Returns Pointer of the node info struct or NULL on failure. - uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void) This function is called by Provisioner to get provisioned node count. - Returns Number of the provisioned nodes. - const esp_ble_mesh_node_t **esp_ble_mesh_provisioner_get_node_table_entry(void) This function is called by Provisioner to get the entry of the node table. Note After invoking the function to get the entry of nodes, users can use the "for" loop combined with the macro CONFIG_BLE_MESH_MAX_PROV_NODES to get each node's information. Before trying to read the node's information, users need to check if the node exists, i.e. if the *(esp_ble_mesh_node_t **node) is NULL.
This function is called to delete the provisioned node information with the node device uuid. - Parameters uuid -- [in] Device UUID of the node - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr) This function is called to delete the provisioned node information with the node unicast address. - Parameters unicast_addr -- [in] Unicast address of the node - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t
If set to NULL, app_key will be generated internally. net_idx: Should be an existing one. app_idx: If it is going to be generated internally, it should be set to 0xFFFF, and the new app_idx will be reported via an event. - Parameters app_key -- [in] The app key to be set for the local BLE Mesh stack. net_idx -- [in] The network key index. app_idx -- [in] The app key index. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16], uint16_t net_idx, uint16_t app_idx) This function is used to update a local AppKey for Provisioner. - Parameters app_key -- [in] Value of the AppKey. net_idx -- [in] Corresponding NetKey Index. app_idx -- [in] The AppKey Index - - Returns ESP_OK on success or error code otherwise. - const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint16_t app_idx) This function is called by Provisioner to get the local app key value. - Parameters net_idx -- [in] Network key index. app_idx -- [in] Application key index. - - Returns App key on success, or NULL on failure. - esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx, uint16_t model_id, uint16_t company_id) This function is called by Provisioner to bind own model with proper app key.
If going to bind app_key with local vendor model, company_id should be set to 0xFFFF. - Parameters element_addr -- [in] Provisioner local element address app_idx -- [in] Provisioner local appkey index model_id -- [in] Provisioner local model id company_id -- [in] Provisioner local company id - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_add_local_net_key(const uint8_t net_key[16 ], uint16_t net_idx) This function is called by Provisioner to add local network key. Note net_key: If set to NULL, net_key will be generated internally. net_idx: If it is going to be generated internally, it should be set to 0xFFFF, and the new net_idx will be reported via an event. - Parameters net_key -- [in] The network key to be added to the Provisioner local BLE Mesh stack. net_idx -- [in] The network key index. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16], uint16_t net_idx) This function is called by Provisioner to update a local network key. - Parameters net_key -- [in] Value of the NetKey. net_idx -- [in] The NetKey Index. - - Returns ESP_OK on success or error code otherwise. - const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx) This function is called by Provisioner to get the local network key value. - Parameters net_idx -- [in] Network key index. - Returns Network key on success, or NULL on failure. - esp_err_t esp_ble_mesh_provisioner_recv_heartbeat(bool enable) This function is called by Provisioner to enable or disable receiving heartbeat messages. Note If enabling receiving heartbeat message successfully, the filter will be an empty rejectlist by default, which means all heartbeat messages received by the Provisioner will be reported to the application layer. - Parameters enable -- [in] Enable or disable receiving heartbeat messages. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_type(uint8_t type) This function is called by Provisioner to set the heartbeat filter type.
Before closing the nvs namespace, it must be open. When the function is invoked, the Provisioner functionality will be disabled firstly, and: a) If the "erase" flag is set to false, the mesh information will be cleaned (e.g. removing NetKey, AppKey, nodes, etc) from the mesh stack. b) If the "erase" flag is set to true, the mesh information stored in the nvs namespace will also be erased besides been cleaned from the mesh stack. If Provisioner tries to work properly again, we can invoke the open function to open a new nvs namespace or a previously added one, and restore the mesh information from it if not erased. The working process shall be as following: a) Open settings A b) Start to provision and control nodes c) Close settings A d) Open settings B e) Start to provision and control other nodes f) Close settings B g) ...... - Parameters index -- [in] Settings index. erase -- [in] Indicate if erasing mesh information. - - Returns ESP_OK on success or error code otherwise. - - esp_err_t esp_ble_mesh_provisioner_close_settings_with_uid(const char *uid, bool erase) This function is called by Provisioner to close a nvs namespace which is opened previously for storing mesh information. Note 1.
Before closing the nvs namespace, it must be open. When the function is invoked, the Provisioner functionality will be disabled firstly, and: a) If the "erase" flag is set to false, the mesh information will be cleaned (e.g. removing NetKey, AppKey, nodes, etc) from the mesh stack. b) If the "erase" flag is set to true, the mesh information stored in the nvs namespace will also be erased besides been cleaned from the mesh stack. If Provisioner tries to work properly again, we can invoke the open function to open a new nvs namespace or a previously added one, and restore the mesh information from it if not erased.
[in] Indicate if erasing mesh information. - - Returns ESP_OK on success or error code otherwise. - - esp_err_t esp_ble_mesh_provisioner_delete_settings_with_index(uint8_t index) This function is called by Provisioner to erase the mesh information and settings user id from a nvs namespace. Note When this function is called, the nvs namespace must not be open. This function is used to erase the mesh information and settings user id which are not used currently. - Parameters index -- [in] Settings index. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_delete_settings_with_uid(const char *uid) This function is called by Provisioner to erase the mesh information and settings user id from a nvs namespace. Note When this function is called, the nvs namespace must not be open. This function is used to erase the mesh information and settings user id which are not used currently. - Parameters uid -- [in] Settings user id. - Returns ESP_OK on success or error code otherwise. - const char *esp_ble_mesh_provisioner_get_settings_uid(uint8_t index) This function is called by Provisioner to get settings user id. - Parameters index -- [in] Settings index. - Returns Setting user id on success or NULL on failure. - uint8_t esp_ble_mesh_provisioner_get_settings_index(const char *uid) This function is called by Provisioner to get settings index. - Parameters uid -- [in] Settings user id. - Returns Settings index. - uint8_t esp_ble_mesh_provisioner_get_free_settings_count(void) This function is called by Provisioner to get the number of free settings user id. - Returns Number of free settings user id. - const uint8_t *esp_ble_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx) This function is called to get fast provisioning application key. - Parameters net_idx --
[in] Application key index. - - Returns Application key on success, or NULL on failure. Type Definitions - typedef void (*esp_ble_mesh_model_cb_t)(esp_ble_mesh_model_cb_event_t event, esp_ble_mesh_model_cb_param_t *param) : event, event code of user-defined model events; param, parameters of user-defined model events ESP-BLE-MESH Node/Provisioner Provisioning Header File components/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_provisioning_api.h This header file can be included with: #include "esp_ble_mesh_provisioning_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_ble_mesh_register_prov_callback(esp_ble_mesh_prov_cb_t callback) Register BLE Mesh provisioning callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. - bool esp_ble_mesh_node_is_provisioned(void) Check if a device has been provisioned. - Returns TRUE if the device is provisioned, FALSE if the device is unprovisioned. - esp_err_t esp_ble_mesh_node_prov_enable(esp_ble_mesh_prov_bearer_t bearers) Enable specific provisioning bearers to get the device ready for provisioning.
Note PB-ADV: send unprovisioned device beacon. PB-GATT: send connectable advertising packets. - Parameters bearers -- Bit-wise OR of provisioning bearers. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers) Disable specific provisioning bearers to make a device inaccessible for provisioning. - Parameters bearers -- Bit-wise OR of provisioning bearers. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32], uint8_t private_key[32]) Unprovisioned device set own oob public key & private key pair.
In order to avoid suffering brute-forcing attack (CVE-2020-26559). The Bluetooth SIG recommends that potentially vulnerable mesh provisioners use an out-of-band mechanism to exchange the public keys. So as an unprovisioned device, it should use this function to input the Public Key exchanged through the out-of-band mechanism. - Parameters pub_key_x -- [in] Unprovisioned device's Public Key X pub_key_y -- [in] Unprovisioned device's Public Key Y private_key -- [in] Unprovisioned device's Private Key - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_input_number(uint32_t number) Provide provisioning input OOB number. Note This is intended to be called if the user has received ESP_BLE_MESH_NODE_PROV_INPUT_EVT with ESP_BLE_MESH_ENTER_NUMBER as the action. - Parameters number -- [in] Number input by device. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_node_input_string(const char *string) Provide provisioning input OOB string. Note This is intended to be called if the user has received ESP_BLE_MESH_NODE_PROV_INPUT_EVT with ESP_BLE_MESH_ENTER_STRING as the action. - Parameters string -- [in] String input by device. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name) Using this function, an unprovisioned device can set its own device name, which will be broadcasted in its advertising data. Note This API applicable to PB-GATT mode only by setting the name to the scan response data, it doesn't apply to PB-ADV mode. - Parameters name -- [in] Unprovisioned device name - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32], uint8_t pub_key_y[32]) Provisioner inputs unprovisioned device's oob public key.
In order to avoid suffering brute-forcing attack (CVE-2020-26559). The Bluetooth SIG recommends that potentially vulnerable mesh provisioners use an out-of-band mechanism to exchange the public keys. - Parameters link_idx -- [in] The provisioning link index pub_key_x -- [in] Unprovisioned device's Public Key X pub_key_y -- [in] Unprovisioned device's Public Key Y - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link_idx) Provide provisioning input OOB string. This is intended to be called after the esp_ble_mesh_prov_t prov_input_num callback has been called with ESP_BLE_MESH_ENTER_STRING as the action. - Parameters string -- [in] String input by Provisioner. link_idx -- [in] The provisioning link index. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_input_number(uint32_t number, uint8_t link_idx) Provide provisioning input OOB number. This is intended to be called after the esp_ble_mesh_prov_t prov_input_num callback has been called with ESP_BLE_MESH_ENTER_NUMBER as the action. - Parameters number -- [in] Number input by Provisioner.
[in] The provisioning link index. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_prov_enable(esp_ble_mesh_prov_bearer_t bearers) Enable one or more provisioning bearers. Note PB-ADV: Enable BLE scan. PB-GATT: Initialize corresponding BLE Mesh Proxy info. - Parameters bearers -- [in] Bit-wise OR of provisioning bearers. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t bearers) Disable one or more provisioning bearers. Note PB-ADV:
Currently address type only supports public address and static random address. Bearer must be equal to ESP_BLE_MESH_PROV_ADV or ESP_BLE_MESH_PROV_GATT, since Provisioner will start to provision a device immediately once this function is invoked. And the input bearer must be identical with the one within the parameters of the ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT event. If this function is used by a Provisioner to provision devices, the application should take care of the assigned unicast address and avoid overlap of the unicast addresses of different nodes. Recommend to use only one of the functions "esp_ble_mesh_provisioner_add_unprov_dev" and "esp_ble_mesh_provisioner_prov_device_with_addr" by a Provisioner. - Parameters uuid -- [in] Device UUID of the unprovisioned device addr -- [in] Device address of the unprovisioned device addr_type -- [in] Device address type of the unprovisioned device bearer -- [in] Provisioning bearer going to be used by Provisioner oob_info -- [in] OOB info of the unprovisioned device unicast_addr -- [in] Unicast address going to be allocated for the unprovisioned device - - Returns Zero on success or (negative) error code otherwise. - - esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_dev) Delete device from queue, and reset current provisioning link with the device. Note If the device is in the queue, remove it from the queue; if the device is being provisioned, terminate the provisioning procedure. Either one of the device address or device UUID can be used as input. - Parameters del_dev -- [in] Pointer to a struct containing the device information. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len, uint8_t offset, bool prov_after_match) This function is called by Provisioner to set the part of the device UUID to be compared before starting to provision. - Parameters match_val -- [in] Value to be compared with the part of the device UUID.
This header file can be included with: #include "esp_ble_mesh_proxy_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_ble_mesh_proxy_identity_enable(void) Enable advertising with Node Identity. Note This API requires that GATT Proxy support be enabled. Once called, each subnet starts advertising using Node Identity for the next 60 seconds, and after 60s Network ID will be advertised. Under normal conditions, the BLE Mesh Proxy Node Identity and Network ID advertising will be enabled automatically by BLE Mesh stack after the device is provisioned. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_gatt_enable(void) Enable BLE Mesh GATT Proxy Service. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_gatt_disable(void) Disconnect the BLE Mesh GATT Proxy connection if there is any, and disable the BLE Mesh GATT Proxy Service. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_private_proxy_identity_enable(void) Enable advertising with Private Node Identity. Note This API requires that GATT Proxy support be enabled. Once called, each subnet starts advertising using Private Node Identity for the next 60 seconds, and after 60s Private Network ID will be advertised. Under normal conditions, the BLE Mesh Proxy Node Identity, Network ID advertising, Proxy Private Node Identity and Private Network ID advertising will be enabled automatically by BLE Mesh stack after the device is provisioned. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_private_proxy_identity_disable(void) Disable advertising with Private Node Identity. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr, esp_ble_mesh_addr_type_t addr_type, uint16_t net_idx) Proxy Client creates a connection with the Proxy Server. - Parameters addr -- [in] Device address of the Proxy Server. addr_type -- [in] Device address type(public or static random). net_idx -- [in]
NetKey Index related with Network ID in the Mesh Proxy advertising packet. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle) Proxy Client terminates a connection with the Proxy Server. - Parameters conn_handle -- [in] Proxy connection handle. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx, esp_ble_mesh_proxy_filter_type_t filter_type) Proxy Client sets the filter type of the Proxy Server. - Parameters conn_handle -- [in] Proxy connection handle. net_idx -- [in] Corresponding NetKey Index. filter_type -- [in] whitelist or blacklist. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx, uint16_t *addr, uint16_t addr_num) Proxy Client adds address to the Proxy Server filter list. - Parameters conn_handle -- [in] Proxy connection handle. net_idx -- [in] Corresponding NetKey Index. addr -- [in] Pointer to the filter address.
[in] Number of the filter address. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_directed_proxy_set(uint8_t conn_handle, uint16_t net_idx, uint8_t use_directed) Proxy Client sets whether or not the Directed Proxy Server uses directed forwarding for Directed Proxy Client messages. - Parameters conn_handle -- [in] Proxy connection handle. net_idx -- [in] Corresponding NetKey Index. use_directed -- [in] Whether or not to send message by directed forwarding. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_proxy_client_send_solic_pdu(uint8_t net_idx, uint16_t ssrc, uint16_t dst) Proxy Client sends Solicitation PDU. - Parameters net_idx -- [in] Corresponding NetKey Index. ssrc -- [in] Solicitation SRC, shall be one of its element address.
Configuration Client/Server Models Header File components/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_config_model_api.h This header file can be included with: #include "esp_ble_mesh_config_model_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_ble_mesh_register_config_client_callback(esp_ble_mesh_cfg_client_cb_t callback) Register BLE Mesh Config Client Model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_register_config_server_callback(esp_ble_mesh_cfg_server_cb_t callback) Register BLE Mesh Config Server Model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_cfg_client_get_state_t *get_state) Get the value of Config Server Model states using the Config Client Model get messages. Note If you want to find the opcodes and corresponding meanings accepted by this API, please refer to esp_ble_mesh_opcode_config_client_get_t in esp_ble_mesh_defs.h - Parameters params -- [in] Pointer to BLE Mesh common client parameters. get_state -- [in] Pointer to a union, each kind of opcode corresponds to one structure inside. Shall not be set to NULL. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_cfg_client_set_state_t *set_state) Set the value of the Configuration Server Model states using the Config Client Model set messages. Note If you want to find the opcodes and corresponding meanings accepted by this API, please refer to esp_ble_mesh_opcode_config_client_set_t in esp_ble_mesh_defs.h - Parameters params -- [in] Pointer to BLE Mesh common client parameters. set_state -- [in] Pointer to a union, each kind of opcode corresponds to one structure inside. Shall not be set to NULL. - - Returns ESP_OK on success or error code otherwise. Unions - union esp_ble_mesh_cfg_client_get_state_t - #include <esp_ble_mesh_config_model_api.h> For ESP_BLE_MESH_MODEL_OP_BEACON_GET ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET ESP_BLE_MESH_MODEL_OP_RELAY_GET ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET ESP_BLE_MESH_MODEL_OP_FRIEND_GET ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET the get_state parameter in the esp_ble_mesh_config_client_get_state function should not be set to NULL.
Public Members - esp_ble_mesh_cfg_model_pub_get_t model_pub_get For ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET. - esp_ble_mesh_cfg_composition_data_get_t comp_data_get For ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET. - esp_ble_mesh_cfg_sig_model_sub_get_t sig_model_sub_get For ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET - esp_ble_mesh_cfg_vnd_model_sub_get_t vnd_model_sub_get For ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET - esp_ble_mesh_cfg_app_key_get_t app_key_get For ESP_BLE_MESH_MODEL_OP_APP_KEY_GET. - esp_ble_mesh_cfg_node_identity_get_t node_identity_get For ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET. - esp_ble_mesh_cfg_sig_model_app_get_t sig_model_app_get For ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET - esp_ble_mesh_cfg_vnd_model_app_get_t vnd_model_app_get For ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET - esp_ble_mesh_cfg_kr_phase_get_t kr_phase_get For ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET - esp_ble_mesh_cfg_lpn_polltimeout_get_t lpn_pollto_get For ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET - esp_ble_mesh_cfg_model_pub_get_t model_pub_get - union esp_ble_mesh_cfg_client_set_state_t - #include <esp_ble_mesh_config_model_api.h>
For ESP_BLE_MESH_MODEL_OP_BEACON_SET ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET ESP_BLE_MESH_MODEL_OP_RELAY_SET ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND ESP_BLE_MESH_MODEL_OP_NODE_RESET ESP_BLE_MESH_MODEL_OP_FRIEND_SET ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET the set_state parameter in the esp_ble_mesh_config_client_set_state function should not be set to NULL.
Public Members - esp_ble_mesh_health_fault_get_t fault_get For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET. - esp_ble_mesh_health_fault_get_t fault_get - union esp_ble_mesh_health_client_set_state_t - #include <esp_ble_mesh_health_model_api.h> For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK ESP_BLE_MESH_MODEL_OP_ATTENTION_SET ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK the set_state parameter in the esp_ble_mesh_health_client_set_state function should not be set to NULL.
Public Members - esp_ble_mesh_health_attention_set_t attention_set For ESP_BLE_MESH_MODEL_OP_ATTENTION_SET or ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK. - esp_ble_mesh_health_period_set_t period_set For ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET or ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK. - esp_ble_mesh_health_fault_test_t fault_test For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST or ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK. - esp_ble_mesh_health_fault_clear_t fault_clear For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR or ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK. -
The health current status value - esp_ble_mesh_health_fault_status_cb_t fault_status The health fault status value - esp_ble_mesh_health_period_status_cb_t period_status The health period status value - esp_ble_mesh_health_attention_status_cb_t attention_status The health attention status value - esp_ble_mesh_health_current_status_cb_t current_status - union esp_ble_mesh_health_server_cb_param_t - #include <esp_ble_mesh_health_model_api.h> Health Server Model callback parameters union. Public Members - esp_ble_mesh_health_fault_update_comp_cb_t fault_update_comp ESP_BLE_MESH_HEALTH_SERVER_FAULT_UPDATE_COMP_EVT - esp_ble_mesh_health_fault_clear_cb_t fault_clear ESP_BLE_MESH_HEALTH_SERVER_FAULT_CLEAR_EVT - esp_ble_mesh_health_fault_test_cb_t fault_test ESP_BLE_MESH_HEALTH_SERVER_FAULT_TEST_EVT - esp_ble_mesh_health_attention_on_cb_t attention_on ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_ON_EVT - esp_ble_mesh_health_attention_off_cb_t attention_off ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_OFF_EVT - esp_ble_mesh_health_fault_update_comp_cb_t fault_update_comp Structures - struct esp_ble_mesh_health_srv_cb_t ESP BLE Mesh Health Server callback Public Members - esp_ble_mesh_cb_t
0x80 ~ 0xFF: Vendor Specific Warning/Error. - ESP_BLE_MESH_BATTERY_LOW_WARNING - ESP_BLE_MESH_BATTERY_LOW_ERROR - ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_LOW_WARNING - ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_LOW_ERROR - ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_HIGH_WARNING - ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_HIGH_ERROR - ESP_BLE_MESH_POWER_SUPPLY_INTERRUPTED_WARNING - ESP_BLE_MESH_POWER_SUPPLY_INTERRUPTED_ERROR - ESP_BLE_MESH_NO_LOAD_WARNING - ESP_BLE_MESH_NO_LOAD_ERROR - ESP_BLE_MESH_OVERLOAD_WARNING - ESP_BLE_MESH_OVERLOAD_ERROR - ESP_BLE_MESH_OVERHEAT_WARNING - ESP_BLE_MESH_OVERHEAT_ERROR - ESP_BLE_MESH_CONDENSATION_WARNING - ESP_BLE_MESH_CONDENSATION_ERROR - ESP_BLE_MESH_VIBRATION_WARNING - ESP_BLE_MESH_VIBRATION_ERROR - ESP_BLE_MESH_CONFIGURATION_WARNING - ESP_BLE_MESH_CONFIGURATION_ERROR - ESP_BLE_MESH_ELEMENT_NOT_CALIBRATED_WARNING - ESP_BLE_MESH_ELEMENT_NOT_CALIBRATED_ERROR - ESP_BLE_MESH_MEMORY_WARNING - ESP_BLE_MESH_MEMORY_ERROR - ESP_BLE_MESH_SELF_TEST_WARNING - ESP_BLE_MESH_SELF_TEST_ERROR - ESP_BLE_MESH_INPUT_TOO_LOW_WARNING - ESP_BLE_MESH_INPUT_TOO_LOW_ERROR - ESP_BLE_MESH_INPUT_TOO_HIGH_WARNING - ESP_BLE_MESH_INPUT_TOO_HIGH_ERROR - ESP_BLE_MESH_INPUT_NO_CHANGE_WARNING - ESP_BLE_MESH_INPUT_NO_CHANGE_ERROR - ESP_BLE_MESH_ACTUATOR_BLOCKED_WARNING - ESP_BLE_MESH_ACTUATOR_BLOCKED_ERROR - ESP_BLE_MESH_HOUSING_OPENED_WARNING - ESP_BLE_MESH_HOUSING_OPENED_ERROR - ESP_BLE_MESH_TAMPER_WARNING - ESP_BLE_MESH_TAMPER_ERROR - ESP_BLE_MESH_DEVICE_MOVED_WARNING - ESP_BLE_MESH_DEVICE_MOVED_ERROR - ESP_BLE_MESH_DEVICE_DROPPED_WARNING - ESP_BLE_MESH_DEVICE_DROPPED_ERROR - ESP_BLE_MESH_OVERFLOW_WARNING - ESP_BLE_MESH_OVERFLOW_ERROR - ESP_BLE_MESH_EMPTY_WARNING - ESP_BLE_MESH_EMPTY_ERROR - ESP_BLE_MESH_INTERNAL_BUS_WARNING - ESP_BLE_MESH_INTERNAL_BUS_ERROR - ESP_BLE_MESH_MECHANISM_JAMMED_WARNING - ESP_BLE_MESH_MECHANISM_JAMMED_ERROR - ESP_BLE_MESH_HEALTH_FAULT_ARRAY_SIZE Type Definitions - typedef void
esp_ble_mesh_register_generic_server_callback(esp_ble_mesh_generic_server_cb_t callback) Register BLE Mesh Generic Server Model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. Unions - union esp_ble_mesh_generic_client_get_state_t - #include <esp_ble_mesh_generic_model_api.h> Generic Client Model get message union. Public Members - esp_ble_mesh_gen_user_property_get_t user_property_get For ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET - esp_ble_mesh_gen_admin_property_get_t admin_property_get For ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET - esp_ble_mesh_gen_manufacturer_property_get_t manufacturer_property_get For ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET - esp_ble_mesh_gen_client_properties_get_t client_properties_get For ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET - esp_ble_mesh_gen_user_property_get_t user_property_get - union esp_ble_mesh_generic_client_set_state_t - #include <esp_ble_mesh_generic_model_api.h> Generic Client Model set message union. Public Members - esp_ble_mesh_gen_onoff_set_t
onoff_set For ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET & ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK - esp_ble_mesh_gen_level_set_t level_set For ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK - esp_ble_mesh_gen_delta_set_t delta_set For ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET & ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET_UNACK - esp_ble_mesh_gen_move_set_t move_set For ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET & ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET_UNACK - esp_ble_mesh_gen_def_trans_time_set_t def_trans_time_set For ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET & ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK - esp_ble_mesh_gen_onpowerup_set_t power_set For ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET & ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET_UNACK - esp_ble_mesh_gen_power_level_set_t power_level_set For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET_UNACK - esp_ble_mesh_gen_power_default_set_t power_default_set For ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET_UNACK - esp_ble_mesh_gen_power_range_set_t power_range_set For ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET_UNACK - esp_ble_mesh_gen_loc_global_set_t loc_global_set For ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK - esp_ble_mesh_gen_loc_local_set_t loc_local_set For ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK - esp_ble_mesh_gen_user_property_set_t user_property_set For ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET_UNACK - esp_ble_mesh_gen_admin_property_set_t admin_property_set For ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET_UNACK - esp_ble_mesh_gen_manufacturer_property_set_t manufacturer_property_set For ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET_UNACK - esp_ble_mesh_gen_onoff_set_t
onoff_set - union esp_ble_mesh_gen_client_status_cb_t - #include <esp_ble_mesh_generic_model_api.h> Generic Client Model received message union. Public Members - esp_ble_mesh_gen_onoff_status_cb_t onoff_status For ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS - esp_ble_mesh_gen_level_status_cb_t level_status For ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_STATUS - esp_ble_mesh_gen_def_trans_time_status_cb_t def_trans_time_status For ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_STATUS - esp_ble_mesh_gen_onpowerup_status_cb_t onpowerup_status For ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_STATUS - esp_ble_mesh_gen_power_level_status_cb_t power_level_status For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS - esp_ble_mesh_gen_power_last_status_cb_t power_last_status For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_STATUS - esp_ble_mesh_gen_power_default_status_cb_t power_default_status For ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS - esp_ble_mesh_gen_power_range_status_cb_t power_range_status For ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS - esp_ble_mesh_gen_battery_status_cb_t battery_status For ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_STATUS - esp_ble_mesh_gen_loc_global_status_cb_t location_global_status For ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS - esp_ble_mesh_gen_loc_local_status_cb_t location_local_status ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS - esp_ble_mesh_gen_user_properties_status_cb_t user_properties_status ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_STATUS - esp_ble_mesh_gen_user_property_status_cb_t user_property_status ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_STATUS - esp_ble_mesh_gen_admin_properties_status_cb_t admin_properties_status ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_STATUS - esp_ble_mesh_gen_admin_property_status_cb_t admin_property_status ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_STATUS - esp_ble_mesh_gen_manufacturer_properties_status_cb_t manufacturer_properties_status ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_STATUS - esp_ble_mesh_gen_manufacturer_property_status_cb_t manufacturer_property_status ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_STATUS - esp_ble_mesh_gen_client_properties_status_cb_t client_properties_status ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS - esp_ble_mesh_gen_onoff_status_cb_t onoff_status - union esp_ble_mesh_generic_server_state_change_t - #include <esp_ble_mesh_generic_model_api.h> Generic Server Model state change value union. Public Members - esp_ble_mesh_state_change_gen_onoff_set_t
The Generic Power OnOff Server model extends the Generic OnOff Server model. When this model is present on an element, the corresponding Generic Power OnOff Setup Server model shall also be present. This model may be used to represent a variety of devices that do not fit any of the model descriptions that have been defined but support the generic properties of On/Off. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_power_onoff_srv_t. - - Returns New Generic Power OnOff Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_SETUP_SRV(srv_pub, srv_data) Define a new Generic Power OnOff Setup Server Model.
The Generic Power OnOff Setup Server model extends the Generic Power OnOff Server model and the Generic Default Transition Time Server model. This model shall support model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_power_onoff_setup_srv_t. - - Returns New Generic Power OnOff Setup Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SRV(srv_pub, srv_data) Define a new Generic Power Level Server Model.
The Generic Power Level Server model extends the Generic Power OnOff Server model and the Generic Level Server model. When this model is present on an Element, the corresponding Generic Power Level Setup Server model shall also be present. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_power_level_srv_t. - - Returns New Generic Power Level Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SETUP_SRV(srv_pub, srv_data) Define a new Generic Power Level Setup Server Model.
The Generic Power Level Setup Server model extends the Generic Power Level Server model and the Generic Power OnOff Setup Server model. This model shall support model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_power_level_setup_srv_t. - - Returns New Generic Power Level Setup Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_BATTERY_SRV(srv_pub, srv_data) Define a new Generic Battery Server Model.
The Generic Battery Server Model is a root model. This model shall support model publication and model subscription. The model may be used to represent an element that is powered by a battery. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_battery_srv_t. - - Returns New Generic Battery Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_LOCATION_SRV(srv_pub, srv_data) Define a new Generic Location Server Model. Note 1.
The Generic Location Server model is a root model. When this model is present on an Element, the corresponding Generic Location Setup Server model shall also be present. This model shall support model publication and model subscription. The model may be used to represent an element that knows its location (global or local). - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_location_srv_t. - - Returns New Generic Location Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_LOCATION_SETUP_SRV(srv_pub, srv_data) Define a new Generic Location Setup Server Model. Note 1. The Generic Location Setup Server model extends the Generic Location Server model. This model shall support model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_location_setup_srv_t. - - Returns New Generic Location Setup Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_USER_PROP_SRV(srv_pub, srv_data) Define a new Generic User Property Server Model. Note 1.
The Generic User Property Server model is a root model. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_user_prop_srv_t. - - Returns New Generic User Property Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_ADMIN_PROP_SRV(srv_pub, srv_data) Define a new Generic Admin Property Server Model. Note 1. The Generic Admin Property Server model extends the Generic User Property Server model. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_admin_prop_srv_t. - - Returns New Generic Admin Property Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_MANUFACTURER_PROP_SRV(srv_pub, srv_data) Define a new Generic Manufacturer Property Server Model. Note 1. The Generic Manufacturer Property Server model extends the Generic User Property Server model. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_gen_manu_prop_srv_t. - - Returns New Generic Manufacturer Property Server Model instance. - - ESP_BLE_MESH_MODEL_GEN_CLIENT_PROP_SRV(srv_pub, srv_data) Define a new Generic User Property Server Model. Note 1.
Public Members - esp_ble_mesh_sensor_descriptor_get_t descriptor_get For ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_GET - esp_ble_mesh_sensor_cadence_get_t cadence_get For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_GET - esp_ble_mesh_sensor_settings_get_t settings_get For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_GET - esp_ble_mesh_sensor_setting_get_t setting_get For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_GET - esp_ble_mesh_sensor_get_t sensor_get For ESP_BLE_MESH_MODEL_OP_SENSOR_GET - esp_ble_mesh_sensor_column_get_t column_get For ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_GET - esp_ble_mesh_sensor_series_get_t series_get For ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_GET - esp_ble_mesh_sensor_descriptor_get_t descriptor_get - union esp_ble_mesh_sensor_client_set_state_t - #include <esp_ble_mesh_sensor_model_api.h> Sensor Client Model set message union. Public Members - esp_ble_mesh_sensor_cadence_set_t cadence_set For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET & ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET_UNACK - esp_ble_mesh_sensor_setting_set_t setting_set For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET & ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET_UNACK - esp_ble_mesh_sensor_cadence_set_t cadence_set - union esp_ble_mesh_sensor_client_status_cb_t - #include <esp_ble_mesh_sensor_model_api.h> Sensor Client Model received message union. Public Members - esp_ble_mesh_sensor_descriptor_status_cb_t descriptor_status For ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_STATUS - esp_ble_mesh_sensor_cadence_status_cb_t cadence_status For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_STATUS - esp_ble_mesh_sensor_settings_status_cb_t settings_status For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_STATUS - esp_ble_mesh_sensor_setting_status_cb_t setting_status For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_STATUS - esp_ble_mesh_sensor_status_cb_t sensor_status For ESP_BLE_MESH_MODEL_OP_SENSOR_STATUS - esp_ble_mesh_sensor_column_status_cb_t column_status For ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_STATUS - esp_ble_mesh_sensor_series_status_cb_t series_status For ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_STATUS - esp_ble_mesh_sensor_descriptor_status_cb_t descriptor_status - union esp_ble_mesh_sensor_server_state_change_t - #include <esp_ble_mesh_sensor_model_api.h> Sensor Server Model state change value union.
- esp_ble_mesh_sensor_client_status_cb_t status_cb The sensor status message callback values - int error_code - struct esp_ble_mesh_sensor_descriptor_t Parameters of Sensor Descriptor state Public Members - uint32_t positive_tolerance The value of Sensor Positive Tolerance field - uint32_t negative_tolerance The value of Sensor Negative Tolerance field - uint32_t sampling_function The value of Sensor Sampling Function field - uint8_t measure_period The value of Sensor Measurement Period field - uint8_t update_interval The value of Sensor Update Interval field - uint32_t positive_tolerance - struct esp_ble_mesh_sensor_setting_t Parameters of Sensor Setting state - struct esp_ble_mesh_sensor_cadence_t Parameters of Sensor Cadence state Public Members - uint8_t period_divisor The value of Fast Cadence Period Divisor field - uint8_t trigger_type The value of Status Trigger Type field - struct net_buf_simple *trigger_delta_down Note: The parameter "size" in trigger_delta_down, trigger_delta_up, fast_cadence_low & fast_cadence_high indicates the exact length of these four parameters, and they are associated with the Sensor Property ID. Users need to initialize the "size" precisely.
The Sensor Server model is a root model. When this model is present on an element, the corresponding Sensor Setup Server model shall also be present. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_sensor_srv_t. - - Returns New Sensor Server Model instance. - - ESP_BLE_MESH_MODEL_SENSOR_SETUP_SRV(srv_pub, srv_data) Define a new Sensor Setup Server Model.
srv_data -- Pointer to the unique struct esp_ble_mesh_sensor_setup_srv_t. - - Returns New Sensor Setup Server Model instance. - - ESP_BLE_MESH_INVALID_SENSOR_PROPERTY_ID Invalid Sensor Property ID - ESP_BLE_MESH_SENSOR_PROPERTY_ID_LEN Length of Sensor Property ID - ESP_BLE_MESH_SENSOR_DESCRIPTOR_LEN Length of Sensor Descriptor state - ESP_BLE_MESH_SENSOR_UNSPECIFIED_POS_TOLERANCE Unspecified Sensor Positive Tolerance - ESP_BLE_MESH_SENSOR_UNSPECIFIED_NEG_TOLERANCE Unspecified Sensor Negative Tolerance - ESP_BLE_MESH_SENSOR_NOT_APPL_MEASURE_PERIOD Not applicable Sensor Measurement Period - ESP_BLE_MESH_SENSOR_NOT_APPL_UPDATE_INTERVAL Not applicable Sensor Update Interval - ESP_BLE_MESH_INVALID_SENSOR_SETTING_PROPERTY_ID Invalid Sensor Setting Property ID - ESP_BLE_MESH_SENSOR_SETTING_PROPERTY_ID_LEN Length of Sensor Setting Property ID - ESP_BLE_MESH_SENSOR_SETTING_ACCESS_LEN Length of Sensor Setting Access - ESP_BLE_MESH_SENSOR_SETTING_ACCESS_READ Sensor Setting Access - Read - ESP_BLE_MESH_SENSOR_SETTING_ACCESS_READ_WRITE Sensor Setting Access - Read & Write - ESP_BLE_MESH_SENSOR_DIVISOR_TRIGGER_TYPE_LEN Length of Sensor Divisor Trigger Type - ESP_BLE_MESH_SENSOR_STATUS_MIN_INTERVAL_LEN Length of Sensor Status Min Interval - ESP_BLE_MESH_SENSOR_PERIOD_DIVISOR_MAX_VALUE Maximum value of Sensor Period Divisor - ESP_BLE_MESH_SENSOR_STATUS_MIN_INTERVAL_MAX Maximum value of Sensor Status Min Interval - ESP_BLE_MESH_SENSOR_STATUS_TRIGGER_TYPE_CHAR Sensor Status Trigger Type - Format Type of the characteristic that the Sensor Property ID state references - ESP_BLE_MESH_SENSOR_STATUS_TRIGGER_TYPE_UINT16 Sensor Status Trigger Type - Format Type "uint16" - ESP_BLE_MESH_SENSOR_DATA_FORMAT_A Sensor Data Format A - ESP_BLE_MESH_SENSOR_DATA_FORMAT_B Sensor Data Format B - ESP_BLE_MESH_SENSOR_DATA_FORMAT_A_MPID_LEN MPID length of Sensor Data Format A - ESP_BLE_MESH_SENSOR_DATA_FORMAT_B_MPID_LEN MPID length of Sensor Data Format B - ESP_BLE_MESH_SENSOR_DATA_ZERO_LEN Zero length of Sensor Data. Note: The Length field is a 1-based uint7 value (valid range 0x0–0x7F, representing range of 1–127). The value 0x7F represents a length of zero. - ESP_BLE_MESH_GET_SENSOR_DATA_FORMAT(_data) Get format of the sensor data.
Note Multiple sensor data may be concatenated. Make sure the _data pointer is updated before getting the format of the corresponding sensor data. - Parameters _data -- Pointer to the start of the sensor data. - - Returns Format of the sensor data. - ESP_BLE_MESH_GET_SENSOR_DATA_LENGTH(_data, _fmt) Get length of the sensor data. Note Multiple sensor data may be concatenated. Make sure the _data pointer is updated before getting the length of the corresponding sensor data. - Parameters _data -- Pointer to the start of the sensor data. _fmt -- Format of the sensor data. - - Returns Length (zero-based) of the sensor data. - ESP_BLE_MESH_GET_SENSOR_DATA_PROPERTY_ID(_data, _fmt) Get Sensor Property ID of the sensor data. Note Multiple sensor data may be concatenated. Make sure the _data pointer is updated before getting Sensor Property ID of the corresponding sensor data. - Parameters _data -- Pointer to the start of the sensor data. _fmt -- Format of the sensor data. - - Returns Sensor Property ID of the sensor data. - ESP_BLE_MESH_SENSOR_DATA_FORMAT_A_MPID(_len, _id) Generate a MPID value for sensor data with Format A. Note 1. The Format field is 0b0 and indicates that Format A is used. The Length field is a 1-based uint4 value (valid range 0x0–0xF, representing range of 1–16). The Property ID is an 11-bit bit field representing 11 LSb of a Property ID. This format may be used for Property Values that are not longer than 16 octets and for Property IDs less than 0x0800. - Parameters _len -- Length of Sensor Raw value. _id -- Sensor Property ID. - - Returns 2-octet MPID value for sensor data with Format A. - - ESP_BLE_MESH_SENSOR_DATA_FORMAT_B_MPID(_len, _id) Generate a MPID value for sensor data with Format B. Note 1.
The Format field is 0b1 and indicates Format B is used. The Length field is a 1-based uint7 value (valid range 0x0–0x7F, representing range of 1–127). The value 0x7F represents a length of zero. The Property ID is a 16-bit bit field representing a Property ID. This format may be used for Property Values not longer than 128 octets and for any Property IDs. Property values longer than 128 octets are not supported by the Sensor Status message. Exclude the generated 1-octet value, the 2-octet Sensor Property ID - Parameters _len -- Length of Sensor Raw value. _id -- Sensor Property ID. - - Returns 3-octet MPID value for sensor data with Format B. - Type Definitions - typedef void (*esp_ble_mesh_sensor_client_cb_t)(esp_ble_mesh_sensor_client_cb_event_t event, esp_ble_mesh_sensor_client_cb_param_t *param) Bluetooth Mesh Sensor Client Model function. Sensor Client Model callback function type - Param event Event type - Param param Pointer to callback parameter - typedef void
time_set For ESP_BLE_MESH_MODEL_OP_TIME_SET - esp_ble_mesh_time_zone_set_t time_zone_set For ESP_BLE_MESH_MODEL_OP_TIME_ZONE_SET - esp_ble_mesh_tai_utc_delta_set_t tai_utc_delta_set For ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_SET - esp_ble_mesh_time_role_set_t time_role_set For ESP_BLE_MESH_MODEL_OP_TIME_ROLE_SET - esp_ble_mesh_scene_store_t scene_store For ESP_BLE_MESH_MODEL_OP_SCENE_STORE & ESP_BLE_MESH_MODEL_OP_SCENE_STORE_UNACK - esp_ble_mesh_scene_recall_t scene_recall For ESP_BLE_MESH_MODEL_OP_SCENE_RECALL & ESP_BLE_MESH_MODEL_OP_SCENE_RECALL_UNACK - esp_ble_mesh_scene_delete_t scene_delete For ESP_BLE_MESH_MODEL_OP_SCENE_DELETE & ESP_BLE_MESH_MODEL_OP_SCENE_DELETE_UNACK - esp_ble_mesh_scheduler_act_set_t scheduler_act_set For ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET & ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET_UNACK - esp_ble_mesh_time_set_t
Public Members - esp_ble_mesh_time_status_cb_t time_status For ESP_BLE_MESH_MODEL_OP_TIME_STATUS - esp_ble_mesh_time_zone_status_cb_t time_zone_status For ESP_BLE_MESH_MODEL_OP_TIME_ZONE_STATUS - esp_ble_mesh_tai_utc_delta_status_cb_t tai_utc_delta_status For ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_STATUS - esp_ble_mesh_time_role_status_cb_t time_role_status For ESP_BLE_MESH_MODEL_OP_TIME_ROLE_STATUS - esp_ble_mesh_scene_status_cb_t scene_status For ESP_BLE_MESH_MODEL_OP_SCENE_STATUS - esp_ble_mesh_scene_register_status_cb_t scene_register_status For ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_STATUS - esp_ble_mesh_scheduler_status_cb_t scheduler_status For ESP_BLE_MESH_MODEL_OP_SCHEDULER_STATUS - esp_ble_mesh_scheduler_act_status_cb_t scheduler_act_status For ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_STATUS - esp_ble_mesh_time_status_cb_t time_status - union esp_ble_mesh_time_scene_server_state_change_t - #include <esp_ble_mesh_time_scene_model_api.h> Time Scene Server Model state change value union. Public Members - esp_ble_mesh_state_change_time_set_t
The Time Server model is a root model. When this model is present on an Element, the corresponding Time Setup Server model shall also be present. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_time_srv_t. - - Returns New Time Server Model instance. - - ESP_BLE_MESH_MODEL_TIME_SETUP_SRV(srv_data) Define a new Time Setup Server Model. Note 1. The Time Setup Server model extends the Time Server model. Time is sensitive information that is propagated across a mesh network. Only an authorized Time Client should be allowed to change the Time and Time Role states. A dedicated application key Bluetooth SIG Proprietary should be used on the Time Setup Server to restrict access to the server to only authorized Time Clients. This model does not support subscribing nor publishing. - Parameters srv_data -- Pointer to the unique struct esp_ble_mesh_time_setup_srv_t. - - Returns New Time Setup Server Model instance. - - ESP_BLE_MESH_MODEL_SCENE_SRV(srv_pub, srv_data) Define a new Scene Server Model. Note 1.
The Scene Server model is a root model. When this model is present on an Element, the corresponding Scene Setup Server model shall also be present. This model shall support model publication and model subscription. The model may be present only on the Primary element of a node. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_scene_srv_t. - - Returns New Scene Server Model instance. - - ESP_BLE_MESH_MODEL_SCENE_SETUP_SRV(srv_pub, srv_data) Define a new Scene Setup Server Model.
The Scene Setup Server model extends the Scene Server model and the Generic Default Transition Time Server model. This model shall support model subscription. The model may be present only on the Primary element of a node. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_scene_setup_srv_t. - - Returns New Scene Setup Server Model instance. - - ESP_BLE_MESH_MODEL_SCHEDULER_SRV(srv_pub, srv_data) Define a new Scheduler Server Model.
The Scheduler Server model extends the Scene Server model. When this model is present on an Element, the corresponding Scheduler Setup Server model shall also be present. This model shall support model publication and model subscription. The model may be present only on the Primary element of a node. The model requires the Time Server model shall be present on the element. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_scheduler_srv_t. - - Returns New Scheduler Server Model instance. - - ESP_BLE_MESH_MODEL_SCHEDULER_SETUP_SRV(srv_pub, srv_data) Define a new Scheduler Setup Server Model.
The Scheduler Setup Server model extends the Scheduler Server and the Scene Setup Server models. This model shall support model subscription. The model may be present only on the Primary element of a node. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_scheduler_setup_srv_t. - - Returns New Scheduler Setup Server Model instance. - - ESP_BLE_MESH_UNKNOWN_TAI_SECONDS Unknown TAI Seconds - ESP_BLE_MESH_UNKNOWN_TAI_ZONE_CHANGE Unknown TAI of Zone Change - ESP_BLE_MESH_UNKNOWN_TAI_DELTA_CHANGE Unknown TAI of Delta Change - ESP_BLE_MESH_TAI_UTC_DELTA_MAX_VALUE Maximum TAI-UTC Delta value - ESP_BLE_MESH_TAI_SECONDS_LEN Length of TAI Seconds - ESP_BLE_MESH_TAI_OF_ZONE_CHANGE_LEN Length of TAI of Zone Change - ESP_BLE_MESH_TAI_OF_DELTA_CHANGE_LEN Length of TAI of Delta Change - ESP_BLE_MESH_INVALID_SCENE_NUMBER Invalid Scene Number - ESP_BLE_MESH_SCENE_NUMBER_LEN Length of the Scene Number - ESP_BLE_MESH_SCHEDULE_YEAR_ANY_YEAR Any year of the Scheduled year - ESP_BLE_MESH_SCHEDULE_DAY_ANY_DAY Any day of the Scheduled day - ESP_BLE_MESH_SCHEDULE_HOUR_ANY_HOUR Any hour of the Scheduled hour - ESP_BLE_MESH_SCHEDULE_HOUR_ONCE_A_DAY Any hour of the Scheduled Day - ESP_BLE_MESH_SCHEDULE_SEC_ANY_OF_HOUR Any minute of the Scheduled hour - ESP_BLE_MESH_SCHEDULE_SEC_EVERY_15_MIN Every 15 minutes of the Scheduled hour - ESP_BLE_MESH_SCHEDULE_SEC_EVERY_20_MIN Every 20 minutes of the Scheduled hour - ESP_BLE_MESH_SCHEDULE_SEC_ONCE_AN_HOUR Once of the Scheduled hour - ESP_BLE_MESH_SCHEDULE_SEC_ANY_OF_MIN Any second of the Scheduled minute - ESP_BLE_MESH_SCHEDULE_SEC_EVERY_15_SEC Every 15 seconds of the Scheduled minute - ESP_BLE_MESH_SCHEDULE_SEC_EVERY_20_SEC Every 20 seconds of the Scheduled minute - ESP_BLE_MESH_SCHEDULE_SEC_ONCE_AN_MIN Once of the Scheduled minute - ESP_BLE_MESH_SCHEDULE_ACT_TURN_OFF Scheduled Action - Turn Off - ESP_BLE_MESH_SCHEDULE_ACT_TURN_ON Scheduled Action - Turn On - ESP_BLE_MESH_SCHEDULE_ACT_SCENE_RECALL Scheduled Action - Scene Recall - ESP_BLE_MESH_SCHEDULE_ACT_NO_ACTION Scheduled Action - No Action - ESP_BLE_MESH_SCHEDULE_SCENE_NO_SCENE Scheduled Scene - No Scene - ESP_BLE_MESH_SCHEDULE_ENTRY_MAX_INDEX Maximum number of Scheduled entries - ESP_BLE_MESH_TIME_NONE Time Role - None - ESP_BLE_MESH_TIME_AUTHORITY Time Role - Mesh Time Authority - ESP_BLE_MESH_TIME_RELAY Time Role - Mesh Time Relay - ESP_BLE_MESH_TIME_CLIENT Time Role - Mesh Time Client - ESP_BLE_MESH_SCENE_SUCCESS Scene operation - Success - ESP_BLE_MESH_SCENE_REG_FULL Scene operation - Scene Register Full - ESP_BLE_MESH_SCENE_NOT_FOUND Scene operation - Scene Not Found Type Definitions - typedef void
Time Scene Client Model callback function type - Param event Event type - Param param Pointer to callback parameter - typedef void (*esp_ble_mesh_time_scene_server_cb_t)(esp_ble_mesh_time_scene_server_cb_event_t event, esp_ble_mesh_time_scene_server_cb_param_t *param) Bluetooth Mesh Time and Scenes Server Model function. Time Scene Server Model callback function type - Param event Event type - Param param Pointer to callback parameter Enumerations - enum esp_ble_mesh_time_scene_client_cb_event_t This enum value is the event of Time Scene Client Model Values: - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_GET_STATE_EVT - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_SET_STATE_EVT - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_PUBLISH_EVT - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_TIMEOUT_EVT - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_EVT_MAX - enumerator ESP_BLE_MESH_TIME_SCENE_CLIENT_GET_STATE_EVT - enum esp_ble_mesh_time_scene_server_cb_event_t This enum value is the event of Time Scene Server Model Values: - enumerator
ESP_BLE_MESH_TIME_SCENE_SERVER_STATE_CHANGE_EVT When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be callback to the application layer when Time Scene Get messages are received. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will be callback to the application layer when Time Scene Set/Set Unack messages are received. - - enumerator ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_GET_MSG_EVT When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when Time Scene Get messages are received. - enumerator ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_SET_MSG_EVT When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when Time Scene Set/Set Unack messages are received. - enumerator ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_STATUS_MSG_EVT When status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when TIme Status message is received. - enumerator ESP_BLE_MESH_TIME_SCENE_SERVER_EVT_MAX - enumerator
ESP_BLE_MESH_TIME_SCENE_SERVER_STATE_CHANGE_EVT Lighting Client/Server Models Header File components/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_lighting_model_api.h This header file can be included with: #include "esp_ble_mesh_lighting_model_api.h" This header file is a part of the API provided by the btcomponent. To declare that your component depends on bt, add the following to your CMakeLists.txt: REQUIRES bt or PRIV_REQUIRES bt Functions - esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_cb_t callback) Register BLE Mesh Light Client Model callback. - Parameters callback -- [in] pointer to the callback function. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_light_client_get_state_t *get_state) Get the value of Light Server Model states using the Light Client Model get messages. Note If you want to know the opcodes and corresponding meanings accepted by this API, please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h - Parameters params -- [in] Pointer to BLE Mesh common client parameters. get_state -- [in] Pointer of light get message value. Shall not be set to NULL. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_light_client_set_state_t *set_state) Set the value of Light Server Model states using the Light Client Model set messages. Note If you want to know the opcodes and corresponding meanings accepted by this API, please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h - Parameters params -- [in] Pointer to BLE Mesh common client parameters. set_state -- [in] Pointer of light set message value.
Shall not be set to NULL. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback) Register BLE Mesh Lighting Server Model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. Unions - union esp_ble_mesh_light_client_get_state_t - #include <esp_ble_mesh_lighting_model_api.h> Lighting Client Model get message union. Public Members - esp_ble_mesh_light_lc_property_get_t lc_property_get For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET - esp_ble_mesh_light_lc_property_get_t lc_property_get - union esp_ble_mesh_light_client_set_state_t - #include <esp_ble_mesh_lighting_model_api.h> Lighting Client Model set message union. Public Members - esp_ble_mesh_light_lightness_set_t
Public Members - esp_ble_mesh_light_lightness_status_cb_t lightness_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS - esp_ble_mesh_light_lightness_linear_status_cb_t lightness_linear_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS - esp_ble_mesh_light_lightness_last_status_cb_t lightness_last_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS - esp_ble_mesh_light_lightness_default_status_cb_t lightness_default_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS - esp_ble_mesh_light_lightness_range_status_cb_t lightness_range_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS - esp_ble_mesh_light_ctl_status_cb_t ctl_status For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS - esp_ble_mesh_light_ctl_temperature_status_cb_t ctl_temperature_status For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS - esp_ble_mesh_light_ctl_temperature_range_status_cb_t ctl_temperature_range_status For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS - esp_ble_mesh_light_ctl_default_status_cb_t ctl_default_status For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS - esp_ble_mesh_light_hsl_status_cb_t hsl_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS - esp_ble_mesh_light_hsl_target_status_cb_t hsl_target_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS - esp_ble_mesh_light_hsl_hue_status_cb_t hsl_hue_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS - esp_ble_mesh_light_hsl_saturation_status_cb_t hsl_saturation_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS - esp_ble_mesh_light_hsl_default_status_cb_t hsl_default_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS - esp_ble_mesh_light_hsl_range_status_cb_t hsl_range_status For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS - esp_ble_mesh_light_xyl_status_cb_t xyl_status For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS - esp_ble_mesh_light_xyl_target_status_cb_t xyl_target_status For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS - esp_ble_mesh_light_xyl_default_status_cb_t xyl_default_status For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS - esp_ble_mesh_light_xyl_range_status_cb_t xyl_range_status For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS - esp_ble_mesh_light_lc_mode_status_cb_t lc_mode_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS - esp_ble_mesh_light_lc_om_status_cb_t lc_om_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS - esp_ble_mesh_light_lc_light_onoff_status_cb_t lc_light_onoff_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS - esp_ble_mesh_light_lc_property_status_cb_t lc_property_status For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS - esp_ble_mesh_light_lightness_status_cb_t lightness_status - union esp_ble_mesh_lighting_server_state_change_t - #include <esp_ble_mesh_lighting_model_api.h> Lighting Server Model state change value union.
Initialized internally. - esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl Response control of the server model received messages - esp_ble_mesh_light_xyl_state_t *state Parameters of the Light xyL state - esp_ble_mesh_last_msg_info_t last Parameters of the last received set message - esp_ble_mesh_state_transition_t transition Parameters of state transition - int32_t tt_delta_lightness Delta change value of lightness state transition - int32_t tt_delta_x Delta change value of x state transition - int32_t tt_delta_y Delta change value of y state transition - esp_ble_mesh_model_t *model - struct esp_ble_mesh_light_xyl_setup_srv_t User data of Light xyL Setup Server Model Public Members - esp_ble_mesh_model_t *model Pointer to the Lighting xyL Setup Server Model.
The Light Lightness Server model extends the Generic Power OnOff Server model and the Generic Level Server model. When this model is present on an Element, the corresponding Light Lightness Setup Server model shall also be present. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_lightness_srv_t. - - Returns New Light Lightness Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SETUP_SRV(srv_pub, srv_data) Define a new Light Lightness Setup Server Model.
The Light CTL Server model extends the Light Lightness Server model. When this model is present on an Element, the corresponding Light CTL Temperature Server model and the corresponding Light CTL Setup Server model shall also be present. This model shall support model publication and model subscription. The model requires two elements: the main element and the Temperature element. The Temperature element contains the corresponding Light CTL Temperature Server model and an instance of a Generic Level state bound to the Light CTL Temperature state on the Temperature element. The Light CTL Temperature state on the Temperature element is bound to the Light CTL state on the main element. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_ctl_srv_t. - - Returns New Light CTL Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_CTL_SETUP_SRV(srv_pub, srv_data) Define a new Light CTL Setup Server Model.
The Light HSL Server model extends the Light Lightness Server model. When this model is present on an Element, the corresponding Light HSL Hue Server model and the corresponding Light HSL Saturation Server model and the corresponding Light HSL Setup Server model shall also be present. This model shall support model publication and model subscription. The model requires three elements: the main element and the Hue element and the Saturation element. The Hue element contains the corresponding Light HSL Hue Server model and an instance of a Generic Level state bound to the Light HSL Hue state on the Hue element. The Saturation element contains the corresponding Light HSL Saturation Server model and an instance of a Generic Level state bound to the Light HSL Saturation state on the Saturation element. The Light HSL Hue state on the Hue element is bound to the Light HSL state on the main element and the Light HSL Saturation state on the Saturation element is bound to the Light HSL state on the main element. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_hsl_srv_t. - - Returns New Light HSL Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_HSL_SETUP_SRV(srv_pub, srv_data) Define a new Light HSL Setup Server Model.
The Light HSL Hue Server model extends the Generic Level Server model. This model is associated with the Light HSL Server model. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_hsl_hue_srv_t. - - Returns New Light HSL Hue Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_HSL_SAT_SRV(srv_pub, srv_data) Define a new Light HSL Saturation Server Model.
The Light HSL Saturation Server model extends the Generic Level Server model. This model is associated with the Light HSL Server model. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_hsl_sat_srv_t. - - Returns New Light HSL Saturation Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_XYL_SRV(srv_pub, srv_data) Define a new Light xyL Server Model.
The Light xyL Server model extends the Light Lightness Server model. When this model is present on an Element, the corresponding Light xyL Setup Server model shall also be present. This model shall support model publication and model subscription. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_xyl_srv_t. - - Returns New Light xyL Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_XYL_SETUP_SRV(srv_pub, srv_data) Define a new Light xyL
The Light LC (Lightness Control) Server model extends the Light Lightness Server model and the Generic OnOff Server model. When this model is present on an Element, the corresponding Light LC Setup Server model shall also be present. This model shall support model publication and model subscription. This model may be used to represent an element that is a client to a Sensor Server model and controls the Light Lightness Actual state via defined state bindings. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_lc_srv_t. - - Returns New Light LC Server Model instance. - - ESP_BLE_MESH_MODEL_LIGHT_LC_SETUP_SRV(srv_pub, srv_data) Define a new Light LC Setup Server Model.
The Light LC (Lightness Control) Setup model extends the Light LC Server model. This model shall support model publication and model subscription. This model may be used to configure setup parameters for the Light LC Server model. - Parameters srv_pub -- Pointer to the unique struct esp_ble_mesh_model_pub_t. srv_data -- Pointer to the unique struct esp_ble_mesh_light_lc_setup_srv_t. - - Returns New Light LC Setup Server Model instance. - Type Definitions - typedef void (*esp_ble_mesh_light_client_cb_t)(esp_ble_mesh_light_client_cb_event_t event, esp_ble_mesh_light_client_cb_param_t *param) Bluetooth Mesh Light Client Model function. Lighting Client Model callback function type - Param event Event type - Param param Pointer to callback parameter - typedef void
Lighting Server Model callback function type - Param event Event type - Param param Pointer to callback parameter Enumerations - enum esp_ble_mesh_light_client_cb_event_t This enum value is the event of Lighting Client Model Values: - enumerator ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT - enumerator ESP_BLE_MESH_LIGHT_CLIENT_SET_STATE_EVT - enumerator ESP_BLE_MESH_LIGHT_CLIENT_PUBLISH_EVT - enumerator ESP_BLE_MESH_LIGHT_CLIENT_TIMEOUT_EVT - enumerator ESP_BLE_MESH_LIGHT_CLIENT_EVT_MAX - enumerator ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT - enum esp_ble_mesh_lc_state_t This enum value is the Light LC State Machine states Values: - enumerator ESP_BLE_MESH_LC_OFF - enumerator ESP_BLE_MESH_LC_STANDBY - enumerator ESP_BLE_MESH_LC_FADE_ON - enumerator ESP_BLE_MESH_LC_RUN - enumerator ESP_BLE_MESH_LC_FADE - enumerator ESP_BLE_MESH_LC_PROLONG - enumerator ESP_BLE_MESH_LC_FADE_STANDBY_AUTO - enumerator ESP_BLE_MESH_LC_FADE_STANDBY_MANUAL - enumerator ESP_BLE_MESH_LC_OFF - enum esp_ble_mesh_lighting_server_cb_event_t This enum value is the event of Lighting Server Model Values: - enumerator ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be callback to the application layer when Lighting Get messages are received. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will be callback to the application layer when Lighting Set/Set Unack messages are received. - - enumerator ESP_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when Lighting Get messages are received. - enumerator ESP_BLE_MESH_LIGHTING_SERVER_RECV_SET_MSG_EVT When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when Lighting Set/Set Unack messages are received. - enumerator ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT When status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be callback to the application layer when Sensor Status message is received. - enumerator ESP_BLE_MESH_LIGHTING_SERVER_EVT_MAX - enumerator ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT ESP-BLE-MESH (v1.1) Core API Reference Note This section is a preview version, so the related structures, macros, and APIs may be changed. This section contains ESP-BLE-MESH v1.1 Core related APIs, event types, event parameters, etc. This API reference covers 10 components: Remote Provisioning Header File components/bt/esp_ble_mesh/v1.1/api/core/include/esp_ble_mesh_rpr_model_api.h This header file can be included with: #include "esp_ble_mesh_rpr_model_api.h" This header file is a part of the API provided by the btcomponent.
esp_ble_mesh_register_rpr_client_callback(esp_ble_mesh_rpr_client_cb_t callback) Register BLE Mesh Remote Provisioning Client model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_rpr_client_send(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_rpr_client_msg_t *msg) Get the value of Remote Provisioning Server model state with the corresponding get message. - Parameters params -- [in] Pointer to BLE Mesh common client parameters. msg -- [in] Pointer to Remote Provisioning Client message. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_rpr_client_action(esp_ble_mesh_rpr_client_act_type_t type, esp_ble_mesh_rpr_client_act_param_t *param) Remote Provisioning Client model perform related actions, e.g. start remote provisioning. - Parameters type -- [in] Type of the action to be performed. param -- [in] Parameters of the action to be performed. - - Returns ESP_OK on success or error code otherwise. - esp_err_t esp_ble_mesh_register_rpr_server_callback(esp_ble_mesh_rpr_server_cb_t callback) Register BLE Mesh Remote Provisioning Server model callback. - Parameters callback -- [in] Pointer to the callback function. - Returns ESP_OK on success or error code otherwise. Unions - union esp_ble_mesh_rpr_client_msg_t - #include <esp_ble_mesh_rpr_model_api.h> Remote Provisioning Client model message union. Public Members - esp_ble_mesh_rpr_scan_start_t scan_start For ESP_BLE_MESH_MODEL_OP_RPR_SCAN_START - esp_ble_mesh_rpr_ext_scan_start_t ext_scan_start For ESP_BLE_MESH_MODEL_OP_RPR_EXT_SCAN_START - esp_ble_mesh_rpr_link_open_t link_open For ESP_BLE_MESH_MODEL_OP_RPR_LINK_OPEN - esp_ble_mesh_rpr_link_close_t link_close For ESP_BLE_MESH_MODEL_OP_RPR_LINK_CLOSE - esp_ble_mesh_rpr_scan_start_t scan_start - union esp_ble_mesh_rpr_client_act_param_t - #include <esp_ble_mesh_rpr_model_api.h> Remote Provisioning Client model action union. Public Members - esp_ble_mesh_rpr_client_start_rpr_t start_rpr Start remote provisioning - esp_ble_mesh_rpr_client_start_rpr_t start_rpr - union esp_ble_mesh_rpr_client_recv_cb_t - #include <esp_ble_mesh_rpr_model_api.h> Remote Provisioning Client model received message union. Public Members - esp_ble_mesh_rpr_scan_caps_status_t scan_caps_status For ESP_BLE_MESH_MODEL_OP_RPR_SCAN_CAPS_STATUS - esp_ble_mesh_rpr_scan_status_t scan_status For ESP_BLE_MESH_MODEL_OP_RPR_SCAN_STATUS - esp_ble_mesh_rpr_scan_report_t scan_report For ESP_BLE_MESH_MODEL_OP_RPR_SCAN_REPORT - esp_ble_mesh_rpr_ext_scan_report_t ext_scan_report For ESP_BLE_MESH_MODEL_OP_RPR_EXT_SCAN_REPORT - esp_ble_mesh_rpr_link_status_t link_status For ESP_BLE_MESH_MODEL_OP_RPR_LINK_STATUS - esp_ble_mesh_rpr_link_report_t link_report
For ESP_BLE_MESH_MODEL_OP_BRIDGED_SUBNETS_GET - esp_ble_mesh_bridging_table_get_t bridging_table_get For ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_GET - esp_ble_mesh_subnet_bridge_set_t subnet_bridge_set For ESP_BLE_MESH_MODEL_OP_SUBNET_BRIDGE_SET - esp_ble_mesh_bridging_table_add_t bridging_table_add For ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_ADD - esp_ble_mesh_bridging_table_remove_t bridging_table_remove For ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_REMOVE - esp_ble_mesh_bridged_subnets_get_t bridged_subnets_get - union esp_ble_mesh_brc_client_recv_cb_t - #include <esp_ble_mesh_brc_model_api.h> Bridge Configuration Client model received message union. Public Members - esp_ble_mesh_subnet_bridge_status_t subnet_bridge_status ESP_BLE_MESH_MODEL_OP_SUBNET_BRIDGE_STATUS - esp_ble_mesh_bridging_table_status_t bridging_table_status ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_STATUS - esp_ble_mesh_bridged_subnets_list_t bridged_subnets_list ESP_BLE_MESH_MODEL_OP_BRIDGED_SUBNETS_LIST - esp_ble_mesh_bridging_table_list_t bridging_table_list ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_LIST - esp_ble_mesh_bridging_table_size_status_t bridging_table_size_status ESP_BLE_MESH_MODEL_OP_BRIDGING_TABLE_SIZE_STATUS - esp_ble_mesh_subnet_bridge_status_t subnet_bridge_status - union esp_ble_mesh_brc_server_state_change_t - #include <esp_ble_mesh_brc_model_api.h> Bridge Configuration Server model state change value union.
Private Beacon Set - esp_ble_mesh_state_change_priv_gatt_proxy_set_t priv_gatt_proxy_set Private GATT Proxy Set - esp_ble_mesh_state_change_priv_node_id_set_t priv_node_id_set Private Node Identity Set - esp_ble_mesh_state_change_priv_beacon_set_t priv_beacon_set - union esp_ble_mesh_prb_server_cb_value_t - #include <esp_ble_mesh_prb_model_api.h> Private Beacon Server model callback value union. Public Members - esp_ble_mesh_prb_server_state_change_t state_change ESP_BLE_MESH_PRB_SERVER_STATE_CHANGE_EVT - esp_ble_mesh_prb_server_state_change_t state_change Structures - struct esp_ble_mesh_prb_srv_t Private Beacon Server Model context Public Members - esp_ble_mesh_model_t *model Pointer to Private Beacon Server Model - uint8_t private_beacon Value of Private Beacon state - uint8_t random_update_interval Value of Random Update Interval Steps state - uint8_t private_gatt_proxy Value of Private GATT Proxy state - struct k_delayed_work update_timer Timer for update the random field of private beacon - esp_ble_mesh_model_t *model - struct esp_ble_mesh_priv_beacon_set_t Parameter of private Beacon Set - struct esp_ble_mesh_priv_gatt_proxy_set_t Parameter of Private GATT Proxy Set Public Members - uint8_t
Proxy state - uint8_t private_gatt_proxy - struct esp_ble_mesh_priv_node_id_get_t Parameter of Private node identity Get Public Members - uint16_t net_idx Index of the NetKey - uint16_t net_idx - struct esp_ble_mesh_priv_node_id_set_t Parameter of Private node identity Set - struct esp_ble_mesh_priv_beacon_status_cb_t Parameter of Private Beacon Status - struct esp_ble_mesh_priv_gatt_proxy_status_cb_t Parameter of Private GATT Proxy Status Public Members - uint8_t private_gatt_proxy Private GATT Proxy state - uint8_t private_gatt_proxy - struct esp_ble_mesh_priv_node_identity_status_cb_t Parameters of Private Node Identity Status - struct esp_ble_mesh_prb_client_send_cb_t Result of sending Bridge Configuration Client messages - struct esp_ble_mesh_prb_client_cb_param_t Mesh Private Beacon Client Model callback parameters Public Members - esp_ble_mesh_client_common_param_t *params The client common parameters. - esp_ble_mesh_prb_client_send_cb_t send Result of sending a message - esp_ble_mesh_prb_client_recv_cb_t recv The private beacon message status callback values - union esp_ble_mesh_prb_client_cb_param_t::[anonymous] [anonymous] Union of Private Beacon Client callback - esp_ble_mesh_client_common_param_t *params - struct esp_ble_mesh_state_change_priv_beacon_set_t Mesh Private Beacon Server model related context. Parameters of Private Beacon Set. - struct esp_ble_mesh_state_change_priv_gatt_proxy_set_t Parameters of Private GATT Proxy Set. Public Members - uint8_t private_gatt_proxy Private GATT
Error Codes Reference This section lists various error code constants defined in ESP-IDF. For general information about error codes in ESP-IDF, see Error Handling. ESP_FAIL (-1): Generic esp_err_t code indicating failure ESP_OK (0): esp_err_t value indicating success (no error) ESP_ERR_NO_MEM (0x101): Out of memory ESP_ERR_INVALID_ARG (0x102): Invalid argument ESP_ERR_INVALID_STATE (0x103): Invalid state ESP_ERR_INVALID_SIZE (0x104): Invalid size ESP_ERR_NOT_FOUND (0x105): Requested resource not found ESP_ERR_NOT_SUPPORTED (0x106): Operation or feature not supported ESP_ERR_TIMEOUT (0x107): Operation timed out ESP_ERR_INVALID_RESPONSE (0x108): Received response was invalid ESP_ERR_INVALID_CRC (0x109): CRC or checksum was invalid ESP_ERR_INVALID_VERSION (0x10a): Version was invalid ESP_ERR_INVALID_MAC (0x10b): MAC address was invalid ESP_ERR_NOT_FINISHED (0x10c): Operation has not fully completed ESP_ERR_NOT_ALLOWED (0x10d): Operation is not allowed ESP_ERR_NVS_BASE (0x1100): Starting number of error codes ESP_ERR_NVS_NOT_INITIALIZED (0x1101): The storage driver is not initialized ESP_ERR_NVS_NOT_FOUND (0x1102): A requested entry couldn't be found or namespace doesn’t exist yet and mode is NVS_READONLY ESP_ERR_NVS_TYPE_MISMATCH (0x1103): The type of set or get operation doesn't match the type of value stored in NVS ESP_ERR_NVS_READ_ONLY (0x1104): Storage handle was opened as read only ESP_ERR_NVS_NOT_ENOUGH_SPACE (0x1105): There is not enough space in the underlying storage to save the value ESP_ERR_NVS_INVALID_NAME (0x1106): Namespace name doesn’t satisfy constraints ESP_ERR_NVS_INVALID_HANDLE (0x1107): Handle has been closed or is NULL ESP_ERR_NVS_REMOVE_FAILED (0x1108): The value wasn’t updated because flash write operation has failed. The value was written however, and update will be finished after re-initialization of nvs, provided that flash operation doesn’t fail again.
ESP_ERR_NVS_KEY_TOO_LONG (0x1109): Key name is too long ESP_ERR_NVS_PAGE_FULL (0x110a): Internal error; never returned by nvs API functions ESP_ERR_NVS_INVALID_STATE (0x110b): NVS is in an inconsistent state due to a previous error. Call nvs_flash_init and nvs_open again, then retry. ESP_ERR_NVS_INVALID_LENGTH (0x110c): String or blob length is not sufficient to store data ESP_ERR_NVS_NO_FREE_PAGES (0x110d): NVS partition doesn't contain any empty pages. This may happen if NVS partition was truncated. Erase the whole partition and call nvs_flash_init again. ESP_ERR_NVS_VALUE_TOO_LONG (0x110e): Value doesn't fit into the entry or string or blob length is longer than supported by the implementation ESP_ERR_NVS_PART_NOT_FOUND (0x110f): Partition with specified name is not found in the partition table ESP_ERR_NVS_NEW_VERSION_FOUND (0x1110): NVS partition contains data in new format and cannot be recognized by this version of code ESP_ERR_NVS_XTS_ENCR_FAILED (0x1111): XTS encryption failed while writing NVS entry ESP_ERR_NVS_XTS_DECR_FAILED (0x1112): XTS decryption failed while reading NVS entry ESP_ERR_NVS_XTS_CFG_FAILED (0x1113): XTS configuration setting failed ESP_ERR_NVS_XTS_CFG_NOT_FOUND (0x1114): XTS configuration not found ESP_ERR_NVS_ENCR_NOT_SUPPORTED (0x1115): NVS encryption is not supported in this version ESP_ERR_NVS_KEYS_NOT_INITIALIZED (0x1116): NVS key partition is uninitialized ESP_ERR_NVS_CORRUPT_KEY_PART (0x1117): NVS key partition is corrupt ESP_ERR_NVS_CONTENT_DIFFERS (0x1118): Internal error; never returned by nvs API functions. NVS key is different in comparison ESP_ERR_NVS_WRONG_ENCRYPTION (0x1119): NVS partition is marked as encrypted with generic flash encryption. This is forbidden since the NVS encryption works differently.
ESP_ERR_ULP_BASE (0x1200): Offset for ULP-related error codes ESP_ERR_ULP_SIZE_TOO_BIG (0x1201): Program doesn't fit into RTC memory reserved for the ULP ESP_ERR_ULP_INVALID_LOAD_ADDR (0x1202): Load address is outside of RTC memory reserved for the ULP ESP_ERR_ULP_DUPLICATE_LABEL (0x1203): More than one label with the same number was defined ESP_ERR_ULP_UNDEFINED_LABEL (0x1204): Branch instructions references an undefined label ESP_ERR_ULP_BRANCH_OUT_OF_RANGE (0x1205): Branch target is out of range of B instruction (try replacing with BX) ESP_ERR_OTA_BASE (0x1500): Base error code for ota_ops api ESP_ERR_OTA_PARTITION_CONFLICT (0x1501): Error if request was to write or erase the current running partition ESP_ERR_OTA_SELECT_INFO_INVALID (0x1502): Error if OTA data partition contains invalid content ESP_ERR_OTA_VALIDATE_FAILED (0x1503): Error if OTA app image is invalid ESP_ERR_OTA_SMALL_SEC_VER (0x1504): Error if the firmware has a secure version less than the running firmware. ESP_ERR_OTA_ROLLBACK_FAILED (0x1505): Error if flash does not have valid firmware in passive partition and hence rollback is not possible ESP_ERR_OTA_ROLLBACK_INVALID_STATE (0x1506): Error if current active firmware is still marked in pending validation state (ESP_OTA_IMG_PENDING_VERIFY), essentially first boot of firmware image post upgrade and hence firmware upgrade is not possible ESP_ERR_EFUSE (0x1600): Base error code for efuse api. ESP_OK_EFUSE_CNT (0x1601): OK the required number of bits is set. ESP_ERR_EFUSE_CNT_IS_FULL (0x1602): Error field is full. ESP_ERR_EFUSE_REPEATED_PROG (0x1603): Error repeated programming of programmed bits is strictly forbidden. ESP_ERR_CODING (0x1604): Error while a encoding operation. ESP_ERR_NOT_ENOUGH_UNUSED_KEY_BLOCKS (0x1605): Error not enough unused key blocks available ESP_ERR_DAMAGED_READING (0x1606): Error. Burn or reset was done during a reading operation leads to damage read data. This error is internal to the efuse component and not returned by any public API.
ESP_ERR_IMAGE_BASE (0x2000) ESP_ERR_IMAGE_FLASH_FAIL (0x2001) ESP_ERR_IMAGE_INVALID (0x2002) ESP_ERR_WIFI_BASE (0x3000): Starting number of WiFi error codes ESP_ERR_WIFI_NOT_INIT (0x3001): WiFi driver was not installed by esp_wifi_init ESP_ERR_WIFI_NOT_STARTED (0x3002): WiFi driver was not started by esp_wifi_start ESP_ERR_WIFI_NOT_STOPPED (0x3003): WiFi driver was not stopped by esp_wifi_stop ESP_ERR_WIFI_IF (0x3004): WiFi interface error ESP_ERR_WIFI_MODE (0x3005): WiFi mode error ESP_ERR_WIFI_STATE (0x3006): WiFi internal state error ESP_ERR_WIFI_CONN (0x3007): WiFi internal control block of station or soft-AP error ESP_ERR_WIFI_NVS (0x3008): WiFi internal NVS module error ESP_ERR_WIFI_MAC (0x3009): MAC address is invalid ESP_ERR_WIFI_SSID (0x300a): SSID is invalid ESP_ERR_WIFI_PASSWORD (0x300b): Password is invalid ESP_ERR_WIFI_TIMEOUT (0x300c): Timeout error ESP_ERR_WIFI_WAKE_FAIL (0x300d): WiFi is in sleep state(RF closed) and wakeup fail ESP_ERR_WIFI_WOULD_BLOCK (0x300e): The caller would block ESP_ERR_WIFI_NOT_CONNECT (0x300f): Station still in disconnect status ESP_ERR_WIFI_POST (0x3012): Failed to post the event to WiFi task ESP_ERR_WIFI_INIT_STATE (0x3013): Invalid WiFi state when init/deinit is called ESP_ERR_WIFI_STOP_STATE (0x3014): Returned when WiFi is stopping ESP_ERR_WIFI_NOT_ASSOC (0x3015): The WiFi connection is not associated ESP_ERR_WIFI_TX_DISALLOW (0x3016): The WiFi TX is disallowed ESP_ERR_WIFI_TWT_FULL (0x3017): no available flow id ESP_ERR_WIFI_TWT_SETUP_TIMEOUT (0x3018):
ESP-NOW Overview ESP-NOW is a kind of connectionless Wi-Fi communication protocol that is defined by Espressif. In ESP-NOW, application data is encapsulated in a vendor-specific action frame and then transmitted from one Wi-Fi device to another without connection. CTR with CBC-MAC Protocol (CCMP) is used to protect the action frame for security. ESP-NOW is widely used in smart light, remote controlling, sensor, etc. Frame Format ESP-NOW uses a vendor-specific action frame to transmit ESP-NOW data. The default ESP-NOW bit rate is 1 Mbps.
The format of the vendor-specific action frame is as follows: ------------------------------------------------------------------------------------------------------------ | MAC Header | Category Code | Organization Identifier | Random Values | Vendor Specific Content | FCS | ------------------------------------------------------------------------------------------------------------ 24 bytes 1 byte 3 bytes 4 bytes 7-257 bytes 4 bytes Category Code: The Category Code field is set to the value (127) indicating the vendor-specific category. Organization Identifier: The Organization Identifier contains a unique identifier (0x18fe34), which is the first three bytes of MAC address applied by Espressif. Random Value: The Random Value filed is used to prevents relay attacks.
Vendor Specific Content: The Vendor Specific Content contains vendor-specific fields as follows: ------------------------------------------------------------------------------- | Element ID | Length | Organization Identifier | Type | Version | Body | ------------------------------------------------------------------------------- 1 byte 1 byte 3 bytes 1 byte 1 byte 0-250 bytes Element ID: The Element ID field is set to the value (221), indicating the vendor-specific element. Length: The length is the total length of Organization Identifier, Type, Version and Body. Organization Identifier: The Organization Identifier contains a unique identifier (0x18fe34), which is the first three bytes of MAC address applied by Espressif. Type: The Type field is set to the value (4) indicating ESP-NOW. Version: The Version field is set to the version of ESP-NOW. Body: The Body contains the ESP-NOW data. As ESP-NOW is connectionless, the MAC header is a little different from that of standard frames. The FromDS and ToDS bits of FrameControl field are both 0. The first address field is set to the destination address. The second address field is set to the source address. The third address field is set to broadcast address (0xff:0xff:0xff:0xff:0xff:0xff). Security ESP-NOW uses the CCMP method, which is described in IEEE Std. 802.11-2012, to protect the vendor-specific action frame.
When esp_now_deinit() is called, all of the information of paired devices are deleted. Add Paired Device Call esp_now_add_peer() to add the device to the paired device list before you send data to this device. If security is enabled, the LMK must be set. You can send ESP-NOW data via both the Station and the SoftAP interface. Make sure that the interface is enabled before sending ESP-NOW data. The maximum number of paired devices is 20, and the paired encryption devices are no more than 17, the default is 7. If you want to change the number of paired encryption devices, set CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM in the Wi-Fi component configuration menu. A device with a broadcast MAC address must be added before sending broadcast data. The range of the channel of paired devices is from 0 to 14. If the channel is set to 0, data will be sent on the current channel. Otherwise, the channel must be set as the channel that the local device is on.
It will return ESP_NOW_SEND_SUCCESS in sending callback function if the data is received successfully on the MAC layer. Otherwise, it will return ESP_NOW_SEND_FAIL. Several reasons can lead to ESP-NOW fails to send data. For example, the destination device does not exist; the channels of the devices are not the same; the action frame is lost when transmitting on the air, etc. It is not guaranteed that application layer can receive the data. If necessary, send back ack data when receiving ESP-NOW data. If receiving ack data timeouts, retransmit the ESP-NOW data. A sequence number can also be assigned to ESP-NOW data to drop the duplicate data. If there is a lot of ESP-NOW data to send, call esp_now_send() to send less than or equal to 250 bytes of data once a time. Note that too short interval between sending two ESP-NOW data may lead to disorder of sending callback function. So, it is recommended that sending the next ESP-NOW data after the sending callback function of the previous sending has returned. The sending callback function runs from a high-priority Wi-Fi task.
The default value is the maximum, which allowing RX all the time. If Power-saving is needed for ESP-NOW, call esp_wifi_connectionless_module_set_wake_interval() to configure Interval as well. Please refer to connectionless module power save to get more detail. Application Examples Example of sending and receiving ESP-NOW data between two devices: wifi/espnow. For more application examples of how to use ESP-NOW, please visit ESP-NOW repository. API Reference Header File This header file can be included with: #include "esp_now.h" This header file is a part of the API provided by the esp_wificomponent. To declare that your component depends on esp_wifi, add the following to your CMakeLists.txt: REQUIRES esp_wifi or PRIV_REQUIRES esp_wifi Functions - esp_err_t esp_now_init(void) Initialize ESPNOW function. - Returns ESP_OK : succeed ESP_ERR_ESPNOW_INTERNAL : Internal error - - esp_err_t esp_now_get_version(uint32_t *version) Get the version of ESPNOW. - Parameters version -- ESPNOW version - Returns ESP_OK : succeed ESP_ERR_ESPNOW_ARG : invalid argument - - esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb) Register callback function of receiving ESPNOW data. - Parameters cb -- callback function of receiving ESPNOW data - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_INTERNAL : internal error - - esp_err_t esp_now_unregister_recv_cb(void) Unregister callback function of receiving ESPNOW data. - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized - - esp_err_t esp_now_register_send_cb(esp_now_send_cb_t cb) Register callback function of sending ESPNOW data. - Parameters cb -- callback function of sending ESPNOW data - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_INTERNAL : internal error - - esp_err_t esp_now_unregister_send_cb(void) Unregister callback function of sending ESPNOW data. - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized - - esp_err_t esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len) Send ESPNOW data.
If peer_addr is not NULL, send data to the peer whose MAC address matches peer_addr - Attention 2. If peer_addr is NULL, send data to all of the peers that are added to the peer list - Attention 3. The maximum length of data must be less than ESP_NOW_MAX_DATA_LEN - Attention 4. The buffer pointed to by data argument does not need to be valid after esp_now_send returns - Parameters peer_addr -- peer MAC address data -- data to send len -- length of data - - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_INTERNAL : internal error ESP_ERR_ESPNOW_NO_MEM : out of memory, when this happens, you can delay a while before sending the next data ESP_ERR_ESPNOW_NOT_FOUND : peer is not found ESP_ERR_ESPNOW_IF : current Wi-Fi interface doesn't match that of peer ESP_ERR_ESPNOW_CHAN: current Wi-Fi channel doesn't match that of peer - - esp_err_t esp_now_add_peer(const esp_now_peer_info_t *peer) Add a peer to peer list. - Parameters peer -- peer information - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_FULL : peer list is full ESP_ERR_ESPNOW_NO_MEM : out of memory ESP_ERR_ESPNOW_EXIST : peer has existed - - esp_err_t
Delete a peer from peer list. - Parameters peer_addr -- peer MAC address - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_NOT_FOUND : peer is not found - - esp_err_t esp_now_mod_peer(const esp_now_peer_info_t *peer) Modify a peer. - Parameters peer -- peer information - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_FULL : peer list is full - - esp_err_t esp_wifi_config_espnow_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) Config ESPNOW rate of specified interface. - Deprecated: please use esp_now_set_peer_rate_config() instead. - Attention 1. This API should be called after esp_wifi_start(). - Attention 2. This API only work when not use Wi-Fi 6 and esp_now_set_peer_rate_config() not called. - Parameters ifx -- Interface to be configured.
Phy rate to be configured. - - Returns ESP_OK: succeed others: failed - - esp_err_t esp_now_set_peer_rate_config(const uint8_t *peer_addr, esp_now_rate_config_t *config) Set ESPNOW rate config for each peer. - Attention 1. This API should be called after esp_wifi_start() and esp_now_init(). - Parameters peer_addr -- peer MAC address config -- rate config to be configured. - - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_INTERNAL : internal error - - esp_err_t esp_now_get_peer(const uint8_t *peer_addr, esp_now_peer_info_t *peer) Get a peer whose MAC address matches peer_addr from peer list. - Parameters peer_addr -- peer MAC address peer -- peer information - - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_NOT_FOUND : peer is not found - - esp_err_t esp_now_fetch_peer(bool from_head, esp_now_peer_info_t *peer) Fetch a peer from peer list. Only return the peer which address is unicast, for the multicast/broadcast address, the function will ignore and try to find the next in the peer list. - Parameters from_head -- fetch from head of list or not peer -- peer information - - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument ESP_ERR_ESPNOW_NOT_FOUND : peer is not found - - bool esp_now_is_peer_exist(const uint8_t *peer_addr) Peer exists or not. - Parameters peer_addr -- peer MAC address - Returns true : peer exists false : peer not exists - - esp_err_t esp_now_get_peer_num(esp_now_peer_num_t *num) Get the number of peers. - Parameters num -- number of peers - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument - - esp_err_t esp_now_set_pmk(const uint8_t *pmk) Set the primary master key. - Attention 1. primary master key is used to encrypt local master key - Parameters pmk -- primary master key - Returns ESP_OK : succeed ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized ESP_ERR_ESPNOW_ARG : invalid argument - - esp_err_t esp_now_set_wake_window(uint16_t window)