This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Adding Sensor Model to bluetooth 5 mesh

Hi Support Team,

I am trying to create the custom model - as far as I know there are two types of models possible in bluetooth 5 mesh - SIG defined and vendor specific.

Example given is for simple on-off model - nrf5_SDK_for_Mesh_v0.10.1-Alpha_src\models\simple_on_off has the opcode defined as 0xC1, 0xC2, 0xC3, 0xC4 for set, get, group set, status model states. But the Mesh_Model_Specification v1.0.pdf gives Generic On Off Message opcodes as below:

Server Model Message Name Opcode
Generic OnOff Get : 0x82 0x01
Generic OnOff Set : 0x82 0x02
Generic OnOff Set Unacknowledged : 0x82 0x03
Generic OnOff Status : 0x82 0x04

So I assume the Opcode defined in simple on off example is vendor specific and is taken as example and not as per the mesh model specifications document.

I have written my sensor model by copying the sensor on off model c and header files and modifying that according to Mesh_Model_Specification v1.0.pdf. Generic Sensor model has lot of opcodes for messages but I have written only two sensor states:

typedef enum
{
    SIMPLE_SENSOR_OPCODE_GET = 0xD0,            /**< Simple Sensor Get. */
    SIMPLE_SENSOR_OPCODE_STATUS = 0xD1          /**< Simple Sensor Status. */
} simple_sensor_opcode_t;

#define SIMPLE_SENSOR_CLIENT_MODEL_ID (0x02)

And now with these two models, I have modified and compiled - nrf5_SDK_for_Mesh_v0.10.1-Alpha_src\examples\light_switch server (ble node) and client (ble provisioner) codes.

Please find attached modified light_switch server & client, sensor model. I am trying to add these two models with same element id (0, 1, 2, 3 as given in light_switch example). So I am trying to add on-off and sensor models to same element id 0, 1, 2, 3.

Is this approach correct? could you please check my modified code and model?

Thanks and Regards,

Madhav K

simple_sensor.rar

light_switch.rar

Parents
  • What do you mean by Element index and element ID ? You mean the unicast address of each element ?

    Note that if you are collecting data from multiple sensors, you can think of using single client model to collect data from multiple server. It's not a requirement that you need one client for each server. You can send a packet to a server by changing the publication address of the client.

Reply
  • What do you mean by Element index and element ID ? You mean the unicast address of each element ?

    Note that if you are collecting data from multiple sensors, you can think of using single client model to collect data from multiple server. It's not a requirement that you need one client for each server. You can send a packet to a server by changing the publication address of the client.

Children
No Data
Related