Class SGrRestApiDevice

    • Method Detail

      • connect

        public void connect()
                     throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Connect the device.
        Specified by:
        connect in interface GenDeviceApi
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • disconnect

        public void disconnect()
                        throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Disconnect the device.
        Specified by:
        disconnect in interface GenDeviceApi
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • isConnected

        public boolean isConnected()
        Description copied from interface: GenDeviceApi
        Checks if the device is connected.
        Specified by:
        isConnected in interface GenDeviceApi
        Returns:
        true if connected, false otherwise
      • getVal

        public Value getVal​(java.lang.String profileName,
                            java.lang.String dataPointName)
                     throws java.io.IOException,
                            RestApiServiceCallException,
                            RestApiResponseParseException,
                            com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi4Rest
        Reads a value in its string representation from the REST API device.
        Specified by:
        getVal in interface GenDeviceApi
        Specified by:
        getVal in interface GenDeviceApi4Rest
        Parameters:
        profileName - The name of the functional profile.
        dataPointName - The name of the data point within the functional profile.
        Returns:
        The value read from the device.
        Throws:
        java.io.IOException - If the communication with the server failed.
        RestApiServiceCallException - If the service call could not be executed on the remote side.
        RestApiResponseParseException - If parsing of the service response failed.
        com.smartgridready.driver.api.common.GenDriverException - If a common error occured.
      • getVal

        public Value getVal​(java.lang.String profileName,
                            java.lang.String dataPointName,
                            java.util.Properties parameters)
                     throws java.io.IOException,
                            RestApiServiceCallException,
                            RestApiResponseParseException,
                            com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi4Rest
        Reads a value in its string representation from the REST API device.
        Specified by:
        getVal in interface GenDeviceApi
        Specified by:
        getVal in interface GenDeviceApi4Rest
        Parameters:
        profileName - The name of the functional profile.
        dataPointName - The name of the data point within the functional profile.
        parameters - Key value pairs with request parameters
        Returns:
        The value read from the device.
        Throws:
        java.io.IOException - If the communication with the server failed.
        RestApiServiceCallException - If the service call could not be executed on the remote side.
        RestApiResponseParseException - If parsing of the service response failed.
        com.smartgridready.driver.api.common.GenDriverException - If a common error occurred.
      • setVal

        public void setVal​(java.lang.String profileName,
                           java.lang.String dataPointName,
                           Value value)
                    throws java.io.IOException,
                           RestApiServiceCallException,
                           RestApiResponseParseException,
                           com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi4Rest
        Writes a value to the REST API device. The value may be provided as:
        • single string value
        • http request body on json or XML
        depending on the value parameter defined in the external interface XML.
        Specified by:
        setVal in interface GenDeviceApi
        Specified by:
        setVal in interface GenDeviceApi4Rest
        Parameters:
        profileName - The name of the functional profile.
        dataPointName - The name of the data point within the functional profile.
        value - The value to be written. Will replace the value tagged with [[value]] within the external interface RestApiServiceCall element for the given data point.
        Throws:
        java.io.IOException - If the communication with the server failed.
        RestApiServiceCallException - If the service call could not be executed on the remote side.
        RestApiResponseParseException - If parsing of the service response failed.
        com.smartgridready.driver.api.common.GenDriverException - If a common error occurred.
      • findProfile

        protected java.util.Optional<com.smartgridready.ns.v0.RestApiFunctionalProfile> findProfile​(java.lang.String profileName)
        Specified by:
        findProfile in class SGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,​com.smartgridready.ns.v0.RestApiFunctionalProfile,​com.smartgridready.ns.v0.RestApiDataPoint>
      • findDataPointForProfile

        protected java.util.Optional<com.smartgridready.ns.v0.RestApiDataPoint> findDataPointForProfile​(com.smartgridready.ns.v0.RestApiFunctionalProfile aProfile,
                                                                                                        java.lang.String aDataPointName)
        Specified by:
        findDataPointForProfile in class SGrDeviceBase<com.smartgridready.ns.v0.DeviceFrame,​com.smartgridready.ns.v0.RestApiFunctionalProfile,​com.smartgridready.ns.v0.RestApiDataPoint>