@@ -22,6 +22,7 @@ use super::{security::AuxiliarySecurityHeader, EncodeError};
2222///
2323/// [MAC frame format start at 5.2]: http://ecee.colorado.edu/~liue/teaching/comm_standards/2015S_zigbee/802.15.4-2011.pdf
2424#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
25+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
2526pub struct Header {
2627 // * Frame Control Field * /
2728 /// Frame Type
@@ -51,6 +52,12 @@ pub struct Header {
5152 /// present.
5253 pub pan_id_compress : bool ,
5354
55+ /// Suppress sequence number
56+ pub seq_no_suppress : bool ,
57+
58+ /// Information element present
59+ pub ie_present : bool ,
60+
5461 /// Frame version
5562 pub version : FrameVersion ,
5663
@@ -122,8 +129,14 @@ impl TryRead<'_> for Header {
122129 let pan_id_compress =
123130 ( ( bits & mask:: PAN_ID_COMPRESS ) >> offset:: PAN_ID_COMPRESS ) as u8 ;
124131
132+ let seq_no_suppress =
133+ ( ( bits & mask:: SEQ_NO_SUPPRESS ) >> offset:: SEQ_NO_SUPPRESS ) as u8 ;
134+ let ie_present =
135+ ( ( bits & mask:: IE_PRESENT ) >> offset:: IE_PRESENT ) as u8 ;
136+
125137 let dest_addr_mode =
126138 ( ( bits & mask:: DEST_ADDR_MODE ) >> offset:: DEST_ADDR_MODE ) as u8 ;
139+
127140 let version = ( ( bits & mask:: VERSION ) >> offset:: VERSION ) as u8 ;
128141 let src_addr_mode =
129142 ( ( bits & mask:: SRC_ADDR_MODE ) >> offset:: SRC_ADDR_MODE ) as u8 ;
@@ -140,6 +153,8 @@ impl TryRead<'_> for Header {
140153 let frame_pending = frame_pending > 0 ;
141154 let ack_request = ack_request > 0 ;
142155 let pan_id_compress = pan_id_compress > 0 ;
156+ let seq_no_suppress = seq_no_suppress > 0 ;
157+ let ie_present = ie_present > 0 ;
143158
144159 /* Decode header depending on Frame Control Fields */
145160
@@ -202,6 +217,8 @@ impl TryRead<'_> for Header {
202217 frame_pending,
203218 ack_request,
204219 pan_id_compress,
220+ seq_no_suppress,
221+ ie_present,
205222 version,
206223 seq,
207224 destination,
@@ -295,6 +312,7 @@ where
295312/// let pan_id = PanId(0x0123);
296313/// ```
297314#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
315+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
298316pub struct PanId ( pub u16 ) ;
299317
300318impl PanId {
@@ -332,6 +350,7 @@ impl TryRead<'_> for PanId {
332350/// let short_address = ShortAddress(0x0123);
333351/// ```
334352#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
353+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
335354pub struct ShortAddress ( pub u16 ) ;
336355
337356impl ShortAddress {
@@ -371,6 +390,7 @@ impl TryRead<'_> for ShortAddress {
371390/// let ext_address = ExtendedAddress(0x0123456789abcdef);
372391/// ```
373392#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
393+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
374394pub struct ExtendedAddress ( pub u64 ) ;
375395
376396impl ExtendedAddress {
@@ -400,6 +420,7 @@ impl TryRead<'_> for ExtendedAddress {
400420
401421/// An address that might contain an PAN ID and address
402422#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
423+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
403424pub enum Address {
404425 /// Short (16-bit) address and PAN ID (16-bit)
405426 Short ( PanId , ShortAddress ) ,
@@ -408,6 +429,7 @@ pub enum Address {
408429}
409430
410431#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
432+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
411433enum AddressEncoding {
412434 Normal ,
413435 Compressed ,
0 commit comments