Send file data demo.

Dependencies:   DebouncedInterrupt modem_ref_helper

Files at this revision

API Documentation at this revision

Comitter:
Jeej
Date:
Thu Oct 11 10:15:04 2018 +0000
Parent:
14:788c749cabed
Child:
16:355dcd95c082
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 12:26:16 2018 +0000
+++ b/files.cpp	Thu Oct 11 10:15:04 2018 +0000
@@ -6,7 +6,7 @@
 #define __DEVICE_ID__               0x00000014
 
 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
 };
 
 alp_file_header_t h_alarm = {
-    .perm = RW_R,
+    .perm = RWRWR_,
     .prop = FS_VOLATILE,
     .afid = 0,
     .ifid = 0,
--- a/main.cpp	Thu Sep 20 12:26:16 2018 +0000
+++ b/main.cpp	Thu Oct 11 10:15:04 2018 +0000
@@ -27,11 +27,11 @@
     .cfg.to                         = 0,
     .cfg.te                         = 0,
     .cfg.qos.bf.resp                = D7A_RESP_ALL,
+    .cfg.qos.bf.retry               = ALP_RPOL_ONESHOT,
     .cfg.addressee.ctrl.bf.nls      = D7A_NLS_AES_CCM_64,
     .cfg.addressee.ctrl.bf.idf      = D7A_ID_NBID,
-    .cfg.addressee.xcl.bf           = {.s = 0x2, .m = 0x1},// XXX D7A_XCL_GW,
-    .cfg.addressee.id[0]            = D7A_CTF_VAL(1,1),
-    .cfg.qos.bf.retry               = 1 // XXX WM_RPOL_RARE_SINGLE_CHECK,
+    .cfg.addressee.xcl.bf           = {.s = 2, .m = 0x1},// XXX D7A_XCL_GW,
+    .cfg.addressee.id[0]            = D7A_CTF_ENCODE(8),
 };
 
 // Interrupt Service Routine on button press.
@@ -55,8 +55,11 @@
 
 // Main Callback
 void my_main_callback(uint8_t terminal, int8_t err, uint8_t id)
-{    
-    print_status(id, err);
+{
+    if (ALP_ERR_NONE != err)
+    {
+        modem_print_error(ALP_ITF_TYPE_D7A, err);
+    }
     
     if (terminal)
     {
@@ -69,6 +72,11 @@
 {
     (void)id;
     
+    if (ALP_ERR_NONE != err)
+    {
+        modem_print_error(ALP_ITF_TYPE_D7A, err);
+    }
+    
     if (terminal)
     {
         modem_resp.put((void*)MODEM_RESP_TERMINAL);
@@ -81,7 +89,6 @@
         }
         else
         {
-            PRINT("Resp err %d ", err);
             modem_resp.put((void*)MODEM_RESP_ERROR);
         }
     }
@@ -227,9 +234,6 @@
     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);
-
     // Button/Alarm is a local file. As we want to check the outcome of sending
     // this, don't use D7AActP Notification but rather plain ALP ITF Forwarding.
     // Declaration just allows remote access.
@@ -241,7 +245,7 @@
     modem_ready.wait();
     
     PRINT("Start D7A Stack\n");
-    modem_activate_itf(ALP_ITF_TYPE_D7A, 24, 0, ALP_D7A_ISTAT_RESP | ALP_D7A_ISTAT_UNS, true, id);
+    modem_activate_itf(ALP_ITF_TYPE_D7A, 24, 0, ALP_D7A_ISTAT_RESP | ALP_D7A_ISTAT_UNS | ALP_D7A_ISTAT_EOP, true, id);
     modem_ready.wait();
     
     PRINT("Notify Modem Version\n");
@@ -249,8 +253,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(&f_rev, &h_rev, default_root_key);
     
     modem_free_id(id);
 
--- a/modem_ref_helper.lib	Thu Sep 20 12:26:16 2018 +0000
+++ b/modem_ref_helper.lib	Thu Oct 11 10:15:04 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