pull/76/head
weetmuts 2020-02-04 14:46:48 +01:00
rodzic 590a94e870
commit 399f357496
3 zmienionych plików z 11 dodań i 13 usunięć

Wyświetl plik

@ -144,13 +144,10 @@ void WMBusCUL::setLinkModes(LinkModeSet lms)
msg[3] = 0xa; msg[3] = 0xa;
msg[4] = 0xd; msg[4] = 0xd;
serial()->send(msg);
usleep(1000*100);
verbose("(cul) set link mode %c\n", msg[2]); verbose("(cul) set link mode %c\n", msg[2]);
bool sent = serial()->send(msg);
sent_command_ = string(&msg[0], &msg[3]); sent_command_ = string(&msg[0], &msg[3]);
received_response_ = ""; received_response_ = "";
bool sent = serial()->send(msg);
if (sent) waitForResponse(); if (sent) waitForResponse();
@ -298,10 +295,6 @@ FrameStatus WMBusCUL::checkCULFrame(vector<uchar> &data,
} }
if (eolp >= data.size()) return PartialFrame; if (eolp >= data.size()) return PartialFrame;
// We got a full line, but if it is too short, then
// there is something wrong. Discard the data.
if (data.size() < 10) return ErrorInFrame;
if (data[0] != 'b') if (data[0] != 'b')
{ {
// C1 and T1 telegrams should start with a 'b' // C1 and T1 telegrams should start with a 'b'

Wyświetl plik

@ -394,6 +394,7 @@ FrameStatus WMBusIM871A::checkIM871AFrame(vector<uchar> &data,
{ {
if (data.size() == 0) return PartialFrame; if (data.size() == 0) return PartialFrame;
if (data[0] != 0xa5) return ErrorInFrame; if (data[0] != 0xa5) return ErrorInFrame;
if (data.size() < 4) return PartialFrame;
int ctrlbits = (data[1] & 0xf0) >> 4; int ctrlbits = (data[1] & 0xf0) >> 4;
if (ctrlbits & 1) return ErrorInFrame; // Bit 1 is reserved, we do not expect it.... if (ctrlbits & 1) return ErrorInFrame; // Bit 1 is reserved, we do not expect it....

Wyświetl plik

@ -13,22 +13,26 @@ public class Analyze {
args[0])); args[0]));
String prevline = reader.readLine(); String prevline = reader.readLine();
String line = reader.readLine(); String line = reader.readLine();
while (line != null) { while (line != null)
if (line.indexOf(match) >= 0) { {
if (line.indexOf(match) >= 0)
{
boolean space = false; boolean space = false;
for (int i=0; i<line.length()-4; i+=2) { for (int i=0; i<line.length()-4; i+=2)
{
if (i < prevline.length()-1 && i < line.length()-1 && if (i < prevline.length()-1 && i < line.length()-1 &&
line.charAt(i) == prevline.charAt(i) && line.charAt(i) == prevline.charAt(i) &&
line.charAt(i+1) == prevline.charAt(i+1)) line.charAt(i+1) == prevline.charAt(i+1))
{ {
space = true; space = true;
System.out.print(" ");
} }
else else
{ {
if (space) { /*if (space) {
System.out.print(" ("+i/2+")"); System.out.print(" ("+i/2+")");
space = false; space = false;
} }*/
System.out.print(line.charAt(i)); System.out.print(line.charAt(i));
System.out.print(line.charAt(i+1)); System.out.print(line.charAt(i+1));
} }