LoRaWAN demo.

Dependencies:   DebouncedInterrupt modem_ref_helper

Revision:
12:18ab0181d584
Parent:
8:544a04d2bf55
Child:
13:b9420183fbfc
--- a/main.cpp	Wed Sep 26 14:04:39 2018 +0000
+++ b/main.cpp	Thu Oct 11 10:54:27 2018 +0000
@@ -82,28 +82,18 @@
     }
 }
 
-void print_resp(uint8_t id, int status)
-{
-    switch (status)
-    {
-        case ALP_ERR_NONE:
-            PRINT("Resp[%d]: OK\n", id);
-            break;
-        default:
-            PRINT("Resp[%d]: error %d\n", id, status);
-            break;
-    }
-}
-
 // Callback for id User
 void my_main_callback(uint8_t terminal, int8_t err, uint8_t id)
 {
     (void)id;
     
-    print_resp(id, err);
+    if (ALP_ERR_NONE != err)
+    {
+        modem_print_error(ALP_ITF_TYPE_D7A, err);
+    }
     
     if (terminal)
-    {    
+    {
         modem_ready[id].release();
     }
 }
@@ -301,10 +291,6 @@
     uint8_t id = modem_get_id(my_main_callback);
     
     DPRINT("Register Files\n");
-    
-    // HOST Revision is a local file. Uses D7AActP Notification.
-    modem_update_file(FID_HOST_REV, (alp_file_header_t*)&h_rev, (uint8_t*)&f_rev);
-    
     // Create report file on modem.
     modem_update_file(FID_SENSOR_LIGHT, (alp_file_header_t*)&h_sensor_light, NULL);
 
@@ -325,7 +311,7 @@
     modem_activate_itf(ALP_ITF_TYPE_D7A, 24, 0, ALP_D7A_ISTAT_UNS|ALP_D7A_ISTAT_RESP, true, id);
     modem_ready[id].wait();
     
-    PRINT("Start LoRaWAN Stack\n");
+    PRINT("Start LoRaWAN Stack (Join)\n");
     modem_activate_itf(ALP_ITF_TYPE_LWAN, 1, FID_LWAN_ITF0, 0, true, id);
     modem_ready[id].wait();
     
@@ -334,8 +320,8 @@
     modem_ready[id].wait();
     
     PRINT("Notify FW Version\n");
-    modem_notify_file(FID_HOST_REV, 0, SIZE_HOST_REV, id);
-    modem_ready[id].wait();
+    uint8_t default_root_key[16] = DEFAULT_ROOT_KEY;
+    modem_notify_host_rev(&f_rev, &h_rev, default_root_key);
     
     modem_free_id(id);