this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Revision:
89:45f6db09a76d
Parent:
88:7ffa053be662
Child:
90:ed0267eca7b5
--- a/source/ATCmdManager.cpp	Sun Mar 31 22:09:45 2019 +0000
+++ b/source/ATCmdManager.cpp	Mon Apr 01 08:00:41 2019 +0000
@@ -68,7 +68,7 @@
     printf("\n --- ATCmdManager constructor completed ---\n");
     at_resp = AT_RESP_NONE;
     dataMode = AT_CMD_DATA_MODE;
-    event_queue.call_every(120000,&print_memory_info);
+    event_queue.call_every(3600000,&print_memory_info);
     //AT+UMRS=230400,2,8,1,1,1
     // AT+UBTLE
 }
@@ -148,10 +148,29 @@
                 //////_smutex.unlock();
                 at_resp = AT_RESP_NONE;
                 break;
+            case AT_HTTPS_RESP_DOWNLOAD:  
+                // AT_HTTPS_RESP_DOWNLOAD response state 
+                //////_smutex.lock();
+                printf("\n [ATCMD MAN] WIFI HTTPS DOWNLOAD RESPONSE RECEIVED!!\n");
+                return_response(true); // set download paramter to true
+                _parser.send("OK\n");
+                //////_smutex.unlock();
+                at_resp = AT_RESP_NONE;
+                break;
             case AT_HTTP_RESP:  
                 // AT_HTTP_RESP response state 
                 //////_smutex.lock();
                 printf("\n [ATCMD MAN] WIFI HTTP RESPONSE RECEIVED!!\n");
+                return_response(); 
+                _parser.send("OK\n");
+                //////_smutex.unlock();
+                at_resp = AT_RESP_NONE;
+                break;
+            case AT_HTTP_RESP_DOWNLOAD:  
+                // AT_HTTP_RESP response state 
+                //////_smutex.lock();
+                printf("\n [ATCMD MAN] WIFI HTTP RESPONSE RECEIVED!!\n");
+                return_response(true); // set download paramter to true
                 _parser.send("OK\n");
                 //////_smutex.unlock();
                 at_resp = AT_RESP_NONE;
@@ -167,6 +186,14 @@
         }
 }
 
+void ATCmdManager::printBufferInHex(uint8_t *buf, int pLen)
+{
+    for(int i =0;i<pLen;i++){
+        if(i%8==0) printf("\n[%3d]",i);
+        printf("%02x ", buf[i]);
+    }
+    printf("\n");
+}
 
 bool ATCmdManager::validate(edm_header_t edm_header)
 {
@@ -326,11 +353,7 @@
                     n = _parser.read((char *)rx_buf_ptr, pLen);
                     if(n == -1) break; // timeout!
                     printf("%d bytes read - expected %d!\n", n, pLen);
-                    for(int i =0;i<pLen;i++){
-                        if(i%8==0) printf("\n[%3d]",i/8);
-                        printf("%02x ", rx_buf_ptr[i]);
-                    }
-                    printf("\n");
+                    printBufferInHex(rx_buf_ptr, pLen);
                     printf("rx_buf_ptr[pLen-1] = %0x\n",rx_buf_ptr[pLen-1]);
                     if(rx_buf_ptr[pLen-1] != EDM_STOP_BYTE) {
                         break; // exit if stop byte now found - possible data corruption!
@@ -814,10 +837,17 @@
 }
 
 
-void ATCmdManager::return_response() {
+void ATCmdManager::return_response(bool download) {
     char * resp = (char *) resp_data->buffer;
     printf("\n[ATCMD MAN] received response:\n");
-    printf("%s\r\n", (char *)resp);
+    if(download == false) // not download must be ascii header
+    {
+        printf("%.*s\r\n", resp_data->dataLen, resp);
+    }
+    else // dump payload as hex
+    {
+        printBufferInHex((uint8_t *)resp, resp_data->dataLen);
+    }
     _parser.write(resp, resp_data->dataLen);
     _wiFi2ATDatamPool->free(resp_data);