Class DataPoint


  • public class DataPoint
    extends java.lang.Object
    • 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)  
    • Field Detail

    • 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.
      • 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 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 read.
        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
        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:
        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()