SensorType
- Type of parent sensorpublic abstract class AbstractSensorOutput<SensorType extends ISensorModule<?>> extends Object implements ISensorDataInterface
Class providing default implementation of common sensor data interface API methods. By default, storage is unsupported.
Modifier and Type | Field and Description |
---|---|
protected static String |
ERROR_NO_STORAGE |
protected IEventHandler |
eventHandler |
protected net.opengis.swe.v20.DataBlock |
latestRecord |
protected long |
latestRecordTime |
protected String |
name |
protected SensorType |
parentSensor |
Constructor and Description |
---|
AbstractSensorOutput(SensorType parentSensor) |
AbstractSensorOutput(String name,
SensorType parentSensor) |
Modifier and Type | Method and Description |
---|---|
int |
clearAllRecords()
Clears all records currently stored in driver or sensor memory.
This method must be implemented if ISensorDataInterface.isStorageSupported() returns true. |
List<net.opengis.swe.v20.DataBlock> |
getAllRecords(boolean clear)
Retrieves all records stored by the driver or sensor.
This method must be implemented if ISensorDataInterface.isStorageSupported() returns true. |
net.opengis.swe.v20.DataBlock |
getLatestRecord()
Gets the latest record received on this data channel.
|
List<net.opengis.swe.v20.DataBlock> |
getLatestRecords(int maxRecords,
boolean clear)
Retrieves the N last records stored.
This method must be implemented if ISensorDataInterface.isStorageSupported() returns true. |
long |
getLatestRecordTime()
Used to check when the last record was produced.
This is usually set as system time when the output is sent, and must be the same as the corresponding event time stamp. |
String |
getName()
Gets this output interface name.
|
int |
getNumberOfAvailableRecords()
Retrieves number of record currectly available from driver or on-board sensor memory.
This method must be implemented if ISensorDataInterface.isStorageSupported() returns true. |
SensorType |
getParentModule()
Allows by-reference access to parent sensor module
|
int |
getStorageCapacity()
Gets the internal storage capacity.
This method must be implemented if ISensorDataInterface.isStorageSupported() returns true. |
protected abstract void |
init() |
boolean |
isEnabled()
Checks if this interface is enabled
|
boolean |
isStorageSupported()
Checks data storage capability
|
void |
registerListener(IEventListener listener)
Registers a listener with this event producer.
|
protected void |
stop() |
void |
unregisterListener(IEventListener listener)
Unregisters a listener from this event producer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAverageSamplingPeriod, getRecommendedEncoding, getRecordDescription
protected static String ERROR_NO_STORAGE
protected SensorType extends ISensorModule<?> parentSensor
protected String name
protected IEventHandler eventHandler
protected net.opengis.swe.v20.DataBlock latestRecord
protected long latestRecordTime
public AbstractSensorOutput(SensorType parentSensor)
public AbstractSensorOutput(String name, SensorType parentSensor)
protected abstract void init() throws SensorException
SensorException
protected void stop()
public SensorType getParentModule()
ISensorDataInterface
getParentModule
in interface IStreamingDataInterface
getParentModule
in interface ISensorDataInterface
public String getName()
ISensorDataInterface
It MUST be the name reported in the map by getXXXOutputs methods
of ISensorModule
getName
in interface IStreamingDataInterface
getName
in interface ISensorDataInterface
ISensorModule.getAllOutputs()
public boolean isEnabled()
IStreamingDataInterface
isEnabled
in interface IStreamingDataInterface
public net.opengis.swe.v20.DataBlock getLatestRecord()
ISensorDataInterface
When storage is supported, this method does not cause data to be removed from memory.
Note that this does not trigger a new measurement but simply retrieves the result of the last measurement made.
getLatestRecord
in interface IStreamingDataInterface
getLatestRecord
in interface ISensorDataInterface
public long getLatestRecordTime()
IStreamingDataInterface
Note: this method is useful to know if a record has been produced since the
last call to IStreamingDataInterface.getLatestRecord()
.
getLatestRecordTime
in interface IStreamingDataInterface
getLatestRecordTime
in interface ISensorDataInterface
Long.MIN_VALUE
if no record is available yetpublic boolean isStorageSupported()
ISensorDataInterface
Note that storage can be provided by the sensor itself or by the driver.
isStorageSupported
in interface ISensorDataInterface
public int getStorageCapacity() throws SensorException
ISensorDataInterface
ISensorDataInterface.isStorageSupported()
returns true.getStorageCapacity
in interface ISensorDataInterface
SensorException
- if storage is not supported or a problem occured while
checking sensor on-board storage capacitypublic int getNumberOfAvailableRecords() throws SensorException
ISensorDataInterface
ISensorDataInterface.isStorageSupported()
returns true.getNumberOfAvailableRecords
in interface ISensorDataInterface
SensorException
- if storage is not supported or a problem occured while
reading from on-board sensor storagepublic List<net.opengis.swe.v20.DataBlock> getLatestRecords(int maxRecords, boolean clear) throws SensorException
ISensorDataInterface
ISensorDataInterface.isStorageSupported()
returns true.getLatestRecords
in interface ISensorDataInterface
maxRecords
- Maximum number of records to retrieveclear
- if true, also clears records from driver or sensor memorySensorException
- if storage is not supported or a problem occured while
reading from on-board sensor storagepublic List<net.opengis.swe.v20.DataBlock> getAllRecords(boolean clear) throws SensorException
ISensorDataInterface
ISensorDataInterface.isStorageSupported()
returns true.getAllRecords
in interface ISensorDataInterface
clear
- if true, also clears records from driver or sensor memorySensorException
- if storage is not supported or a problem occured
while reading from on-board sensor storagepublic int clearAllRecords() throws SensorException
ISensorDataInterface
ISensorDataInterface.isStorageSupported()
returns true.clearAllRecords
in interface ISensorDataInterface
SensorException
- if storage is not supported or a problem occured while
clearing on-board sensor storagepublic void registerListener(IEventListener listener)
IEventProducer
registerListener
in interface IEventProducer
public void unregisterListener(IEventListener listener)
IEventProducer
unregisterListener
in interface IEventProducer
Copyright © 2015 Sensia Software LLC. All rights reserved.