Class SGrDeviceBase<D extends com.smartgridready.ns.v0.DeviceFrame,​F extends com.smartgridready.ns.v0.FunctionalProfileBase,​P extends com.smartgridready.ns.v0.DataPointBase>

    • Field Detail

      • device

        protected final D extends com.smartgridready.ns.v0.DeviceFrame device
    • Constructor Detail

      • SGrDeviceBase

        protected SGrDeviceBase​(D device)
    • Method Detail

      • findProfile

        protected abstract java.util.Optional<F> findProfile​(java.lang.String profileName)
      • findDataPointForProfile

        protected abstract java.util.Optional<P> findDataPointForProfile​(F functionalProfile,
                                                                         java.lang.String dataPointName)
      • findDataPoint

        protected P findDataPoint​(java.lang.String profileName,
                                  java.lang.String dataPointName)
                           throws com.smartgridready.driver.api.common.GenDriverException
        Throws:
        com.smartgridready.driver.api.common.GenDriverException
      • checkOutOfRange

        public void checkOutOfRange​(Value[] values,
                                    com.smartgridready.ns.v0.DataPointBase dataPoint)
                             throws com.smartgridready.driver.api.common.GenDriverException
        Throws:
        com.smartgridready.driver.api.common.GenDriverException
      • checkReadWritePermission

        public void checkReadWritePermission​(com.smartgridready.ns.v0.DataPointBase dataPoint,
                                             SGrDeviceBase.RwpDirections direction)
                                      throws com.smartgridready.driver.api.common.GenDriverException
        Throws:
        com.smartgridready.driver.api.common.GenDriverException
      • checkOutOfRange

        protected java.util.Optional<java.lang.String> checkOutOfRange​(Value[] values,
                                                                       double limit,
                                                                       SGrDeviceBase.Comparator comparator)
                                                                throws com.smartgridready.driver.api.common.GenDriverException
        Throws:
        com.smartgridready.driver.api.common.GenDriverException
      • getDeviceInfo

        public DeviceInfo getDeviceInfo()
                                 throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Get device information
        Specified by:
        getDeviceInfo in interface GenDeviceApi
        Returns:
        The device information
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - Generic error while reading from the device
      • getFunctionalProfiles

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

        public FunctionalProfile getFunctionalProfile​(java.lang.String functionalProfileName)
                                               throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Get a functional profile
        Specified by:
        getFunctionalProfile in interface GenDeviceApi
        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

        public java.util.List<DataPoint> getDataPoints​(java.lang.String functionalProfileName)
                                                throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Get all data points of a functional profile
        Specified by:
        getDataPoints in interface GenDeviceApi
        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

        public DataPoint getDataPoint​(java.lang.String functionalProfileName,
                                      java.lang.String dataPointName)
                               throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: GenDeviceApi
        Get a data point
        Specified by:
        getDataPoint in interface GenDeviceApi
        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
      • getValues

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

        public boolean canSubscribe()
        Description copied from interface: GenDeviceApi
        Checks whether the device can subscribe to data points.
        Specified by:
        canSubscribe in interface GenDeviceApi
        Returns:
        true if subscribe possible, false otherwise
      • subscribe

        public 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
        Description copied from interface: GenDeviceApi
        Subscribes to messages that are related to the given data point
        Specified by:
        subscribe in interface GenDeviceApi
        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

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

        protected static <P extends com.smartgridready.ns.v0.DataPointBase> Value applyUnitConversion​(P dataPoint,
                                                                                                      Value value,
                                                                                                      java.util.function.DoubleBinaryOperator conversionFunction)
      • isNumeric

        protected static boolean isNumeric​(Value value)
      • divide

        protected static double divide​(double dividend,
                                       double divisor)
      • multiply

        protected static double multiply​(double factor1,
                                         double factor2)