org.openmuc.jmbus
public final class MBusSap extends java.lang.Object
Constructor and Description |
---|
MBusSap(java.lang.String serialPort)
Creates an M-Bus Service Access Point that is used to read meters.
|
Modifier and Type | Method and Description |
---|---|
void |
applicationReset(java.lang.String meterAddr) |
void |
applicationReset(java.lang.String meterAddr,
byte subCode) |
void |
close()
Closes the serial port.
|
int |
getTimeout()
Returns the timeout in ms.
|
void |
open(int initialBaudRate)
Opens the serial port.
|
VariableDataResponse |
read(java.lang.String meterAddress)
Sends a data request to the remote device and returns the Variable Data Response received.
|
void |
setTimeout(int timeout)
Sets the maximum time in ms to wait for new data from the remote device.
|
public MBusSap(java.lang.String serialPort)
serialPort
- examples for serial port identifiers are on Linux "/dev/ttyS0" or "/dev/ttyUSB0" and on Windows "COM1"public void setTimeout(int timeout)
timeout
- the maximum time in ms to wait for new data.public int getTimeout()
public void open(int initialBaudRate) throws java.io.IOException
initialBaudRate
- java.io.IOException
- if any kind of error occurs opening the serial port.public void close()
public VariableDataResponse read(java.lang.String meterAddress) throws java.io.IOException
meterAddress
- e.g. p1 or s...java.io.IOException
- if any kind of error (including timeout) occurs while trying to read the remote device. Note that the
connection is not closed when an IOException is thrown.public void applicationReset(java.lang.String meterAddr) throws java.io.IOException, java.util.concurrent.TimeoutException
java.io.IOException
java.util.concurrent.TimeoutException
public void applicationReset(java.lang.String meterAddr, byte subCode) throws java.io.IOException, java.util.concurrent.TimeoutException
java.io.IOException
java.util.concurrent.TimeoutException