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
InterruptedExceptionIOExceptionpublic int deviceIndexOf(GenericDevice d)
public void clearDevices()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic 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
IOExceptionInterruptedExceptionpublic GenericDevice[] searchDevicesByPrimaryAddress() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic GenericDevice[] searchDevicesByPrimaryAddress(byte first, byte last) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic Frame send(Frame frame, int maxTries, long timeout) throws IOException, InterruptedException
send in interface SenderIOExceptionInterruptedExceptionpublic Map<GenericDevice,Frame> sendRequestUserData(MBusAddressing addressing) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic Frame sendInitSlave(byte address) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic Frame sendRequestUserData(byte address) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic Map<GenericDevice,Frame> sendRequestUserData(Map<GenericDevice,MBusAddressing> devices) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic int sendSlaveSelect(int bcdMaskedId,
short maskedMan,
byte maskedVersion,
byte maskedMedium,
int maxTries)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic void setConnection(Connection conn)
public Closeable open() throws IOException
IOExceptionpublic GenericDevice[] widcardSearch(int bcdMaskedId, short bcdMaskedMan, byte bcdMaskedVersion, byte bcdMaskedMedium, int maxTries) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic UserDataResponse readResponseBySecondary(int bcdId, String man, Byte version, MBusMedium medium, int maxTries) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic UserDataResponse readResponse(byte address) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic boolean selectDevice(int bcdMaskedId,
short maskedMan,
byte maskedVersion,
byte maskedMedium,
int maxTries)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic boolean selectDevice(MBusResponseFramesContainer dev) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void readValues(ValueRequest<?> requests) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static MBusMaster readJsonStream(InputStream is) throws IOException
IOExceptionpublic void fromJSON(net.sf.json.JSONObject json)
fromJSON in interface JSONSerializablepublic net.sf.json.JSONObject toJSON(JsonSerializeType jsonSerializeType)
toJSON in interface JSONSerializableCopyright © 2009–2014 MBus4J. All rights reserved.