public interface RFCardReaderDevice extends Device, TimeConstants
The RFCard reader device object is obtained from the POSTerminal
, its' as follows:
RFCardReaderDevice rFCardReaderDevice = (RFCardReaderDevice) POSTerminal.getInstance().getDevice("cloudpos.device.rfcardreader");Among them, the "cloudpos.device.rfcardreader" string is to identify the RFCard reader device, defined by the specific implementation.
Uses the RFCard reader device object to control the operation of the printer device.
An app can request permission to access the device, as shown below:
<uses-permission android:name="android.permission.CLOUDPOS_CONTACTLESS_CARD"/>
Device
Modifier and Type | Field and Description |
---|---|
static int |
MODE_AUTO
The mode is automatically detected according to the environment
|
static int |
MODE_FELICA
Proximity communication mode: FeliCa®
|
static int |
MODE_ISO14443_TYPE_A
Proximity communication mode (PCD): ISO/IEC 14443 Type A compliant
|
static int |
MODE_ISO14443_TYPE_B
Proximity communication mode (PCD): ISO/IEC 14443 Type B compliant
|
static int |
MODE_ISO15693
Vicinity communication mode (VCD): ISO/IEC 15693 compliant
|
static int |
MODE_MIFARE
Proximity communication mode: MIFARE®
|
static int |
MODE_NFC_ACTIVE
NFC active communication mode: ISO/IEC 18092 (ECMA 340: NFCIP-1)
|
static int |
MODE_NFC_PASSIVE
NFC passive communication mode: ISO/IEC 18092 (ECMA 340: NFCIP-1)
|
static int |
PARAM_NB_SLOT
Number of slot to use for anti collision.
|
static int |
PARAM_SPEED
Speed rate to use for the initialization phase.
|
static int |
RATE_106K
106 kbps speed rate used with
PARAM_SPEED |
static int |
RATE_1667K
1667 kbps speed rate (active mode only) used with
PARAM_SPEED |
static int |
RATE_212K
212 kbps speed rate used with
PARAM_SPEED |
static int |
RATE_3390K
3390 kbps speed rate (active mode only) used with
PARAM_SPEED |
static int |
RATE_424K
424 kbps speed rate used with
PARAM_SPEED |
static int |
RATE_6670K
6670 kbps speed rate (active mode only) used with
PARAM_SPEED |
static int |
RATE_848K
848 kbps speed rate (active mode only) used with
PARAM_SPEED |
FOREVER, IMMEDIATE, MilliSECOND, SECOND
Modifier and Type | Method and Description |
---|---|
int |
getMode()
Gets current communication mode.
|
int |
getSpeed()
Gets the baud rate.
|
void |
listenForCardAbsent(OperationListener listener,
int timeout)
Listens until a card is removed from this terminal.
|
void |
listenForCardPresent(OperationListener listener,
int timeout)
Starts reader according to Contactless protocols and performs
initialization according to the communication mode.
|
void |
open(int logicalID,
int mode)
Opens the device with a specific communication mode.
|
void |
setSpeed(int value)
Sets the baud rate used
during the initialization phase.
|
RFCardReaderOperationResult |
waitForCardAbsent(int timeout)
This is the synchronous method of the
listenForCardAbsent(OperationListener,int) . |
RFCardReaderOperationResult |
waitForCardPresent(int timeout)
This is the synchronous method of the
listenForCardPresent(OperationListener,int) . |
cancelRequest, close, getFailCount, getUsageCount, open
static final int MODE_AUTO
static final int MODE_NFC_PASSIVE
static final int MODE_NFC_ACTIVE
static final int MODE_ISO14443_TYPE_A
static final int MODE_ISO14443_TYPE_B
static final int MODE_ISO15693
static final int MODE_MIFARE
static final int MODE_FELICA
static final int PARAM_SPEED
static final int PARAM_NB_SLOT
static final int RATE_106K
PARAM_SPEED
static final int RATE_212K
PARAM_SPEED
static final int RATE_424K
PARAM_SPEED
static final int RATE_848K
PARAM_SPEED
static final int RATE_1667K
PARAM_SPEED
static final int RATE_3390K
PARAM_SPEED
static final int RATE_6670K
PARAM_SPEED
void open(int logicalID, int mode) throws DeviceException
Resets the state of the initiator if it has previously been opened.
logicalID
- logical ID of the device to open.mode
- Communication mode to use.DeviceException
- for the standard reasons that are documented in
DeviceException
.int getMode() throws DeviceException
DeviceException
- for the standard reasons that are documented in
DeviceException
.void setSpeed(int value) throws DeviceException
value
- baud rateDeviceException
- for the standard reasons that are documented in
DeviceException
.int getSpeed() throws DeviceException
DeviceException
- for the standard reasons that are documented in
DeviceException
.void listenForCardPresent(OperationListener listener, int timeout) throws DeviceException
This is an asynchronous method.
handleResult()
will be invoked when at least one card has been detected in the field.
Only support a single card, many cards will report error ERR_MULTI_CARD
This method will use parameters previously added with
setSpeed()
. If none has been
set, scanTargets will behave with a typical behavior adapted to the selected
communication mode.
Information about successfully detected card can be retrieved by the
getCard()
function.
Because this method uses a timeout parameter, the device receiving this request MUST be able to
successfully respond to cancelRequest()
and abort the operation.
In case of a timeout occurring, the operation result will contain code=
ERR_TIMEOUT
, and no information about
card will be available.
listener
- operation listener.timeout
- the maximum scanning time of the method, in milliseconds.DeviceException
- for the standard reasons that are documented in
DeviceException
RFCardReaderOperationResult waitForCardPresent(int timeout) throws DeviceException
listenForCardPresent(OperationListener,int)
.timeout
- the maximum scanning time of the method, in milliseconds.DeviceException
- for the standard reasons that are documented in
DeviceException
void listenForCardAbsent(OperationListener listener, int timeout) throws DeviceException
This is an asynchronous method.
Result information about successfully removed card can be retrieved by the
SUCCESS
function.
Because this method uses a timeout parameter, the device receiving this request MUST be able to
successfully respond to cancelRequest()
and abort the operation.
In case of a timeout occurring, the operation result will contain code=
ERR_TIMEOUT
, and no information about
card will be available.
listener
- operation listener.timeout
- the maximum wait time of the method, in milliseconds.DeviceException
- for the standard reasons that are documented in
DeviceException
RFCardReaderOperationResult waitForCardAbsent(int timeout) throws DeviceException
listenForCardAbsent(OperationListener,int)
.timeout
- the maximum wait time of the method, in milliseconds.DeviceException
- for the standard reasons that are documented in
DeviceException