org.openmuc.framework.driver.spi
public interface Connection
DriverService.connect(String, String)
is called.
The OpenMUC framework can give certain guarantees about the order of the functions it calls:
Modifier and Type | Method and Description |
---|---|
void |
disconnect()
Disconnects or closes the connection.
|
java.lang.Object |
read(java.util.List<ChannelRecordContainer> containers,
java.lang.Object containerListHandle,
java.lang.String samplingGroup)
Reads the data channels that correspond to the given record containers.
|
java.util.List<org.openmuc.framework.config.ChannelScanInfo> |
scanForChannels(java.lang.String settings)
Scan a given communication device for available data channels.
|
void |
startListening(java.util.List<ChannelRecordContainer> containers,
RecordsReceivedListener listener)
Starts listening on the given connection for data from the channels that correspond to the given record
containers.
|
java.lang.Object |
write(java.util.List<ChannelValueContainer> containers,
java.lang.Object containerListHandle)
Writes the data channels that correspond to the given value containers.
|
java.util.List<org.openmuc.framework.config.ChannelScanInfo> scanForChannels(java.lang.String settings) throws java.lang.UnsupportedOperationException, org.openmuc.framework.config.ArgumentSyntaxException, org.openmuc.framework.config.ScanException, ConnectionException
settings
- scanning settings. The syntax is driver specific.org.openmuc.framework.config.ArgumentSyntaxException
- if the syntax of the deviceAddress or settings string is incorrect.java.lang.UnsupportedOperationException
- if the method is not implemented by the driver.org.openmuc.framework.config.ScanException
- if an error occurs while scanning but the connection is still alive.ConnectionException
- if an error occurs while scanning and the connection was closedjava.lang.Object read(java.util.List<ChannelRecordContainer> containers, java.lang.Object containerListHandle, java.lang.String samplingGroup) throws java.lang.UnsupportedOperationException, ConnectionException
Flag.DRIVER_ERROR_CHANNEL_NOT_ACCESSIBLE
. If the
connection to the device is interrupted, then any necessary resources that correspond to this connection should
be cleaned up and a ConnectionException
shall be thrown.containers
- the containers hold the information of what channels are to be read. They will be filled by this
function with the records read.containerListHandle
- the containerListHandle returned by the last read call for this exact list of containers. Will be
equal to null
if this is the first read call for this container list after a connection
has been established. Driver implementations can optionally use this object to improve the read
performance.samplingGroup
- the samplingGroup that was configured for this list of channels that are to be read. Sometimes it may
be desirable to give the driver a hint on how to group several channels when reading them. This can
done through the samplingGroup.null
.java.lang.UnsupportedOperationException
- if the method is not implemented by the driver.ConnectionException
- if the connection to the device was interrupted.void startListening(java.util.List<ChannelRecordContainer> containers, RecordsReceivedListener listener) throws java.lang.UnsupportedOperationException, ConnectionException
containers
- the containers identify the channels to listen on. They will be filled by this function with the
records received and passed to the listener.listener
- the listener to inform that new data has arrived.java.lang.UnsupportedOperationException
- if the method is not implemented by the driver.ConnectionException
- if the connection to the device was interrupted.java.lang.Object write(java.util.List<ChannelValueContainer> containers, java.lang.Object containerListHandle) throws java.lang.UnsupportedOperationException, ConnectionException
ConnectionException
shall be thrown.containers
- the containers hold the information of what channels are to be written and the values that are to
written. They will be filled by this function with a flag stating whether the write process was
successful or not.containerListHandle
- the containerListHandle returned by the last write call for this exact list of containers. Will be
equal to null
if this is the first read call for this container list after a connection
has been established. Driver implementations can optionally use this object to improve the write
performance.null
.java.lang.UnsupportedOperationException
- if the method is not implemented by the driver.ConnectionException
- if the connection to the device was interrupted.void disconnect()