Class DataPoint


  • public class DataPoint
    extends java.lang.Object
    Implements a generic data point facade.
    • 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)
      Constructs a data point.
    • 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()
      Tells if the device interface supports subscribe/unsubscribe.
      java.lang.Integer getArrayLen()
      Gets the number of array elements of the data point value.
      DataTypeInfo getDataType()
      Gets the data type.
      java.util.List<DynamicRequestParameter> getDynamicRequestParameters()
      Gets the available dynamic request parameters that need to be provided as Properties when calling the method GenDeviceApi.getVal(String, String, Properties).
      java.lang.String getFunctionalProfileName()
      Gets the functional profile name.
      java.util.List<GenericAttribute> getGenericAttributes()
      Gets the generic attributes of the data point.
      java.lang.Double getMaximumValue()
      Gets the maximal allowed data point value for setVal().
      java.lang.Double getMinimumValue()
      Gets the maximal allowed data point value for setVal().
      java.lang.String getName()
      Gets the data point name.
      com.smartgridready.ns.v0.DataDirectionProduct getPermissions()
      Gets the read-write permissions of the data point.
      com.smartgridready.ns.v0.Units getUnit()
      Gets the unit of measurement.
      Value getVal()
      Read the value from this data point.
      Value getVal​(long timeoutMs)
      Gets a value from the device by reading.
      Value getVal​(java.util.Properties parameters)
      Read the value from this data point, with request-specific parameters.
      Value getVal​(java.util.Properties parameters, long timeoutMs)
      Gets a value from the device by reading.
      void setVal​(Value value)
      Write a value to the data point.
      void 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.
      void unsubscribe()
      Unsubscribes from messages that are related to a given data point.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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)
        Constructs a data point.
        Parameters:
        name - the data point name
        functionalProfileName - the functional profile name
        dataType - the data type and range
        unit - the unit of measurement
        permissions - the read-write permissions
        minimumValue - the minimal allowed value
        maximumValue - the maximal allowed value
        arrayLen - the number of array elements, if the value is an array
        genericAttributes - the generic attributes
        dynamicRequestParameters - the dynamic request parameters
        genDeviceApi - the device interface
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the data point name.
        Returns:
        The data point name
      • getFunctionalProfileName

        public java.lang.String getFunctionalProfileName()
        Gets the functional profile name.
        Returns:
        The functional profile name
      • getDataType

        public DataTypeInfo getDataType()
        Gets the data type.
        Returns:
        The data type name and range
      • getUnit

        public com.smartgridready.ns.v0.Units getUnit()
        Gets the unit of measurement.
        Returns:
        The units of the data point value
      • getPermissions

        public com.smartgridready.ns.v0.DataDirectionProduct getPermissions()
        Gets the read-write permissions of the data point.
        Returns:
        The RW permissions
      • getMinimumValue

        public java.lang.Double getMinimumValue()
        Gets the maximal allowed data point value for setVal().
        Returns:
        The minimal allowed value
      • getMaximumValue

        public java.lang.Double getMaximumValue()
        Gets the maximal allowed data point value for setVal().
        Returns:
        The maximal allowed value
      • getArrayLen

        public java.lang.Integer getArrayLen()
        Gets the number of array elements of the data point value.
        Returns:
        The array length if the data point represents an array of values, otherwise null
      • getGenericAttributes

        public java.util.List<GenericAttribute> getGenericAttributes()
        Gets the generic attributes of the data point.
        Returns:
        A list of generic attributes for this data point.
      • 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 delivered by the device.
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - On a generic error
        RestApiResponseParseException - If the web service response could not be parsed
        com.smartgridready.driver.api.modbus.GenDriverModbusException - If the modbus command could not be processed
        RestApiServiceCallException - If web service call failed
        com.smartgridready.driver.api.modbus.GenDriverSocketException - If the COM port socket unexpectedly closed
        java.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 delivered by the device.
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - On a generic error
        RestApiResponseParseException - If the web service response could not be parsed
        com.smartgridready.driver.api.modbus.GenDriverModbusException - If the modbus command could not be processed
        RestApiServiceCallException - If web service call failed
        com.smartgridready.driver.api.modbus.GenDriverSocketException - If the COM port socket unexpectedly closed
        java.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 to write
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - On a generic error
        RestApiResponseParseException - If the web service response could not be parsed
        com.smartgridready.driver.api.modbus.GenDriverModbusException - If the modbus command could not be processed
        RestApiServiceCallException - If web service call failed
        com.smartgridready.driver.api.modbus.GenDriverSocketException - If the COM port socket unexpectedly closed
        java.io.IOException - On generic IO operation errors
      • 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:
        parameters - the dynamic request 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()
        Tells if the device interface supports subscribe/unsubscribe.
        Returns:
        true if