ESP32 BLE Notify only working on Initial service

mgsscorr1
Posts: 6
Joined: Wed Aug 22, 2018 7:27 pm

ESP32 BLE Notify only working on Initial service

Postby mgsscorr1 » Wed Aug 22, 2018 7:42 pm

Hello,

Im having issues with being able to use the notify property for all services. I have currently set up my code to produce 2 services. Both services are used to transmit sensor data. For some reason even when i send the data on the separate Service, all notify data is only being seen on the first service. I feel like its an issue with the conn_id of each profile but i cant seem to narrow down the issue.

Attached is my code, hopefully someone can catch this bug that i cant seem to find why it keeps attaching to the first service. I deactivated the Notify on the first service but still cant see the notify on the second service
Attachments
EarMuffBLE.c
(63.97 KiB) Downloaded 537 times

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 BLE Notify only working on Initial service

Postby chegewara » Fri Aug 24, 2018 10:33 am

Hi, first of all notifications are sent for characteristics not services. Service is set of characteristic and each characteristic can have value, service cant have any value.

Now your issue. You have hardcoded attribute handle value and in both cases its the same value:

Code: Select all

uint16_t attr_handle = 0x002a;
When you are creating service, characteristic or descriptor you should store attribute handle returned in proper event like:

Code: Select all

ESP_GATTS_CREATE_EVT

Who is online

Users browsing this forum: Google [Bot] and 233 guests