Class DataPoint
- java.lang.Object
-
- com.smartgridready.communicator.common.api.dto.DataPoint
-
public class DataPoint extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected GenDeviceApi
genDeviceApi
-
Constructor Summary
Constructors Constructor Description DataPoint(java.lang.String name, java.lang.String functionalProfileName, DataTypeInfo dataType, com.smartgridready.ns.v0.Units unit, com.smartgridready.ns.v0.DataDirectionProduct permissions, java.lang.Double minimumValue, java.lang.Double maximumValue, java.lang.Integer arrayLen, java.util.List<GenericAttribute> genericAttributes, java.util.List<DynamicRequestParameter> dynamicRequestParameters, GenDeviceApi genDeviceApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
authenticate()
Deprecated, for removal: This API element is subject to removal in a future version.Since version 2.1.0.boolean
canSubscribe()
java.lang.Integer
getArrayLen()
DataTypeInfo
getDataType()
java.util.List<DynamicRequestParameter>
getDynamicRequestParameters()
java.lang.String
getFunctionalProfileName()
java.util.List<GenericAttribute>
getGenericAttributes()
java.lang.Double
getMaximumValue()
java.lang.Double
getMinimumValue()
java.lang.String
getName()
com.smartgridready.ns.v0.DataDirectionProduct
getPermissions()
com.smartgridready.ns.v0.Units
getUnit()
Value
getVal()
Read the value from this data pointValue
getVal(long timeoutMs)
Gets a value from the device by reading This operation is supported for messaging devices onlyValue
getVal(java.util.Properties parameters)
Read the value from this data point, with request-specific parametersValue
getVal(java.util.Properties parameters, long timeoutMs)
Gets a value from the device by reading This operation is supported for messaging devices onlyvoid
setVal(Value value)
Write a value to the data pointvoid
subscribe(java.util.function.Consumer<io.vavr.control.Either<java.lang.Throwable,Value>> callbackFunction)
Subscribes to messages that are related to the given data point This operation is supported for messaging devices onlyvoid
unsubscribe()
Unsubscribes from messages that are related to a given data point This operation is supported for messaging devices only
-
-
-
Field Detail
-
genDeviceApi
protected final GenDeviceApi genDeviceApi
-
-
Constructor Detail
-
DataPoint
public DataPoint(java.lang.String name, java.lang.String functionalProfileName, DataTypeInfo dataType, com.smartgridready.ns.v0.Units unit, com.smartgridready.ns.v0.DataDirectionProduct permissions, java.lang.Double minimumValue, java.lang.Double maximumValue, java.lang.Integer arrayLen, java.util.List<GenericAttribute> genericAttributes, java.util.List<DynamicRequestParameter> dynamicRequestParameters, GenDeviceApi genDeviceApi)
-
-
Method Detail
-
getName
public java.lang.String getName()
- Returns:
- The data point name
-
getFunctionalProfileName
public java.lang.String getFunctionalProfileName()
- Returns:
- The functional profile name
-
getDataType
public DataTypeInfo getDataType()
- Returns:
- The data type name and range
-
getUnit
public com.smartgridready.ns.v0.Units getUnit()
- Returns:
- The units of the data point value
-
getPermissions
public com.smartgridready.ns.v0.DataDirectionProduct getPermissions()
- Returns:
- The RW permissions
-
getMinimumValue
public java.lang.Double getMinimumValue()
- Returns:
- The minimum allowed value for
setVal()
-
getMaximumValue
public java.lang.Double getMaximumValue()
- Returns:
- The maximum allowed value for
setVal()
-
getArrayLen
public java.lang.Integer getArrayLen()
- Returns:
- The array length if the data point represents an array of values.
-
getGenericAttributes
public java.util.List<GenericAttribute> getGenericAttributes()
- Returns:
- A list of generic attributes for this data point.
-
getDynamicRequestParameters
public java.util.List<DynamicRequestParameter> getDynamicRequestParameters()
- Returns:
- A list of the request parameters that need to be provided as
Properties
when calling the methodGenDeviceApi.getVal(String, String, Properties)
-
getVal
public Value getVal() throws com.smartgridready.driver.api.common.GenDriverException, RestApiResponseParseException, com.smartgridready.driver.api.modbus.GenDriverModbusException, RestApiServiceCallException, com.smartgridready.driver.api.modbus.GenDriverSocketException, java.io.IOException
Read the value from this data point- Returns:
- The value read.
- Throws:
com.smartgridready.driver.api.common.GenDriverException
- On a generic errorRestApiResponseParseException
- If the web service response could not be parsedcom.smartgridready.driver.api.modbus.GenDriverModbusException
- If the modbus command could not be processedRestApiServiceCallException
- If web service call failedcom.smartgridready.driver.api.modbus.GenDriverSocketException
- If the COM port socket unexpectedly closedjava.io.IOException
- On generic IO operation errors
-
getVal
public Value getVal(java.util.Properties parameters) throws com.smartgridready.driver.api.common.GenDriverException, RestApiResponseParseException, com.smartgridready.driver.api.modbus.GenDriverModbusException, RestApiServiceCallException, com.smartgridready.driver.api.modbus.GenDriverSocketException, java.io.IOException
Read the value from this data point, with request-specific parameters- Parameters:
parameters
- Key value pairs with request parameters- Returns:
- The value read.
- Throws:
com.smartgridready.driver.api.common.GenDriverException
- On a generic errorRestApiResponseParseException
- If the web service response could not be parsedcom.smartgridready.driver.api.modbus.GenDriverModbusException
- If the modbus command could not be processedRestApiServiceCallException
- If web service call failedcom.smartgridready.driver.api.modbus.GenDriverSocketException
- If the COM port socket unexpectedly closedjava.io.IOException
- On generic IO operation errors
-
setVal
public void setVal(Value value) throws com.smartgridready.driver.api.common.GenDriverException, RestApiResponseParseException, com.smartgridready.driver.api.modbus.GenDriverModbusException, RestApiServiceCallException, com.smartgridready.driver.api.modbus.GenDriverSocketException, java.io.IOException
Write a value to the data point- Parameters:
value
- The value- Throws:
com.smartgridready.driver.api.common.GenDriverException
- On a generic errorRestApiResponseParseException
- If the web service response could not be parsedcom.smartgridready.driver.api.modbus.GenDriverModbusException
- If the modbus command could not be processedRestApiServiceCallException
- If web service call failedcom.smartgridready.driver.api.modbus.GenDriverSocketException
- If the COM port socket unexpectedly closedjava.io.IOException
- On generic IO operation errors
-
authenticate
@Deprecated(since="2.1.0", forRemoval=true) public void authenticate() throws RestApiResponseParseException, RestApiAuthenticationException, RestApiServiceCallException, java.io.IOException
Deprecated, for removal: This API element is subject to removal in a future version.Since version 2.1.0.Does the authentication to access the web service if needed. Note: can be removed, as this is already covered by connect()- Throws:
RestApiResponseParseException
- If the authentication response could not be parsedRestApiAuthenticationException
- If the authentication could not be performedRestApiServiceCallException
- If the REST API service call failedjava.io.IOException
- If an IO operation error occurred
-
getVal
public Value getVal(long timeoutMs) throws com.smartgridready.driver.api.common.GenDriverException
Gets a value from the device by reading This operation is supported for messaging devices only- Parameters:
timeoutMs
- The read timeout in milliseconds- Returns:
- The value received from the device
- Throws:
com.smartgridready.driver.api.common.GenDriverException
- if an error occurs
-
getVal
public Value getVal(java.util.Properties parameters, long timeoutMs) throws com.smartgridready.driver.api.common.GenDriverException
Gets a value from the device by reading This operation is supported for messaging devices only- Parameters:
timeoutMs
- The read timeout in milliseconds- Returns:
- The value received from the device
- Throws:
com.smartgridready.driver.api.common.GenDriverException
- if an error occurs
-
subscribe
public void subscribe(java.util.function.Consumer<io.vavr.control.Either<java.lang.Throwable,Value>> callbackFunction) throws com.smartgridready.driver.api.common.GenDriverException
Subscribes to messages that are related to the given data point This operation is supported for messaging devices only- Parameters:
callbackFunction
- A callback function that provides the received value- Throws:
com.smartgridready.driver.api.common.GenDriverException
- if an error occurs
-
unsubscribe
public void unsubscribe() throws com.smartgridready.driver.api.common.GenDriverException
Unsubscribes from messages that are related to a given data point This operation is supported for messaging devices only- Throws:
com.smartgridready.driver.api.common.GenDriverException
- if an error occurs
-
canSubscribe
public boolean canSubscribe()
-
-