zigbee_core/aps/frame/command/
verify_key.rs1use zigbee_macros::impl_byte;
2use zigbee_types::ByteArray;
3use zigbee_types::IeeeAddress;
4
5impl_byte! {
6 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
8 pub struct VerifyKey {
9 pub key_type: u8,
11 pub source_address: IeeeAddress,
13 pub hash: ByteArray<16>,
15 }
16}
17
18#[cfg(test)]
19mod tests {
20 use byte::TryRead;
21 use byte::TryWrite;
22
23 use crate::aps::frame::command::Command;
24
25 #[test]
26 fn round_trip_verify_key() {
27 let frame_buf = [
28 0x0f, 0x04, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
33 0x88, 0x99,
34 ];
35
36 let (cmd, _) = Command::try_read(&frame_buf, ()).unwrap();
37
38 let mut got_buf = [0u8; _];
39 cmd.try_write(&mut got_buf, ()).unwrap();
40
41 assert_eq!(frame_buf, got_buf);
42 }
43}