SCLFlicButtonDelegate
@protocol SCLFlicButtonDelegate <NSObject>
The delegate of a SCLFlicButton object must adopt the SCLFlicButtonDelegate
protocol. There are not
any required delegate methods, but all are recommended for proper use of the Flic/PbF.
-
The Flic/PbF registered a button down event.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didReceiveButtonDown:(BOOL)queued age:(NSInteger)age;
Swift
optional func flicButton(_ button: SCLFlicButton, didReceiveButtonDown queued: Bool, age: Int)
Parameters
button
The SCLFlicButton object that the event came from.
queued
This lets you know if the event is a queued event that happened before the Flic/PbF connected or if it is a real time event.
age
The age of the trigger event in seconds. This is particularily important when receiving events that might have been queued up on Flic/PbF while it was out of range. The units is in seconds and will be rounded to the nearest second.
-
The Flic/PbF registered a button up event.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didReceiveButtonUp:(BOOL)queued age:(NSInteger)age;
Swift
optional func flicButton(_ button: SCLFlicButton, didReceiveButtonUp queued: Bool, age: Int)
Parameters
button
The SCLFlicButton object that the event came from.
queued
This lets you know if the event is a queued event that happened before the Flic/PbF connected or if it is a real time event.
age
The age of the trigger event in seconds. This is particularily important when receiving events that might have been queued up on Flic/PbF while it was out of range. The units is in seconds and will be rounded to the nearest second.
-
The Flic/PbF registered a button click event. The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didReceiveButtonClick:(BOOL)queued age:(NSInteger)age;
Swift
optional func flicButton(_ button: SCLFlicButton, didReceiveButtonClick queued: Bool, age: Int)
Parameters
button
The SCLFlicButton object that the event came from.
queued
This lets you know if the event is a queued event that happened before the Flic/PbF connected or if it is a real time event.
age
The age of the trigger event in seconds. This is particularily important when receiving events that might have been queued up on Flic/PbF while it was out of range. The units is in seconds and will be rounded to the nearest second.
-
The Flic/PbF registered a button double click event. The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didReceiveButtonDoubleClick:(BOOL)queued age:(NSInteger)age;
Swift
optional func flicButton(_ button: SCLFlicButton, didReceiveButtonDoubleClick queued: Bool, age: Int)
Parameters
button
The SCLFlicButton object that the event came from.
queued
This lets you know if the event is a queued event that happened before the Flic/PbF connected or if it is a real time event.
age
The age of the trigger event in seconds. This is particularily important when receiving events that might have been queued up on Flic/PbF while it was out of range. The units is in seconds and will be rounded to the nearest second.
-
The Flic/PbF registered a button hold event. The behavior of this event depends on what SCLFlicButtonTriggerBehavior the triggerBehavior property is set to.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didReceiveButtonHold:(BOOL)queued age:(NSInteger)age;
Swift
optional func flicButton(_ button: SCLFlicButton, didReceiveButtonHold queued: Bool, age: Int)
Parameters
button
The SCLFlicButton object that the event came from.
queued
This lets you know if the event is a queued event that happened before the Flic/PbF connected or if it is a real time event.
age
The age of the trigger event in seconds. This is particularily important when receiving events that might have been queued up on Flic/PbF while it was out of range. The units is in seconds and will be rounded to the nearest second.
-
This delegate method is called every time the Flic/PbF physically connected to the iOS device, regardless of the reason for it. Keep in mind that you also have to wait for the
flicButtonIsReady:
before the Flic/PbF is ready for use. TheconnectionState
is not guaranteed to switch toSCLFlicButtonConnectionStateConnected
until after theflicButtonIsReady:
callback has arrived.Declaration
Objective-C
- (void)flicButtonDidConnect:(SCLFlicButton *_Nonnull)button;
Swift
optional func flicButtonDidConnect(_ button: SCLFlicButton)
Parameters
button
The SCLFlicButton object that the event came from.
-
This delegate method is called every time the Flic/PbF has sucessfully connected and the autheticity has been verified. You will not receive any press events from the Flic/PbF before this callback has been sent. Typically this event will be sent immediately after the
flicButtonDidConnect:
event. The verification process will take longer time the very first time that the PbF (only PbF) is connected to the particular iOS device since a round-trip to the backend server has to be completed. This also means that an active internet connection is needed during the first connect of the PbF.Declaration
Objective-C
- (void)flicButtonIsReady:(SCLFlicButton *_Nonnull)button;
Swift
optional func flicButtonIsReady(_ button: SCLFlicButton)
Parameters
button
The SCLFlicButton object that the event came from.
-
This delegate method is called every time the Flic/PbF has disconnected, regardless of the reason for it. This can sometimes be called during a connection event that failed before the user was notified of the connection.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didDisconnectWithError:(NSError *_Nullable)error;
Swift
optional func flicButton(_ button: SCLFlicButton, didDisconnectWithError error: Error?)
Parameters
button
The SCLFlicButton object that the event came from.
error
The error that caused the disconnect. If the disconnect was intentional, then the parameter will be nil.
-
The requested connection failed. Please note that depending on at what point in the connection process the connection failed you might also receive a regular flicButtonDidDisconnect: as well. If the connection fails and this callback is made then the Flic/PbF will always cancel the pending connection, regardless of what mode the Flic/PbF happens to be in. This means that if you get a
flicButton:didFailToConnectWithError:
event and the Flic/PbF is in Background mode then you need to call theconnect:
yourself to activate the pending connection once again.Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didFailToConnectWithError:(NSError *_Nullable)error;
Swift
optional func flicButton(_ button: SCLFlicButton, didFailToConnectWithError error: Error?)
Parameters
button
The SCLFlicButton object that the event came from.
error
The error that caused the Flic/PbF to fail to connect.
-
This lets you know that the battery status of the flic has been updated.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didChangeBatteryStatus:(SCLFlicButtonBatteryStatus)status;
Swift
optional func flicButton(_ button: SCLFlicButton, didChange status: SCLFlicButtonBatteryStatus)
Parameters
button
The SCLFlicButton object that the event came from.
status
The battery status.
-
This callback verifies (unless an error occurred) that the RSSI value was updated.
Declaration
Objective-C
- (void)flicButton:(SCLFlicButton *_Nonnull)button didUpdateRSSI:(NSNumber *_Nonnull)RSSI error:(NSError *_Nullable)error;
Swift
optional func flicButton(_ button: SCLFlicButton, didUpdateRSSI RSSI: NSNumber, error: Error?)
Parameters
button
The SCLFlicButton object that the event came from.
RSSI
The RSSI value represented in decibels.
error
In case there was a problem with updating the RSSI value then this parameter will describe the error. This will in all other cases be nil.