How to handle a CBPeripheral that disconnect

I am receiving data in UART mode from a bluetooth emiter (arduino/BlueFruit).

i need to handle the case where the emiter is ungplug (powered off)


not sure where the message will come from. I could not find it in CBCentralManager or in CBPeripheral.

i can't be checking the state continuously.


there must be some sort of StateChanged message for the peripheral somewhere, or a disconnect alert :-)



i get in the console - and it make perfect sense.

[CoreBluetooth] API MISUSE: <CBPeripheral: XXXX, identifier = XXXX, name = Adafruit Bluefruit LE, state = disconnected> can only accept commands while in the connected state


Thank you.

Accepted Reply

Replies

Ohh. I knew i was bad but... :-) i really miss this one


i was looking at

https://developer.apple.com/documentation/corebluetooth/cbcentralmanager


i stiil have a lot to learn about how to read and Search documentation.


Thank you