org.openmuc.core.driver
Interface DeviceDriverInterface

All Known Implementing Classes:
CANopenDriver, EHZDriverImpl, MBusDriverImpl, ModbusDriverImpl, S7PLCDriverImpl, SunnyWebboxDriverImpl, WagoDriverImpl

public interface DeviceDriverInterface

Interface that all openMUC i/o drivers have to implement. Drivers that implement this interface can be plugged into the framework


Field Summary
static int ERROR_INVALID_MESSAGE
           
static int ERROR_TIMEOUT
           
static int IO_ERROR
           
 
Method Summary
 void configureInterface(java.lang.String iface, java.lang.String configStr)
          Configure the interface.
 java.util.List<ChannelInformation> getDeviceChannels(DeviceURI url)
          Scan a device for available channels This operation is optional and my not be supported by specific drivers
 java.util.List<DeviceURI> getDeviceList(BusURI url)
          Scan the bus for connected meters This operation is optional and my not be supported by specific drivers
 java.lang.String getDriverID()
           
 java.util.List<java.lang.String> getSupportedOperations()
          Get a list of supported operations by the driver.
 void readDeviceAsync(DeviceURI url, java.util.List<ChannelIdentifier> channels, DataReceivedListener callback, java.lang.Object handle)
           
 java.util.List<Measurement> readDeviceSync(DeviceURI url, java.util.List<ChannelIdentifier> channels)
           
 void writeChannel(DeviceURI url, ChannelIdentifier channel, double value)
          Write a channel/register on connected meter / device / i/o
 

Field Detail

ERROR_TIMEOUT

static final int ERROR_TIMEOUT
See Also:
Constant Field Values

ERROR_INVALID_MESSAGE

static final int ERROR_INVALID_MESSAGE
See Also:
Constant Field Values

IO_ERROR

static final int IO_ERROR
See Also:
Constant Field Values
Method Detail

configureInterface

void configureInterface(java.lang.String iface,
                        java.lang.String configStr)
                        throws NoSuchInterfaceException,
                               MethodNotImplementedException,
                               java.io.IOException
Configure the interface.

Parameters:
iface - Interface descriptor. E.g. com1 for "/dev/ttyS0" usb1 for "/dev/ttyUSB0"
configStr - Configuration data for interface e.g. "setting=2400-7N1" mbus:com1:p1?setting=2400-7N1
Throws:
NoSuchInterfaceException - if the interface is not present
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException

getSupportedOperations

java.util.List<java.lang.String> getSupportedOperations()
Get a list of supported operations by the driver. This list does not contain the mandatory operations.

Returns:
List of the supported optional operation names

getDriverID

java.lang.String getDriverID()

getDeviceList

java.util.List<DeviceURI> getDeviceList(BusURI url)
                                        throws MethodNotImplementedException,
                                               java.io.IOException
Scan the bus for connected meters This operation is optional and my not be supported by specific drivers

Parameters:
url -
Returns:
List of URLs of connected meters or null if this operation is not supported by the driver.
Throws:
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException

getDeviceChannels

java.util.List<ChannelInformation> getDeviceChannels(DeviceURI url)
                                                     throws MethodNotImplementedException,
                                                            java.io.IOException
Scan a device for available channels This operation is optional and my not be supported by specific drivers

Parameters:
url -
Returns:
List of Strings of assigned channels for a meters or null if this operation is not supported by the driver.
Throws:
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException

readDeviceAsync

void readDeviceAsync(DeviceURI url,
                     java.util.List<ChannelIdentifier> channels,
                     DataReceivedListener callback,
                     java.lang.Object handle)
                     throws MethodNotImplementedException
Parameters:
url - URL of the device
channels - List of channels to readout. If channels == null all channels will be read.
callback - Callback object if task finished or error/timeout occured.
Throws:
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException

readDeviceSync

java.util.List<Measurement> readDeviceSync(DeviceURI url,
                                           java.util.List<ChannelIdentifier> channels)
                                           throws MethodNotImplementedException,
                                                  java.io.IOException
Parameters:
url -
channels -
Throws:
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException

writeChannel

void writeChannel(DeviceURI url,
                  ChannelIdentifier channel,
                  double value)
                  throws MethodNotImplementedException,
                         java.io.IOException
Write a channel/register on connected meter / device / i/o

Parameters:
url - - URL of the device in a driver specific format
channel - - channel to write to
value - - value to write to register
Throws:
MethodNotImplementedException - if method is not implemented by driver
java.io.IOException