Skip to content

Commit

Permalink
Fixed issue in unconfirmed_retransmission behavior
Browse files Browse the repository at this point in the history
Fixed issue on LoRaWANStack based on lorawan v1.0.2 specification page
24 line 25-27. The specification mentioned that that end-device shall
stop retransmission when receiving ANY downlink on RX1 or RX2 window.

- Removed conflicting behavior in
  LoRaWANStack::post_process_tx_with_reception()
- Updated comment section of nb_trials at lorawan_data_structures.h
  • Loading branch information
Zulkarnaen authored and zul00 committed Feb 11, 2022
1 parent c6d814e commit 1e92543
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
29 changes: 6 additions & 23 deletions connectivity/lorawan/source/LoRaWANStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,29 +619,12 @@ void LoRaWANStack::post_process_tx_with_reception()
}
}
} else {
// handle UNCONFIRMED case here, RX slots were turned off due to
// valid packet reception.
uint8_t prev_QOS_level = _loramac.get_prev_QOS_level();
uint8_t QOS_level = _loramac.get_QOS_level();

// We will not apply QOS on the post-processing of the previous
// outgoing message as we would have received QOS instruction in response
// to that particular message
if (QOS_level > LORAWAN_DEFAULT_QOS && _qos_cnt < QOS_level
&& (prev_QOS_level == QOS_level)) {
_ctrl_flags &= ~TX_DONE_FLAG;
const int ret = _queue->call(this, &LoRaWANStack::state_controller,
DEVICE_STATE_SCHEDULING);
MBED_ASSERT(ret != 0);
(void) ret;
_qos_cnt++;
tr_info("QOS: repeated transmission #%d queued", _qos_cnt);
} else {
_loramac.post_process_mcps_req();
_ctrl_flags |= TX_DONE_FLAG;
make_tx_metadata_available();
state_controller(DEVICE_STATE_STATUS_CHECK);
}
// On reception, end-device shall stop sending retransmission as stated in lorawan v1.0.2
// specification, page 24, line 25-27
_loramac.post_process_mcps_req();
_ctrl_flags |= TX_DONE_FLAG;
make_tx_metadata_available();
state_controller(DEVICE_STATE_STATUS_CHECK);
}
}

Expand Down
2 changes: 1 addition & 1 deletion connectivity/lorawan/system/lorawan_data_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ typedef struct {
*
* Provides a certain QOS level set by network server in LinkADRReq MAC
* command. The device will transmit the given UNCONFIRMED message nb_trials
* time with same frame counter until a downlink is received. Standard defined
* time with the same frame counter OR until a downlink is received. Standard defined
* range is 1:15. Data rates will NOT be adapted according to chapter 18.4.
*/
uint8_t nb_trials;
Expand Down

0 comments on commit 1e92543

Please sign in to comment.