DeviceManager¶
The DeviceManager class manages the connection, power, and settings of the AsReader device.
getInstance¶
Retrieves the instance of DeviceManager.
public static DeviceManager getInstance()
Return Value¶
Type |
Description |
|
Instance of the |
Sample Code¶
DeviceManager deviceManager = DeviceManager.getInstance();
setCallback¶
Sets the DeviceManagerCallback callback.
public void setCallback(DeviceManagerCallback callback)
Parameters¶
Name |
Type |
Description |
|
|
Instance of the DeviceManagerCallback class |
Sample Code¶
deviceManager.setCallback(this);
isConnected¶
Retrieves the connection status.
public boolean isConnected()
Return Value¶
Type |
Description |
|
true: Connected / false: Not connected |
Sample Code¶
boolean isConnected = deviceManager.isConnected();
isPowerOn¶
Retrieves the power status.
public boolean isPowerOn()
Return Value¶
Type |
Description |
|
true: Power on / false: Power off |
Sample Code¶
boolean isPowerOn = deviceManager.isPowerOn();
isOpen¶
Retrieves the status of the USB port.
public boolean isOpen()
Return Value¶
Type |
Description |
|
true: Open / false: Closed |
Sample Code¶
boolean isOpen = deviceManager.isOpen();
initialize¶
Initializes the DeviceManager.
public void initialize(Context context)
Parameters¶
Name |
Type |
Description |
|
|
Application or Activity context |
Sample Code¶
DeviceManager.getInstance().initialize(context);
setPower¶
Turns the power on or off.
public void setPower(boolean power)
Parameters¶
Name |
Type |
Description |
|
|
true: Power on / false: Power off |
Sample Code¶
deviceManager.setPower(true);
setPowerWithOption¶
Configures the AsReader power and its features.
After executing this method, battery information is received via the onCompletedPreparation callback.
public void setPowerWithOption(
boolean power,
boolean beep,
boolean vib,
boolean led,
boolean aimer,
boolean powerOnBeep
)
Parameters¶
Name |
Type |
Description |
|
|
true: Power on |
|
|
true: Beep on / false: Beep off |
|
|
true: Vibration on / false: Vibration off |
|
|
true: LED on / false: LED off |
|
|
true: Aimer on / false: Aimer off |
|
|
true: Power-on beep on / false: Power-on beep off |
Sample Code¶
deviceManager.setPowerWithOption(true, true, true, true, true, true);
setReaderSettings¶
Configures the reader features.
Note
On ASR-M30S, only beep can be configured.
public void setReaderSettings(boolean beep, boolean vib, boolean led, boolean aimer)
Parameters¶
Name |
Type |
Description |
|
|
true: Beep on / false: Beep off |
|
|
true: Vibration on / false: Vibration off |
|
|
true: LED on / false: LED off (battery LED) |
|
|
true: Aimer on / false: Aimer off |
Sample Code¶
deviceManager.setReaderSettings(true, true, true, true);
getBattery¶
Retrieves the battery information of the AsReader.
After executing this method, information is received via the onBatteryStateReceived callback.
public void getBattery()
Sample Code¶
deviceManager.getBattery();
getReaderInfo¶
Retrieves information about the AsReader.
After executing this method, information is received via the following callbacks:
public void getReaderInfo(int type)
Parameters¶
Name |
Type |
Description |
|
|
0xB1 or 0xB2: Request firmware information |
Sample Code¶
deviceManager.getReaderInfo(0xB1);
isM30SDevice¶
Determines whether the AsReader model is ASR-M30S.
public boolean isM30SDevice()
Return Value¶
Type |
Description |
|
true: ASR-M30S / false: Not ASR-M30S |
Sample Code¶
boolean isM30S = deviceManager.isM30SDevice();