public interface Device
Device
interface is the foundational interface for all device-related interfaces in the com.cloudpos package.
It serves as a base that must be inherited by all device interfaces, and ultimately implemented by all concrete device classes.
This interface is used to interact with devices in a terminal. Devices in the terminal are considered exclusive,
meaning that each device must be accessed individually by a unique Device
object at any given time.
If a device has different logical classifications, each classification must be opened by its own Device
object.
Restrictions:
Device
object, once opened for a specific logical classification, cannot open the same or a different classification.
Device
object has opened a specific logical classification, another Device
object cannot open the same classification.
Device
objects can open different logical classifications of the device.
Some special devices, such as security devices, may allow shared access.Modifier and Type | Method and Description |
---|---|
void |
cancelRequest()
Attempts to cancel a pending request initiated by the
Device object. |
void |
close()
Disconnects the device from the
Device object. |
long |
getFailCount()
Retrieves the count of failures for three types of card interactions: MSR swipe failures, and APDU
transmission failures for both IC and contactless cards.
|
long |
getUsageCount()
Retrieves the count of usage for three types of card interactions: Magnetic Stripe Reader (MSR) swipes,
and APDU transmissions for both IC and contactless cards.
|
void |
open()
Opens the device for use with a default logical ID.
|
void open() throws DeviceException
Device
object has already opened the device, attempting to open it again is not allowed.
Device
objects cannot open the same device simultaneously.
Device
object can reopen a device that has been previously closed.DeviceException
- for standard reasons as documented in DeviceException
.void close() throws DeviceException
Device
object. This method stops any ongoing activities initiated by the device object,
such as halting a continuous blinking of an LED. Once the device is closed, the Device
object is no longer
associated with that specific device, allowing it to be reconnected to either the same device or a different one later on.
Additionally, any asynchronous requests that are in progress will be cancelled when the device is closed.DeviceException
- with BAD_CONTROL_MODE if the device is not open at the time of the request. This exception
indicates that the control mode is inappropriate for the requested operation, such as trying
to close a device that is not currently open. For standard reasons as documented in DeviceException
.void cancelRequest() throws DeviceException
Device
object. The behavior of this method
is dependent on the specific operation in progress:
Device
object must respond to cancelRequest
and successfully abort the operation.
cancelRequest
may vary based on the
implementation. Some operations might not support cancellation through this method.
DeviceException
- with BAD_CONTROL_MODE if the device is not currently open, or NO_REQUEST_PENDING
if there is no pending request from this Device
object. BAD_CONTROL_MODE
indicates an inappropriate control mode for the operation, such as attempting to
cancel a request on a device that is not active. NO_REQUEST_PENDING suggests that
there is no active request to cancel. For standard reasons as documented in DeviceException
.long getUsageCount()
long getFailCount()