public interface RFCardReaderDevice extends Device, TimeConstants
RFCardReaderDevice
interface defines APIs for RFCard reader operations.
This interface is used for handling various RF card communication modes and operations in POS systems.
To obtain an instance of this interface:
RFCardReaderDevice rfCardReaderDevice = (RFCardReaderDevice) POSTerminal.getInstance().getDevice("com.cloudpos.device.rfcardreader");
Access to the device requires the following permission in your app manifest:
<uses-permission android:name="android.permission.CLOUDPOS_CONTACTLESS_CARD"/>
Device
Modifier and Type | Field and Description |
---|---|
static int |
MODE_AUTO
Automatically detects the communication mode based on the environment.
|
static int |
MODE_FELICA
Proximity communication mode supporting FeliCa® technology.
|
static int |
MODE_ISO14443_TYPE_A
Proximity communication mode (PCD) compliant with ISO/IEC 14443 Type A.
|
static int |
MODE_ISO14443_TYPE_B
Proximity communication mode (PCD) compliant with ISO/IEC 14443 Type B.
|
static int |
MODE_ISO15693
Vicinity communication mode (VCD) compliant with ISO/IEC 15693.
|
static int |
MODE_MIFARE
Proximity communication mode supporting MIFARE® technology.
|
static int |
MODE_NFC_ACTIVE
NFC active communication mode compliant with ISO/IEC 18092 (NFCIP-1).
|
static int |
MODE_NFC_PASSIVE
NFC passive communication mode compliant with ISO/IEC 18092 (NFCIP-1).
|
static int |
PARAM_NB_SLOT
Parameter indicating the number of slots to use for anti-collision.
|
static int |
PARAM_SPEED
Parameter indicating the speed rate to be used during the initialization phase.
|
static int |
RATE_106K
106 kbps speed rate for use with PARAM_SPEED.
|
static int |
RATE_1667K
1667 kbps speed rate, for active mode only, used with PARAM_SPEED.
|
static int |
RATE_212K
212 kbps speed rate for use with PARAM_SPEED.
|
static int |
RATE_3390K
3390 kbps speed rate, for active mode only, used with PARAM_SPEED.
|
static int |
RATE_424K
424 kbps speed rate for use with PARAM_SPEED.
|
static int |
RATE_6670K
6670 kbps speed rate, for active mode only, used with PARAM_SPEED.
|
static int |
RATE_848K
848 kbps speed rate, for active mode only, used with PARAM_SPEED.
|
FOREVER, IMMEDIATE, MilliSECOND, SECOND
Modifier and Type | Method and Description |
---|---|
boolean |
disableLowPowerCardDetect()
Disables low power card detection mode.
|
boolean |
enableLowPowerCardDetect()
Enables low power card detection mode.
|
int[] |
getCardTypeValue()
Retrieves the card type value as determined by the kernel.
|
int |
getMode()
Retrieves the current communication mode of the device.
|
int |
getSpeed()
Gets the current baud rate.
|
void |
listenForCardAbsent(OperationListener listener,
int timeout)
Asynchronously listens for the removal of a card from the terminal.
|
void |
listenForCardPresent(OperationListener listener,
int timeout)
Initiates the RF card reader to detect contactless cards using the selected communication mode.
|
void |
open(int logicalID,
int mode)
Opens the device with a specified communication mode.
|
int |
sendControlCommand(int cmdID,
byte[] byteArrayCmdData)
Sends a specific control command to the device.
|
void |
setSpeed(int value)
Sets the baud rate used during the initialization phase.
|
RFCardReaderOperationResult |
waitForCardAbsent(int timeout)
Synchronously waits for a card to be removed from the terminal within a specified timeout.
|
RFCardReaderOperationResult |
waitForCardPresent(int timeout)
Waits synchronously for a contactless card to be present within a specified timeout period.
|
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
static final int RATE_212K
static final int RATE_424K
static final int RATE_848K
static final int RATE_1667K
static final int RATE_3390K
static final int RATE_6670K
void open(int logicalID, int mode) throws DeviceException
logicalID
- Logical ID of the device to open.mode
- Communication mode to use.DeviceException
- for standard device errors as outlined in DeviceException
.int getMode() throws DeviceException
DeviceException
- for standard device errors as outlined in DeviceException
.void setSpeed(int value) throws DeviceException
value
- Baud rate value.DeviceException
- for standard device errors as outlined in DeviceException
.int getSpeed() throws DeviceException
DeviceException
- for standard device errors as outlined in DeviceException
.int[] getCardTypeValue() throws DeviceException
DeviceException
- for standard device errors as outlined in DeviceException
.void listenForCardPresent(OperationListener listener, int timeout) throws DeviceException
This method is asynchronous. The handleResult()
method will be invoked once at least one card is detected in the reader's field.
ERR_MULTI_CARD
error.setSpeed()
, if set. Otherwise, it defaults to standard behavior for the chosen communication mode.getCard()
.cancelRequest()
to abort the operation if needed.ERR_TIMEOUT
, and no card information will be available.listener
- Listener to handle operation results.timeout
- Maximum time allowed for scanning, in milliseconds.DeviceException
- for standard device errors as documented in DeviceException
.RFCardReaderOperationResult waitForCardPresent(int timeout) throws DeviceException
This method is the synchronous version of listenForCardPresent(OperationListener,int)
,
designed to detect the presence of a card within the given timeframe.
timeout
- Maximum time allowed for scanning in milliseconds. The method will wait for a card to be detected within this time.RFCardReaderOperationResult
containing the details of the detected card. Returns null if no card is detected within the timeout period.DeviceException
- for standard device errors as outlined in DeviceException
.void listenForCardAbsent(OperationListener listener, int timeout) throws DeviceException
This method triggers a callback when a card is removed or if no card is present initially. It is designed to continuously monitor the card presence.
Key Points:
OperationListener
.SUCCESS
.cancelRequest()
for operation abortion on timeouts.ERR_TIMEOUT
, with no card data available.listener
- The listener that handles operation results.timeout
- The maximum waiting time, in milliseconds.DeviceException
- Standard errors as documented in DeviceException
.RFCardReaderOperationResult waitForCardAbsent(int timeout) throws DeviceException
This method is the synchronous equivalent of listenForCardAbsent(OperationListener,int)
, offering a direct return of the operation result.
Key Points:
RFCardReaderOperationResult
indicating the operation outcome.timeout
- The maximum waiting time for card removal, in milliseconds.RFCardReaderOperationResult
containing the operation result.DeviceException
- Standard errors as documented in DeviceException
.int sendControlCommand(int cmdID, byte[] byteArrayCmdData) throws DeviceException
This method allows the sending of control commands, identified by a command ID, along with associated data.
Key Details:
Note: Bits are omitted at the end of the byte. For example, a data byte of B2h (sent LSB first) with TxLastBits = 011b (3h) will send 010b (LSB first), with TxLastBits = 110b (6h) will send 010011b (LSB first).
cmdID
- The ID of the command to be sent.byteArrayCmdData
- The data associated with the command.DeviceException
- Standard errors as documented in DeviceException
.boolean enableLowPowerCardDetect() throws DeviceException
true
if the operation is successful, false
otherwise.DeviceException
- for standard errors as documented in DeviceException
.boolean disableLowPowerCardDetect() throws DeviceException
true
if the operation is successful, false
otherwise.DeviceException
- for standard errors as documented in DeviceException
.