Skip to content

Commit ff77dc3

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Revert "Merge pull request ARMmbed#8299 from hasnainvirk/issue_8285"
This reverts commit b666cd6, reversing changes made to a9f4323.
1 parent a6651b8 commit ff77dc3

File tree

5 files changed

+14
-25
lines changed

5 files changed

+14
-25
lines changed

features/lorawan/LoRaWANBase.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ class LoRaWANBase {
493493
* other negative error code if request failed:
494494
* LORAWAN_STATUS_NOT_INITIALIZED if system is not initialized with initialize(),
495495
* LORAWAN_STATUS_BUSY if the send cannot be canceled
496-
* LORAWAN_STATUS_NO_OP if the operation cannot be completed (nothing to cancel)
497496
*/
498497
virtual lorawan_status_t cancel_sending(void) = 0;
499498
};

features/lorawan/LoRaWANStack.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,15 @@ lorawan_status_t LoRaWANStack::stop_sending(void)
272272
return LORAWAN_STATUS_NOT_INITIALIZED;
273273
}
274274

275-
lorawan_status_t status = _loramac.clear_tx_pipe();
276-
277-
if (status == LORAWAN_STATUS_OK) {
275+
if (_loramac.clear_tx_pipe() == LORAWAN_STATUS_OK) {
278276
_ctrl_flags &= ~TX_DONE_FLAG;
279277
_ctrl_flags &= ~TX_ONGOING_FLAG;
280278
_loramac.set_tx_ongoing(false);
281279
_device_current_state = DEVICE_STATE_IDLE;
282280
return LORAWAN_STATUS_OK;
283281
}
284282

285-
return status;
283+
return LORAWAN_STATUS_BUSY;
286284
}
287285

288286
int16_t LoRaWANStack::handle_tx(const uint8_t port, const uint8_t *data,
@@ -296,6 +294,11 @@ int16_t LoRaWANStack::handle_tx(const uint8_t port, const uint8_t *data,
296294
if (!null_allowed && !data) {
297295
return LORAWAN_STATUS_PARAMETER_INVALID;
298296
}
297+
// add a link check request with normal data, until the application
298+
// explicitly removes it.
299+
if (_link_check_requested) {
300+
_loramac.setup_link_check_request();
301+
}
299302

300303
if (!_lw_session.active) {
301304
return LORAWAN_STATUS_NO_ACTIVE_SESSIONS;
@@ -305,12 +308,6 @@ int16_t LoRaWANStack::handle_tx(const uint8_t port, const uint8_t *data,
305308
return LORAWAN_STATUS_WOULD_BLOCK;
306309
}
307310

308-
// add a link check request with normal data, until the application
309-
// explicitly removes it.
310-
if (_link_check_requested) {
311-
_loramac.setup_link_check_request();
312-
}
313-
314311
lorawan_status_t status;
315312

316313
if (_loramac.nwk_joined() == false) {

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ LoRaMac::LoRaMac()
7777
_mlme_indication(),
7878
_mlme_confirmation(),
7979
_is_nwk_joined(false),
80-
_can_cancel_tx(true),
8180
_continuous_rx2_window_open(false),
8281
_device_class(CLASS_A)
8382
{
@@ -1031,16 +1030,11 @@ int LoRaMac::get_backoff_timer_event_id(void)
10311030

10321031
lorawan_status_t LoRaMac::clear_tx_pipe(void)
10331032
{
1034-
if (!_can_cancel_tx) {
1035-
return LORAWAN_STATUS_BUSY;
1036-
}
1037-
10381033
// check if the event is not already queued
10391034
const int id = get_backoff_timer_event_id();
1040-
10411035
if (id == 0) {
10421036
// No queued send request
1043-
return LORAWAN_STATUS_NO_OP;
1037+
return LORAWAN_STATUS_OK;
10441038
}
10451039

10461040
if (_ev_queue->time_left(id) > 0) {
@@ -1098,7 +1092,6 @@ lorawan_status_t LoRaMac::schedule_tx()
10981092
case LORAWAN_STATUS_DUTYCYCLE_RESTRICTED:
10991093
if (backoff_time != 0) {
11001094
tr_debug("DC enforced: Transmitting in %lu ms", backoff_time);
1101-
_can_cancel_tx = true;
11021095
_lora_time.start(_params.timers.backoff_timer, backoff_time);
11031096
}
11041097
return LORAWAN_STATUS_OK;
@@ -1161,7 +1154,6 @@ lorawan_status_t LoRaMac::schedule_tx()
11611154
_params.is_srv_ack_requested = false;
11621155
}
11631156

1164-
_can_cancel_tx = false;
11651157
return send_frame_on_channel(_params.channel);
11661158
}
11671159

@@ -1246,7 +1238,6 @@ bool LoRaMac::tx_ongoing()
12461238

12471239
void LoRaMac::set_tx_ongoing(bool ongoing)
12481240
{
1249-
_can_cancel_tx = true;
12501241
_ongoing_tx_msg.tx_ongoing = ongoing;
12511242
}
12521243

features/lorawan/lorastack/mac/LoRaMac.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,6 @@ class LoRaMac {
669669

670670
bool _is_nwk_joined;
671671

672-
bool _can_cancel_tx;
673-
674672
bool _continuous_rx2_window_open;
675673

676674
device_class_t _device_class;

features/lorawan/lorawan_types.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ typedef enum lorawan_status {
9898
LORAWAN_STATUS_CRYPTO_FAIL = -1014, /**< Service not started - crypto failure */
9999
LORAWAN_STATUS_PORT_INVALID = -1015, /**< Invalid port */
100100
LORAWAN_STATUS_CONNECT_IN_PROGRESS = -1016, /**< Services started - Connection in progress */
101-
LORAWAN_STATUS_NO_ACTIVE_SESSIONS = -1017, /**< Services not started - No active session */
101+
LORAWAN_STATUS_NO_ACTIVE_SESSIONS = -1017, /**< Services not started - No active session */
102102
LORAWAN_STATUS_IDLE = -1018, /**< Services started - Idle at the moment */
103-
LORAWAN_STATUS_NO_OP = -1019, /**< Cannot perform requested operation */
103+
#if defined(LORAWAN_COMPLIANCE_TEST)
104+
//Deprecated - will replace the code -1019 with something
105+
//else in future.
106+
LORAWAN_STATUS_COMPLIANCE_TEST_ON = -1019, /**< Compliance test - is on-going */
107+
#endif
104108
LORAWAN_STATUS_DUTYCYCLE_RESTRICTED = -1020, /**< Transmission will continue after duty cycle backoff*/
105109
LORAWAN_STATUS_NO_CHANNEL_FOUND = -1021, /**< None of the channels is enabled at the moment*/
106110
LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND = -1022, /**< None of the enabled channels is ready for another TX (duty cycle limited)*/

0 commit comments

Comments
 (0)