@ProviderType
public interface Driver
ChannelRecord
,
ChannelDescriptor
Modifier and Type | Interface and Description |
---|---|
static class |
Driver.ConnectionException
The Class ConnectionException is a driver specific exception which is
essentially used to raise exception related to driver connection
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DRIVER_PID_PROPERTY_NAME
Each driver is identified by the value of this property in the Component Configuration
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Attempts to connect to the asset.
|
void |
disconnect()
Attempts to disconnect the already established communication channel.
|
ChannelDescriptor |
getChannelDescriptor()
Returns the protocol specific channel descriptor.
|
PreparedRead |
prepareRead(java.util.List<ChannelRecord> records)
This method allows the driver to perform protocol specific optimizations in order to accelerate the execution of
batches of read requests having the same channel configuration.
|
void |
read(java.util.List<ChannelRecord> records)
Reads the communication channels that correspond to the given channel
records.
|
void |
registerChannelListener(java.util.Map<java.lang.String,java.lang.Object> channelConfig,
ChannelListener listener)
Registers channel listener for the provided channel configuration for a
monitor operation on it.
|
void |
unregisterChannelListener(ChannelListener listener)
Unregisters a already registered channel listener which has been
registered for a monitor operation.
|
void |
write(java.util.List<ChannelRecord> records)
Writes the data channels that correspond to the given channel records.
|
static final java.lang.String DRIVER_PID_PROPERTY_NAME
void connect() throws Driver.ConnectionException
ConnectionException
Some communication protocols are not connection oriented. That means no
connection has to be built up in order to read or write data. In this
case the connect function may optionally test if the asset is reachable.Driver.ConnectionException
- if the connection to the field device is interruptedvoid disconnect() throws Driver.ConnectionException
Driver.ConnectionException
- if the connection to the field device is interruptedChannelDescriptor getChannelDescriptor()
void read(java.util.List<ChannelRecord> records) throws Driver.ConnectionException
DriverFlag#DRIVER_ERROR_UNSPECIFIED
. If the connection to the
asset is interrupted, then any necessary resources that correspond to
this connection should be cleaned up and a ConnectionException
shall be thrown.records
- the records hold the information of what channels are to be
read. They will be filled by this function with the records
already read.Driver.ConnectionException
- if the connection to the field device is interruptedjava.lang.NullPointerException
- if argument is nulljava.lang.IllegalArgumentException
- if argument is emptyKuraRuntimeException
- if the method is not implemented by the driver then specific
error code KuraErrorCode#OPERATION_NOT_SUPPORTED
needs to be set in the thrown KuraRuntimeException
void registerChannelListener(java.util.Map<java.lang.String,java.lang.Object> channelConfig, ChannelListener listener) throws Driver.ConnectionException
channelConfig
- the channel configurationlistener
- the listenerDriver.ConnectionException
- if the connection to the field device is interruptedjava.lang.NullPointerException
- any of the arguments is nullKuraRuntimeException
- if the method is not implemented by the driver then specific
error code KuraErrorCode#OPERATION_NOT_SUPPORTED
needs to be set in the thrown KuraRuntimeException
void unregisterChannelListener(ChannelListener listener) throws Driver.ConnectionException
listener
- the listener to unregisterDriver.ConnectionException
- if the connection to the field device is interruptedjava.lang.NullPointerException
- if the argument is nullKuraRuntimeException
- if the method is not implemented by the driver then specific
error code KuraErrorCode#OPERATION_NOT_SUPPORTED
needs to be set in the thrown KuraRuntimeException
void write(java.util.List<ChannelRecord> records) throws Driver.ConnectionException
ChannelFlag#SUCCESS
in the channel records. If the
connection to the asset is interrupted, then any necessary resources that
correspond to this connection should be cleaned up and a
ConnectionException
shall be thrown.records
- the records 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 driver flag stating whether the
write process was successful or not.Driver.ConnectionException
- if the connection to the field device is interruptedjava.lang.NullPointerException
- if the argument is nulljava.lang.IllegalArgumentException
- if the provided list is emptyKuraRuntimeException
- if the method is not implemented by the driver then specific
error code KuraErrorCode#OPERATION_NOT_SUPPORTED
needs to be set in the thrown KuraRuntimeException
PreparedRead prepareRead(java.util.List<ChannelRecord> records)
PreparedRead
instance that can be
used to perform the requests.
In order to improve efficiency a driver should validate the channel configuration of the provided channels during
this method call.
It is also permitted to the implementation of the PreparedRead.execute()
and
PreparedRead.getChannelRecords()
methods to return the same ChannelRecord
instances provided as
an
argument to this method.
If the validation of the channel configuration fails for some channels, the driver must not throw an exception
but it is required to return channel records with proper error flags set as a result of the
PreparedRead.execute()
call.records
- The list of channel records that represent the request to be optimized.PreparedRead
instancejava.lang.NullPointerException
- if the provided list is nullPreparedRead