Skip to content

Commit

Permalink
feat(protocols/c-bus): added ExtendedFormatStatusReply
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Mar 1, 2022
1 parent ed223d5 commit c34636c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,37 @@ void StandardFormatStatusReply3() throws Exception {
.isNotNull();
System.out.println(msg);
}

// 7.4
@Test
void ExtendedFormatStatusReply1() throws Exception {
byte[] bytes = Hex.decodeHex("F9073800AAAA000095990000000005555000000000005555555548" + CR + LF);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
.isNotNull();
System.out.println(msg);
}

@Test
void ExtendedFormatStatusReply2() throws Exception {
byte[] bytes = Hex.decodeHex("F907380B0000000000005555000000000000000000000000000013" + CR + LF);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
.isNotNull();
System.out.println(msg);
}

@Test
void ExtendedFormatStatusReply3() throws Exception {
byte[] bytes = Hex.decodeHex("f70738160000000000000000000000000000000000000000B4" + CR + LF);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
.isNotNull();
System.out.println(msg);
}
}

}
35 changes: 33 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 @@ -553,7 +553,8 @@
]

[type StandardFormatStatusReply
[simple StatusHeader statusHeader]
[simple StatusHeader
statusHeader ]
[simple Application
application ]
[simple uint 8 blockStart ]
Expand All @@ -568,10 +569,33 @@
]

[type StatusHeader
[reserved uint 2 '1' ]
[reserved uint 2 '3' ]
[simple uint 6 numberOfCharacterPairs ]
]

[type ExtendedFormatStatusReply
[simple ExtendedStatusHeader
statusHeader ]
[simple StatusCoding
coding ]
[simple Application
application ]
[simple uint 8 blockStart ]
[array StatusByte
statusBytes
count
'statusHeader.numberOfCharacterPairs - 3' ]
[simple Checksum
crc ]
[const byte cr 0x0D ] // 0xD == "<cr>"
[const byte lf 0x0A ] // 0xA == "<lf>"
]

[type ExtendedStatusHeader
[reserved uint 3 '7' ]
[simple uint 5 numberOfCharacterPairs ]
]

[type StatusByte
[simple GAVState gav3 ]
[simple GAVState gav2 ]
Expand All @@ -584,4 +608,11 @@
['1' ON ]
['2' OFF ]
['3' ERRO ]
]

[enum byte StatusCoding
['0x00' BINARY_BY_THIS_SERIAL_INTERFACE ]
['0x40' BINARY_BY_ELSEWHERE ]
['0x07' LEVEL_BY_THIS_SERIAL_INTERFACE ]
['0x47' LEVEL_BY_ELSEWHERE ]
]

0 comments on commit c34636c

Please sign in to comment.