@@ -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
@@ -120,6 +127,9 @@ impl TryRead<'_> for Header {
120127 let ack_request = ( ( bits & mask:: ACK ) >> offset:: ACK ) as u8 ;
121128 let pan_id_compress = ( ( bits & mask:: PAN_ID_COMPRESS ) >> offset:: PAN_ID_COMPRESS ) as u8 ;
122129
130+ let seq_no_suppress = ( ( bits & mask:: SEQ_NO_SUPPRESS ) >> offset:: SEQ_NO_SUPPRESS ) as u8 ;
131+ let ie_present = ( ( bits & mask:: IE_PRESENT ) >> offset:: IE_PRESENT ) as u8 ;
132+
123133 let dest_addr_mode = ( ( bits & mask:: DEST_ADDR_MODE ) >> offset:: DEST_ADDR_MODE ) as u8 ;
124134 let version = ( ( bits & mask:: VERSION ) >> offset:: VERSION ) as u8 ;
125135 let src_addr_mode = ( ( bits & mask:: SRC_ADDR_MODE ) >> offset:: SRC_ADDR_MODE ) as u8 ;
@@ -136,6 +146,8 @@ impl TryRead<'_> for Header {
136146 let frame_pending = frame_pending > 0 ;
137147 let ack_request = ack_request > 0 ;
138148 let pan_id_compress = pan_id_compress > 0 ;
149+ let seq_no_suppress = seq_no_suppress > 0 ;
150+ let ie_present = ie_present > 0 ;
139151
140152 /* Decode header depending on Frame Control Fields */
141153
@@ -189,6 +201,8 @@ impl TryRead<'_> for Header {
189201 frame_pending,
190202 ack_request,
191203 pan_id_compress,
204+ seq_no_suppress,
205+ ie_present,
192206 version,
193207 seq,
194208 destination,
@@ -278,6 +292,7 @@ where
278292/// let pan_id = PanId(0x0123);
279293/// ```
280294#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
295+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
281296pub struct PanId ( pub u16 ) ;
282297
283298impl PanId {
@@ -315,6 +330,7 @@ impl TryRead<'_> for PanId {
315330/// let short_address = ShortAddress(0x0123);
316331/// ```
317332#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
333+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
318334pub struct ShortAddress ( pub u16 ) ;
319335
320336impl ShortAddress {
@@ -354,6 +370,7 @@ impl TryRead<'_> for ShortAddress {
354370/// let ext_address = ExtendedAddress(0x0123456789abcdef);
355371/// ```
356372#[ derive( Clone , Copy , Debug , Eq , Hash , Hash32 , PartialEq ) ]
373+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
357374pub struct ExtendedAddress ( pub u64 ) ;
358375
359376impl ExtendedAddress {
@@ -383,6 +400,7 @@ impl TryRead<'_> for ExtendedAddress {
383400
384401/// An address that might contain an PAN ID and address
385402#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
403+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
386404pub enum Address {
387405 /// Short (16-bit) address and PAN ID (16-bit)
388406 Short ( PanId , ShortAddress ) ,
@@ -391,6 +409,7 @@ pub enum Address {
391409}
392410
393411#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
412+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
394413enum AddressEncoding {
395414 Normal ,
396415 Compressed ,
0 commit comments