troystribling / BlueCap

iOS Bluetooth LE framework
MIT License
715 stars 115 forks source link

Receiving didModifyServices message for Peripheral #94

Open michael-martinez opened 3 years ago

michael-martinez commented 3 years ago

When the distant device application gets killed, I would like to disconnect properly from my side, I am receiving only one log from the library internals: ./Pods/BlueCapKit/BlueCapKit/Central/Peripheral.swift:peripheral(_:didModifyServices:):332

As it is not forwarded anywhere, and the Peripheral registers as the CBDelegate, I cannot handle the notification from my side. Do I have to modify the source code to forward that message or am I missing something?

Thanks for your support,

michael-martinez commented 3 years ago

The solution I found is to manually poll on the peripheral services property after being connected:

Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in print("Is notifying ? (self.connectedPeripheral!.services.first!.characteristics[0].isNotifying)") }