LMiC LoRa Semtech + Nucleo

Dependents:   LoRaWAN-lmic-app

Fork of LMiC by Pascal Nysten

Revision:
3:1079dc4b4c59
Parent:
2:bebd6b2e3d18
Child:
4:663db54d46eb
diff -r bebd6b2e3d18 -r 1079dc4b4c59 lmic.cpp
--- a/lmic.cpp	Fri Nov 20 12:30:06 2015 +0000
+++ b/lmic.cpp	Mon Nov 23 09:53:54 2015 +0000
@@ -1227,9 +1227,16 @@
     if( !replayConf ) {
         // Handle payload only if not a replay
         // Decrypt payload - if any
-        if( port >= 0  &&  pend-poff > 0 )
+        
+        //if( port >= 0  &&  pend-poff > 0 )
+            //aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
+
+        if( port == 0  &&  pend-poff > 0 )
+        {
+            debug_str("Payload decrypting...\r\n");
             aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
-
+        }
+        
         EV(dfinfo, DEBUG, (e_.deveui  = MAIN::CDEV->getEui(),
                            e_.devaddr = LMIC.devaddr,
                            e_.seqno   = seqno,