BT GATT Server Changing values

richardl
Posts: 12
Joined: Sun Nov 18, 2018 5:02 pm

BT GATT Server Changing values

Postby richardl » Sun Dec 30, 2018 11:54 am

I am using the table version of the standard ESP32 GATTs example, it worked fine, however as an ex-CSR programmer I have 2 major disconnects as to its proper use.

1.)
There seems to be no option to handle the return value in code rather than by a static table. I.E. once the table is set up the values seem to be copied internally (just like the CSR) and changing them has no effect.

Even the HR monitor example does not actually change the HR, it appears to just return the same value from the table, not much use for a HR monitor :-).

On the CSR I'd set up a a [FLAG_IRQ] in the table to get to handle the value return in code, there seems to be no such option with the ESP32, so how would I please do this?

I.E. allow my code to get a call back to prep a new value and send this rather than the table value.

2.)
The notification examples allow notification to be turned on, however they don't have any code to actually do any notifying, i.e. usually I'd run a time and send notifications on timeout, or if a value changes. The examples log notification is turned on, but they don't show how to actually send a value updated notify.

This could of course be related to 1.) as if there is not way to change values then there is also no need to do notifications.

So is this an oversight in the API, or am I just being dumb.

Any ideas?

Regards

Richard

richardl
Posts: 12
Joined: Sun Nov 18, 2018 5:02 pm

Re: BT GATT Server Changing values

Postby richardl » Mon Dec 31, 2018 3:05 pm

OK, all sorted now.

1.) Found the ESP_GATT_RSP_BY_APP flag, so App does the response
2.) Handled my own notification using esp_ble_gatts_send_indicate();


Addendum, actually abandoned the "simpler" Table based solution as it it actually much easier to set the service, characteristics and descriptors up code for anything other than a really trivial example.

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 148 guests