From 2ccbb7479f6d8550e9b9873c9a18893f64d9dbb4 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN Date: Mon, 3 Apr 2023 19:06:41 +0200 Subject: [PATCH 1/3] fix comment format --- Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h index 31885118..cf4315e9 100644 --- a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h +++ b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h @@ -394,7 +394,7 @@ LmHandlerErrorStatus_t LmHandlerPingSlotReq( uint8_t periodicity ); * * \retval status Returns \ref LORAMAC_HANDLER_SUCCESS if request has been * processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED - else \ref LORAMAC_HANDLER_ERROR + * else \ref LORAMAC_HANDLER_ERROR */ LmHandlerErrorStatus_t LmHandlerRequestClass( DeviceClass_t newClass ); From 78bc3c4a6dfd3ad5725995e4f934616a2f83d3f0 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN Date: Mon, 3 Apr 2023 19:08:05 +0200 Subject: [PATCH 2/3] Add return status for LmHandlerJoin function --- .../Third_Party/LoRaWAN/LmHandler/LmHandler.c | 22 +++++++++++++++---- .../Third_Party/LoRaWAN/LmHandler/LmHandler.h | 6 ++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c index cc8c67b6..604a6227 100644 --- a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c +++ b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c @@ -589,8 +589,10 @@ TimerTime_t LmHandlerGetDutyCycleWaitTime( void ) return DutyCycleWaitTime; } -void LmHandlerJoin( ActivationType_t mode, bool forceRejoin ) +LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin ) { + LmHandlerErrorStatus_t lmhStatus = LORAMAC_HANDLER_ERROR; + LoRaMacStatus_t status; MlmeReq_t mlmeReq; mlmeReq.Type = MLME_JOIN; @@ -605,7 +607,12 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin ) LoRaMacStart(); #if (defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000300 )) /* Starts the OTAA join procedure */ - LoRaMacMlmeRequest( &mlmeReq ); + status = LoRaMacMlmeRequest( &mlmeReq ); + + if( status == LORAMAC_STATUS_OK ) + { + lmhStatus = LORAMAC_STATUS_OK; + } #endif /* LORAMAC_VERSION */ } else @@ -655,7 +662,7 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin ) { LmHandlerCallbacks->OnJoinRequest( &JoinParams ); } - LmHandlerRequestClass( LmHandlerParams.DefaultClass ); + lmhStatus = LmHandlerRequestClass( LmHandlerParams.DefaultClass ); #endif /* LORAMAC_VERSION */ } @@ -663,10 +670,17 @@ void LmHandlerJoin( ActivationType_t mode, bool forceRejoin ) if( ( CtxRestoreDone == false ) || ( forceRejoin == true ) ) { /* Starts the join procedure */ - LoRaMacMlmeRequest( &mlmeReq ); + status = LoRaMacMlmeRequest( &mlmeReq ); + + if( status == LORAMAC_STATUS_OK ) + { + lmhStatus = LORAMAC_STATUS_OK; + } } DutyCycleWaitTime = mlmeReq.ReqReturn.DutyCycleWaitTime; #endif /* LORAMAC_VERSION */ + + return lmhStatus; } LmHandlerFlagStatus_t LmHandlerJoinStatus( void ) diff --git a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h index cf4315e9..53fde578 100644 --- a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h +++ b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h @@ -363,8 +363,12 @@ TimerTime_t LmHandlerGetDutyCycleWaitTime( void ); * * \param [in] mode Activation mode (OTAA or ABP) * \param [in] forceRejoin Flag to force the rejoin even if LoRaWAN context can be restored + * + * \retval status Returns \ref LORAMAC_HANDLER_SUCCESS if request has been + * processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED + * else \ref LORAMAC_HANDLER_ERROR */ -void LmHandlerJoin( ActivationType_t mode, bool forceRejoin ); +LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin ); /*! * Check whether the Device is joined to the network From 5a2a231dea2cecbe86f804fe8d827592dab38883 Mon Sep 17 00:00:00 2001 From: Maxime JOURDAN Date: Mon, 3 Apr 2023 19:15:35 +0200 Subject: [PATCH 3/3] fix typo --- Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h index 53fde578..27bc6be7 100644 --- a/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h +++ b/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.h @@ -368,7 +368,7 @@ TimerTime_t LmHandlerGetDutyCycleWaitTime( void ); * processed else if device not yet joined a network \ref LORAMAC_HANDLER_NO_NETWORK_JOINED * else \ref LORAMAC_HANDLER_ERROR */ -LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin ); +LmHandlerErrorStatus_t LmHandlerJoin( ActivationType_t mode, bool forceRejoin ); /*! * Check whether the Device is joined to the network