From dd1c09173695191334e83fa5c75a5e26668d713e 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 91e303b35..461ca61dd 100644 --- a/src/mac/LoRaMac.c +++ b/src/mac/LoRaMac.c @@ -3331,6 +3331,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 ef408ca8e..390c35be9 100644 --- a/src/mac/LoRaMac.h +++ b/src/mac/LoRaMac.h @@ -2476,6 +2476,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 *