Data reception demo.
Dependencies: modem_ref_helper CRC
Diff: main.cpp
- Revision:
- 10:c262c5feac24
- Parent:
- 9:72a15235e097
- Child:
- 11:7df24b241621
--- 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);