42 lines
969 B
Java
Raw Normal View History

2020-09-01 20:52:26 +02:00
package de.hottis.mbusMaster;
import java.util.Properties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MbusMaster {
static final String PROPS_FILENAME = "mbusMaster.props";
static final Logger logger = LogManager.getRootLogger();
public static void main(String[] args) throws Exception {
logger.info("MbusMaster starting");
/*
final Properties config = new Properties();
try (FileInputStream propsFileInputStream = new FileInputStream(PROPS_FILENAME)) {
config.load(propsFileInputStream);
}
logger.debug("Configuration loaded");
*/
2020-09-02 18:08:25 +02:00
MbusgwChild mbusgw = new MbusgwChild(false);
2020-09-02 15:47:23 +02:00
mbusgw.start();
2020-09-01 20:52:26 +02:00
2020-09-02 15:47:23 +02:00
mbusgw.sendRequest((byte)0x5b, (byte)80);
2020-09-01 20:52:26 +02:00
2020-09-02 15:47:23 +02:00
byte[] frame = mbusgw.collectResponse();
2020-09-01 20:52:26 +02:00
for (byte x : frame) {
System.out.print(Integer.toHexString(Byte.toUnsignedInt(x)) + " ");
}
System.out.println();
2020-09-02 15:47:23 +02:00
System.out.println("Stopping mbusgw process");
mbusgw.stop();
2020-09-01 20:52:26 +02:00
}
}