New Tester

Dependencies:   HPM

Fork of frdm_https_HPM by mDot

Files at this revision

API Documentation at this revision

Comitter:
Roietronics
Date:
Wed Dec 06 11:25:25 2017 +0000
Parent:
26:43420c027a45
Commit message:
New tester HPM_lib_tester loads hang online ide

Changed in this revision

HPM.lib Show annotated file Show diff for this revision Revisions of this file
HPM.lib.orig Show diff for this revision Revisions of this file
HPM_Modes.h 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
easy-connect.lib Show diff for this revision Revisions of this file
mbed-http.lib Show diff for this revision Revisions of this file
mbed_app.json Show diff for this revision Revisions of this file
mbedtls_entropy_config.h Show diff for this revision Revisions of this file
source/main-http-socket-reuse.cpp Show diff for this revision Revisions of this file
source/main-http.cpp Show diff for this revision Revisions of this file
source/main-https-socket-reuse.cpp Show diff for this revision Revisions of this file
source/main-https.cpp Show diff for this revision Revisions of this file
source/prev_test_main-https.cpp Show diff for this revision Revisions of this file
source/select-demo.h Show diff for this revision Revisions of this file
--- a/HPM.lib	Wed Nov 29 17:02:13 2017 +0000
+++ b/HPM.lib	Wed Dec 06 11:25:25 2017 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/mDot/code/HPM/#0f9dc7a845dc
+https://os.mbed.com/teams/mDot/code/HPM/#77a06cb07542
--- a/HPM.lib.orig	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/mDot/code/HPM/#760ebe68bcbe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HPM_Modes.h	Wed Dec 06 11:25:25 2017 +0000
@@ -0,0 +1,14 @@
+//Uncoment one ot the MODE defintions to select implementzation type
+
+//#define MODE 1  //interrupt handler and serial object are class members
+                //interrupt data variables are static (singleton) member of main
+                //class i.e. :: the class with the main() function 
+                //Clean up version on Jacob's  code
+//#define MODE 2 //interrupt handler serial object and all interrupt handler
+                 //data members are HPM class instance member
+//#define MODE 3 //interrupt handler serial object and all interrupt handler
+                 //data members are static (singlton) member of HPM class 
+#define MODE 4 //interrupt handler serial serial object and all interrupt
+                  //data members are static (singlton) :: (Main Class)
+                  //Honeywell_Dust_Simple_2 implementation  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Main.cpp	Wed Dec 06 11:25:25 2017 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "HPM.h"
+
+#define TESTER_VERSION 1.0
+
+Serial pc(USBTX, USBRX, 115200);
+
+#if MODE == 4
+RawSerial link(D0, D1);
+#endif
+
+main()
+{
+    pc.printf("Starting HPM library Tester Version %s\n", TESTER_VERSION);
+#if MODE == 4
+    HPM pm(&link);
+#else
+    HPM pm(D1, D0);  //Create an instance of a HPM class object
+#endif
+    pm.setLog(&pc);  //Attach a log output stream
+    pm.startAutoRead(); //Start the sensor in continous read mode
+    for(int index = 0; index < 5; index++) { //Display 5 readings
+        pm.getPMReadings(); 
+        }
+    pm.stopAutoRead(); //Shut the sensor down
+    
+    }
+
--- a/easy-connect.lib	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://github.com/ARMmbed/easy-connect/#a913964341394430cd3997c6f2950f93ba1d75c8
--- a/mbed-http.lib	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/sandbox/code/mbed-http/#3004056e4661
--- a/mbed_app.json	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-{
-    "config": {
-        "network-interface": {
-            "help": "options are ETHERNET,WIFI_ESP8266,MESH_LOWPAN_ND,MESH_THREAD",
-            "value": "ETHERNET"
-        },
-        "mesh_radio_type": {
-        	"help": "options are ATMEL, MCR20",
-        	"value": "ATMEL"
-        },
-        "esp8266-tx": {
-            "help": "Pin used as TX (connects to ESP8266 RX)",
-            "value": "D1"
-        },
-        "esp8266-rx": {
-            "help": "Pin used as RX (connects to ESP8266 TX)",
-            "value": "D0"
-        },
-        "esp8266-debug": {
-            "value": false
-        },
-        "wifi-ssid": {
-            "value": "\"SSID\""
-        },
-        "wifi-password": {
-            "value": "\"Password\""
-        }
-    },
-    "macros": [ "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_entropy_config.h\"", "MBEDTLS_TEST_NULL_ENTROPY", "MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES" ],
-    "target_overrides": {
-        "*": {
-            "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"],
-            "mbed-mesh-api.6lowpan-nd-channel-page": 0,
-            "mbed-mesh-api.6lowpan-nd-channel": 12,
-            "mbed-trace.enable": 0,
-            "mbed-http.http-buffer-size": 2048
-        },
-        "HEXIWEAR": {
-            "esp8266-tx": "PTD3",
-            "esp8266-rx": "PTD2"
-        },
-        "NUCLEO_F401RE": {
-            "esp8266-tx": "D8",
-            "esp8266-rx": "D2"
-        },
-        "NUCLEO_F411RE": {
-            "esp8266-tx": "D8",
-            "esp8266-rx": "D2"
-        }
-    }
-}
--- a/mbedtls_entropy_config.h	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- *  Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
- *  SPDX-License-Identifier: Apache-2.0
- *
- *  Licensed under the Apache License, Version 2.0 (the "License"); you may
- *  not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *  This file is part of mbed TLS (https://tls.mbed.org)
- */
-
-#include "select-demo.h"
-
-/* Enable entropy for K64F and K22F. This means entropy is disabled for all other targets. */
-/* Do **NOT** deploy this code in production on other targets! */
-/* See https://tls.mbed.org/kb/how-to/add-entropy-sources-to-entropy-pool */
-#if defined(TARGET_K64F) || defined(TARGET_K22F)
-#undef MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
-#undef MBEDTLS_TEST_NULL_ENTROPY
-#endif
-
-#if DEMO == DEMO_HTTPS
-
-#if !defined(MBEDTLS_ENTROPY_HARDWARE_ALT) && \
-    !defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_TEST_NULL_ENTROPY)
-#error "This hardware does not have an entropy source."
-#endif /* !MBEDTLS_ENTROPY_HARDWARE_ALT && !MBEDTLS_ENTROPY_NV_SEED &&
-        * !MBEDTLS_TEST_NULL_ENTROPY */
-
-#if !defined(MBEDTLS_SHA1_C)
-#define MBEDTLS_SHA1_C
-#endif /* !MBEDTLS_SHA1_C */
-
-#if !defined(MBEDTLS_RSA_C)
-#define MBEDTLS_RSA_C
-#endif /* !MBEDTLS_RSA_C */
-
-/*
- *  This value is sufficient for handling 2048 bit RSA keys.
- *
- *  Set this value higher to enable handling larger keys, but be aware that this
- *  will increase the stack usage.
- */
-#define MBEDTLS_MPI_MAX_SIZE        1024
-
-#define MBEDTLS_MPI_WINDOW_SIZE     1
-
-#endif
--- a/source/main-http-socket-reuse.cpp	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-#include "select-demo.h"
-
-#if DEMO == DEMO_HTTP_SOCKET_REUSE
-
-#include "mbed.h"
-#include "easy-connect.h"
-#include "http_request.h"
-
-Serial pc(USBTX, USBRX);
-
-void dump_response(HttpResponse* res) {
-    printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
-
-    printf("Headers:\n");
-    for (size_t ix = 0; ix < res->get_headers_length(); ix++) {
-        printf("\t%s: %s\n", res->get_headers_fields()[ix]->c_str(), res->get_headers_values()[ix]->c_str());
-    }
-    printf("\nBody (%d bytes):\n\n%s\n", res->get_body_length(), res->get_body_as_string().c_str());
-}
-
-int main() {
-    pc.baud(115200);
-    // Connect to the network (see mbed_app.json for the connectivity method used)
-    NetworkInterface *network = easy_connect(true);
-    if (!network) {
-        printf("Cannot connect to the network, see serial output");
-        return 1;
-    }
-
-    // Create a TCP socket
-    printf("\n----- Setting up TCP connection -----\n");
-
-    TCPSocket* socket = new TCPSocket();
-    nsapi_error_t open_result = socket->open(network);
-    if (open_result != 0) {
-        printf("Opening TCPSocket failed... %d\n", open_result);
-        return 1;
-    }
-
-    nsapi_error_t connect_result = socket->connect("httpbin.org", 80);
-    if (connect_result != 0) {
-        printf("Connecting over TCPSocket failed... %d\n", connect_result);
-        return 1;
-    }
-
-    printf("Connected over TCP to httpbin.org:80\n");
-
-    // Do a GET request to httpbin.org
-    {
-        HttpRequest* get_req = new HttpRequest(socket, HTTP_GET, "http://httpbin.org/status/418");
-
-        // By default the body is automatically parsed and stored in a string, this is memory heavy.
-        // To receive chunked response, pass in a callback as third parameter to 'send'.
-        HttpResponse* get_res = get_req->send();
-        if (!get_res) {
-            printf("HttpRequest failed (error code %d)\n", get_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTP GET response -----\n");
-        dump_response(get_res);
-
-        delete get_req;
-    }
-
-    // POST request to httpbin.org
-    {
-        HttpRequest* post_req = new HttpRequest(socket, HTTP_POST, "http://httpbin.org/post");
-        post_req->set_header("Content-Type", "application/json");
-
-        const char body[] = "{\"hello\":\"world\"}";
-
-        HttpResponse* post_res = post_req->send(body, strlen(body));
-        if (!post_res) {
-            printf("HttpRequest failed (error code %d)\n", post_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTP POST response -----\n");
-        dump_response(post_res);
-
-        delete post_req;
-    }
-
-    delete socket;
-
-    Thread::wait(osWaitForever);
-}
-
-#endif
--- a/source/main-http.cpp	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#include "select-demo.h"
-
-#if DEMO == DEMO_HTTP
-
-#include "mbed.h"
-#include "easy-connect.h"
-#include "http_request.h"
-
-Serial pc(USBTX, USBRX);
-
-void dump_response(HttpResponse* res) {
-    printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
-
-    printf("Headers:\n");
-    for (size_t ix = 0; ix < res->get_headers_length(); ix++) {
-        printf("\t%s: %s\n", res->get_headers_fields()[ix]->c_str(), res->get_headers_values()[ix]->c_str());
-    }
-    printf("\nBody (%d bytes):\n\n%s\n", res->get_body_length(), res->get_body_as_string().c_str());
-}
-
-int main() {
-    pc.baud(115200);
-    // Connect to the network (see mbed_app.json for the connectivity method used)
-    NetworkInterface *network = easy_connect(true);
-    if (!network) {
-        printf("Cannot connect to the network, see serial output");
-        return 1;
-    }
-
-    // Do a GET request to httpbin.org
-    {
-        // By default the body is automatically parsed and stored in a buffer, this is memory heavy.
-        // To receive chunked response, pass in a callback as last parameter to the constructor.
-        HttpRequest* get_req = new HttpRequest(network, HTTP_GET, "http://httpbin.org/status/418");
-
-        HttpResponse* get_res = get_req->send();
-        if (!get_res) {
-            printf("HttpRequest failed (error code %d)\n", get_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTP GET response -----\n");
-        dump_response(get_res);
-
-        delete get_req;
-    }
-
-    // POST request to httpbin.org
-    {
-        HttpRequest* post_req = new HttpRequest(network, HTTP_POST, "http://httpbin.org/post");
-        post_req->set_header("Content-Type", "application/json");
-
-        const char body[] = "{\"hello\":\"world\"}";
-
-        HttpResponse* post_res = post_req->send(body, strlen(body));
-        if (!post_res) {
-            printf("HttpRequest failed (error code %d)\n", post_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTP POST response -----\n");
-        dump_response(post_res);
-
-        delete post_req;
-    }
-
-    Thread::wait(osWaitForever);
-}
-
-#endif
--- a/source/main-https-socket-reuse.cpp	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-#include "select-demo.h"
-
-/**
- * This demo shows how to re-use sockets, so the TLS handshake only has to happen once
- */
-
-#if DEMO == DEMO_HTTPS_SOCKET_REUSE
-
-#include "mbed.h"
-#include "easy-connect.h"
-#include "https_request.h"
-
-Serial pc(USBTX, USBRX);
-
-/* List of trusted root CA certificates
- * currently one: Let's Encrypt, the CA for httpbin.org
- *
- * To add more root certificates, just concatenate them.
- */
-const char SSL_CA_PEM[] = "-----BEGIN CERTIFICATE-----\n"
-    "MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\n"
-    "MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
-    "DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\n"
-    "SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\n"
-    "GkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOC\n"
-    "AQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EF\n"
-    "q6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8\n"
-    "SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0\n"
-    "Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWA\n"
-    "a6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj\n"
-    "/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0T\n"
-    "AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIG\n"
-    "CCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNv\n"
-    "bTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9k\n"
-    "c3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAw\n"
-    "VAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcC\n"
-    "ARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAz\n"
-    "MDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwu\n"
-    "Y3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsF\n"
-    "AAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo\n"
-    "uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/\n"
-    "wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu\n"
-    "X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG\n"
-    "PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6\n"
-    "KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n"
-    "-----END CERTIFICATE-----\n";
-
-void dump_response(HttpResponse* res) {
-    mbedtls_printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
-
-    mbedtls_printf("Headers:\n");
-    for (size_t ix = 0; ix < res->get_headers_length(); ix++) {
-        mbedtls_printf("\t%s: %s\n", res->get_headers_fields()[ix]->c_str(), res->get_headers_values()[ix]->c_str());
-    }
-    mbedtls_printf("\nBody (%d bytes):\n\n%s\n", res->get_body_length(), res->get_body_as_string().c_str());
-}
-
-int main() {
-    pc.baud(115200);
-
-    NetworkInterface* network = easy_connect(true);
-    if (!network) {
-        return 1;
-    }
-
-    // Create a TLS socket (which holds a TCPSocket)
-    printf("\n----- Setting up TLS connection -----\n");
-
-    TLSSocket* socket = new TLSSocket(network, "httpbin.org", 443, SSL_CA_PEM);
-    socket->set_debug(true);
-    if (socket->connect() != 0) {
-        printf("TLS Connect failed %d\n", socket->error());
-        return 1;
-    }
-
-    // GET request to httpbin.org
-    {
-        HttpsRequest* get_req = new HttpsRequest(socket, HTTP_GET, "https://httpbin.org/status/418");
-        get_req->set_debug(true);
-
-        HttpResponse* get_res = get_req->send();
-        if (!get_res) {
-            printf("HttpRequest failed (error code %d)\n", get_req->get_error());
-            return 1;
-        }
-        printf("\n----- HTTPS GET response -----\n");
-        dump_response(get_res);
-
-        delete get_req;
-    }
-
-    // POST request to httpbin.org
-    {
-        HttpsRequest* post_req = new HttpsRequest(socket, HTTP_POST, "https://httpbin.org/post");
-        post_req->set_debug(true);
-        post_req->set_header("Content-Type", "application/json");
-
-        const char body[] = "{\"hello\":\"world\"}";
-
-        HttpResponse* post_res = post_req->send(body, strlen(body));
-        if (!post_res) {
-            printf("HttpRequest failed (error code %d)\n", post_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTPS POST response -----\n");
-        dump_response(post_res);
-
-        delete post_req;
-    }
-
-    delete socket;
-
-    Thread::wait(osWaitForever);
-}
-
-#endif
--- a/source/main-https.cpp	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-#include "select-demo.h"
-
-#if DEMO == DEMO_HTTPS
-
-#include "mbed.h"
-#include "easy-connect.h"
-#include "https_request.h"
-#include "TestHPM.h"
-#include "HPM.h"
-
-Serial pc(USBTX, USBRX);
-
-/* List of trusted root CA certificates
- * currently two: GlobalSign, the CA for developer.mbed.org and Let's Encrypt, the CA for httpbin.org
- *
- * To add more root certificates, just concatenate them.
- */
-
-const char SSL_CA_PEM[] = 
-/* DigiCert Baltimore Root */
-"-----BEGIN CERTIFICATE-----\r\n"
-"MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ\r\n"
-"RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD\r\n"
-"VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX\r\n"
-"DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y\r\n"
-"ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy\r\n"
-"VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr\r\n"
-"mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr\r\n"
-"IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK\r\n"
-"mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu\r\n"
-"XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy\r\n"
-"dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye\r\n"
-"jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1\r\n"
-"BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3\r\n"
-"DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92\r\n"
-"9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx\r\n"
-"jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0\r\n"
-"Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz\r\n"
-"ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS\r\n"
-"R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp\r\n"
-"-----END CERTIFICATE-----\r\n";
-
-void dump_response(HttpResponse* res) {
-    mbedtls_printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
-
-    mbedtls_printf("Headers:\n");
-    for (size_t ix = 0; ix < res->get_headers_length(); ix++) {
-        mbedtls_printf("\t%s: %s\n", res->get_headers_fields()[ix]->c_str(), res->get_headers_values()[ix]->c_str());
-    }
-    mbedtls_printf("\nBody (%d bytes):\n\n%s\n", res->get_body_length(), res->get_body_as_string().c_str());
-}
-
-int main() {
-    pc.baud(115200);
-    
-    // Create an instance of the Honeywell Particle sensor interface object
-    HPM sensor(D1, D0);
-
-    NetworkInterface* network = easy_connect(true);
-    if (!network) {
-        return 1;
-    }
-
-    for (int i=0;i<5;i++)
-    // POST request to httpbin.org
-    {
-        printf("\n----- HTTPS POST request -----\n");
-        
-        std::string iotHub = "hublora";
-        //std::string iotHub = "smartlink-iot-hub-1";
-        std::string deviceId = "HPM01";
-        //std::string deviceId = "smartlink-test-device-1";
-        std::string api = "2016-02-03";
-    
-        //Build rest endpoint for the device.
-        std::string restUri = "https://"+iotHub+".azure-devices.net/devices/"+ deviceId+"/messages/events?api-version="+api;
-        const char* s = restUri.c_str();
-
-        HttpsRequest* post_req = new HttpsRequest(network, SSL_CA_PEM, HTTP_POST, s);
-        post_req->set_debug(true);
-        post_req->set_header("Content-Type", "application/json");
-        //post_req->set_header("Authorization","SharedAccessSignature sr=smartlink-iot-hub-1.azure-devices.net%2Fdevices%2Fsmartlink-test-device-1&sig=KaZZE%2BLN4Muu%2FerJM4pqVF8n%2Bdg8j141id5CYzxUFkA%3D&se=1542117770");
-        post_req->set_header("Authorization","SharedAccessSignature sr=hublora.azure-devices.net%2Fdevices%2FHPM01&sig=3app1U%2Fvh1mIgcv0vb%2FsXa33udUpnwITURxOFPQFsJI%3D&se=1541972292");
-        
-        #if TEST
-        printf("TEST getPMReadingsJSON()");
-        string valuesJSON = TestHPM::getPMReadingsJSON();
-        char body[256];
-        strncpy(body, valuesJSON.c_str(), sizeof(body));
-        printf("%s", body);
-        #else
-        printf("SENSOR getPMReadingsJSON()");
-//        const char body[] = "{\"hello\":\"SmartLink\"}";
-        string valuesJSON = sensor.getPMReadingsJSON();
-        printf("HTM Library returned");
-        char body[256];
-        strncpy(body, valuesJSON.c_str(), sizeof(body));
-        printf("%S", body);
-        #endif
-
-        HttpResponse* post_res = post_req->send(body, strlen(body));
-        if (!post_res) {
-            printf("HttpRequest failed (error code %d)\n", post_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTPS POST response -----\n");
-        dump_response(post_res);
-
-        delete post_req;
-    }
-
-    Thread::wait(osWaitForever);
-}
-
-#endif
--- a/source/prev_test_main-https.cpp	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-#include "select-demo.h"
-
-#if DEMO == OLD_TEST_DEMO_HTTPS
-
-#include "mbed.h"
-#include "easy-connect.h"
-#include "https_request.h"
-#include "TestHPM.h"
-//#include <sstream>
-
-Serial pc(USBTX, USBRX);
-
-/* List of trusted root CA certificates
- * currently two: GlobalSign, the CA for developer.mbed.org and Let's Encrypt, the CA for httpbin.org
- *
- * To add more root certificates, just concatenate them.
- */
-
-const char SSL_CA_PEM[] = 
-/* DigiCert Baltimore Root */
-"-----BEGIN CERTIFICATE-----\r\n"
-"MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ\r\n"
-"RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD\r\n"
-"VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX\r\n"
-"DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y\r\n"
-"ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy\r\n"
-"VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr\r\n"
-"mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr\r\n"
-"IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK\r\n"
-"mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu\r\n"
-"XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy\r\n"
-"dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye\r\n"
-"jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1\r\n"
-"BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQ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8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG\n"
-    "snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ\n"
-    "U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8\n"
-    "9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E\n"
-    "BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B\n"
-    "AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz\n"
-    "yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE\n"
-    "38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP\n"
-    "AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad\n"
-    "DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME\n"
-    "HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==\n"
-    "-----END CERTIFICATE-----\n"
-    "-----BEGIN CERTIFICATE-----\n"
-    "MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/\n"
-    "MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
-    "DkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0Nlow\n"
-    "SjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMT\n"
-    "Gkxld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fNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJo\n"
-    "uM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/\n"
-    "wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwu\n"
-    "X4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlG\n"
-    "PfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6\n"
-    "KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n"
-    "-----END CERTIFICATE-----\n"
-    */
-    ;
-    
-
-
-void dump_response(HttpResponse* res) {
-    mbedtls_printf("Status: %d - %s\n", res->get_status_code(), res->get_status_message().c_str());
-
-    mbedtls_printf("Headers:\n");
-    for (size_t ix = 0; ix < res->get_headers_length(); ix++) {
-        mbedtls_printf("\t%s: %s\n", res->get_headers_fields()[ix]->c_str(), res->get_headers_values()[ix]->c_str());
-    }
-    mbedtls_printf("\nBody (%d bytes):\n\n%s\n", res->get_body_length(), res->get_body_as_string().c_str());
-}
-
-int main() {
-    pc.baud(115200);
-
-    NetworkInterface* network = easy_connect(true);
-    if (!network) {
-        return 1;
-    }
-
-    for (int i=0;i<5;i++)
-    // POST request to httpbin.org
-    {
-        printf("\n----- HTTPS POST request -----\n");
-        printf("\n----- Test Function HPM -----\n");
-        //std::string iotHub = "hublora";
-        std::string iotHub = "smartlink-iot-hub-1";
-        //std::string deviceId = "HPM01";
-        std::string deviceId = "smartlink-test-device-1";
-        std::string api = "2016-02-03";
-
-        //Build rest endpoint for the device.
-        std::string restUri = "https://"+iotHub+".azure-devices.net/devices/"+ deviceId+"/messages/events?api-version="+api;
-        const char* s = restUri.c_str();
-
-        HttpsRequest* post_req = new HttpsRequest(network, SSL_CA_PEM, HTTP_POST, s);
-        post_req->set_debug(true);
-        post_req->set_header("Content-Type", "application/json");
-        post_req->set_header("Authorization","SharedAccessSignature sr=smartlink-iot-hub-1.azure-devices.net%2Fdevices%2Fsmartlink-test-device-1&sig=KaZZE%2BLN4Muu%2FerJM4pqVF8n%2Bdg8j141id5CYzxUFkA%3D&se=1542117770");
-        //post_req->set_header("Authorization","SharedAccessSignature sr=hublora.azure-devices.net%2Fdevices%2FHPM01&sig=3app1U%2Fvh1mIgcv0vb%2FsXa33udUpnwITURxOFPQFsJI%3D&se=1541972292");
-        
-        //std::stringstream data;
-        //TestHPM::PMReading readings = TestHPM::getPMReadings();
-        //uint16_t * readings[3] = TestHPM::getPMReadings();
-        //data << "{\"PM01\": " << readings.PM01Value << ", \"PM2_5\": " << readings.PM2_5Value << ", \"PM10\": " << readings.PM10Value << "}";
-          
-        //string data = "{\"PM01\": ";
-//        //uint16_t * readings[3] = TestHPM::getPMReadings();
-//        //data << "{\"PM01\": " << readings.PM01Value << ", \"PM2_5\": " << readings.PM2_5Value << ", \"PM10\": " << readings.PM10Value << "}";
-//        char str[32];
-//        string dataArray[3];
-//        dataArray[0] = sprintf(str, "%d", readings.PM01Value);//"%f"
-//        data.append(dataArray[0]);
-//        data = data + ", \"PM2_5\": ";
-//        dataArray[1] = sprintf(str, "%d", readings.PM2_5Value);//"%f"
-//        data.append(dataArray[1]);
-//        data = data + ", \"PM10\": ";
-//        dataArray[2] = sprintf(str, "%d", readings.PM10Value);//"%f"
-//        data.append(dataArray[2]);
-//        data = data + "}";
-        // Convert the string to char array, which is expected by the http send method
-//        char data[256] = TestHPM::getPMReadingsJSON();
-        
-//        body[sizeof(body) - 1] = 0;
-//        char body[] = valuesJSON.c_str();
-
-        string valuesJSON = TestHPM::getPMReadingsJSON();
-        char body[256];
-        strncpy(body, valuesJSON.c_str(), sizeof(body));
-        
-        //const char body[] = "{\"hello\":\"SmartLink\"}";
-
-        //HttpResponse* post_res = post_req->send(data, strlen(data));
-        HttpResponse* post_res = post_req->send(body, strlen(body));
-        if (!post_res) {
-            printf("HttpRequest failed (error code %d)\n", post_req->get_error());
-            return 1;
-        }
-
-        printf("\n----- HTTPS POST response -----\n");
-        dump_response(post_res);
-        delete post_req;
-    }
-    Thread::wait(osWaitForever);
-}
-
-#endif
--- a/source/select-demo.h	Wed Nov 29 17:02:13 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#ifndef _SELECT_METHOD_H_
-#define _SELECT_METHOD_H_
-
-#define         DEMO_HTTP                   1
-#define         DEMO_HTTP_SOCKET_REUSE      2
-#define         DEMO_HTTPS                  3
-#define         DEMO_HTTPS_SOCKET_REUSE     4
-
-#define         DEMO            DEMO_HTTPS
-
-// TEST 1 to run the fake PM generator, TEST 0 to use attached sensor
-#define         TEST            1
-
-#endif // _SELECT_METHOD_H_