Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem
Fork of ATT_AWS_IoT_demo by
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, committed 2016-09-06
- Comitter:
- mbed_official
- Date:
- Tue Sep 06 16:30:30 2016 +0100
- Parent:
- 8:50d4701593ad
- Child:
- 10:f4fc50022e71
- Commit message:
- Reduce example stack usage
Dynamically allocate buffers that would normally be declared on the
stack. This reduces the maximum stack depth by ~2k.
Commit copied from https://github.com/ARMmbed/mbed-os-example-tls
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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, ð_iface);
- hello.startTest(HTTPS_PATH);
+ HelloHTTPS *hello = new HelloHTTPS(HTTPS_SERVER_NAME, HTTPS_SERVER_PORT, ð_iface);
+ hello->startTest(HTTPS_PATH);
+ delete hello;
}
