espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.33k stars 7.2k forks source link

BLE-MESH generic level server model get response (IDFGH-3037) #5062

Open sheldon123z opened 4 years ago

sheldon123z commented 4 years ago

3443 Environment

Problem Description

Hi, I wonder how to respond to the ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_GET op-code. From the example, the esp_ble_mesh_model_publish and esp_ble_mesh_server_model_send_msg are used for the generic onoff models. The data type for the "data" parameter is uint8_t for the above two functions, but the data type of the "level" member in the esp_ble_mesh_gen_level_state_t is uint16_t, I tried to convert it to uint8_t but it doesn't work for the phone app. There is nothing shown on the app when I click the "Read" button on the model interface. Are there any other functions that we can use for sending messages?

Thanks.

Campou commented 4 years ago

Hi @sheldon123z

Sorry for the late reply.

For server model sending messages, only the esp_ble_mesh_server_model_send_msg & esp_ble_mesh_model_publish should be used, no other functions. And the data parameter for the two functions is just a uint8_t * pointer, for responding with a uint16_t data, you can provide the data length and covert the data to a uint8_t * pointer.

BTW, does this issue still exist?

Thanks.