Skip to content

Commit

Permalink
Do not allow a MLME_PING_SLOT_INFO request, if the MAC is not in clas…
Browse files Browse the repository at this point in the history
…s A.

The function returns a SERVICE_UNKNOWN state in this case.
  • Loading branch information
mluis1 committed Jun 14, 2019
1 parent f6393c5 commit ffbd453
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -4488,15 +4488,18 @@ LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t* mlmeRequest )
}
case MLME_PING_SLOT_INFO:
{
uint8_t value = mlmeRequest->Req.PingSlotInfo.PingSlot.Value;

// LoRaMac will send this command piggy-pack
LoRaMacClassBSetPingSlotInfo( mlmeRequest->Req.PingSlotInfo.PingSlot.Fields.Periodicity );
macCmdPayload[0] = value;
status = LORAMAC_STATUS_OK;
if( LoRaMacCommandsAddCmd( MOTE_MAC_PING_SLOT_INFO_REQ, macCmdPayload, 1 ) != LORAMAC_COMMANDS_SUCCESS )
if( MacCtx.NvmCtx->DeviceClass == CLASS_A )
{
status = LORAMAC_STATUS_MAC_COMMAD_ERROR;
uint8_t value = mlmeRequest->Req.PingSlotInfo.PingSlot.Value;

// LoRaMac will send this command piggy-pack
LoRaMacClassBSetPingSlotInfo( mlmeRequest->Req.PingSlotInfo.PingSlot.Fields.Periodicity );
macCmdPayload[0] = value;
status = LORAMAC_STATUS_OK;
if( LoRaMacCommandsAddCmd( MOTE_MAC_PING_SLOT_INFO_REQ, macCmdPayload, 1 ) != LORAMAC_COMMANDS_SUCCESS )
{
status = LORAMAC_STATUS_MAC_COMMAD_ERROR;
}
}
break;
}
Expand Down

0 comments on commit ffbd453

Please sign in to comment.