com.accessltd.device
Class AccessHIDInterface

java.lang.Object
  extended by com.accessltd.device.AccessHIDInterface
All Implemented Interfaces:
java.lang.Runnable

public class AccessHIDInterface
extends java.lang.Object
implements java.lang.Runnable

This class provides access to the OCR (Optical Character Recognition) reader.

In order to use the OCR reader, you should first obtain an instance of the OCR class using #Interface(Activity), then register a AccessOCRDataListener using setOnOCRRxDataListener(AccessOCRDataListener) in order to receive card or passport swipe events and a AccessDeviceStatus using #setDeviceStatusListener(AccessDeviceStatusListener)

Once done, you should remove the listener using removeOCRListeners() and close the connection using #close().


Constructor Summary
AccessHIDInterface(android.app.Activity myActivity)
          Constructs a new instance of the AccessHIDInterface class.
 
Method Summary
protected  void finalize()
           
 boolean FindDevice()
          This method check if a known device is connected
 boolean getOCRReadingEnabled()
           
 void removeOCRListeners()
          Unregister the AccessDeviceStatusListener and AccessOCRDataListener.
 void ReStart()
          Restarts OCR device and reconnect it.
 void run()
           
 boolean send(byte[] DataToSend)
          Send data to the OCR
 void setOcrDeviceStatusListener(AccessDeviceStatusListener newListener)
          Register the AccessDeviceStatusListener.
 void setOCRReadingEnabled(boolean Enabled)
          Open the OCR connection.
 void setOnOCRRxDataListener(AccessOCRDataListener newListener)
          Register the AccessOCRDataListener.
 void Stop()
          Stop device connection.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessHIDInterface

public AccessHIDInterface(android.app.Activity myActivity)
Constructs a new instance of the AccessHIDInterface class.

Parameters:
myActivity - is an Activity value
Method Detail

Stop

public void Stop()
Stop device connection. This should be done when the OCR is no longer needed in order to free the system allocated resources.


ReStart

public void ReStart()
Restarts OCR device and reconnect it.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

setOnOCRRxDataListener

public void setOnOCRRxDataListener(AccessOCRDataListener newListener)
Register the AccessOCRDataListener. This listener allow to get data coming from OCR.

Parameters:
newListener - is an AccessOCRDataListener value

removeOCRListeners

public void removeOCRListeners()
Unregister the AccessDeviceStatusListener and AccessOCRDataListener. This listener allowed to get data coming from OCR.


setOcrDeviceStatusListener

public void setOcrDeviceStatusListener(AccessDeviceStatusListener newListener)
Register the AccessDeviceStatusListener. This listener allows to get the OCR state (connected or disconnected) an AccessDeviceStatusListener value


FindDevice

public boolean FindDevice()
This method check if a known device is connected

Returns:
a Boolean value

send

public boolean send(byte[] DataToSend)
Send data to the OCR

Parameters:
DataToSend - a ByteBuffer value
Returns:
a Boolean value

setOCRReadingEnabled

public void setOCRReadingEnabled(boolean Enabled)
Open the OCR connection. Enable OCR reading


getOCRReadingEnabled

public boolean getOCRReadingEnabled()

run

public void run()
Specified by:
run in interface java.lang.Runnable