Sending and reception of big data file (1kB example)

Dependencies:   modem_ref_helper CRC DebouncedInterrupt

Revision:
4:fd480d5fe62b
Parent:
0:a2bbc478f812
Child:
6:33dfecc85ebf
--- a/modem_callbacks.cpp	Thu Dec 14 19:17:47 2017 +0000
+++ b/modem_callbacks.cpp	Thu Dec 21 15:19:49 2017 +0000
@@ -1,13 +1,18 @@
 #include "modem_ref_helper.h"
 #include "files.h"
 
+#define SERIAL_MAX_PACKET_SIZE  (255)
+
 // ============================================================}}}
 
 // Callbacks to MODEM's ALP requests
 // ============================================================{{{
 void my_read(u8 fid, u32 offset, u32 length, int id)
 {
-    u8 data[256];
+    u8 data[SERIAL_MAX_PACKET_SIZE];
+    
+    ASSERT((ALP_ACTION_RSP_TAG_SIZE + ALP_ACTION_RSP_F_DATA_SIZE(offset, length)) <= SERIAL_MAX_PACKET_SIZE,
+    "Read response too big for serial protocol (%d/%dmax)", length, ALP_ACTION_RSP_TAG_SIZE + ALP_ACTION_RSP_F_DATA_SIZE(offset,SERIAL_MAX_PACKET_SIZE));
     
     if (ram_fs_read(fid, offset, length, data))
     {