Last active
October 17, 2019 13:36
-
-
Save AntonMeier/2ec70331e0d80c4d3fb6c24c7867b834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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