Forum Archive

Bluetooth not detecting when device goes off

robertiii

I can get the ui to change for a device getting connected, but not when I turn the device off. How can I detect that the device has been turned off and is no longer connected to the iPad

JonB

If you have connected to the peripheral, you implement

def did_disconnect_peripheral(self, p, error):
        print('Disconnected, error: %s' % (error,))
        % whatever other code goes here

in theory should work.

If you have only discivered, but not connected to the peripheral, then you wont get notified, only an error whn you try to connect