Class SGrContactsDevice
- java.lang.Object
-
- com.smartgridready.communicator.common.impl.SGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,com.smartgridready.ns.v0.ContactFunctionalProfile,com.smartgridready.ns.v0.DataPointBase>
-
- com.smartgridready.communicator.contacts.impl.SGrContactsDevice
-
- All Implemented Interfaces:
GenDeviceApi
public class SGrContactsDevice extends SGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,com.smartgridready.ns.v0.ContactFunctionalProfile,com.smartgridready.ns.v0.DataPointBase>
Implements a communication interface based on digital contacts. This class implements the generic part. As control of the digital contacts is hardware-specific, an appropriateGenDriverAPI4Contactsdriver has to be implemented.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.smartgridready.communicator.common.impl.SGrDeviceBase
SGrDeviceBase.Comparator, SGrDeviceBase.RwpDirections
-
-
Field Summary
-
Fields inherited from class com.smartgridready.communicator.common.impl.SGrDeviceBase
device
-
-
Constructor Summary
Constructors Constructor Description SGrContactsDevice(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.contacts.GenDriverAPI4ContactsFactory aDriverFactory)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Connect the device.voiddisconnect()Disconnect the device.protected java.util.Optional<com.smartgridready.ns.v0.DataPointBase>findDataPointForProfile(com.smartgridready.ns.v0.ContactFunctionalProfile functionalProfile, java.lang.String dataPointName)Finds a data point of a given functional profile by name.protected java.util.Optional<com.smartgridready.ns.v0.ContactFunctionalProfile>findProfile(java.lang.String profileName)Finds a functional profile by name.ValuegetVal(java.lang.String profileName, java.lang.String dataPointName)Get a value for a given data pointValuegetVal(java.lang.String profileName, java.lang.String dataPointName, java.util.Properties parameters)Get a value for a given data point, with request-specific parametersbooleanisConnected()Checks if the device is connected.voidsetVal(java.lang.String profileName, java.lang.String dataPointName, Value value)Set a value for a given data point-
Methods inherited from class com.smartgridready.communicator.common.impl.SGrDeviceBase
applyUnitConversion, canSubscribe, checkOutOfRange, checkOutOfRange, checkReadWritePermission, divide, findDataPoint, getDataPoint, getDataPoints, getDeviceConfigurationInfo, getDeviceInfo, getFunctionalProfile, getFunctionalProfiles, getValues, isNumeric, multiply, subscribe, unsubscribe
-
-
-
-
Constructor Detail
-
SGrContactsDevice
public SGrContactsDevice(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.contacts.GenDriverAPI4ContactsFactory aDriverFactory)Constructs a new instance.- Parameters:
deviceDescription- the device specificationaDriverFactory- the contacts driver factory
-
-
Method Detail
-
getVal
public Value getVal(java.lang.String profileName, java.lang.String dataPointName) throws com.smartgridready.driver.api.common.GenDriverException
Description copied from interface:GenDeviceApiGet a value for a given data point- Parameters:
profileName- The functional profile namedataPointName- The data point name- Returns:
- The value read from the device
- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the device
-
getVal
public Value getVal(java.lang.String profileName, java.lang.String dataPointName, java.util.Properties parameters) throws com.smartgridready.driver.api.common.GenDriverException
Description copied from interface:GenDeviceApiGet a value for a given data point, with request-specific parameters- Parameters:
profileName- The functional profile namedataPointName- The data point nameparameters- Key value pairs with request parameters- Returns:
- The value read from the device
- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the device
-
setVal
public void setVal(java.lang.String profileName, java.lang.String dataPointName, Value value) throws com.smartgridready.driver.api.common.GenDriverExceptionDescription copied from interface:GenDeviceApiSet a value for a given data point- Parameters:
profileName- The functional profile namedataPointName- The data point namevalue- The value to be set- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the device
-
connect
public void connect() throws com.smartgridready.driver.api.common.GenDriverExceptionDescription copied from interface:GenDeviceApiConnect the device.- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the device
-
disconnect
public void disconnect() throws com.smartgridready.driver.api.common.GenDriverExceptionDescription copied from interface:GenDeviceApiDisconnect the device.- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the device
-
isConnected
public boolean isConnected()
Description copied from interface:GenDeviceApiChecks if the device is connected.- Returns:
- true if connected, false otherwise
-
findProfile
protected java.util.Optional<com.smartgridready.ns.v0.ContactFunctionalProfile> findProfile(java.lang.String profileName)
Description copied from class:SGrDeviceBaseFinds a functional profile by name.- Specified by:
findProfilein classSGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,com.smartgridready.ns.v0.ContactFunctionalProfile,com.smartgridready.ns.v0.DataPointBase>- Parameters:
profileName- the name of the functional profile- Returns:
- an optional functional profile
-
findDataPointForProfile
protected java.util.Optional<com.smartgridready.ns.v0.DataPointBase> findDataPointForProfile(com.smartgridready.ns.v0.ContactFunctionalProfile functionalProfile, java.lang.String dataPointName)Description copied from class:SGrDeviceBaseFinds a data point of a given functional profile by name.- Specified by:
findDataPointForProfilein classSGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,com.smartgridready.ns.v0.ContactFunctionalProfile,com.smartgridready.ns.v0.DataPointBase>- Parameters:
functionalProfile- the functional profiledataPointName- the name of the data point to find- Returns:
- an optional data point
-
-