org.openmuc.mbus.driver
Class MBusDriverImpl

java.lang.Object
  extended by org.openmuc.mbus.driver.MBusDriverImpl
All Implemented Interfaces:
DeviceDriverInterface

public class MBusDriverImpl
extends java.lang.Object
implements DeviceDriverInterface


Field Summary
 
Fields inherited from interface org.openmuc.core.driver.DeviceDriverInterface
ERROR_INVALID_MESSAGE, ERROR_TIMEOUT, IO_ERROR
 
Constructor Summary
MBusDriverImpl()
           
 
Method Summary
 int addMeter(java.lang.String meterURL)
           
 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.Vector<OBISData> getMeterValues(int valueSelectionIndicator)
           
 void getMeterValuesRequest(DataReceivedListener listener, int valueSelectionIndicator)
           
 java.util.Vector<java.lang.String> getSupportedOperations()
          Get a list of supported operations by the driver.
 void readDeviceAsync(DeviceURI url, java.util.List<ChannelIdentifier> registers, DataReceivedListener callback, java.lang.Object handle)
           
 java.util.List<Measurement> readDeviceSync(DeviceURI url, java.util.List<ChannelIdentifier> registers)
           
 void shutdown()
           
 void writeChannel(DeviceURI url, ChannelIdentifier register, double value)
          Write a channel/register on connected meter / device / i/o
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBusDriverImpl

public MBusDriverImpl()
Method Detail

addMeter

public int addMeter(java.lang.String meterURL)

getDriverID

public java.lang.String getDriverID()
Specified by:
getDriverID in interface DeviceDriverInterface

getMeterValues

public java.util.Vector<OBISData> getMeterValues(int valueSelectionIndicator)

getMeterValuesRequest

public void getMeterValuesRequest(DataReceivedListener listener,
                                  int valueSelectionIndicator)

getSupportedOperations

public java.util.Vector<java.lang.String> getSupportedOperations()
Description copied from interface: DeviceDriverInterface
Get a list of supported operations by the driver. This list does not contain the mandatory operations.

Specified by:
getSupportedOperations in interface DeviceDriverInterface
Returns:
List of the supported optional operation names

readDeviceAsync

public void readDeviceAsync(DeviceURI url,
                            java.util.List<ChannelIdentifier> registers,
                            DataReceivedListener callback,
                            java.lang.Object handle)
Specified by:
readDeviceAsync in interface DeviceDriverInterface
Parameters:
url - URL of the meter
registers - List of registers to readout. If registers == null all registers will be read.
callback - Callback object if task finished or error/timeout occured.
Throws:
java.io.IOException

configureInterface

public void configureInterface(java.lang.String iface,
                               java.lang.String configStr)
                        throws java.io.IOException
Description copied from interface: DeviceDriverInterface
Configure the interface.

Specified by:
configureInterface in interface DeviceDriverInterface
Parameters:
iface - (eg. "usb0", "com1" etc)
configStr - (eg. "setting=2400-7N1")
Throws:
java.io.IOException

readDeviceSync

public java.util.List<Measurement> readDeviceSync(DeviceURI url,
                                                  java.util.List<ChannelIdentifier> registers)
Specified by:
readDeviceSync in interface DeviceDriverInterface

writeChannel

public void writeChannel(DeviceURI url,
                         ChannelIdentifier register,
                         double value)
                  throws MethodNotImplementedException
Description copied from interface: DeviceDriverInterface
Write a channel/register on connected meter / device / i/o

Specified by:
writeChannel in interface DeviceDriverInterface
Parameters:
url - - URL of the device in a driver specific format
register - - channel to write to
value - - value to write to register
Throws:
MethodNotImplementedException - if method is not implemented by driver

shutdown

public void shutdown()

getDeviceList

public java.util.List<DeviceURI> getDeviceList(BusURI url)
                                        throws MethodNotImplementedException
Description copied from interface: DeviceDriverInterface
Scan the bus for connected meters This operation is optional and my not be supported by specific drivers

Specified by:
getDeviceList in interface DeviceDriverInterface
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

getDeviceChannels

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

Specified by:
getDeviceChannels in interface DeviceDriverInterface
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