aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32-wpan/src/mac/indications.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32-wpan/src/mac/indications.rs')
-rw-r--r--embassy-stm32-wpan/src/mac/indications.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/embassy-stm32-wpan/src/mac/indications.rs b/embassy-stm32-wpan/src/mac/indications.rs
index c0b86d745..45f79ac5b 100644
--- a/embassy-stm32-wpan/src/mac/indications.rs
+++ b/embassy-stm32-wpan/src/mac/indications.rs
@@ -7,6 +7,9 @@ use super::typedefs::{
7 PanId, SecurityLevel, 7 PanId, SecurityLevel,
8}; 8};
9 9
10use smoltcp::wire::Ieee802154FrameType;
11use smoltcp::wire::ieee802154::Frame;
12
10/// MLME ASSOCIATE Indication which will be used by the MAC 13/// MLME ASSOCIATE Indication which will be used by the MAC
11/// to indicate the reception of an association request command 14/// to indicate the reception of an association request command
12#[repr(C)] 15#[repr(C)]
@@ -250,6 +253,21 @@ impl DataIndication {
250 } 253 }
251} 254}
252 255
256pub fn write_frame_from_data_indication<'a, T: AsRef<[u8]> + AsMut<[u8]>>(data: &'a DataIndication, buffer: &'a mut T) {
257 let mut frame = Frame::new_unchecked(buffer);
258
259 // TODO: complete frame creation
260 frame.set_frame_type(Ieee802154FrameType::Data);
261 frame.set_dst_addr(data.dst_address.into());
262 frame.set_src_addr(data.src_address.into());
263 frame.set_dst_pan_id(data.dst_pan_id.into());
264 frame.set_src_pan_id(data.src_pan_id.into());
265 frame.set_sequence_number(data.dsn);
266
267 // No way around the copy with the current API
268 frame.payload_mut().unwrap().copy_from_slice(data.payload());
269}
270
253/// MLME POLL Indication which will be used for indicating the Data Request 271/// MLME POLL Indication which will be used for indicating the Data Request
254/// reception to upper layer as defined in Zigbee r22 - D.8.2 272/// reception to upper layer as defined in Zigbee r22 - D.8.2
255#[repr(C)] 273#[repr(C)]