|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Channel
The Channel
class is used to access a single data field of a communication device. A desired channel can
be obtained using the DataAccessService
. A channel instance can be used to
setLatestSample
.Note that only the call of the read or write functions will actually result in a corresponding read or write request being sent to the communication device.
Method Summary | |
---|---|
void |
addListener(RecordListener listener)
Adds a listener that is notified of new records received my sampling or listening. |
java.lang.String |
getChannelAddress()
Gets the address of this channel. |
ChannelState |
getChannelState()
Gets the current channel state. |
java.lang.String |
getDescription()
Gets the description of this channel. |
java.lang.String |
getDeviceAddress()
Gets the channel's device address. |
java.lang.String |
getDeviceDescription()
Gets the description of the communication device that this channel belongs to. |
java.lang.String |
getDeviceName()
Gets the name of the communication device that this channel belongs to. |
DeviceState |
getDeviceState()
Gets the current state of the communication device that this channel belongs to. |
java.lang.String |
getDriverName()
Gets the unique name of the communication driver that is used by this channel to read/write data. |
java.lang.String |
getInterfaceAddress()
Gets the channel's interface address. |
java.lang.String |
getLabel()
Gets the label of this channel. |
Record |
getLatestSample()
Gets the latest record that was either sampled or received by listening or an application set using setLatestSample . |
Record |
getLoggedValue(long timestamp)
Gets the value that has been stored in the framework's logging data base at the given timestamp. |
java.util.List<Record> |
getLoggedValues(long startTime)
Gets all historical values that have been stored in the framework's logging data base since the given startTime. |
java.util.List<Record> |
getLoggedValues(long startTime,
long endTime)
|
int |
getLoggingInterval()
Get the channel's configured logging interval in milliseconds. |
int |
getLoggingTimeOffset()
Gets the channel's configured logging time offset in milliseconds. |
ReadRecordContainer |
getReadContainer()
Gets a ReadRecordContainer that corresponds to this channel. |
int |
getSamplingInterval()
Gets the channel's configured sampling interval in milliseconds. |
int |
getSamplingTimeOffset()
Gets the channel's configured sampling time offset in milliseconds. |
java.lang.String |
getUnit()
Gets the unit of this channel. |
ValueType |
getValueType()
Gets the value type of this channel. |
WriteValueContainer |
getWriteContainer()
Gets a WriteValueContainer that corresponds to this channel. |
boolean |
isConnected()
Returns true if a connection to the channel's communication device exist. |
Record |
read(int timeout)
Actively reads a value from the channel's corresponding data field in the connected communication device. |
void |
removeListener(RecordListener listener)
Removes a record listener. |
void |
setLatestSample(Record record)
Sets the latest sample record. |
Flag |
write(Value value,
int timeout)
Writes the given value to the channel's corresponding data field in the connected communication device. |
Method Detail |
---|
java.lang.String getLabel()
DataAccessService
.
null
if not set.java.lang.String getChannelAddress()
java.lang.String getDescription()
java.lang.String getUnit()
ValueType getValueType()
Value
implementation
that corresponds to the configured value type.
But usually an application does not need to know the value type of the channel because it can use the value type
of its choice by using the corresponding function of the Value
interface. Conversion is done
transparently.
int getSamplingInterval()
int getSamplingTimeOffset()
int getLoggingInterval()
int getLoggingTimeOffset()
java.lang.String getDriverName()
java.lang.String getInterfaceAddress()
null
if not configured.java.lang.String getDeviceAddress()
java.lang.String getDeviceName()
java.lang.String getDeviceDescription()
ChannelState getChannelState()
DeviceState getDeviceState()
void addListener(RecordListener listener)
listener
- the record listener that is notified of new records.void removeListener(RecordListener listener)
listener
- the listener that no longer shall be notified new records.boolean isConnected()
true
if a connection to the channel's communication device exist.
true
if a connection to the channel's communication device exist.Record getLatestSample()
setLatestSample
.
void setLatestSample(Record record)
Note that the framework treats the passed record in exactly the same way as if it had been received from a driver. In particular that means:
getLatestSample
.addListener
.
record
- the record that the latest sample is set to.Flag write(Value value, int timeout)
Flag
will indicate this.
value
- the value that is to be writtentimeout
- the time in milliseconds after which the write process shall be interrupted and the timeout flag is
returned. A timeout of 0 indicates infinite time.
Flag.VALID
) or not (any
other flag).WriteValueContainer getWriteContainer()
WriteValueContainer
that corresponds to this channel. This container can be passed to the
write function of DataAccessService
to write several values in one transaction.
WriteValueContainer
that corresponds to this channel.Record read(int timeout)
timeout
- the time in milliseconds after which the read process shall be interrupted and the timeout flag is
set.
Flag.VALID
) or a an error (any other flag).ReadRecordContainer getReadContainer()
ReadRecordContainer
that corresponds to this channel. This container can be passed to the
read function of DataAccessService
to read several values in one transaction.
ReadRecordContainer
that corresponds to this channel.Record getLoggedValue(long timestamp) throws LogSourceNotAvailableException, java.io.IOException
getLoggedValues
instead.
timestamp
- the time as milliseconds since midnight, January 1, 1970 UTC.
timestamp
.
LogSourceNotAvailableException
java.io.IOException
java.util.List<Record> getLoggedValues(long startTime) throws LogSourceNotAvailableException, java.io.IOException
startTime
- the time as milliseconds since midnight, January 1, 1970 UTC.
startTime
.
LogSourceNotAvailableException
java.io.IOException
java.util.List<Record> getLoggedValues(long startTime, long endTime) throws LogSourceNotAvailableException, java.io.IOException
LogSourceNotAvailableException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |