Detect metawear disconnect from iOS SDK
I need to know when metawear get disconnected in order to call the connect handler.
This way when the device move out of range and come back it can be connected automatically.
Thanks
This discussion has been closed.
Comments
[self.device addObserver:self forKeyPath:@state options:NSKeyValueObservingOptionNew context:nil];
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (self.device.state == CBPeripheralStateDisconnected) {
// Note there is an automatic retry feature internal to the MetaWear
// framework, so this gets called after an unsuccessful connect too. That's
// why you should only observe a connected device, we are in the process
// of cleaning this up.
}
}