SCPReaderDelegate

Objective-C

@protocol SCPReaderDelegate <NSObject>

Swift

protocol ReaderDelegate : NSObjectProtocol

This is a base reader delegate protocol that all reader delegates inherit from.

Don’t implement this directly but instead implement the specific delegates needed for the reader types you’ll use: SCPMobileReaderDelegate, SCPInternetReaderDelegate, or SCPTapToPayReaderDelegate

  • Optional method that is called when the reader has disconnected from the SDK and includes the reason for the disconnect.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didDisconnect:(SCPDisconnectReason)reason;

    Swift

    optional func reader(_ reader: SCPReader, didDisconnect reason: DisconnectReason)

    Parameters

    reader

    The originating reader.

    reason

    The reason for the disconnect. - see: SCPDisconnectReason

Auto reconnect methods

  • Mobile readers and Tap to Pay only.

    The reader has lost 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.

    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

  • Mobile readers and Tap to Pay only.

    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

    optional func readerDidSucceedReconnect(_ reader: SCPReader)

    Parameters

    reader

    The reader that has now been reconnected to.

  • Mobile readers and Tap to Pay only.

    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

    optional func readerDidFailReconnect(_ reader: SCPReader)

    Parameters

    reader

    The reader that failed to be reconnected to.