Reputation: 293
I am using an Adafruit Feather BLE module to tinker with.
Along with it comes the AT Command set which I am using to create a custom Service and a Characteristic with it. I am using it the notify option. The iOS side code says the Characteristic is not notifying. I did some googling and some people said a descriptor is needed for a Characteristic to be notifying. So I added one, but still no success.
Here is the Adafruit side of the code --
AT+GATTADDSERVICE=UUID128= 3d-e8-3e-34-dc-98-43-d0-87-de-3d-97-73-8b-ba-b6
AT+GATTADDCHAR=UUID=0xABCD, PROPERTIES=0x10, MIN_LEN=2, VALUE='01', DATATYPE=1, DESCRIPTION=TEST, PRESENTATION=17-00-AC-27-01-00-00
I see in the Serial Monitor that its successful. After this I am writing to the BLE module every few milliseconds.
On the iOS side, here is the log I get --
Characteristics: [<CBCharacteristic: 0x2817a4180, UUID = ABCD, properties = 0x10, value = (null), notifying = NO>]
I am using standard code that comes with the examples. Is the property value I am using not the correct one? The Adafruit documentation says 0x10 is to make it notifying.
Upvotes: 1
Views: 805
Reputation: 114846
notifying = no in the debug description indicates that you have not enabled notifications for this characteristic (i.e. its isNotifying
property is false
). It doesn't mean that the characteristic doesn't support notifications.
You need to call setNotifyValue(true, for: characteristic)
to enable notifications.
You will then get a call to the didUpdateNotificationState
delegate callback to tell you whether notifications were successfully enabled or not.
Upvotes: 3