Skip to content

Commit

Permalink
feat(cbus): added support for deprecated binary state status request
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Jul 13, 2022
1 parent 505eb67 commit b56ad32
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 5 deletions.
2 changes: 2 additions & 0 deletions plc4go/protocols/cbus/readwrite/model/StatusRequest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,4 @@ public static boolean knowsSALCommandTypeContainer(ReadBuffer readBuffer) {
}
}

public static boolean moreThanOneByteLeft(ReadBuffer readBuffer) {
return readBuffer.hasMore(16);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -773,5 +773,19 @@ void strangeNotYetParsableCommandResponse() throws Exception {
byte[] bytes1 = writeBuffer.getBytes();
assertThat(bytes1).isEqualTo(bytes);
}

@Test
void statusRequestBinaryState() throws Exception {
byte[] bytes = "\\05FF00FAFF00v\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
cBusOptions = new CBusOptions(false, false, false, false, false, false, false, false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions, bytes.length);
assertThat(msg).isNotNull();
System.out.println(msg);
CBusMessageToServer messageToServer = (CBusMessageToServer) msg;
RequestCommand requestCommand = (RequestCommand) messageToServer.getRequest();
CBusCommand cbusCommand = requestCommand.getCbusCommand();
System.out.println(cbusCommand);
}
}
}
9 changes: 7 additions & 2 deletions protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
Original file line number Diff line number Diff line change
Expand Up @@ -1228,12 +1228,17 @@
[type StatusRequest
[peek byte statusType ]
[typeSwitch statusType
['0x7A' StatusRequestBinaryState
['0x7A' *BinaryState
[reserved byte '0x7A' ]
[simple byte application ]
[reserved byte '0x00' ]
]
['0x73' StatusRequestLevel
['0xFA' *BinaryStateDeprecated
[reserved byte '0xFA' ]
[simple byte application ]
[reserved byte '0x00' ]
]
['0x73' *Level
[reserved byte '0x73' ]
[reserved byte '0x07' ]
[simple byte application ]
Expand Down

0 comments on commit b56ad32

Please sign in to comment.