-[MBLEvent downloadLogAndStopLogging:handler:progressHandler:] kills connection for MBLANCS events.

I previously wrote the following test code:







- (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

  • I was able to get the MetaWear to receive ANCS notifications again by resetting the device. Still, it seems like I discovered some kind of bug.
  • Let me take a look at your ANCS issues. Since this was a newly implemented feature, there might still be some bugs/issues. Thanks for your feedback!
  • Thanks for reporting the issue, I will look into it.

    Also, since the device has to be connected to an iOS device to receive ANCS events.  It might be better to think about using notifications rather than logging anyways.
  • What do you mean by "thing about using notifications"? I'm only using logging to verify that I'm setting up my filters properly. Eventually, I'm just going to show a light or a vibrate the motor or something.
  • Sorry, "think about using notifications"
This discussion has been closed.