ConfigType
- public abstract class AbstractSensorModule<ConfigType extends SensorConfig> extends AbstractModule<ConfigType> implements ISensorModule<ConfigType>
Class providing default implementation of common sensor API methods. This can be used as the base for most sensor driver implementations.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ID |
protected static String |
ERROR_NO_ENTITIES |
protected static String |
ERROR_NO_HISTORY |
protected static String |
ERROR_NO_UPDATE |
protected long |
lastUpdatedSensorDescription |
protected static String |
LOCATION_OUTPUT_ID |
protected static String |
LOCATION_OUTPUT_NAME |
protected DefaultLocationOutput<?> |
locationOutput |
protected net.opengis.sensorml.v20.AbstractProcess |
sensorDescription |
protected static String |
STATE_LAST_SML_UPDATE |
config, eventHandler
Constructor and Description |
---|
AbstractSensorModule() |
Modifier and Type | Method and Description |
---|---|
protected void |
addControlInput(ISensorControlInterface controlInterface)
Call this method to add each sensor control input
|
protected void |
addLocationOutput(double updatePeriod)
Helper method to add a location output so that all sensors can update their location
in a consistent manner.
|
protected void |
addOutput(ISensorDataInterface dataInterface,
boolean isStatus)
Call this method to add each sensor observation or status output
|
Map<String,ISensorDataInterface> |
getAllOutputs()
Retrieves the list of interfaces to all sensor data outputs
|
Map<String,ISensorControlInterface> |
getCommandInputs()
Retrieves the list of interface to sensor command inputs
|
net.opengis.sensorml.v20.AbstractProcess |
getCurrentDescription()
Retrieves most current sensor description.
|
net.opengis.gml.v32.AbstractFeature |
getCurrentFeatureOfInterest()
Retrieves the feature of interest for which this producer is
currently generating data.
In the case of a module generating data from multiple entities (e.g. |
long |
getLastDescriptionUpdate()
Used to check when SensorML description was last updated.
|
protected String |
getLocalFrameID(net.opengis.sensorml.v20.AbstractPhysicalProcess sensorDesc) |
Map<String,ISensorDataInterface> |
getObservationOutputs()
Retrieves the list of interface to sensor observation outputs
|
Map<String,ISensorDataInterface> |
getStatusOutputs()
Retrieves the list of interface to sensor status outputs
|
void |
loadState(IModuleStateManager loader)
Restores the state of this module from info provided by the input stream
|
protected void |
notifyNewDescription(long updateTime) |
protected void |
removeAllControlInputs()
Removes all control inputs previously added to this sensor
|
protected void |
removeAllOutputs()
Removes all outputs previously added to this sensor
|
void |
saveState(IModuleStateManager saver)
Saves the state of this module to the provided output stream
|
void |
updateConfig(ConfigType config)
Updates the module's configuration dynamically.
The module must honor this new configuration unless an error is detected. |
protected void |
updateLocation(double time,
double x,
double y,
double z)
Updates the sensor location.
|
protected void |
updateSensorDescription()
This method should be called whenever the sensor description needs to be regenerated.
This default implementation reads the base description from the SensorML file if provided and then appends the unique sensor identifier, time validity and the description of all registered outputs and control inputs. |
getConfiguration, getLocalID, getName, init, isEnabled, registerListener, unregisterListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isConnected
cleanup, getConfiguration, getLocalID, getName, init, isEnabled, registerListener, start, stop, unregisterListener
public static final String DEFAULT_ID
protected static final String LOCATION_OUTPUT_ID
protected static final String LOCATION_OUTPUT_NAME
protected static final String ERROR_NO_UPDATE
protected static final String ERROR_NO_HISTORY
protected static final String ERROR_NO_ENTITIES
protected static final String STATE_LAST_SML_UPDATE
protected DefaultLocationOutput<?> locationOutput
protected net.opengis.sensorml.v20.AbstractProcess sensorDescription
protected long lastUpdatedSensorDescription
protected void addOutput(ISensorDataInterface dataInterface, boolean isStatus)
dataInterface
- interface to add as sensor outputisStatus
- set to true when registering a status outputprotected void addLocationOutput(double updatePeriod)
updatePeriod
- estimated location update period or NaN if sensor is mostly staticprotected void removeAllOutputs()
protected void addControlInput(ISensorControlInterface controlInterface)
controlInterface
- interface to add as sensor control inputprotected void removeAllControlInputs()
public net.opengis.sensorml.v20.AbstractProcess getCurrentDescription()
ISensorModule
getCurrentDescription
in interface IModuleWithDescription
getCurrentDescription
in interface ISensorModule<ConfigType extends SensorConfig>
public long getLastDescriptionUpdate()
IModuleWithDescription
getLastDescriptionUpdate
in interface IModuleWithDescription
Long.MIN_VALUE
if description was never updated.protected void updateSensorDescription()
SensorException
protected void notifyNewDescription(long updateTime)
protected void updateLocation(double time, double x, double y, double z)
x
- y
- z
- protected String getLocalFrameID(net.opengis.sensorml.v20.AbstractPhysicalProcess sensorDesc)
public Map<String,ISensorDataInterface> getAllOutputs()
ISensorModule
getAllOutputs
in interface IDataProducerModule<ConfigType extends SensorConfig>
getAllOutputs
in interface ISensorModule<ConfigType extends SensorConfig>
public Map<String,ISensorDataInterface> getStatusOutputs()
ISensorModule
getStatusOutputs
in interface ISensorModule<ConfigType extends SensorConfig>
public Map<String,ISensorDataInterface> getObservationOutputs()
ISensorModule
getObservationOutputs
in interface ISensorModule<ConfigType extends SensorConfig>
public Map<String,ISensorControlInterface> getCommandInputs()
ISensorModule
getCommandInputs
in interface ISensorModule<ConfigType extends SensorConfig>
public net.opengis.gml.v32.AbstractFeature getCurrentFeatureOfInterest()
IDataProducerModule
IMultiSourceDataProducer.getCurrentFeatureOfInterest(String)
getCurrentFeatureOfInterest
in interface IDataProducerModule<ConfigType extends SensorConfig>
public void updateConfig(ConfigType config) throws SensorHubException
IModule
updateConfig
in interface IModule<ConfigType extends SensorConfig>
updateConfig
in class AbstractModule<ConfigType extends SensorConfig>
SensorHubException
public void loadState(IModuleStateManager loader) throws SensorHubException
IModule
loadState
in interface IModule<ConfigType extends SensorConfig>
loadState
in class AbstractModule<ConfigType extends SensorConfig>
SensorHubException
public void saveState(IModuleStateManager saver) throws SensorHubException
IModule
saveState
in interface IModule<ConfigType extends SensorConfig>
saveState
in class AbstractModule<ConfigType extends SensorConfig>
SensorHubException
Copyright © 2015 Sensia Software LLC. All rights reserved.