From b11e58f84349ba0358278662497cadc5c0c59c8d Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Thu, 7 Oct 2021 13:32:47 +0200 Subject: [PATCH 1/2] pkg/semtech-loramac: forward uplink schedule request to upper layer --- pkg/semtech-loramac/contrib/semtech_loramac.c | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c index 1d19ae02e8..621127b38f 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac.c @@ -698,10 +698,11 @@ void *_semtech_loramac_event_loop(void *arg) MlmeIndication_t *indication = (MlmeIndication_t *)msg.content.ptr; if (indication->MlmeIndication == MLME_SCHEDULE_UPLINK) { DEBUG("[semtech-loramac] MLME indication: schedule an uplink\n"); - uint8_t prev_port = mac->port; - mac->port = 0; - _semtech_loramac_send(mac, NULL, 0); - mac->port = prev_port; +#ifdef MODULE_SEMTECH_LORAMAC_RX + msg_t msg_ret; + msg_ret.content.value = SEMTECH_LORAMAC_TX_SCHEDULE; + msg_send(&msg_ret, mac->rx_pid); +#endif } break; } @@ -787,18 +788,8 @@ void *_semtech_loramac_event_loop(void *arg) /* Check Multicast Check Port - Check Datarate - Check FramePending */ - if (indication->FramePending) { - /* The server signals that it has pending data to be sent. - We schedule an uplink as soon as possible to flush the server. */ - DEBUG("[semtech-loramac] MCPS indication: pending data, schedule an " - "uplink\n"); - uint8_t prev_port = mac->port; - mac->port = 0; - _semtech_loramac_send(mac, NULL, 0); - mac->port = prev_port; - } + Check Datarate */ + #ifdef MODULE_SEMTECH_LORAMAC_RX if (indication->RxData) { DEBUG("[semtech-loramac] MCPS indication: data received\n"); From 00deef37a9c657fb04bc5b08948817c65683c2b7 Mon Sep 17 00:00:00 2001 From: Jose Alamos Date: Thu, 7 Oct 2021 13:33:32 +0200 Subject: [PATCH 2/2] tests/pkg_semtech-loramac: add pending data indication --- tests/pkg_semtech-loramac/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/pkg_semtech-loramac/main.c b/tests/pkg_semtech-loramac/main.c index 78fa6ef438..24b33fd5a3 100644 --- a/tests/pkg_semtech-loramac/main.c +++ b/tests/pkg_semtech-loramac/main.c @@ -60,6 +60,10 @@ static void *_wait_recv(void *arg) puts("Received ACK from network"); break; + case SEMTECH_LORAMAC_TX_SCHEDULE: + puts("The Network Server has pending data"); + break; + default: break; }