Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Indicate BLE 'Service Changed' (0x2A05) (IDFGH-9551) #1777

Closed
mainr opened this issue Mar 26, 2018 · 6 comments
Closed

How to Indicate BLE 'Service Changed' (0x2A05) (IDFGH-9551) #1777

mainr opened this issue Mar 26, 2018 · 6 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@mainr
Copy link

mainr commented Mar 26, 2018

Under BLE standard 'Generic Attribute' (0x1801) there is a Characteristic 'Service Changed' (0x2A05) with 'indicate' property, which is supposed to be used to indicate that a range of handles in the BLE device have changed, so that they can be 're-discovered', updating any cached information.

How would I go about triggering this?
How do I specify the 'range of affected handles' that are affected by the change?
Does the client need to 'subscribe' to get the indication, or is this automatic (there is no 0x2902 descriptor to write to)?

Issue ( #1673 ) seems to indicate the 'service changed' notification is something other than what I interpret is is supposed to be.

@Weijian-Espressif
Copy link
Collaborator

@mainr gattc is automatic to 'subscribe' the notification, client will get ESP_GATTC_SRVC_CHG_EVT

@mws-rmain
Copy link

mws-rmain commented Mar 28, 2018

Thanks for the response @Weijian-Espressif .

To clarify:
Say my 'gatt_server' is an ESP32, and the 'client' is an android phone.
Say my 'gatt_server' device has an attribute table:

SERVER 1
  +- service 1
  |  +- characteristic 1
  |  +- characteristic 2
  +- service 2
     +- characteristic 3

Now some conditions arise that cause the STRUCTURE of the attribute table to change, such as exposing a new service (or removing an existing one, etc.). If adding, say the attributes now look like:

SERVER 1
  +- service 1
  |  +- characteristic 1
  |  +- characteristic 2
  +- service 2
  |  +- characteristic 3
  +- service 3
     +- characteristic 4

I understand the function of the 'service changed' notification is to inform the client that changes have occured, and it should flush its internal cache (GAP/GATT) for this device, and re-discover services.

What I don't understand is what does the gatt server code running on the ESP32 need to do after modifying the GATT structure to trigger the notify/indicate to the client?

Surely the notification is not automatic so that EVERY change to the GATT triggers notification?
If so, the client-side discovery would be triggered every time a change was made?
What I expect is the server would make whatever changes are necessary, then issue some kind of 'commit' or 'update' or 'notify' command to trigger the 'service changed' notification.

@Weijian-Espressif
Copy link
Collaborator

service_change_demo.zip
please refer to the service change demo

@Sladerix
Copy link

Sladerix commented Mar 3, 2023

service_change_demo.zip
please refer to the service change demo

Hi, is there the Arduino Framework version of this?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 3, 2023
@github-actions github-actions bot changed the title How to Indicate BLE 'Service Changed' (0x2A05) How to Indicate BLE 'Service Changed' (0x2A05) (IDFGH-9551) Mar 3, 2023
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels Mar 4, 2023
@Sladerix
Copy link

service_change_demo.zip
please refer to the service change demo

Hi, is there the Arduino Framework version of this?

Nothing?

@sdetweil
Copy link

sdetweil commented Apr 27, 2023

@Sladerix I don't find anything specific either 'range of...' is ambiguous at best

but I 'guess' that in the end one sends a notify on this characteristic, which triggers the host side action.
I'm going to add that to my arduino code and see what happens...

well, after starting to add the code, it seems u send a notify, then the client READS the 'range of'
so I'm guessing its the characteristic ID... hm.. but my service UUID changed... so does that mean the read is empty or....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

7 participants