Interface GenDeviceApi

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canSubscribe()
      Checks whether the device can subscribe to data points.
      void connect()
      Connect the device.
      void disconnect()
      Disconnect the device.
      DataPoint getDataPoint​(java.lang.String functionalProfileName, java.lang.String dataPointName)
      Get a data point
      java.util.List<DataPoint> getDataPoints​(java.lang.String functionalProfileName)
      Get all data points of a functional profile
      java.util.List<ConfigurationValue> getDeviceConfigurationInfo()
      Get the device interface configuration parameters
      DeviceInfo getDeviceInfo()
      Get device information
      FunctionalProfile getFunctionalProfile​(java.lang.String functionalProfileName)
      Get a functional profile
      java.util.List<FunctionalProfile> getFunctionalProfiles()
      Get all functional profiles
      Value getVal​(java.lang.String profileName, java.lang.String dataPointName)
      Get a value for a given data point
      Value getVal​(java.lang.String profileName, java.lang.String dataPointName, java.util.Properties parameters)
      Get a value for a given data point, with request-specific parameters
      java.util.List<DataPointValue> getValues()
      Get value of all data points in one go
      boolean isConnected()
      Checks if the device is connected.
      void setVal​(java.lang.String profileName, java.lang.String dataPointName, Value value)
      Set a value for a given data point
      void subscribe​(java.lang.String profileName, java.lang.String dataPointName, 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​(java.lang.String profileName, java.lang.String dataPointName)
      Unsubscribes from messages that are related to a given data point
    • Method Detail

      • getVal

        Value getVal​(java.lang.String profileName,
                     java.lang.String dataPointName)
              throws com.smartgridready.driver.api.common.GenDriverException,
                     com.smartgridready.driver.api.modbus.GenDriverSocketException,
                     com.smartgridready.driver.api.modbus.GenDriverModbusException,
                     RestApiServiceCallException,
                     RestApiResponseParseException,
                     java.io.IOException
        Get a value for a given data point
        Parameters:
        profileName - The functional profile name
        dataPointName - 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
        com.smartgridready.driver.api.modbus.GenDriverSocketException - A connection error occurred
        com.smartgridready.driver.api.modbus.GenDriverModbusException - The modbus command returned an error code
        RestApiServiceCallException - The REST API service call failed
        RestApiResponseParseException - The REST API response could not be parsed
        java.io.IOException - Generic communication exception occurred
      • getVal

        Value getVal​(java.lang.String profileName,
                     java.lang.String dataPointName,
                     java.util.Properties parameters)
              throws com.smartgridready.driver.api.common.GenDriverException,
                     com.smartgridready.driver.api.modbus.GenDriverSocketException,
                     com.smartgridready.driver.api.modbus.GenDriverModbusException,
                     RestApiServiceCallException,
                     RestApiResponseParseException,
                     java.io.IOException
        Get a value for a given data point, with request-specific parameters
        Parameters:
        profileName - The functional profile name
        dataPointName - The data point name
        parameters - 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
        com.smartgridready.driver.api.modbus.GenDriverSocketException - A connection error occurred
        com.smartgridready.driver.api.modbus.GenDriverModbusException - The modbus command returned an error code
        RestApiServiceCallException - The REST API service call failed
        RestApiResponseParseException - The REST API response could not be parsed
        java.io.IOException - Generic communication exception occurred
      • setVal

        void setVal​(java.lang.String profileName,
                    java.lang.String dataPointName,
                    Value value)
             throws com.smartgridready.driver.api.common.GenDriverException,
                    com.smartgridready.driver.api.modbus.GenDriverSocketException,
                    com.smartgridready.driver.api.modbus.GenDriverModbusException,
                    RestApiServiceCallException,
                    RestApiResponseParseException,
                    java.io.IOException
        Set a value for a given data point
        Parameters:
        profileName - The functional profile name
        dataPointName - The data point name
        value - The value to be set
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
        com.smartgridready.driver.api.modbus.GenDriverSocketException - A connection error occurred
        com.smartgridready.driver.api.modbus.GenDriverModbusException - The modbus command returned an error code
        RestApiServiceCallException - The REST API service call failed
        RestApiResponseParseException - The REST API response could not be parsed
        java.io.IOException - Generic communication exception occurred
      • getValues

        java.util.List<DataPointValue> getValues()
                                          throws com.smartgridready.driver.api.common.GenDriverException
        Get value of all data points in one go
        Returns:
        The values read from the device, by data point
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getDeviceInfo

        DeviceInfo getDeviceInfo()
                          throws com.smartgridready.driver.api.common.GenDriverException
        Get device information
        Returns:
        The device information
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getDeviceConfigurationInfo

        java.util.List<ConfigurationValue> getDeviceConfigurationInfo()
        Get the device interface configuration parameters
        Returns:
        The configuration parameter list
      • getFunctionalProfiles

        java.util.List<FunctionalProfile> getFunctionalProfiles()
                                                         throws com.smartgridready.driver.api.common.GenDriverException
        Get all functional profiles
        Returns:
        The functional profiles
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getFunctionalProfile

        FunctionalProfile getFunctionalProfile​(java.lang.String functionalProfileName)
                                        throws com.smartgridready.driver.api.common.GenDriverException
        Get a functional profile
        Parameters:
        functionalProfileName - The name of the functional profile
        Returns:
        The functional profile
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getDataPoints

        java.util.List<DataPoint> getDataPoints​(java.lang.String functionalProfileName)
                                         throws com.smartgridready.driver.api.common.GenDriverException
        Get all data points of a functional profile
        Parameters:
        functionalProfileName - The name of the functional profile
        Returns:
        The data points
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getDataPoint

        DataPoint getDataPoint​(java.lang.String functionalProfileName,
                               java.lang.String dataPointName)
                        throws com.smartgridready.driver.api.common.GenDriverException
        Get a data point
        Parameters:
        functionalProfileName - The name of the functional profile
        dataPointName - The name of the data point
        Returns:
        The data point
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • connect

        void connect()
              throws com.smartgridready.driver.api.common.GenDriverException
        Connect the device.
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • disconnect

        void disconnect()
                 throws com.smartgridready.driver.api.common.GenDriverException
        Disconnect the device.
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • isConnected

        boolean isConnected()
        Checks if the device is connected.
        Returns:
        true if connected, false otherwise
      • subscribe

        void subscribe​(java.lang.String profileName,
                       java.lang.String dataPointName,
                       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
        Parameters:
        profileName - The functional profile name
        dataPointName - The data point name
        callbackFunction - A callback function that provides the received value
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - if an error occurs
      • unsubscribe

        void unsubscribe​(java.lang.String profileName,
                         java.lang.String dataPointName)
                  throws com.smartgridready.driver.api.common.GenDriverException
        Unsubscribes from messages that are related to a given data point
        Parameters:
        profileName - The functional profile name
        dataPointName - The data point name
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - if an error occurs
      • canSubscribe

        boolean canSubscribe()
        Checks whether the device can subscribe to data points.
        Returns:
        true if subscribe possible, false otherwise