- All Known Subinterfaces:
@Beta public interface DeviceConnect extends HandlerBehaviourAbstraction of handler behaviour used to set-up and tear-down connections with a device. A connection is intended as the presence of state (e.g. a transport session) required to carry messages between this node and the device.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
connect()Connects to the device, for example by opening the transport session that will be later used to send control messages.
disconnect()Disconnects from the device, for example closing any transport session previously opened.
hasConnection()Returns true if a connection to the device exists, false otherwise.
boolean connect() throws java.lang.IllegalStateExceptionConnects to the device, for example by opening the transport session that will be later used to send control messages. Returns true if the connection was created successfully, false otherwise.
The implementation should trigger without blocking any necessary handshake with the device to initialize the connection over the network, eventually generating a
DeviceAgentEvent.Type.CHANNEL_OPENevent when ready.
When calling this method while a connection to the device already exists, the behavior is not defined. For example, some implementations might require to first call
disconnect(), while other might behave as a no-op.
- true if a connection was created successfully, false otherwise
java.lang.IllegalStateException- if a connection already exists and the implementation requires to call
boolean hasConnection()Returns true if a connection to the device exists, false otherwise. This method is NOT expected to send any message over the network to check for device reachability, but rather it should only give an indication if any internal connection state exists for the device. As such, it should NOT block execution.
- true if the connection is open, false otherwise
void disconnect()Disconnects from the device, for example closing any transport session previously opened.
Calling multiple times this method while a connection to the device is already closed should result in a no-op.
If a connection to the device existed and it was open, the implementation is expected to generate a