Reputation: 1464
I'm trying to get my iOS program to communicate with a custom Bluetooth LE device. I can connect to it, read all the services, and read all the CBCharacteristic
objects for each service.
I am trying to get notified when one specific CBCharacteristic
is updated. The CBCharacteristic.properties
is set to 0x10 (Notify) but the CBCharacteristic.isNotifying
is false.
After calling the following line of code:
myDevice.peripheral.setNotifyValue(true, forCharacteristic: myChar)
I am expecting to receive notifications via the CBPeripheralDelegate
function:
func peripheral(peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error: NSError?) {}
but it never gets called.
In addition, using the LightBlue Explorer app from PunchThrough.com I CAN get notifications, so I know it is possible. What is the LightBlue app doing that I am not?
Has anyone seen something similar to this?
For reference, the device uses WLT2564M Bluetooth module. Also I can read the value using
myDevice.peripheral.readValueForCharacteristic(myChar)
without any issues.
Upvotes: 0
Views: 332
Reputation: 17710
A few things to check:
peripheral
property needs to persist for the duration of its usedelegate
is properly setperipheral:didUpdateNotificationStateForCharacteristic:error:
and log any errors thereUpvotes: 1