public class ControlLabImpl extends Object implements ControlLabInterface
| Modifier | Constructor and Description |
|---|---|
protected |
ControlLabImpl(String aPort)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
byteToHex(byte[] data)
Format a byte array to a String for debug purpose.
|
void |
connect()
Connect to the serial port and start the keepalive thread.
|
void |
disconnect()
Send the message for closing the communication and close the serial port.
|
<S extends Input> |
getInput(Class<S> clazz,
InputPortEnum inputPort)
Get the input type declared by clazz for this port.
|
Output |
getOuput(OutputPortEnum outputPort)
Get the ouput for this port.
|
String |
getPort()
Returns the port.
|
int[] |
getSensorValues()
Get the sensors' values array.
|
void |
readData()
Read the data when available.
|
void |
sendMessage(byte message)
Send a message.
|
void |
sendMessage(byte[] message)
Send a message.
|
protected ControlLabImpl(String aPort)
aPort - the serial port (by example COM1, /dev/ttys1)public void connect()
connect in interface ControlLabInterfacepublic void disconnect()
disconnect in interface ControlLabInterfacepublic void readData()
readData in interface ControlLabInterfacepublic int[] getSensorValues()
getSensorValues in interface ControlLabInterfacepublic void sendMessage(byte[] message)
sendMessage in interface ControlLabInterfacemessage - a byte array.public void sendMessage(byte message)
sendMessage in interface ControlLabInterfacemessage - a bytepublic String getPort()
getPort in interface ControlLabInterfacepublic static final String byteToHex(byte[] data)
data - datapublic Output getOuput(OutputPortEnum outputPort)
getOuput in interface ControlLabInterfaceoutputPort - outputportpublic <S extends Input> S getInput(Class<S> clazz, InputPortEnum inputPort)
getInput in interface ControlLabInterfaceS - class which extends Inputclazz - wanted class instance of the inputinputPort - input portCopyright © 2018. All rights reserved.