Interface GenDeviceApi
-
- All Known Subinterfaces:
GenDeviceApi4Messaging,GenDeviceApi4Modbus,GenDeviceApi4Rest
- All Known Implementing Classes:
SGrContactsDevice,SGrDeviceBase,SGrGenericDevice,SGrMessagingDevice,SGrModbusDevice,SGrRestApiDevice
public interface GenDeviceApiDefines the generic API supported by all SGr device types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanSubscribe()Checks whether the device can subscribe to data points.voidconnect()Connect the device.voiddisconnect()Disconnect the device.DataPointgetDataPoint(java.lang.String functionalProfileName, java.lang.String dataPointName)Get a data pointjava.util.List<DataPoint>getDataPoints(java.lang.String functionalProfileName)Get all data points of a functional profilejava.util.List<ConfigurationValue>getDeviceConfigurationInfo()Get the device interface configuration parametersDeviceInfogetDeviceInfo()Get device informationFunctionalProfilegetFunctionalProfile(java.lang.String functionalProfileName)Get a functional profilejava.util.List<FunctionalProfile>getFunctionalProfiles()Get all functional profilesValuegetVal(java.lang.String profileName, java.lang.String dataPointName)Get a value for a given data pointValuegetVal(java.lang.String profileName, java.lang.String dataPointName, java.util.Properties parameters)Get a value for a given data point, with request-specific parametersjava.util.List<DataPointValue>getValues()Get value of all data points in one gobooleanisConnected()Checks if the device is connected.voidsetVal(java.lang.String profileName, java.lang.String dataPointName, Value value)Set a value for a given data pointvoidsubscribe(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 pointvoidunsubscribe(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 namedataPointName- The data point name- Returns:
- The value read from the device
- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the devicecom.smartgridready.driver.api.modbus.GenDriverSocketException- A connection error occurredcom.smartgridready.driver.api.modbus.GenDriverModbusException- The modbus command returned an error codeRestApiServiceCallException- The REST API service call failedRestApiResponseParseException- The REST API response could not be parsedjava.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 namedataPointName- The data point nameparameters- 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 devicecom.smartgridready.driver.api.modbus.GenDriverSocketException- A connection error occurredcom.smartgridready.driver.api.modbus.GenDriverModbusException- The modbus command returned an error codeRestApiServiceCallException- The REST API service call failedRestApiResponseParseException- The REST API response could not be parsedjava.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.IOExceptionSet a value for a given data point- Parameters:
profileName- The functional profile namedataPointName- The data point namevalue- The value to be set- Throws:
com.smartgridready.driver.api.common.GenDriverException- Generic error while reading from the devicecom.smartgridready.driver.api.modbus.GenDriverSocketException- A connection error occurredcom.smartgridready.driver.api.modbus.GenDriverModbusException- The modbus command returned an error codeRestApiServiceCallException- The REST API service call failedRestApiResponseParseException- The REST API response could not be parsedjava.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 profiledataPointName- 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.GenDriverExceptionConnect 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.GenDriverExceptionDisconnect 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.GenDriverExceptionSubscribes to messages that are related to the given data point- Parameters:
profileName- The functional profile namedataPointName- The data point namecallbackFunction- 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.GenDriverExceptionUnsubscribes from messages that are related to a given data point- Parameters:
profileName- The functional profile namedataPointName- 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
-
-