Skip to content

Instantly share code, notes, and snippets.

@AntonMeier
Last active October 17, 2019 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntonMeier/2ec70331e0d80c4d3fb6c24c7867b834 to your computer and use it in GitHub Desktop.
Save AntonMeier/2ec70331e0d80c4d3fb6c24c7867b834 to your computer and use it in GitHub Desktop.
- (IBAction)startScan:(id)sender;
{
[[FLICManager sharedManager] scanForButtonsWithStateChangeHandler:^(FLICButtonScannerStatusEvent event) {
// You can use these events to update your UI.
switch (event)
{
case FLICButtonScannerStatusEventDiscovered:
NSLog(@"A Flic was discovered.");
break;
case FLICButtonScannerStatusEventConnected:
NSLog(@"A Flic is being verified.");
break;
case FLICButtonScannerStatusEventVerified:
NSLog(@"The Flic was verified successfully.");
break;
case FLICButtonScannerStatusEventVerificationFailed:
NSLog(@"The Flic verification failed.");
break;
default:
break;
}
} completion:^(FLICButton *button, NSError *error) {
NSLog(@"Scanner completed with error: %@", error);
if (!error)
{
NSLog(@"Successfully verified: %@, %@, %@", button.name, button.bluetoothAddress, button.serialNumber);
// Listen to single click only.
button.triggerMode = FLICButtonTriggerModeClick;
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment