Data reception demo.

Dependencies:   modem_ref_helper

Files at this revision

API Documentation at this revision

Comitter:
Jeej
Date:
Thu Oct 11 10:38:28 2018 +0000
Parent:
9:72a15235e097
Child:
11:7df24b241621
Commit message:
v1.0.2 Updated API

Changed in this revision

files.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
modem_ref_helper.lib Show annotated file Show diff for this revision Revisions of this file
--- a/files.cpp	Thu Sep 20 11:21:55 2018 +0000
+++ b/files.cpp	Thu Oct 11 10:38:28 2018 +0000
@@ -6,7 +6,7 @@
 #define __DEVICE_ID__               0x00000016
 
 const alp_file_header_t h_rev = {
-    .perm = RW_R,
+    .perm = RWR_R_,
     .prop = FS_PERMANENT_NOTIF,
     .afid = FID_ACTP_RPT_FULL,
     .ifid = IFID_REPORT,
@@ -28,14 +28,14 @@
     .fw_version.id       = 0,
     .fw_version.major    = 1,
     .fw_version.minor    = 0,
-    .fw_version.patch    = 1,
+    .fw_version.patch    = 2,
     .fw_version.hash     = 0x00000000,
     /// Not used
     .cup_max_size        = 0x00000000
 };
 
 const alp_file_header_t h_string_file = {
-    .perm = RW_RW,
+    .perm = RWRWRW,
     .prop = FS_VOLATILE,
     .afid = 0,
     .ifid = 0,
@@ -46,7 +46,7 @@
 uint8_t f_string_file[SIZE_STRING_FILE] = "Default string value";
 
 const alp_file_header_t h_status_file = {
-    .perm = RW_R,
+    .perm = RWRWR_,
     .prop = FS_VOLATILE_NOTIF,
     .afid = FID_ACTP_RPT_FULL,
     .ifid = IFID_REPORT,
--- a/main.cpp	Thu Sep 20 11:21:55 2018 +0000
+++ b/main.cpp	Thu Oct 11 10:38:28 2018 +0000
@@ -22,24 +22,14 @@
     sendImage();
 }
 
-void print_status(uint8_t id, int status)
-{
-    switch (status)
-    {
-        case ALP_ERR_NONE:
-            PRINT("Status[%d]: OK\n", id);
-            break;
-        default:
-            PRINT("Status[%d]: error %d\n", id, status);
-            break;
-    }
-}
-
 static void my_main_callback(uint8_t terminal, int8_t err, uint8_t id)
 {
     (void)id;
     
-    print_status(id, err);
+    if (ALP_ERR_NONE != err)
+    {
+        modem_print_error(ALP_ITF_TYPE_D7A, err);
+    }
     
     if (terminal)
     {
@@ -142,11 +132,10 @@
     uint8_t id = modem_get_id(my_main_callback);
         
     PRINT("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);
-    
     // Allow remote access.
+    // The string file data is on this host, specify the data buffer.
     modem_update_file(FID_STRING_FILE, (alp_file_header_t*)&h_string_file, (uint8_t*)&f_string_file);
+    // The status file data is in the modem, do not specify a data buffer.
     modem_update_file(FID_STATUS_FILE, (alp_file_header_t*)&h_status_file, NULL);
 
     // Put modem to listen to this access class
@@ -168,8 +157,8 @@
     modem_ready.wait();
     
     PRINT("Notify FW Version\n");
-    modem_notify_file(FID_HOST_REV, 0, SIZE_HOST_REV, id);
-    modem_ready.wait();
+    uint8_t default_root_key[16] = DEFAULT_ROOT_KEY;
+    modem_notify_host_rev((revision_t*)&f_rev, (alp_file_header_t*)&h_rev, default_root_key);
     
     modem_free_id(id);
     
--- a/modem_ref_helper.lib	Thu Sep 20 11:21:55 2018 +0000
+++ b/modem_ref_helper.lib	Thu Oct 11 10:38:28 2018 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/WizziLab/code/modem_ref_helper/#7386c5c5bb9f
+https://developer.mbed.org/teams/WizziLab/code/modem_ref_helper/#7563b8e53e1d