Send file data demo.

Dependencies:   modem_ref_helper CRC DebouncedInterrupt

Revision:
5:ee132af18614
Parent:
4:999305b576c0
Child:
6:05e26c3a495a
--- a/main.cpp	Mon May 15 15:56:47 2017 +0000
+++ b/main.cpp	Wed May 17 14:45:48 2017 +0000
@@ -21,6 +21,8 @@
 #include "d7a_1x_fs.h"
 #include "alp.h"
 
+#define MODEM_VERSION_MAJOR         4
+#define MODEM_VERSION_MINOR         8
 
 WizziCom* g_modem_com;
 Semaphore button_user(0);
@@ -321,15 +323,19 @@
     PRINT(" - Firmware version: v%d.%d.%d\r\n", rev.fw_version.major, rev.fw_version.minor, rev.fw_version.patch);
     PRINT(" - File system CRC:  0x%08x\r\n", rev.fs_crc);
     PRINT("-----------------------------------------\r\n");
-
-    PRINT("Register Files\n");
     
-    // The modem keeps file's headers permanently.
-    // if the file header changed, you have to delete it before declaring
-    // in order to update it.
+    // Check version
+    if (rev.fw_version.major != MODEM_VERSION_MAJOR || rev.fw_version.minor != MODEM_VERSION_MINOR)
+    {
+        PRINT("You need a modem at version %d.%d.x to use this APP.\n"
+              "Please check updates by importing:\n"
+              "https://developer.mbed.org/teams/WizziLab/code/D7A_WM_Updater\n"
+              , MODEM_VERSION_MAJOR, MODEM_VERSION_MINOR);
+        Thread::wait(osWaitForever);
+    }
     
+    PRINT("Register Files\n");
     // HOST Revision is a local file. Uses D7AActP Notification.
-    // Do not need to delete since it should never change
     modem_update_file(FID_HOST_REV, (alp_file_header_t*)&h_rev, (uint8_t*)&f_rev);
 
     // Button/Alarm is a local file. As we want to check the outcome of sending