ReaderInfo

class ReaderInfo(val id: String, val model: ReaderInfo.Model, val state: ReaderInfo.State, val serialNumber: String?, val name: String, val batteryStatus: ReaderInfo.BatteryStatus?, val firmwareVersion: String?, val firmwarePercent: Int?, val supportedCardEntryMethods: Set<CardEntryMethod>, val isForgettable: Boolean = model == Model.CONTACTLESS_AND_CHIP, val isBlinkable: Boolean = model == Model.CONTACTLESS_AND_CHIP)

Provides information about an individual card reader at a given time. This is an immutable snapshot of the reader's past state, not a live model object. Updates are provided via callbacks registered via ReaderManager.setReaderChangedCallback.

Parameters

id

String that identifies this reader. For "smart" readers, this represents the mac address of the device. If the reader is a magstripe reader, the ID will be a string identifying it as a magstripe reader.

model

Type of the reader, one of the Model.

state

Current state of the reader, see State. A reader in State.Ready can be used to take a payment (even if it is also getting a non-blocking firmware update), but other states mark a reader that cannot be used. It is fine to start a payment with a non-Ready reader, however: the payment might be paid with manually-entered information, or the reader might become State.Ready later in the course of the payment.

serialNumber

Unique but not particularly informative string that identifies this reader. Provided by "smart" readers. This represents the serial number of the device. A null value indicates that the smart reader has not yet provided a serial or that the device isn't a smart reader.

name

Readable and hopefully-unique name for this reader. Unlike the return from serialNumber, which is guaranteed to be different from any other reader, the name is only unlikely to be duplicated by other readers.

batteryStatus

Current battery information. Returns null for readers without a battery, such as the magstripe reader. See BatteryStatus.

firmwareVersion

Unique identifier of the firmware currently installed on the reader. If the firmware version is not identifiable (e.g. magstripe readers), returns null.

firmwarePercent

set only if either a blocking or non-blocking firmware update is in progress. If set, it is an integer from 0 to 100 inclusive with an estimate of the update percentage completed. For a blocking firmware update, the state will be State.UpdatingFirmware, but for the more common non-blocking update, the state will typically be State.Ready or possibly State.Connecting.

supportedCardEntryMethods

Set of card entry methods this reader can support. At a given time, a reader might not be able to use all the "supported" payment methods. In particular, for a CardEntryMethod.CONTACTLESS the contactless NFC field will time out a while after a payment begins, and after that a contactless tap will not work, even though contactless payments are supported by the reader. Because these changes to the available payment methods happen in the context of a payment, they are reported through the com.squareup.sdk.mobilepayments.payment.PaymentManager instead. See CardEntryMethod for possible entry values.

isForgettable

Indicates whether reader can be "forgotten", either to permanently remove the reader, or to allow it to pair again "from scratch".

isBlinkable

Indicates whether reader has LEDs to blink. This can be used to identify a particular reader among several, with the ReaderManager.blink method.

Constructors

Link copied to clipboard
constructor(id: String, model: ReaderInfo.Model, state: ReaderInfo.State, serialNumber: String?, name: String, batteryStatus: ReaderInfo.BatteryStatus?, firmwareVersion: String?, firmwarePercent: Int?, supportedCardEntryMethods: Set<CardEntryMethod>, isForgettable: Boolean = model == Model.CONTACTLESS_AND_CHIP, isBlinkable: Boolean = model == Model.CONTACTLESS_AND_CHIP)

Types

Link copied to clipboard
class BatteryStatus(val percent: Int, val isCharging: Boolean)

Status of the reader's battery.

Link copied to clipboard
sealed class ConnectionError

Optional explanation for a State.Disconnected state. In many cases, such as when initially started, the application may not have any additional details, but this class will be available from the state when we do.

Link copied to clipboard
class DeniedReason(val uxHint: ReaderInfo.DeniedUxHint, val localizedTitle: String, val localizedDescription: String)
Link copied to clipboard

Enumerates the possible UX hints for a denied connection reason

Link copied to clipboard

The model of reader.

Link copied to clipboard
sealed class State

The reader's state. MAGSTRIPE readers are always Ready.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard