Test Class CC LoRaWAN

Dependencies:   mbed LoRaWAN-lib SX1272Lib

Fork of LoRaWAN-demo-72 by Semtech

Revision:
9:43df551010a0
Parent:
7:5077515c163b
--- a/app/main.cpp	Thu Sep 21 23:17:53 2017 +0000
+++ b/app/main.cpp	Thu Sep 21 23:21:44 2017 +0000
@@ -6,7 +6,7 @@
 (______/|_____)_|_|_| \__)_____)\____)_| |_|
     (C)2015 Semtech
 
-Description: LoRaMac classA device implementation
+Description: LoRaMac class C device implementation
 
 License: Revised BSD License, see LICENSE.TXT file include in the project
 
@@ -39,7 +39,7 @@
 /*!
  * LoRaWAN confirmed messages
  */
-#define LORAWAN_CONFIRMED_MSG_ON                    true
+#define LORAWAN_CONFIRMED_MSG_ON                    false
 
 /*!
  * LoRaWAN Adaptive Data Rate
@@ -57,7 +57,7 @@
  *
  * \remark Please note that ETSI mandates duty cycled transmissions. Use only for test purposes
  */
-#define LORAWAN_DUTYCYCLE_ON                        false
+#define LORAWAN_DUTYCYCLE_ON                        true
 
 #define USE_SEMTECH_DEFAULT_CHANNEL_LINEUP          1
 
@@ -78,16 +78,16 @@
 /*!
  * LoRaWAN application port
  */
-#define LORAWAN_APP_PORT                            15
+#define LORAWAN_APP_PORT                            2
 
 /*!
  * User application data buffer size
  */
 #if ( LORAWAN_CONFIRMED_MSG_ON == 1 )
-#define LORAWAN_APP_DATA_SIZE                       6
+#define LORAWAN_APP_DATA_SIZE                       11
 
 #else
-#define LORAWAN_APP_DATA_SIZE                       1
+#define LORAWAN_APP_DATA_SIZE                       11
 
 #endif
 
@@ -120,7 +120,7 @@
 /*!
  * User application data buffer size
  */
-#define LORAWAN_APP_DATA_MAX_SIZE                           64
+#define LORAWAN_APP_DATA_MAX_SIZE                           242
 
 /*!
  * User application data
@@ -260,7 +260,7 @@
     SerialDisplayUpdateDutyCycle( false );
 #endif
     SerialDisplayUpdatePublicNetwork( LORAWAN_PUBLIC_NETWORK );
-    
+
     SerialDisplayUpdateLedState( 3, AppLedStateOn );
 }
 
@@ -462,7 +462,7 @@
                 // Check TxPower
                 // Check AckReceived
                 // Check NbTrials
-                LoRaMacUplinkStatus.Acked = mcpsConfirm->AckReceived;
+                //LoRaMacUplinkStatus.Acked = mcpsConfirm->AckReceived;
                 break;
             }
             case MCPS_PROPRIETARY:
@@ -472,8 +472,8 @@
             default:
                 break;
         }
-        LoRaMacUplinkStatus.Datarate = mcpsConfirm->Datarate;
-        LoRaMacUplinkStatus.UplinkCounter = mcpsConfirm->UpLinkCounter;
+        //LoRaMacUplinkStatus.Datarate = mcpsConfirm->Datarate;
+        //LoRaMacUplinkStatus.UplinkCounter = mcpsConfirm->UpLinkCounter;
 
         // Switch LED 1 ON
         Led1State = true;
@@ -529,6 +529,7 @@
     // Check Rssi
     // Check Snr
     // Check RxSlot
+/*
     LoRaMacDownlinkStatus.Rssi = mcpsIndication->Rssi;
     if( mcpsIndication->Snr & 0x80 ) // The SNR sign bit is 1
     {
@@ -546,7 +547,7 @@
     LoRaMacDownlinkStatus.Port = mcpsIndication->Port;
     LoRaMacDownlinkStatus.Buffer = mcpsIndication->Buffer;
     LoRaMacDownlinkStatus.BufferSize = mcpsIndication->BufferSize;
-
+*/
     if( ComplianceTest.Running == true )
     {
         ComplianceTest.DownLinkCounter++;
@@ -817,7 +818,7 @@
             SerialDisplayUpdateLedState( 2, Led2State );
             SerialDisplayUpdateDownlink( LoRaMacDownlinkStatus.RxData, LoRaMacDownlinkStatus.Rssi, LoRaMacDownlinkStatus.Snr, LoRaMacDownlinkStatus.DownlinkCounter, LoRaMacDownlinkStatus.Port, LoRaMacDownlinkStatus.Buffer, LoRaMacDownlinkStatus.BufferSize );
         }
-        
+
         switch( DeviceState )
         {
             case DEVICE_STATE_INIT:
@@ -867,11 +868,13 @@
 #endif
 
 #endif
+                mibReq.Type = MIB_DEVICE_CLASS;
+                mibReq.Param.Class = CLASS_C;
                 SerialDisplayUpdateActivationMode( OVER_THE_AIR_ACTIVATION );
                 SerialDisplayUpdateAdr( LORAWAN_ADR_ON );
                 SerialDisplayUpdatePublicNetwork( LORAWAN_PUBLIC_NETWORK );
 
-                LoRaMacDownlinkStatus.DownlinkCounter = 0;
+                //LoRaMacDownlinkStatus.DownlinkCounter = 0;
 
                 DeviceState = DEVICE_STATE_JOIN;
                 break;
@@ -922,8 +925,8 @@
             {
                 if( NextTx == true )
                 {
-                    SerialDisplayUpdateUplinkAcked( false );
-                    SerialDisplayUpdateDonwlinkRxData( false );
+                    //SerialDisplayUpdateUplinkAcked( false );
+                    //SerialDisplayUpdateDonwlinkRxData( false );
                     PrepareTxFrame( AppPort );
 
                     NextTx = SendFrame( );