Add support for listening to S1 and S1-m telegrams.

pull/31/head
weetmuts 2019-05-21 10:34:09 +02:00
rodzic da4c471afc
commit 1111ea01bd
4 zmienionych plików z 27 dodań i 3 usunięć

Wyświetl plik

@ -27,6 +27,8 @@
#define LIST_OF_LINK_MODES \ #define LIST_OF_LINK_MODES \
X(Any,--anylinkmode) \ X(Any,--anylinkmode) \
X(C1,--c1) \ X(C1,--c1) \
X(S1,--s1) \
X(S1m,--s1m) \
X(T1,--t1) \ X(T1,--t1) \
X(N1a,--n1a) \ X(N1a,--n1a) \
X(N1b,--n1b) \ X(N1b,--n1b) \

Wyświetl plik

@ -196,6 +196,8 @@ void WMBusAmber::getConfiguration()
void WMBusAmber::setLinkMode(LinkMode lm) { void WMBusAmber::setLinkMode(LinkMode lm) {
if (lm != LinkMode::C1 && if (lm != LinkMode::C1 &&
lm != LinkMode::S1 &&
lm != LinkMode::S1m &&
lm != LinkMode::T1) lm != LinkMode::T1)
{ {
error("LinkMode %d is not implemented for amb8465\n", (int)lm); error("LinkMode %d is not implemented for amb8465\n", (int)lm);
@ -209,9 +211,16 @@ void WMBusAmber::setLinkMode(LinkMode lm) {
sent_command_ = msg[1]; sent_command_ = msg[1];
msg[2] = 1; // Len msg[2] = 1; // Len
if (lm == LinkMode::C1) { if (lm == LinkMode::C1) {
msg[3] = 0x0E; // Reception of C1 and C2 messages msg[3] = 0x0E;
} if (lm == LinkMode::T1) { } else
msg[3] = 0x05; // T1-Meter if (lm == LinkMode::S1) {
msg[3] = 0x01;
} else
if (lm == LinkMode::S1m) {
msg[3] = 0x02;
} else
if (lm == LinkMode::T1) {
msg[3] = 0x05;
} }
msg[4] = xorChecksum(msg, 4); msg[4] = xorChecksum(msg, 4);

Wyświetl plik

@ -166,6 +166,12 @@ LinkMode WMBusIM871A::getLinkMode() {
if (received_payload_[offset] == (int)LinkModeIM871A::C1a) { if (received_payload_[offset] == (int)LinkModeIM871A::C1a) {
lm = LinkMode::C1; lm = LinkMode::C1;
} }
if (received_payload_[offset] == (int)LinkModeIM871A::S1) {
lm = LinkMode::S1;
}
if (received_payload_[offset] == (int)LinkModeIM871A::S1m) {
lm = LinkMode::S1m;
}
if (received_payload_[offset] == (int)LinkModeIM871A::T1) { if (received_payload_[offset] == (int)LinkModeIM871A::T1) {
lm = LinkMode::T1; lm = LinkMode::T1;
} }
@ -268,6 +274,8 @@ LinkMode WMBusIM871A::getLinkMode() {
void WMBusIM871A::setLinkMode(LinkMode lm) void WMBusIM871A::setLinkMode(LinkMode lm)
{ {
if (lm != LinkMode::C1 && if (lm != LinkMode::C1 &&
lm != LinkMode::S1 &&
lm != LinkMode::S1m &&
lm != LinkMode::T1 && lm != LinkMode::T1 &&
lm != LinkMode::N1a && lm != LinkMode::N1a &&
lm != LinkMode::N1b && lm != LinkMode::N1b &&
@ -289,6 +297,10 @@ void WMBusIM871A::setLinkMode(LinkMode lm)
msg[5] = 2; // iff1 bits: Set Radio Mode msg[5] = 2; // iff1 bits: Set Radio Mode
if (lm == LinkMode::C1) { if (lm == LinkMode::C1) {
msg[6] = (int)LinkModeIM871A::C1a; msg[6] = (int)LinkModeIM871A::C1a;
} else if (lm == LinkMode::S1) {
msg[6] = (int)LinkModeIM871A::S1;
} else if (lm == LinkMode::S1m) {
msg[6] = (int)LinkModeIM871A::S1m;
} else if (lm == LinkMode::T1) { } else if (lm == LinkMode::T1) {
msg[6] = (int)LinkModeIM871A::T1; msg[6] = (int)LinkModeIM871A::T1;
} else if (lm == LinkMode::N1a) { } else if (lm == LinkMode::N1a) {

Wyświetl plik

@ -57,6 +57,7 @@
#define HWTEST_MSG_RADIOTEST_REQ 0x01 #define HWTEST_MSG_RADIOTEST_REQ 0x01
#define HWTEST_MSG_RADIOTEST_RSP 0x02 #define HWTEST_MSG_RADIOTEST_RSP 0x02
// LinkModeIM871A::S1 is 0, S1m is 1 etc. These numbers are what the dongle requires.
#define LIST_OF_IM871A_LINK_MODES X(S1)X(S1m)X(S2)X(T1)X(T2)X(R2)X(C1a)X(C1b)X(C2a)X(C2b) \ #define LIST_OF_IM871A_LINK_MODES X(S1)X(S1m)X(S2)X(T1)X(T2)X(R2)X(C1a)X(C1b)X(C2a)X(C2b) \
X(N1A)X(N2A)X(N1B)X(N2B)X(N1C)X(N2C)X(N1D)X(N2D)X(N1E)X(N2E)X(N1F)X(N2F)X(UNKNOWN) X(N1A)X(N2A)X(N1B)X(N2B)X(N1C)X(N2C)X(N1D)X(N2D)X(N1E)X(N2E)X(N1F)X(N2F)X(UNKNOWN)