Package org.openwebnet4j.communication
Class USBConnector
- java.lang.Object
-
- org.openwebnet4j.communication.OpenConnector
-
- org.openwebnet4j.communication.USBConnector
-
- All Implemented Interfaces:
gnu.io.SerialPortEventListener
,EventListener
public class USBConnector extends OpenConnector implements gnu.io.SerialPortEventListener
Class for communicating with a ZigBee USB Gateway using the OpenWebNet protocol- Author:
- M. Valla - Initial contribution
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openwebnet4j.communication.OpenConnector
OpenConnector.OWNReceiveThread
-
-
Field Summary
-
Fields inherited from class org.openwebnet4j.communication.OpenConnector
cmdChannel, isCmdConnected, isMonConnected, lastCmdFrameSentTs, listener, monChannel, monRcvThread, notifierExecutor, OWN_MAX_DATA
-
-
Constructor Summary
Constructors Constructor Description USBConnector(String portName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Disconnects both MON and CMD connections and stops MON receive threadString
getFirmwareVersion()
Returns the firmware version for the connector (e.g.void
openCmdConn()
Opens command (CMD) connectionvoid
openMonConn()
Opens monitor (MON) connectionprotected void
processFrame(String newFrame)
Process a frame string receivedprotected Response
sendCommandSynchInternal(String frame)
void
serialEvent(gnu.io.SerialPortEvent event)
-
Methods inherited from class org.openwebnet4j.communication.OpenConnector
disconnectCmdChannel, disconnectMonChannel, getLastCmdFrameSentTs, handleMonDisconnect, isCmdConnected, isMonConnected, notifyListener, sendCommandSynch, setListener
-
-
-
-
Constructor Detail
-
USBConnector
public USBConnector(String portName)
-
-
Method Detail
-
openCmdConn
public void openCmdConn() throws OWNException
Description copied from class:OpenConnector
Opens command (CMD) connection- Specified by:
openCmdConn
in classOpenConnector
- Throws:
OWNException
- in case of error
-
openMonConn
public void openMonConn() throws OWNException
Description copied from class:OpenConnector
Opens monitor (MON) connection- Specified by:
openMonConn
in classOpenConnector
- Throws:
OWNException
- in case of error
-
getFirmwareVersion
public String getFirmwareVersion()
Returns the firmware version for the connector (e.g. 1.2.3)- Returns:
- String containing firmware version, null if unknown
-
sendCommandSynchInternal
protected Response sendCommandSynchInternal(String frame) throws IOException, FrameException
- Specified by:
sendCommandSynchInternal
in classOpenConnector
- Throws:
IOException
FrameException
-
processFrame
protected void processFrame(String newFrame)
Description copied from class:OpenConnector
Process a frame string received- Specified by:
processFrame
in classOpenConnector
- Parameters:
newFrame
- the new frame received
-
serialEvent
public void serialEvent(gnu.io.SerialPortEvent event)
- Specified by:
serialEvent
in interfacegnu.io.SerialPortEventListener
-
disconnect
public void disconnect()
Description copied from class:OpenConnector
Disconnects both MON and CMD connections and stops MON receive thread- Overrides:
disconnect
in classOpenConnector
-
-