public class DemoDeviceDriver extends AbstractDeviceDriver
INDEX_HIGH, INDEX_HIGHER, INDEX_HIGHEST, INDEX_LOW, INDEX_LOWER, INDEX_LOWEST, INDEX_NORMAL, INDEX_VERY_HIGH, INDEX_VERY_LOW| Constructor and Description |
|---|
DemoDeviceDriver() |
| Modifier and Type | Method and Description |
|---|---|
DataTable |
executeFunction(FunctionDefinition fd,
CallerController caller,
DataTable parameters)
This method should implement the call of the device-side operation (function).
|
void |
finishSynchronization()
This method is called in the end of every synchronization.
|
java.lang.String |
getDemoSettingValue() |
java.util.List<EventDefinition> |
readEventDefinitions(DeviceEntities entities)
This method should return definitions of events that may be generated by the device.
|
java.util.List<FunctionDefinition> |
readFunctionDefinitions(DeviceEntities entities)
This method should return definitions of device operations (functions).
|
java.util.List<VariableDefinition> |
readVariableDefinitions(DeviceEntities entities)
This method should return definitions of device settings (variables).
|
DataTable |
readVariableValue(VariableDefinition vd,
CallerController caller)
Implementation of this method should read value of device setting pointed by the argument, convert it to the form of Data Table and return it.
|
void |
setupDeviceContext(DeviceContext deviceContext)
This method is called once during creation of the device context (after device creation and on server startup).
|
void |
writeVariableValue(VariableDefinition vd,
CallerController caller,
DataTable value,
DataTable deviceValue)
Implementation of this method should write server-side value of device setting into a hardware.
|
accessSettingUpdated, acklowledgeEvent, configureDeviceAccount, connect, createConnectionPropertiesFormat, createDiscoveryProvider, definitionsToDescriptors, deviceDestroyed, deviceMoved, disconnect, discoverEvent, discoverFunction, discoverVariable, getAddresses, getConnectionPropertiesFormat, getCustomVariableStatus, getDeviceContext, getPrimaryAddress, getProtocol, getStatus, getStatusExpressions, getVariableModificationTime, isConnected, isUseDeviceSideValuesCache, isUsesAssets, isUsesConnections, readAssets, readBufferedData, readEventDefinitions, readEventDescriptors, readFunctionDefinitions, readFunctionDescriptors, readVariableDefinitions, readVariableDescriptors, runFullSynchronizationOnStartup, setConnected, shouldSynchronize, startSynchronization, updateVariableModificationTimecompareTo, createGlobalConfigContext, createGlobalConfigContext, createUserConfigContext, doStart, doStop, getDescription, getGlobalConfigContext, getId, getPluginDirector, getShortId, getSortIndex, getUserConfigContext, globalDeinit, globalInit, globalStart, globalStop, setDescription, setId, setIndex, setPluginDirector, userDeinit, userInitclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateDeviceContextcreateGlobalConfigContext, createUserConfigContext, getDescription, getGlobalConfigContext, getId, getShortId, getSortIndex, getUserConfigContext, globalDeinit, globalInit, globalStart, globalStop, userDeinit, userInitpublic void setupDeviceContext(DeviceContext deviceContext) throws ContextException
DeviceDriverThis method is called once during creation of the device context (after device creation and on server startup). Driver implementation usually override it to add definitions of device communication settings (e.g. IP address and port number) to the device context. Setup of synchronization settings for the whole device and individual settings is also performed at this point.
Variable definitions representing device communication settings should belong to ContextUtils.GROUP_ACCESS variable group.
setupDeviceContext in interface DeviceDriversetupDeviceContext in class AbstractDeviceDriverContextExceptionpublic java.util.List<VariableDefinition> readVariableDefinitions(DeviceEntities entities) throws ContextException, DeviceException, DisconnectionException
DeviceDriverThis method should return definitions of device settings (variables). Its implementations may read device metadata or construct the definitions based on server-side device configuration.
The method is called only if DeviceDriver.isUsesAssets() method returns false.
readVariableDefinitions in interface DeviceDriverreadVariableDefinitions in class AbstractDeviceDriverentities - Interface allowing to check what variables are active and those definitions should be returned by this method.ContextException - If some server-side error occurredDeviceException - If device metadata reading failed (e.g. hardware error occurred)DisconnectionException - If device connection was interrupted during metadata readingpublic java.util.List<FunctionDefinition> readFunctionDefinitions(DeviceEntities entities) throws ContextException, DeviceException, DisconnectionException
DeviceDriverThis method should return definitions of device operations (functions). Its implementations may read device metadata or construct the definitions based on server-side device configuration.
The method is called only if DeviceDriver.isUsesAssets() method returns false.
readFunctionDefinitions in interface DeviceDriverreadFunctionDefinitions in class AbstractDeviceDriverentities - Interface allowing to check what functions are active and those definitions should be returned by this method.ContextException - If some server-side error occurredDeviceException - If device metadata reading failed (e.g. hardware error occurred)DisconnectionException - If device connection was interrupted during metadata readingpublic java.util.List<EventDefinition> readEventDefinitions(DeviceEntities entities) throws ContextException, DeviceException, DisconnectionException
DeviceDriverThis method should return definitions of events that may be generated by the device. Its implementations may read device metadata or construct the definitions based on server-side device configuration.
Note, that instances of these events may be generated by the driver asynchronously at any time after at least one device synchronization has finished. This is performed by calling DeviceContext.fireEvent().
The method is called only if DeviceDriver.isUsesAssets() method returns false.
readEventDefinitions in interface DeviceDriverreadEventDefinitions in class AbstractDeviceDriverentities - Interface allowing to check what events are active and those definitions should be returned by this method.ContextException - If some server-side error occurredDeviceException - If device metadata reading failed (e.g. hardware error occurred)DisconnectionException - If device connection was interrupted during metadata readingpublic DataTable readVariableValue(VariableDefinition vd, CallerController caller) throws ContextException, DeviceException, DisconnectionException
DeviceDriverreadVariableValue in interface DeviceDriverreadVariableValue in class AbstractDeviceDriverContextException - If conversion of device value to the Data Table has occurredDeviceException - If reading of device setting has failed (e.g. hardware error occurred)DisconnectionException - If device connection was lost during operationpublic void writeVariableValue(VariableDefinition vd, CallerController caller, DataTable value, DataTable deviceValue) throws ContextException, DeviceException, DisconnectionException
DeviceDriverwriteVariableValue in interface DeviceDriverwriteVariableValue in class AbstractDeviceDriverdeviceValue - Previous value of setting received from device by calling DeviceDriver.readVariableValue(VariableDefinition, CallerController). Will be NULL if server was restarted since previous read
operation or DeviceDriver.isUseDeviceSideValuesCache() returns false;ContextException - If conversion of the Data Table to a device value has occurredDeviceException - If writing of device setting has failed (e.g. hardware error occurred)DisconnectionException - If device connection was lost during operationpublic DataTable executeFunction(FunctionDefinition fd, CallerController caller, DataTable parameters) throws ContextException, DeviceException, DisconnectionException
DeviceDriverexecuteFunction in interface DeviceDriverexecuteFunction in class AbstractDeviceDriverContextException - If server-side error occurred (e.g. conversion of input/output between Data Tables and device native format)DeviceException - If device-side error occurredDisconnectionException - If device connection was lost during operationpublic void finishSynchronization()
throws DeviceException
DeviceDriverfinishSynchronization in interface DeviceDriverfinishSynchronization in class AbstractDeviceDriverDeviceException - If some device communications were performed and error occurredpublic java.lang.String getDemoSettingValue()