Smartphone-Companions / ESP32-ANCS-Notifications

Easy-to-use Arduino library for interfacing an ESP 32 with Bluetooth LE ANCS mobile device notifications.
GNU General Public License v3.0
151 stars 24 forks source link

possible to get CategoryID #2

Closed Petros144 closed 4 years ago

Petros144 commented 4 years ago

Hi Jhud!

The Lib works like a charm! the only thing I miss is the Category ID that shows what kind of Event has been added (Call / Social / Email etc.)

The Adafruit NRF52 have this feature in the Ancs sketch, I tried to find out how its done in the ancs_ble_client.cpp but my Programming skills are not so good.

I know that the CategoryID must be the 3rd Byte in the notification source, according to the Developer documents of apple.

https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html#//apple_ref/doc/uid/TP40013460-CH1-SW7

and in verbose mode I may found what I need:

ESP_LOGI(LOG_TAG, "notification added, type: %d", pData[2]);

"17:07:06.269 -> [I][ancs_ble_client.cpp:231] onNotificationSourceNotify(): notification added, type: 2"

"17:07:04.353 -> [I][ancs_ble_client.cpp:231] onNotificationSourceNotify(): notification added, type: 1"

This was a incomming and a missed call.

this looks also like the 3rd Byte that have the info in it?

how to implement this in the demo sketch?

jhud commented 4 years ago

This is now in master, plus accept/reject calls with hardware buttons.