How to use cubecell to receive downlink message?

How to receive downlink message? I see DeviceState in code example as show below.I can’t find Receive or Rxdone state so how to get downlink message.

void loop()
{
switch( DeviceState )
{
case DEVICE_STATE_INIT:
{
#if(AT_SUPPORT)
getDevParam();
#endif
printDevParam();
Serial.printf(“LoRaWan Class%X start! \r\n”,CLASS+10);
LoRaWAN.Init(CLASS,REGION);
DeviceState = DEVICE_STATE_JOIN;
break;
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.Join();
break;
}
case DEVICE_STATE_SEND:
{
PrepareTxFrame( AppPort );
LoRaWAN.Send();
DeviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
TxDutyCycleTime = APP_TX_DUTYCYCLE + randr( 0, APP_TX_DUTYCYCLE_RND );
LoRaWAN.Cycle(TxDutyCycleTime);
DeviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.Sleep();
break;
}
default:
{
DeviceState = DEVICE_STATE_INIT;
break;
}
}
}

1 Like