@@ -267,7 +267,7 @@ static bool LinkedListRemove( MacCommandsList_t* list, MacCommand_t* element )
267267/*
268268 * \brief Determines if a MAC command is sticky or not
269269 *
270- * \param[IN] cid - MAC command identifier
270+ * \param[IN] cid - MAC command identifier
271271 *
272272 * \retval - Status of the operation
273273 */
@@ -289,6 +289,26 @@ static bool IsSticky( uint8_t cid )
289289 }
290290}
291291
292+ /*
293+ * \brief Determines if a MAC command requires an explicit confirmation
294+ *
295+ * \param[IN] cid - MAC command identifier
296+ *
297+ * \retval - Status of the operation
298+ */
299+ static bool IsConfirmationRequired ( uint8_t cid )
300+ {
301+ switch ( cid )
302+ {
303+ case MOTE_MAC_RESET_IND :
304+ case MOTE_MAC_REKEY_IND :
305+ case MOTE_MAC_DEVICE_MODE_IND :
306+ return true;
307+ default :
308+ return false;
309+ }
310+ }
311+
292312LoRaMacCommandStatus_t LoRaMacCommandsInit ( void )
293313{
294314 // Initialize with default
@@ -326,6 +346,7 @@ LoRaMacCommandStatus_t LoRaMacCommandsAddCmd( uint8_t cid, uint8_t* payload, siz
326346 newCmd -> PayloadSize = payloadSize ;
327347 memcpy1 ( ( uint8_t * )newCmd -> Payload , payload , payloadSize );
328348 newCmd -> IsSticky = IsSticky ( cid );
349+ newCmd -> IsConfirmationRequired = IsConfirmationRequired ( cid );
329350
330351 CommandsCtx .SerializedCmdsSize += ( CID_FIELD_SIZE + payloadSize );
331352
@@ -418,7 +439,8 @@ LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds( void )
418439 while ( curElement != NULL )
419440 {
420441 nexElement = curElement -> Next ;
421- if ( IsSticky ( curElement -> CID ) == true )
442+ if ( ( IsSticky ( curElement -> CID ) == true ) &&
443+ ( IsConfirmationRequired ( curElement -> CID ) == false ) )
422444 {
423445 LoRaMacCommandsRemoveCmd ( curElement );
424446 }
0 commit comments