Enable client to set server device Custom Characterstic valid range

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

cross mob
Anonymous
Not applicable

I need an advice on how to give client device (mobile phone) possibility to set the temperature range on the server device (CY8CKIT-042-BLE)

   

So, I'm having my server device measuring temperature on every 10 sec and reporting changes to client via notifications. What I want is to raise an alarm in case of temperature exceeding temperature range... But I want that client can change that range based on his needs... 

   

If I have Custom Service "Device Sensing" and among others "Room Temperature" as its Custom Characteristic, what would be the best approach to add writable "Room Temperature Range" feature? Should it be another Custom Characteristic within the "Device Sensing" Service, or something else?

   

I see there is a an "Valid Range" option for Custom Descriptor which can be added to "Room Temperature" Custom Characteristic. But when I add it, and when I want to write something to it via CySmart App, my device freezes...

   

Is this good approach, or there is a smarter one?

   

Thanks

0 Likes
1 Reply
Anonymous
Not applicable

Okay, I figured this out.

   

I added "Valid Range" Custom Descriptor to my "Room Temperature" characteristic. Within the CYBLE_EVT_GATTS_WRITE_REQ event case of my BLE handler, I looked for the appropriate custom description handle and did my work here.

   

At the end I called CyBle_GattsWriteRsp and it all worked well.

   

Best

0 Likes