Demo application for using the AT&T IoT Starter Kit Powered by AWS.

Dependencies:   SDFileSystem

Fork of ATT_AWS_IoT_demo by Anthony Phillips

IoT Starter Kit Powered by AWS Demo

This program demonstrates the AT&T IoT Starter Kit sending data directly into AWS IoT. It's explained and used in the Getting Started with the IoT Starter Kit Powered by AWS on starterkit.att.com.

What's required

  • AT&T IoT LTE Add-on (also known as the Cellular Shield)
  • NXP K64F - for programming
  • microSD card - used to store your AWS security credentials
  • AWS account
  • Python, locally installed

If you don't already have an IoT Starter Kit, you can purchase a kit here. The IoT Starter Kit Powered by AWS includes the LTE cellular shield, K64F, and a microSD card.

Revision:
9:1ac74f2d7bda
Parent:
0:fc70c47eecb4
Child:
12:1ae41c231014
--- a/main.cpp	Sat Aug 20 00:00:22 2016 +0100
+++ b/main.cpp	Tue Sep 06 16:30:30 2016 +0100
@@ -267,8 +267,9 @@
         /* It also means the handshake is done, time to print info */
         printf("TLS connection to %s established\r\n", HTTPS_SERVER_NAME);
 
-        char buf[1024];
-        mbedtls_x509_crt_info(buf, sizeof(buf), "\r    ",
+        const uint32_t buf_size = 1024;
+        char *buf = new char[buf_size];
+        mbedtls_x509_crt_info(buf, buf_size, "\r    ",
                         mbedtls_ssl_get_peer_cert(&_ssl));
         mbedtls_printf("Server certificate:\r\n%s\r", buf);
 
@@ -276,7 +277,7 @@
         uint32_t flags = mbedtls_ssl_get_verify_result(&_ssl);
         if( flags != 0 )
         {
-            mbedtls_x509_crt_verify_info(buf, sizeof (buf), "\r  ! ", flags);
+            mbedtls_x509_crt_verify_info(buf, buf_size, "\r  ! ", flags);
             printf("Certificate verification failed:\r\n%s\r\r\n", buf);
         }
         else
@@ -291,6 +292,7 @@
                 print_mbedtls_error("mbedtls_ssl_read", ret);
                 onError(_tcpsocket, -1 );
             }
+            delete[] buf;
             return;
         }
         _bpos = static_cast<size_t>(ret);
@@ -310,6 +312,7 @@
         _error = !(_got200 && _gothello);
 
         _tcpsocket->close();
+        delete[] buf;
     }
     /**
      * Check if the test has completed.
@@ -370,21 +373,23 @@
      */
     static int my_verify(void *data, mbedtls_x509_crt *crt, int depth, uint32_t *flags)
     {
-        char buf[1024];
+        const uint32_t buf_size = 1024;
+        char *buf = new char[buf_size];
         (void) data;
 
         mbedtls_printf("\nVerifying certificate at depth %d:\n", depth);
-        mbedtls_x509_crt_info(buf, sizeof (buf) - 1, "  ", crt);
+        mbedtls_x509_crt_info(buf, buf_size - 1, "  ", crt);
         mbedtls_printf("%s", buf);
 
         if (*flags == 0)
             mbedtls_printf("No verification issue for this certificate\n");
         else
         {
-            mbedtls_x509_crt_verify_info(buf, sizeof (buf), "  ! ", *flags);
+            mbedtls_x509_crt_verify_info(buf, buf_size, "  ! ", *flags);
             mbedtls_printf("%s\n", buf);
         }
 
+        delete[] buf;
         return 0;
     }
 #endif
@@ -467,6 +472,7 @@
         mbedtls_printf("No Client IP Address\r\n");
     }
 
-    HelloHTTPS hello(HTTPS_SERVER_NAME, HTTPS_SERVER_PORT, &eth_iface);
-    hello.startTest(HTTPS_PATH);
+    HelloHTTPS *hello = new HelloHTTPS(HTTPS_SERVER_NAME, HTTPS_SERVER_PORT, &eth_iface);
+    hello->startTest(HTTPS_PATH);
+    delete hello;
 }