SCPReconnectionDelegate

Objective-C

@protocol SCPReconnectionDelegate <NSObject>

Swift

protocol ReconnectionDelegate : NSObjectProtocol

Implement this protocol to handle Bluetooth auto-reconnection.

  • The SDK was able to reconnect to the previously connected Bluetooth reader.

    In your implementation of this method, you should notify your user that reader connection has been re-established.

    Requires autoReconnectOnUnexpectedDisconnect is set to true in the SCPBluetoothConnectionConfig

    Declaration

    Objective-C

    - (void)readerDidSucceedReconnect:(nonnull SCPReader *)reader;

    Swift

    func readerDidSucceedReconnect(_ reader: SCPReader)

    Parameters

    reader

    The reader that has now been reconnected to.

  • The SDK was not able to reconnect to the previously connected bluetooth reader. The SDK is now disconnected from any readers.

    In your implementation of this method, you should notify your user that the reader has disconnected.

    Requires autoReconnectOnUnexpectedDisconnect is set to true in the SCPBluetoothConnectionConfig

    Declaration

    Objective-C

    - (void)readerDidFailReconnect:(nonnull SCPReader *)reader;

    Swift

    func readerDidFailReconnect(_ reader: SCPReader)

    Parameters

    reader

    The reader that failed to be reconnected to.

  • Deprecated

    Use reader:didStartReconnect:disconnectReason: instead.

    The reader has lost Bluetooth connection to the SDK and reconnection attempts have been started.

    In your implementation of this method, you should notify your user that the reader disconnected and that reconnection attempts are being made.

    Requires autoReconnectOnUnexpectedDisconnect is set to true in the SCPBluetoothConnectionConfig

    Note

    Update to reader:didStartReconnect:disconnectReason: to get the reason the reader disconnected. If that method is not implemented, this method will be not be called. This method will be removed in 4.0.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didStartReconnect:(nonnull SCPCancelable *)cancelable;

    Swift

    optional func reader(_ reader: SCPReader, didStartReconnect cancelable: SCPCancelable)

    Parameters

    reader

    The reader that is attempting to be reconnected to.

    cancelable

    A cancelable that can be used to stop reconnection

  • The reader has lost Bluetooth connection to the SDK and reconnection attempts have been started.

    In your implementation of this method, you should notify your user that the reader disconnected and that reconnection attempts are being made.

    Requires autoReconnectOnUnexpectedDisconnect is set to true in the SCPBluetoothConnectionConfig

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didStartReconnect:(nonnull SCPCancelable *)cancelable
         disconnectReason:(SCPDisconnectReason)disconnectReason;

    Swift

    optional func reader(_ reader: SCPReader, didStartReconnect cancelable: SCPCancelable, disconnectReason: DisconnectReason)

    Parameters

    reader

    The reader that is attempting to be reconnected to

    cancelable

    A cancelable that can be used to stop reconnection

    disconnectReason

    The reason the reader disconnected