From 73ade38528ee211bc50a6370365b395ad682dda6 Mon Sep 17 00:00:00 2001 From: Jan Janak Date: Sat, 19 Mar 2022 23:32:03 -0400 Subject: [PATCH] Implement new McpsRetransmit primitive The primitive will be invoked whenever the LoRaMac-node library retransmits an uplink message. This could be used by the application to get notified of uplink retransmissions. --- src/mac/LoRaMac.c | 5 +++++ src/mac/LoRaMac.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/mac/LoRaMac.c b/src/mac/LoRaMac.c index 03bf4e400..4b96542a4 100644 --- a/src/mac/LoRaMac.c +++ b/src/mac/LoRaMac.c @@ -3442,6 +3442,11 @@ LoRaMacStatus_t SendFrameOnChannel( uint8_t channel ) // Send now Radio.Send( MacCtx.PktBuffer, MacCtx.PktBufferLen ); + if(MacCtx.ChannelsNbTransCounter != 1 && MacCtx.MacPrimitives->MacMcpsRetransmit != NULL) + { + MacCtx.MacPrimitives->MacMcpsRetransmit( ); + } + return LORAMAC_STATUS_OK; } diff --git a/src/mac/LoRaMac.h b/src/mac/LoRaMac.h index e768d0926..901c2f084 100644 --- a/src/mac/LoRaMac.h +++ b/src/mac/LoRaMac.h @@ -2550,6 +2550,12 @@ typedef struct sLoRaMacPrimitives * \param [OUT] MCPS-Confirm parameters */ void ( *MacMcpsConfirm )( McpsConfirm_t* McpsConfirm ); + /*! + * \brief MCPS-Retransmit primitive + * + * \param [OUT] MCPS-Retransmit parameters + */ + void ( *MacMcpsRetransmit )( void ); /*! * \brief MCPS-Indication primitive *