SCPMobileReaderDelegate

Objective-C

@protocol SCPMobileReaderDelegate <SCPReaderDelegate>

Swift

protocol MobileReaderDelegate : ReaderDelegate

Implement this protocol to handle a connected Bluetooth reader’s events throughout the lifetime of its connection.

Implementing this delegate is required when connecting to any Bluetooth connected reader, such as the Stripe M2, BBPOS Chipper 2X BT, and the BBPOS WisePad 3.

The provided delegate must be retained by your application until the reader disconnects.

  • The SDK is reporting that an update is available for the reader. This update should be installed at the earliest convenience via -[SCPTerminal installUpdate:]

    Check the SCPReaderSoftwareUpdate.requiredAt field to see when this update will be a required update. Required updates are installed immediately upon connection.

    This delegate method is most likely to be called right after connectReader: but applications that stay connected to the reader for long periods of time should expect this method to be called any time the reader is not busy performing a transaction.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didReportAvailableUpdate:(nonnull SCPReaderSoftwareUpdate *)update;

    Swift

    func reader(_ reader: SCPReader, didReportAvailableUpdate update: SCPReaderSoftwareUpdate)

    Parameters

    reader

    The originating reader.

    update

    An SCPReaderSoftwareUpdate object representing the update to be installed.

  • The SDK is reporting that the reader has started installing a software update.

    There are two scenarios when a reader’s software update can be installed. Some updates must be installed immediately, and may be being installed automatically during connectReader:. Other updates can be delayed, and will be installed when your integration calls installAvailableUpdate.

    Required updates will only start installing during connectReader:. Once your app’s connectReader: completion is called, didStartInstallingUpdate: will only fire from requests to install via installUpdate:.

    Note that required updates are critical for the reader to have the correct configuration and prevent receiving SCPErrorUnsupportedReaderVersion. Updates that aren’t yet required are reported by reader:didReportUpdateAvailable:.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didStartInstallingUpdate:(nonnull SCPReaderSoftwareUpdate *)update
                      cancelable:(nullable SCPCancelable *)cancelable;

    Swift

    func reader(_ reader: SCPReader, didStartInstallingUpdate update: SCPReaderSoftwareUpdate, cancelable: SCPCancelable?)

    Parameters

    reader

    The originating reader.

    update

    The SCPReaderSoftwareUpdate with an durationEstimate that can be used to communicate how long the update is expected to take.

    cancelable

    This cancelable is provided to cancel the installation if needed. Canceling a required update will result in a failed connect with error SCPErrorUnsupportedReaderVersion. Incremental only updates will have a nil cancelable because these updates can not be canceled.

  • The reader reported progress on a software update.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didReportReaderSoftwareUpdateProgress:(float)progress;

    Swift

    func reader(_ reader: SCPReader, didReportReaderSoftwareUpdateProgress progress: Float)

    Parameters

    reader

    The originating reader.

    progress

    An estimate of the progress of the software update (in the range [0, 1]).

  • The reader is reporting that an installation has finished. If the install was successful, error will be nil.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didFinishInstallingUpdate:(nullable SCPReaderSoftwareUpdate *)update
                            error:(nullable NSError *)error;

    Swift

    func reader(_ reader: SCPReader, didFinishInstallingUpdate update: SCPReaderSoftwareUpdate?, error: (any Error)?)

    Parameters

    reader

    The originating reader.

    update

    The update that was being installed, if any. Calls to installAvailableUpdate when no update is available will still report didFinishInstallingUpdate, but with a nil update.

    error

    If the installed failed, this will describe the error preventing install.

  • This method is called when the reader begins waiting for input. Your app should prompt the customer to present a payment method using one of the given input options. If the reader emits a prompt, the didRequestReaderDisplayMessage method will be called.

    Use - [SCPTerminal stringFromReaderInputOptions] to get a user facing string for the input options.

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didRequestReaderInput:(SCPReaderInputOptions)inputOptions;

    Swift

    func reader(_ reader: SCPReader, didRequestReaderInput inputOptions: ReaderInputOptions = [])

    Parameters

    reader

    The originating reader.

    inputOptions

    The armed input options on the reader.

  • This method is called to request that a prompt be displayed in your app. For example, if the prompt is SwipeCard, your app should instruct the user to present the card again by swiping it.

    Use - [SCPTerminal stringFromReaderDisplayMessage] to get a user facing string for the prompt.

    See

    SCPReaderDisplayMessage

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didRequestReaderDisplayMessage:(SCPReaderDisplayMessage)displayMessage;

    Swift

    func reader(_ reader: SCPReader, didRequestReaderDisplayMessage displayMessage: ReaderDisplayMessage)

    Parameters

    reader

    The originating reader.

    displayMessage

    The message to display to the user.

  • The SDK reported an event from the reader (e.g. a card was inserted).

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didReportReaderEvent:(SCPReaderEvent)event
                        info:(nullable NSDictionary *)info;

    Swift

    optional func reader(_ reader: SCPReader, didReportReaderEvent event: ReaderEvent, info: [AnyHashable : Any]?)

    Parameters

    reader

    The originating reader.

    event

    The reader event.

    info

    Additional info associated with the event, or nil.

  • The SDK reported the reader’s battery level or charging state has changed.

    See

    SCPBatteryStatus

    Declaration

    Objective-C

    - (void)reader:(nonnull SCPReader *)reader
        didReportBatteryLevel:(float)batteryLevel
                       status:(SCPBatteryStatus)status
                   isCharging:(BOOL)isCharging;

    Swift

    optional func reader(_ reader: SCPReader, didReportBatteryLevel batteryLevel: Float, status: BatteryStatus, isCharging: Bool)

    Parameters

    reader

    The originating reader.

    batteryLevel

    The new battery level of the reader, a float from 0.0 to 1.0

    status

    The classification of the battery level. - see: SCPBatteryStatus

    isCharging

    YES if the reader is plugged in and charging.

  • This method is called when the SDK’s currently connected reader has a low battery.

    Declaration

    Objective-C

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

    Swift

    optional func readerDidReportLowBatteryWarning(_ reader: SCPReader)

    Parameters

    reader

    The originating reader.