This commit is contained in:
Wolfgang Hottgenroth 2020-09-05 18:48:07 +02:00
parent c1a7ad5b6d
commit 10f6ddb08b
Signed by: wn
GPG Key ID: B586EAFCDF2F65F4

View File

@ -31,14 +31,16 @@ public class MbusMaster {
logger.debug("Shutdown hook added"); logger.debug("Shutdown hook added");
*/ */
MbusgwChild mbusgw = new MbusgwChild(false); MbusgwChild mbusgw = new MbusgwChild(true);
mbusgw.start(); mbusgw.start();
byte[] devices = { (byte)80, (byte)81, (byte)82, (byte)83, (byte)84, (byte)85, (byte)86, (byte)87 }; byte[] devices = { (byte)84, (byte)87, (byte)82, (byte)83, (byte)80, (byte)85, (byte)86, (byte)81 };
int cnt = 0; int cnt = 0;
int errCnt = 0;
int successCnt = 0;
while (! stopSignal) { while (! stopSignal) {
System.out.println("--- " + cnt + " ----------------------------------------------------"); System.out.println("--- " + cnt + " - " + successCnt + " - " + errCnt + " ---------------------------------------------------");
cnt++; cnt++;
for (byte device : devices) { for (byte device : devices) {
System.out.println("Querying device " + device); System.out.println("Querying device " + device);
@ -50,14 +52,16 @@ public class MbusMaster {
System.out.print(Integer.toHexString(Byte.toUnsignedInt(x)) + " "); System.out.print(Integer.toHexString(Byte.toUnsignedInt(x)) + " ");
} }
System.out.println(); System.out.println();
successCnt++;
} catch (IOException e) { } catch (IOException e) {
errCnt++;
logger.error("Error " + e.toString() + " in Meterbus dialog for device " + device); logger.error("Error " + e.toString() + " in Meterbus dialog for device " + device);
} }
} }
// if (cnt >= 10) { // if (cnt >= 10) {
// break; // break;
//} //}
Thread.sleep(15*1000); Thread.sleep(5*1000);
} }
logger.info("Stopping mbusgw process"); logger.info("Stopping mbusgw process");