com.abc.circontrol
Class CIRControl
java.lang.Object
com.abc.circontrol.CIRControl
public class CIRControl
extends java.lang.Object
CIRControl
Field Summary
static int ERR_CANCEL
The argument 1 of message as result of request, IR activity is canncelled
static int ERR_CANCEL_FAIL
The argument 1 of message as result of request, fail to cancel assigned request
static int ERR_CHECKSUM_ERROR
The argument 1 of message as result of request, checksum error in IR command
static int ERR_CMD_DROPPED
The argument 1 of message as result of request, the request is dropped (if it is droppable)
static int ERR_CMD_FAILED
The argument 1 of message as result of request, failed to carry out request
static int ERR_HW_BUSY
The argument 1 of message as result of request, hardware is busy
static int ERR_INVALID_VALUE
The argument 1 of message as result of request, command arguments or data is invalid
static int ERR_IO_ERROR
The argument 1 of message as result of request, an IO error occured
static int ERR_LEARNING_TIMEOUT
The argument 1 of message as result of request, the learning process expired
static int ERR_NONE
The argument 1 of message as result of request, no error occured
static int ERR_OBJ_ERROR
The argument 1 of message as result of request, object error in JNI native functions
static int ERR_OUT_OF_FREQ
The argument 1 of message as result of request, learning IR frequency is not supported
static int ERR_PIPE_ERROR
The argument 1 of message as result of request, fail to create/read/write pipe
static int ERR_PULSE_ERROR
The argument 1 of message as result of request, pulse data of IR frame is error
static int ERR_TTY_READ_ERROR
The argument 1 of message as result of request, fail to read IR hardware
static int ERR_TTY_SETUP_ERROR
The argument 1 of message as result of request, fail to init IR hardware
static int ERR_TTY_WRITE_ERROR
The argument 1 of message as result of request, fail to write IR hardware
static int ERR_UNKNOWN
The argument 1 of message as result of request, an unknown error occured
static java.lang.String KEY_CMD_RESULT
The key to put/retrieve data the learnt command to/from bundle
static java.lang.String KEY_COMMAND
The key to put/retrieve the command data to/from bundle
static java.lang.String KEY_DISCARD_ID
The key to put/retrieve the target UUID of a request to discard
static java.lang.String KEY_DROPPABLE
The key to put/retrieve the boolean flag to indicate a request is can be dropped or not
static java.lang.String KEY_RESULT_ID
The key to put/retrieve the generated UUID for a request to/from bundle
static java.lang.String KEY_TIMEOUT
The key to put/retrieve the timeout value for learning
static int MSG_ARG_DROPPABLE
An argument flag to indicate the request can be dropped if CIR module is busy
static int MSG_ARG_NORMAL
An argument flag to indicate the request can be queued and cannot be dropped
static int MSG_CMD_CANCEL
A message type for canceling previous request
static int MSG_CMD_DISCARD
A message type for discard specific request
static int MSG_CMD_GET_FW_VER
A message type for retrieving firmware version of CIR module
static int MSG_CMD_LEARN_IR
A message type for learning request
static int MSG_CMD_REGISTER_CLIENT
A message type for registration of a client
static int MSG_CMD_RESET
A message type for resetting CIR module
static int MSG_CMD_TRANSMIT_IR
A message type for generating IR signals
static int MSG_CMD_UNREGISTER_CLIENT
A message type for unregistration of a client
static int MSG_RET_CANCEL
A message type for the result of canceling of a previous request
static int MSG_RET_DISCARD
A message type for the result of discard request
static int MSG_RET_GET_FW_VER
A message type for the result of retrieving firmware version of CIR module
static int MSG_RET_LEARN_IR
A message type for the result of a learning request
static int MSG_RET_RESET
A message type for the result of retset request
static int MSG_RET_STARTED
A message type for the result whether control ready or not
static int MSG_RET_TRANSMIT_IR
A message type for the result of generating a IR signals
Constructor Summary
CIRControl(Context context, Handler handler)
the CIRControl constructor
Method Summary
java.util.UUID cancelCommand()
cancel the on-going command
java.util.UUID discardCommand(java.util.UUID uuid)
discard the specific commands in queue
java.util.UUID getFirmwareVersion()
get the firmware version of CIR module
boolean isStarted()
check if service has been already started successfully
java.util.UUID learnIRCmd(int timeout)
enter learning mode to learn IR signals as a command
java.util.UUID reset()
reset the hardware of CIR module
void start()
bind to CIRModule service
void stop()
unbind to CIRModule service
java.util.UUID transmitIRCmd(abcIrData irData, boolean droppable)
generate IR signals according to information in the abcIrData
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
MSG_CMD_REGISTER_CLIENT
public static final int MSG_CMD_REGISTER_CLIENT
A message type for registration of a client
See Also:
Constant Field Values
MSG_CMD_UNREGISTER_CLIENT
public static final int MSG_CMD_UNREGISTER_CLIENT
A message type for unregistration of a client
See Also:
Constant Field Values
MSG_CMD_LEARN_IR
public static final int MSG_CMD_LEARN_IR
A message type for learning request
See Also:
Constant Field Values
MSG_CMD_TRANSMIT_IR
public static final int MSG_CMD_TRANSMIT_IR
A message type for generating IR signals
See Also:
Constant Field Values
MSG_CMD_GET_FW_VER
public static final int MSG_CMD_GET_FW_VER
A message type for retrieving firmware version of CIR module
See Also:
Constant Field Values
MSG_CMD_RESET
public static final int MSG_CMD_RESET
A message type for resetting CIR module
See Also:
Constant Field Values
MSG_CMD_CANCEL
public static final int MSG_CMD_CANCEL
A message type for canceling previous request
See Also:
Constant Field Values
MSG_CMD_DISCARD
public static final int MSG_CMD_DISCARD
A message type for discard specific request
See Also:
Constant Field Values
MSG_RET_LEARN_IR
public static final int MSG_RET_LEARN_IR
A message type for the result of a learning request
See Also:
Constant Field Values
MSG_RET_TRANSMIT_IR
public static final int MSG_RET_TRANSMIT_IR
A message type for the result of generating a IR signals
See Also:
Constant Field Values
MSG_RET_GET_FW_VER
public static final int MSG_RET_GET_FW_VER
A message type for the result of retrieving firmware version of CIR module
See Also:
Constant Field Values
MSG_RET_RESET
public static final int MSG_RET_RESET
A message type for the result of retset request
See Also:
Constant Field Values
MSG_RET_CANCEL
public static final int MSG_RET_CANCEL
A message type for the result of canceling of a previous request
See Also:
Constant Field Values
MSG_RET_DISCARD
public static final int MSG_RET_DISCARD
A message type for the result of discard request
See Also:
Constant Field Values
MSG_RET_STARTED
public static final int MSG_RET_STARTED
A message type for the result whether control ready or not
See Also:
Constant Field Values
MSG_ARG_NORMAL
public static final int MSG_ARG_NORMAL
An argument flag to indicate the request can be queued and cannot be dropped
See Also:
Constant Field Values
MSG_ARG_DROPPABLE
public static final int MSG_ARG_DROPPABLE
An argument flag to indicate the request can be dropped if CIR module is busy
See Also:
Constant Field Values
ERR_NONE
public static final int ERR_NONE
The argument 1 of message as result of request, no error occured
See Also:
Constant Field Values
ERR_UNKNOWN
public static final int ERR_UNKNOWN
The argument 1 of message as result of request, an unknown error occured
See Also:
Constant Field Values
ERR_CMD_FAILED
public static final int ERR_CMD_FAILED
The argument 1 of message as result of request, failed to carry out request
See Also:
Constant Field Values
ERR_HW_BUSY
public static final int ERR_HW_BUSY
The argument 1 of message as result of request, hardware is busy
See Also:
Constant Field Values
ERR_IO_ERROR
public static final int ERR_IO_ERROR
The argument 1 of message as result of request, an IO error occured
See Also:
Constant Field Values
ERR_CMD_DROPPED
public static final int ERR_CMD_DROPPED
The argument 1 of message as result of request, the request is dropped (if it is droppable)
See Also:
Constant Field Values
ERR_TTY_SETUP_ERROR
public static final int ERR_TTY_SETUP_ERROR
The argument 1 of message as result of request, fail to init IR hardware
See Also:
Constant Field Values
ERR_TTY_WRITE_ERROR
public static final int ERR_TTY_WRITE_ERROR
The argument 1 of message as result of request, fail to write IR hardware
See Also:
Constant Field Values
ERR_TTY_READ_ERROR
public static final int ERR_TTY_READ_ERROR
The argument 1 of message as result of request, fail to read IR hardware
See Also:
Constant Field Values
ERR_INVALID_VALUE
public static final int ERR_INVALID_VALUE
The argument 1 of message as result of request, command arguments or data is invalid
See Also:
Constant Field Values
ERR_LEARNING_TIMEOUT
public static final int ERR_LEARNING_TIMEOUT
The argument 1 of message as result of request, the learning process expired
See Also:
Constant Field Values
ERR_CANCEL_FAIL
public static final int ERR_CANCEL_FAIL
The argument 1 of message as result of request, fail to cancel assigned request
See Also:
Constant Field Values
ERR_CHECKSUM_ERROR
public static final int ERR_CHECKSUM_ERROR
The argument 1 of message as result of request, checksum error in IR command
See Also:
Constant Field Values
ERR_OUT_OF_FREQ
public static final int ERR_OUT_OF_FREQ
The argument 1 of message as result of request, learning IR frequency is not supported
See Also:
Constant Field Values
ERR_CANCEL
public static final int ERR_CANCEL
The argument 1 of message as result of request, IR activity is canncelled
See Also:
Constant Field Values
ERR_PULSE_ERROR
public static final int ERR_PULSE_ERROR
The argument 1 of message as result of request, pulse data of IR frame is error
See Also:
Constant Field Values
ERR_PIPE_ERROR
public static final int ERR_PIPE_ERROR
The argument 1 of message as result of request, fail to create/read/write pipe
See Also:
Constant Field Values
ERR_OBJ_ERROR
public static final int ERR_OBJ_ERROR
The argument 1 of message as result of request, object error in JNI native functions
See Also:
Constant Field Values
KEY_COMMAND
public static final java.lang.String KEY_COMMAND
The key to put/retrieve the command data to/from bundle
See Also:
Constant Field Values
KEY_CMD_RESULT
public static final java.lang.String KEY_CMD_RESULT
The key to put/retrieve data the learnt command to/from bundle
See Also:
Constant Field Values
KEY_RESULT_ID
public static final java.lang.String KEY_RESULT_ID
The key to put/retrieve the generated UUID for a request to/from bundle
See Also:
Constant Field Values
KEY_DISCARD_ID
public static final java.lang.String KEY_DISCARD_ID
The key to put/retrieve the target UUID of a request to discard
See Also:
Constant Field Values
KEY_DROPPABLE
public static final java.lang.String KEY_DROPPABLE
The key to put/retrieve the boolean flag to indicate a request is can be dropped or not
See Also:
Constant Field Values
KEY_TIMEOUT
public static final java.lang.String KEY_TIMEOUT
The key to put/retrieve the timeout value for learning
See Also:
Constant Field Values
Constructor Detail
CIRControl
public CIRControl(Context context,
Handler handler)
the CIRControl constructor
Parameters:
context - the Context of application
handler - Handler for receiving result or request
Method Detail
isStarted
public boolean isStarted()
check if service has been already started successfully
Returns:
true if it is bound
start
public void start()
bind to CIRModule service
stop
public void stop()
unbind to CIRModule service
getFirmwareVersion
public java.util.UUID getFirmwareVersion()
get the firmware version of CIR module
Returns:
get the UUID assigned to this request; null represents service is not brought up yet
cancelCommand
public java.util.UUID cancelCommand()
cancel the on-going command
Returns:
get the UUID assigned to this request; null represents service is not brought up yet
discardCommand
public java.util.UUID discardCommand(java.util.UUID uuid)
discard the specific commands in queue
Parameters:
uuid - specific the target command with its UUID value
Returns:
get the UUID assigned to this request; null represents service is not brought up yet
reset
public java.util.UUID reset()
reset the hardware of CIR module
Returns:
get the UUID assigned to this request; null represents service is not brought up yet
transmitIRCmd
public java.util.UUID transmitIRCmd(abcIrData irData,
boolean droppable)
generate IR signals according to information in the abcIrData
Parameters:
irData - contains the information of generating IR signals
droppable - if true, command can be dropped when IR is running and busy
Returns:
get the UUID assigned to this request; null represents service is not brought up yet
learnIRCmd
public java.util.UUID learnIRCmd(int timeout)
enter learning mode to learn IR signals as a command
Parameters:
timeout - the period of time before learning process expires if the CIR module cannot detect valid IR signals frames
Returns:
get the UUID assigned to this request; null represents service is not brought up yet