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

DeviceManager

Instance of the DeviceManager class

Sample Code

DeviceManager deviceManager = DeviceManager.getInstance();

setCallback

Sets the DeviceManagerCallback callback.

public void setCallback(DeviceManagerCallback callback)

Parameters

Name

Type

Description

callback

DeviceManagerCallback

Instance of the DeviceManagerCallback class

Sample Code

deviceManager.setCallback(this);

isConnected

Retrieves the connection status.

public boolean isConnected()

Return Value

Type

Description

boolean

true: Connected / false: Not connected

Sample Code

boolean isConnected = deviceManager.isConnected();

isPowerOn

Retrieves the power status.

public boolean isPowerOn()

Return Value

Type

Description

boolean

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

boolean

true: Open / false: Closed

Sample Code

boolean isOpen = deviceManager.isOpen();

initialize

Initializes the DeviceManager.

public void initialize(Context context)

Parameters

Name

Type

Description

context

Context

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

power

boolean

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

power

boolean

true: Power on

beep

boolean

true: Beep on / false: Beep off

vib

boolean

true: Vibration on / false: Vibration off

led

boolean

true: LED on / false: LED off

aimer

boolean

true: Aimer on / false: Aimer off

powerOnBeep

boolean

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

beep

boolean

true: Beep on / false: Beep off

vib

boolean

true: Vibration on / false: Vibration off

led

boolean

true: LED on / false: LED off (battery LED)

aimer

boolean

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

type

int

0xB1 or 0xB2: Request firmware information
0x01: Request RF module information
0xB0: Request all AsReader configuration information

Sample Code

deviceManager.getReaderInfo(0xB1);

isM30SDevice

Determines whether the AsReader model is ASR-M30S.

public boolean isM30SDevice()

Return Value

Type

Description

boolean

true: ASR-M30S / false: Not ASR-M30S

Sample Code

boolean isM30S = deviceManager.isM30SDevice();