Class SerialSession
java.lang.Object
com.marginallyclever.communications.session.SessionLayer
com.marginallyclever.communications.transport.serial.SerialSession
- All Implemented Interfaces:
jssc.SerialPortEventListener
Encapsulate all serial receive/transmit at the session layer of the OSI model.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
getName()
boolean
isOpen()
void
openConnection
(String portName) Open a serial connection to a device.void
void
sendMessage
(String msg) void
serialEvent
(jssc.SerialPortEvent events) Methods inherited from class com.marginallyclever.communications.session.SessionLayer
addListener, removeListener
-
Constructor Details
-
SerialSession
-
-
Method Details
-
closeConnection
public void closeConnection()- Specified by:
closeConnection
in classSessionLayer
-
openConnection
Open a serial connection to a device. Has no idea to whom we are opening.- Specified by:
openConnection
in classSessionLayer
- Throws:
Exception
-
serialEvent
public void serialEvent(jssc.SerialPortEvent events) - Specified by:
serialEvent
in interfacejssc.SerialPortEventListener
-
sendMessage
- Specified by:
sendMessage
in classSessionLayer
- Throws:
Exception
-
reconnect
- Specified by:
reconnect
in classSessionLayer
- Throws:
Exception
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in classSessionLayer
- Returns:
- the port open for this serial connection.
-
getName
- Specified by:
getName
in classSessionLayer
-
getTransportLayer
- Specified by:
getTransportLayer
in classSessionLayer
-