public interface SignatureDevice extends Device
SignatureDevice
interface defines the API for capturing signatures through applications.
A signature device object is obtained from the POSTerminal
as follows:
SignatureDevice signatureDevice = (SignatureDevice) POSTerminal.getInstance().getDevice("com.cloudpos.device.signature");
The string "com.cloudpos.device.signature" is used to identify the signature device, as defined by the specific implementation.
Applications can use this interface to control signature capture operations and must request the necessary permissions:
<uses-permission android:name="android.permission.CLOUDPOS_SIGNATURE"/>
Device
Modifier and Type | Method and Description |
---|---|
void |
listenSignature(java.lang.String transactionCode,
OperationListener listener,
int timeout)
Initiates an asynchronous operation to capture a signature.
|
void |
open(int logicID)
Opens the signature device.
|
SignatureOperationResult |
waitSignature(java.lang.String transactionCode,
int timeout)
Synchronous counterpart of
listenSignature(String, OperationListener, int) . |
cancelRequest, close, getFailCount, getUsageCount, open
void open(int logicID) throws DeviceException
logicID
- Logical ID of the device to open.DeviceException
- for standard errors as documented in DeviceException
.void listenSignature(java.lang.String transactionCode, OperationListener listener, int timeout) throws DeviceException
OperationListener.handleResult(OperationResult)
will be called upon completion or timeout of the signature capture.
This method supports a timeout mechanism. The device must be able to respond to Device.cancelRequest()
to abort the operation if needed.
In case of a timeout, the operation result will contain the error code OperationResult.ERR_TIMEOUT
, with no signature data available.
transactionCode
- A transaction code associated with the signature capture.listener
- The OperationListener
to handle the result.timeout
- The maximum time allowed for capturing the signature, in milliseconds.DeviceException
- for standard errors as documented in DeviceException
.OperationListener.handleResult(com.cloudpos.OperationResult)
SignatureOperationResult waitSignature(java.lang.String transactionCode, int timeout) throws DeviceException
listenSignature(String, OperationListener, int)
. Waits for a signature to be captured or a timeout to occur.transactionCode
- A transaction code associated with the signature capture.timeout
- The maximum time allowed for capturing the signature, in milliseconds.DeviceException
- for standard errors as documented in DeviceException
.