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

Dependencies:   mbed-http

Files at this revision

API Documentation at this revision

Comitter:
ocomeni
Date:
Mon May 06 10:24:53 2019 +0000
Branch:
PassingRegression
Parent:
105:e5ce023eee93
Child:
107:f1a83fd41b17
Commit message:
latest version - still issues with TLS connection

Changed in this revision

source/WiFiManager.cpp Show annotated file Show diff for this revision Revisions of this file
source/main-https.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/WiFiManager.cpp	Mon May 06 09:06:36 2019 +0000
+++ b/source/WiFiManager.cpp	Mon May 06 10:24:53 2019 +0000
@@ -984,6 +984,8 @@
 //#define DONT_USE_TLS_SOCKET
 bool WiFiManager::createHttpsRequest()
 {
+    int  starttime;
+    int stoptime;
     // reset chunk #;
     chunkNum = 0;
 #ifdef MIX_HDR_AND_BODY
@@ -1056,6 +1058,7 @@
         mbed_stats_heap_t heap_stats;
         mbed_stats_heap_get(&heap_stats);
         dbg_printf(LOG, "Heap size: %lu / %lu bytes\r\n", heap_stats.current_size, heap_stats.reserved_size);
+        starttime = Kernel::get_ms_count();
 #ifndef DONT_USE_TLS_SOCKET
         if(https_connection_active == false){
             bool tlsResult;
@@ -1063,6 +1066,8 @@
 #ifdef ENABLE_MBED_TRACE
             mbed_trace_free(); // free trace memory
 #endif
+            stoptime = Kernel::get_ms_count();
+            dbg_printf(LOG, "\r\nTLS connection time : %d ms\r\n", (stoptime - starttime));
             if(tlsResult == false){
                  delete socket;
                  dbg_printf(LOG, "TLS Socket connection failed - deleting data msg\r\n");
@@ -1086,6 +1091,9 @@
         // Pass in `socket`, instead of `network` as first argument, and omit the `SSL_CA_PEM` argument
         //HttpsRequest* get_req = new HttpsRequest(socket, HTTP_GET, "https://httpbin.org/status/418");
         //_wmutex.lock();
+        stoptime = Kernel::get_ms_count();
+        dbg_printf(LOG, "\r\nTLS connection time : %d ms\r\n", (stoptime - starttime));
+        starttime = Kernel::get_ms_count();
         https_request = new HttpsRequest(socket, 
                                          http_req_cfg->method, 
                                          full_url,
@@ -1163,6 +1171,8 @@
     dbg_printf(LOG, "deleted https_request\r\n");
     https_request = NULL;
     http_result = RESPONSE_OK;
+    stoptime = Kernel::get_ms_count();
+    dbg_printf(LOG, "\r\nhttp request to response time : %d ms\r\n", (stoptime - starttime));
     return true;
 }
 
--- a/source/main-https.cpp	Mon May 06 09:06:36 2019 +0000
+++ b/source/main-https.cpp	Mon May 06 10:24:53 2019 +0000
@@ -375,6 +375,7 @@
 #define PAUSE_SECONDS   0
 #define PAUSE_SECONDS_BLE 0
 int main() {
+    device = new RawSerial(USBTX, USBRX, 2*DEFAULT_BAUD_RATE);
     initialise_debug();
 #ifdef MBED_MAJOR_VERSION
     dbg_printf(LOG, "Mbed OS version %d.%d.%d\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
@@ -383,7 +384,6 @@
     reset_counter++;
     print_memory_info();
     dbg_printf(LOG, "\r\n ++++++ PROGRAM STARTING -- reset count = %d ++++++ \r\n", reset_counter);
-    device = new RawSerial(USBTX, USBRX, 2*DEFAULT_BAUD_RATE);
     //device = new RawSerial(PA_9, PA_10, DEFAULT_BAUD_RATE);
     
     dbg_printf(LOG, "*** HELLO MESSAGE *** \n %s", (char *)&hello_msg[6]);