beautypg.com

Get tracks data from reader, Get connection status of reader – MagTek Audio Reader for Android Devices User Manual

Page 30

background image

24

Get Tracks Data From Reader:

private class

SCRAHandlerCallback

implements

Callback {

public boolean

handleMessage(Message msg) {

switch

(msg.what)

{

case

MagTekSCRA.

DEVICE_MESSAGE_STATE_CHANGE

:

{

switch

(msg.arg1)

{

case

MagTekSCRA.

DEVICE_STATE_CONNECTED

:

{
}

break

;

case

MagTekSCRA.

DEVICE_STATE_CONNECTING

:

{
}

break

;

case

MagTekSCRA.

DEVICE_STATE_DISCONNECTED

:

{
}

break

;

}
}

break

;

case

MagTekSCRA.

DEVICE_MESSAGE_DATA_CHANGE

:

if

(msg.obj !=

null

)

{

mStringCardDataBuffer

= (String)msg.obj;

//Do something

mStringCardDataBuffer="";

return true

;

}

break

;

default

:

if

(msg.obj !=

null

)

{

mStringCardDataBuffer

= (String)msg.obj;

//Do something

mStringCardDataBuffer="";

}

break

;

};

return false

;

}

}

Get Connection Status Of Reader:

if

(

mMTSCRA

.isDeviceConnected()) {

//Do Something

}