Skip to content

Commit 192007b

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
Fixed MAC Asynch message send and header build bug.
1 parent e0494b7 commit 192007b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

source/MAC/IEEE802_15_4/mac_header_helper_functions.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool mac_dst_panid_present(const mac_fcf_sequence_t *header)
6060
presents = true;
6161
}
6262

63-
} else if (header->DstAddrMode) {
63+
} else if (header->DstAddrMode && !header->SrcAddrMode) {
6464
if (header->frameVersion == MAC_FRAME_VERSION_2015) {
6565
if (!header->intraPan) {
6666
presents = true;
@@ -69,9 +69,11 @@ bool mac_dst_panid_present(const mac_fcf_sequence_t *header)
6969
presents = true;
7070
}
7171

72-
} else {
72+
} else if (!header->DstAddrMode && !header->SrcAddrMode) {
7373
if (header->frameVersion == MAC_FRAME_VERSION_2015) {
74-
presents = true;
74+
if (!header->intraPan) {
75+
presents = true;
76+
}
7577
}
7678
}
7779

@@ -665,9 +667,14 @@ static uint8_t *mac_payload_ie_terimate(uint8_t *ptr)
665667

666668
void mac_header_information_elements_preparation(mac_pre_build_frame_t *buffer)
667669
{
670+
if (buffer->message_builded) {
671+
return;
672+
}
673+
668674
if (buffer->headerIeLength || buffer->payloadsIeLength) {
669675
buffer->fcf_dsn.frameVersion = MAC_FRAME_VERSION_2015;
670676
buffer->fcf_dsn.informationElementsPresets = true;
677+
buffer->message_builded = true;
671678
//Write Header elements
672679
if (buffer->headerIeLength) {
673680
buffer->mac_header_length_with_security += buffer->headerIeLength;

source/MAC/IEEE802_15_4/mac_mcps_sap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ typedef struct mac_pre_build_frame{
128128
bool upper_layer_request;
129129
bool mac_allocated_payload_ptr:1;
130130
bool asynch_request:1;
131+
bool message_builded:1;
131132
unsigned security_mic_len:5; //Max possible lengths 0, 4, 8, 16 bytes
132133
unsigned priority:2;
133134
struct mac_pre_build_frame *next; //Pointer for queue purpose

0 commit comments

Comments
 (0)