-[MBLEvent downloadLogAndStopLogging:handler:progressHandler:] kills connection for MBLANCS events.
- (IBAction)logAncsValueChanged:(id)sender
{
if (self.logAncsSwitch.on) {
self.anyCategoryEvent = [self.device.ancs eventWithCategoryIds:MBLANCSCategoryIDAny
identifier:@heath2];
[self.anyCategoryEvent startLogging];
} else {
// MBLEvent *anyCategoryEvent = [self.device.ancs eventWithCategoryIds:MBLANCSCategoryIDAny
// identifier:@heath];
if (self.anyCategoryEvent) {
__typeof__(self) __weak weakSelf = self;
[self.anyCategoryEvent downloadLogAndStopLogging:YES
handler:(^(NSArray *array, NSError *error) {
NSLog(@Received %@ entries with error: %@", @(array.count), error.description);
for (MBLLogEntry *logEntry in array) {
NSLog(@class: %@, timestamp: %@, entry: %@", NSStringFromClass([logEntry class]), logEntry.timestamp, logEntry);
}
weakSelf.anyCategoryEvent = nil;
})
progressHandler:(^(float number, NSError *error) {
})];
} else {
NSLog(@Wasn't previously logging);
}
}
}
When I received a text, the above code used to print a bunch of events, but after changing to use -[MBLANCS eventWithCategoryIds:eventIds:eventFlags:attributeId:attributeData:identifier:], my MetaWear connection drops after the call to [self.anyCategoryEvent downloadLogAndStopLogging:handler:progressHandler:]. This seems like a pretty big bug. ANCS seems broken on this device.
Comments