I don't ever receive notifications from 6E400006-B5A3-F393-E0A9-E50E24DCCA9E. I must enable the sensor by writing 0x01 to Characteristic 6E400009-B5A3-F393-E0A9-E50E24DCCA9E. I'm using the Bluepy Python Library.
Verified Services and Characteristics using LightBlue iOS App. Log:
21:58:33.956 — Characteristic (6E400009-B5A3-F393-E0A9-E50E24DCCA9E) wrote new value: <01>
21:58:33.999 — Characteristic (6E400009-B5A3-F393-E0A9-E50E24DCCA9E) read: (null)
21:58:39.339 — Characteristic (6E400006-B5A3-F393-E0A9-E50E24DCCA9E) notified: <06020341 090000>
21:58:39.849 — Characteristic (6E400006-B5A3-F393-E0A9-E50E24DCCA9E) notified: <06020338 090000>
21:58:40.329 — Characteristic (6E400006-B5A3-F393-E0A9-E50E24DCCA9E) notified: <0602033f 090000>
21:58:40.840 — Characteristic (6E400006-B5A3-F393-E0A9-E50E24DCCA9E) notified: <06020338 090000>
21:58:41.349 — Characteristic (6E400006-B5A3-F393-E0A9-E50E24DCCA9E) notified: <0602033a 090000>
from bluepy.btle import UUID, Peripheral, DefaultDelegate
import time
import struct
class MyDelegate(DefaultDelegate):
def __init__(self):
DefaultDelegate.__init__(self)
def handleNotification(self, cHandle, data):
print(cHandle, data)
#Should recieve notification from 6e400006-b5a3-f393-e0a9-e50e24dcca9e
#Connect to device
print('Connecting...')
dev = Peripheral("df:4c:cf:e7:9b:1f")
#Setup Notifications
dev.setDelegate( MyDelegate() )
#Get sensor services
sensorServices = dev.getServiceByUUID( UUID("6E400000-B5A3-F393-E0A9-E50E24DCCA9E") )
print(sensorServices)
#Get Stream Characteristic
enableStreamCharacteristic = sensorServices.getCharacteristics( UUID('6E400009-B5A3-F393-E0A9-E50E24DCCA9E') )[0]
print(enableStreamCharacteristic)
#Write 0x01 to 6e400009-b5a3-f393-e0a9-e50e24dcca9e
enableStreamCharacteristic.write( struct.pack('<B', 0x01) )
print("Waiting...")
while True:
if dev.waitForNotifications(1.0):
# handleNotification() was called
continue
dev.disconnect()
print('Done')
Results:
Connecting...
Service <uuid=6e400000-b5a3-f393-e0a9-e50e24dcca9e handleStart=9 handleEnd=65535>
Characteristic <6e400009-b5a3-f393-e0a9-e50e24dcca9e>
Waiting...
The reason you aren't getting notifications is because you need to enable notifications for the specific characteristic first. Add this to your code:
Declare some values for use when necessary
Before you start listening for notifications, enable them for the characteristic(s) that are sending the notifications (in your case probably one between 6e400001-6e400008):
After you add this code you should start receiving notifications.