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 voiddisconnect()Disconnects both MON and CMD connections and stops MON receive threadStringgetFirmwareVersion()Returns the firmware version for the connector (e.g.voidopenCmdConn()Opens command (CMD) connectionvoidopenMonConn()Opens monitor (MON) connectionprotected voidprocessFrame(String newFrame)Process a frame string receivedprotected ResponsesendCommandSynchInternal(String frame)voidserialEvent(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 OWNExceptionDescription copied from class:OpenConnectorOpens command (CMD) connection- Specified by:
openCmdConnin classOpenConnector- Throws:
OWNException- in case of error
-
openMonConn
public void openMonConn() throws OWNExceptionDescription copied from class:OpenConnectorOpens monitor (MON) connection- Specified by:
openMonConnin 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:
sendCommandSynchInternalin classOpenConnector- Throws:
IOExceptionFrameException
-
processFrame
protected void processFrame(String newFrame)
Description copied from class:OpenConnectorProcess a frame string received- Specified by:
processFramein classOpenConnector- Parameters:
newFrame- the new frame received
-
serialEvent
public void serialEvent(gnu.io.SerialPortEvent event)
- Specified by:
serialEventin interfacegnu.io.SerialPortEventListener
-
disconnect
public void disconnect()
Description copied from class:OpenConnectorDisconnects both MON and CMD connections and stops MON receive thread- Overrides:
disconnectin classOpenConnector
-
-