SCLFlicManagerDelegate

@protocol SCLFlicManagerDelegate <NSObject>

The delegate of a SCLFlicManager instance must adopt the SCLFlicManagerDelegate protocol. There are no required delegate methods, but flicManagerDidChangeBluetoothState is highly recommended.

  • This delegate method is called every time the a new PbF is discovered, the SCLFlicButton object can at this point be used to properly connect the PbF. If you do not wish to keep it at this time, then remember to call forgetButton: on it so that it can be discovered again at a later time. Otherwise it will remain as a known button and can not be discovered again. It will however not be verified as a genuine PbF until after it has been properly connected. Remember that you will only be able to scan for PbFs that are owned by your company.

    Declaration

    Objective-C

    - (void)flicManager:(SCLFlicManager *_Nonnull)manager
        didDiscoverButton:(SCLFlicButton *_Nonnull)button
                 withRSSI:(NSNumber *_Nullable)RSSI;

    Swift

    func flicManager(_ manager: SCLFlicManager, didDiscover button: SCLFlicButton, withRSSI RSSI: NSNumber?)

    Parameters

    manager

    The manager providing this information.

    button

    The SCLFlicButton object that was generated for the newly found PbF.

    RSSI

    The RSSI value of the newly found button at the time of discovery.

  • This delegate method is called every time the a new Flic button is grabbed from the Flic App.

    Declaration

    Objective-C

    - (void)flicManager:(SCLFlicManager *_Nonnull)manager
        didGrabFlicButton:(SCLFlicButton *_Nullable)button
                withError:(NSError *_Nullable)error;

    Swift

    optional func flicManager(_ manager: SCLFlicManager, didGrab button: SCLFlicButton?, withError error: Error?)

    Parameters

    manager

    The manager providing this information.

    button

    The SCLFlicButton object that was grabbed from the Flic app

    error

    In case something went wrong while grabbing the Flic this parameter will explain the error.

  • If the bluetooth state on the iOS device or the flicManager changes for any reason, then this delegate method will be called letting you that something happened. A parameter state will be included, but it is a good practice to always read the most current value of the bluetoothState property on the manager to get info about the current state, since there is a chance that the state could have changed again while the callback was sent. If the state changes to SCLFlicManagerBluetoothStatePoweredOn then all the previous connections and pending connections will be set back to pending again.

    Declaration

    Objective-C

    - (void)flicManager:(SCLFlicManager *_Nonnull)manager
        didChangeBluetoothState:(SCLFlicManagerBluetoothState)state;

    Swift

    optional func flicManager(_ manager: SCLFlicManager, didChange state: SCLFlicManagerBluetoothState)

    Parameters

    manager

    The manager providing this information.

    state

    The state that the manager changed to that caused the callback. Notice that there is no guarantee that it has not changed since*

  • This delegate method will be called after the manager has been properly restored after being terminated by the system. All the flic buttons that that you had prior to being terminated have been restored as well and this is a good time to collect all the SCLFlicButton objects by using the knownButtons: method in order to properly restore the rest of your application. Do not forget to re-set the delegate on all buttons.

    Declaration

    Objective-C

    - (void)flicManagerDidRestoreState:(SCLFlicManager *_Nonnull)manager;

    Swift

    optional func flicManagerDidRestoreState(_ manager: SCLFlicManager)

    Parameters

    manager

    The manager providing this information.

  • This callback will be made when a button has been properly forgotten/removed, unless there was an error. Remember to also remove your references in case you still have any.

    Declaration

    Objective-C

    - (void)flicManager:(SCLFlicManager *_Nonnull)manager
        didForgetButton:(NSUUID *_Nonnull)buttonIdentifier
                  error:(NSError *_Nullable)error;

    Swift

    optional func flicManager(_ manager: SCLFlicManager, didForgetButton buttonIdentifier: UUID, error: Error?)

    Parameters

    manager

    The providing this information.

    buttonIdentifier

    The buttonIdentifier of the SCLFlicButton object that was cleared

    error

    In case there was an error