Set period in server sensor from client sensor in mesh project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AKORICHE
Level 1
Level 1
50 sign-ins First solution authored 25 sign-ins
Hello,

I
am using the Cypress EZ-BT Mesh Evaluation Kit.
The temperature sensor example and the sensor client example are used. I want to control the sensor from the mesh_sensor_client board. Actually, I am able to get the temperature by pushing the button. My aim is to change the period by pushing the button. I didn't find the function that changes the measurement period in the wiced_bt_mesh_models.h

Is there a fonction to fulfil my aim ? Or do I have to call specila fonction to generate the call of notify period set ?

Thank you.

 

 

 

 

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

In case of sensor_temperature example, please check mesh_sensor_server_restart_timer(). It changes the periodic timer depending on the publication period, fast cadence divisor and minimum interval. It is getting called from mesh_sensor_server_config_change_handler() when WICED_BT_MESH_SENSOR_CADENCE_SET is recevied. Stack initiate this event based on the configuration changes set by the Sensor Client.

https://github.com/cypresssemiconductorco/mtb-example-btsdk-mesh-demo-sensor-temperature

Thanks,

-Dheeraj

View solution in original post

0 Likes
6 Replies
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

In case of sensor_temperature example, please check mesh_sensor_server_restart_timer(). It changes the periodic timer depending on the publication period, fast cadence divisor and minimum interval. It is getting called from mesh_sensor_server_config_change_handler() when WICED_BT_MESH_SENSOR_CADENCE_SET is recevied. Stack initiate this event based on the configuration changes set by the Sensor Client.

https://github.com/cypresssemiconductorco/mtb-example-btsdk-mesh-demo-sensor-temperature

Thanks,

-Dheeraj

0 Likes
AKORICHE
Level 1
Level 1
50 sign-ins First solution authored 25 sign-ins

Hi,

Thank you for your answer.

In the provided exemple mesh_snip_sensor_client, I have this code to get the temperature :

p_event = wiced_bt_mesh_create_event(0, MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_SENSOR_CLNT, 0, 0);
mesh_sensor_get(p_event, p_data, 1);

In the temperature_sensor exemple it calls mesh_sensor_server_report_handler(uint16_t event, uint8_t element_idx, void *p_get, void *p_ref_data). The temperature is received in the client_sensor.

But when I write this code :
uint8_t p_data[26]= { 0x4F,0, 3, 2,0,0,0,0,0,0,0,0,0,0,0x40,0,0,0,0,0,0,0,0,0,0,0};
p_event = wiced_bt_mesh_create_event(0, MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_SENSOR_CLNT, 0, 0);
mesh_sensor_cadence_set(p_event, p_data, 1);

This code don't call mesh_sensor_server_report_handler(uint16_t event, uint8_t element_idx, void *p_get, void *p_ref_data) in the temperature_sensor code example.

Do you have any idea why ?

 

0 Likes
AKORICHE
Level 1
Level 1
50 sign-ins First solution authored 25 sign-ins

Hello,

After reading the documentation and the code, I am able to refine my question. What fonction could I call in the mesh_sensor_client example that generate the callback fonction notify period set in the temperature sensor demo ?

Thank you for your help

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

So you have two embedded devices - One is mesh_sensor_client and other one is temperature_sensor or mesh_sensor_server app. Right? 

Here you have to provision these two devices into a single network using a provisioner. Have you done it?

And when you send command from the client to the server you have to use the correct keys also. I would suggest you to use the mesh_sensor_server and mesh_sensor_client apps to do the basic test. Here you can use the MeshClientControl to control the device. 

You can refer below post and steps. The difference is mesh_provision_client app itself have mesh_sensor_client model, so here the provisioner and mesh_sensor_client both are same device.

https://community.cypress.com/t5/ModusToolbox-Bluetooth-SDK/Hello-All/m-p/60384

 

Thanks,

-Dheeraj

0 Likes
AKORICHE
Level 1
Level 1
50 sign-ins First solution authored 25 sign-ins

Hi,

Thank you for your answer.
I provisonned them in the same network.

I proceded this way :

- I loaded in one card the mesh_snip_sensor_server and in other card mesh_snip_sensor client.
- I created a network using mesh client on Windows 10, then, I sacenned and provisionned both of them.
- After that, in the meshclient if I get the temperature or configure cadebce it works

AKORICHE_0-1625242146679.png

I get this log :

AKORICHE_1-1625242232696.png

- I copied the adress of the node and app key index in mesh client control app in windows 10. I selected the port of the mesh_snip_sensor_client card BR : 115200.
When I want temperature, it works. But when I want to set cadence, the call back fonction isn't called as with the mesh client app. I also tried with HCI command, it's same result.

AKORICHE_2-1625242493442.pngAKORICHE_3-1625242548988.png

AKORICHE_4-1625242597571.png


I am on it since several days.I hope there will be a solution to go further in the project and start the production.

The IDE is modusToolBox 2.3.1
For the bt-SDK and the app I followed the getting started document. everything was created from the IDE and tools were open from the IDE.

 

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Are you still observe the issue?

"When I want temperature, it works. But when I want to set cadence, the call back fonction isn't called as with the mesh client app"

What I understood is, the temperature GET messages works for you but temperature SET messages does not work. If this is the case, please try to open the network.json (meshclient database in it's directory) and use the "setup" app key.  Under the appkey section, there will be "Generic", "Setup" and "vendor" app keys availabel. You have to select "Setup" app key.

Thanks,

-Dheeraj.P.K

0 Likes