public class MBusMaster extends Object implements Iterable<GenericDevice>, Sender, JSONSerializable, Closeable
DEFAULT_SEND_TRIES
Constructor and Description |
---|
MBusMaster() |
Modifier and Type | Method and Description |
---|---|
boolean |
addDevice(GenericDevice device) |
GenericDevice |
addDeviceByAddress(byte address) |
void |
cancel() |
void |
clearDevices() |
void |
close() |
void |
deselectBySecondaryAddress() |
int |
deviceCount() |
int |
deviceIndexOf(GenericDevice d) |
void |
fromJSON(net.sf.json.JSONObject json) |
Connection |
getConnection() |
static DataBlock |
getDataBlock(Frame frame,
ValueRequestPointLocator locator) |
GenericDevice |
getDevice(int i) |
static GenericDevice |
getDevice(Iterable<GenericDevice> deviceList,
ValueRequestPointLocator locator) |
GenericDevice[] |
getDevices() |
long |
getIdleTime()
Idle time is 33 bit periods see M-Bus doc chaper 5.4
|
long |
getLastByteSended() |
long |
getResponseTimeout()
Timeout is 330 bit periods + 50ms see M-Bus doc chaper 5.4 2 times max
(256) packet size added
|
long |
getShortResponseTimeout() |
Iterator<GenericDevice> |
iterator() |
Closeable |
open() |
static MBusMaster |
readJsonStream(InputStream is) |
UserDataResponse |
readResponse(byte address) |
UserDataResponse |
readResponseBySecondary(int bcdId,
String man,
Byte version,
MBusMedium medium,
int maxTries) |
void |
readValues(ValueRequest<?> requests) |
GenericDevice[] |
searchDevicesByPrimaryAddress()
Search by primary address (0..250) 253 is for slave select 254 broadcast
addres to all devices
|
GenericDevice[] |
searchDevicesByPrimaryAddress(byte first,
byte last) |
GenericDevice[] |
searchDevicesBySecondaryAddressing(int maxTries) |
boolean |
selectDevice(int bcdMaskedId,
short maskedMan,
byte maskedVersion,
byte maskedMedium,
int maxTries) |
boolean |
selectDevice(MBusResponseFramesContainer dev) |
Frame |
send(Frame frame,
int maxTries,
long timeout) |
Frame |
sendInitSlave(byte address) |
Frame |
sendRequestUserData(byte address) |
Map<GenericDevice,Frame> |
sendRequestUserData(Map<GenericDevice,MBusAddressing> devices) |
Map<GenericDevice,Frame> |
sendRequestUserData(MBusAddressing addressing) |
int |
sendSlaveSelect(int bcdMaskedId,
short maskedMan,
byte maskedVersion,
byte maskedMedium,
int maxTries) |
void |
setConnection(Connection conn) |
net.sf.json.JSONObject |
toJSON(JsonSerializeType jsonSerializeType) |
GenericDevice[] |
widcardSearch(int bcdMaskedId,
short bcdMaskedMan,
byte bcdMaskedVersion,
byte bcdMaskedMedium,
int maxTries) |
void |
writeJsonStream(FileOutputStream os) |
public void cancel()
public static GenericDevice getDevice(Iterable<GenericDevice> deviceList, ValueRequestPointLocator locator)
public static DataBlock getDataBlock(Frame frame, ValueRequestPointLocator locator)
public Connection getConnection()
public void writeJsonStream(FileOutputStream os) throws UnsupportedEncodingException, IOException
public long getLastByteSended()
public boolean addDevice(GenericDevice device)
device
- public GenericDevice addDeviceByAddress(byte address) throws InterruptedException, IOException
InterruptedException
IOException
public int deviceIndexOf(GenericDevice d)
public void clearDevices()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void deselectBySecondaryAddress()
public int deviceCount()
public GenericDevice getDevice(int i)
public GenericDevice[] getDevices()
public long getIdleTime()
public long getResponseTimeout()
public long getShortResponseTimeout()
public Iterator<GenericDevice> iterator()
iterator
in interface Iterable<GenericDevice>
public GenericDevice[] searchDevicesBySecondaryAddressing(int maxTries) throws IOException, InterruptedException
IOException
InterruptedException
public GenericDevice[] searchDevicesByPrimaryAddress() throws IOException, InterruptedException
IOException
InterruptedException
public GenericDevice[] searchDevicesByPrimaryAddress(byte first, byte last) throws IOException, InterruptedException
IOException
InterruptedException
public Frame send(Frame frame, int maxTries, long timeout) throws IOException, InterruptedException
send
in interface Sender
IOException
InterruptedException
public Map<GenericDevice,Frame> sendRequestUserData(MBusAddressing addressing) throws IOException, InterruptedException
IOException
InterruptedException
public Frame sendInitSlave(byte address) throws IOException, InterruptedException
IOException
InterruptedException
public Frame sendRequestUserData(byte address) throws IOException, InterruptedException
IOException
InterruptedException
public Map<GenericDevice,Frame> sendRequestUserData(Map<GenericDevice,MBusAddressing> devices) throws IOException, InterruptedException
IOException
InterruptedException
public int sendSlaveSelect(int bcdMaskedId, short maskedMan, byte maskedVersion, byte maskedMedium, int maxTries) throws IOException, InterruptedException
IOException
InterruptedException
public void setConnection(Connection conn)
public Closeable open() throws IOException
IOException
public GenericDevice[] widcardSearch(int bcdMaskedId, short bcdMaskedMan, byte bcdMaskedVersion, byte bcdMaskedMedium, int maxTries) throws IOException, InterruptedException
IOException
InterruptedException
public UserDataResponse readResponseBySecondary(int bcdId, String man, Byte version, MBusMedium medium, int maxTries) throws IOException, InterruptedException
IOException
InterruptedException
public UserDataResponse readResponse(byte address) throws IOException, InterruptedException
IOException
InterruptedException
public boolean selectDevice(int bcdMaskedId, short maskedMan, byte maskedVersion, byte maskedMedium, int maxTries) throws IOException, InterruptedException
IOException
InterruptedException
public boolean selectDevice(MBusResponseFramesContainer dev) throws IOException, InterruptedException
IOException
InterruptedException
public void readValues(ValueRequest<?> requests) throws IOException, InterruptedException
IOException
InterruptedException
public static MBusMaster readJsonStream(InputStream is) throws IOException
IOException
public void fromJSON(net.sf.json.JSONObject json)
fromJSON
in interface JSONSerializable
public net.sf.json.JSONObject toJSON(JsonSerializeType jsonSerializeType)
toJSON
in interface JSONSerializable
Copyright © 2009–2014 MBus4J. All rights reserved.