49 lines
1.1 KiB
Java
Raw Normal View History

2020-09-01 20:52:26 +02:00
package de.hottis.mbusMaster;
2020-09-07 17:47:37 +02:00
import java.io.FileInputStream;
2020-09-02 18:43:38 +02:00
import java.io.IOException;
2020-09-01 20:52:26 +02:00
import java.util.Properties;
2020-09-07 10:25:53 +02:00
import java.util.List;
2020-09-07 17:47:37 +02:00
import java.util.concurrent.LinkedBlockingQueue;
2020-09-01 20:52:26 +02:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2020-09-07 10:24:43 +02:00
import org.openmuc.jmbus.DataRecord;
import org.openmuc.jmbus.MBusMessage;
import org.openmuc.jmbus.VariableDataStructure;
2020-09-01 20:52:26 +02:00
public class MbusMaster {
static final Logger logger = LogManager.getRootLogger();
2020-09-02 22:05:43 +02:00
static boolean stopSignal = false;
2020-09-01 20:52:26 +02:00
public static void main(String[] args) throws Exception {
logger.info("MbusMaster starting");
2020-09-07 17:47:37 +02:00
final ConfigProperties config = new ConfigProperties();
2020-09-01 20:52:26 +02:00
2020-09-02 22:05:43 +02:00
/*
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
stopSignal = true;
}));
logger.debug("Shutdown hook added");
*/
2020-09-04 19:35:19 +02:00
2020-09-07 17:47:37 +02:00
LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>();
2020-09-01 20:52:26 +02:00
2020-09-07 17:47:37 +02:00
MbusScheduledQuerier querier = new MbusScheduledQuerier(config, queue);
querier.start();
2020-09-07 10:24:43 +02:00
2020-09-07 17:47:37 +02:00
DummyDequeuer ddq = new DummyDequeuer(queue);
ddq.start();
2020-09-07 10:24:43 +02:00
2020-09-01 20:52:26 +02:00
2020-09-07 17:47:37 +02:00
querier.join();
ddq.join();
logger.info("MbusMaster terminating");
2020-09-01 20:52:26 +02:00
}
}