NuMaker connection with AWS IoT thru MQTT/HTTPS

Dependencies:   MQTT_ON_AWS

Committer:
ccli8
Date:
Thu Jan 04 13:09:45 2018 +0800
Revision:
1:5ffad9f24d63
Child:
4:dc23eeba885a
Support AWS IoT MQTT/HTTPS protocol

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ccli8 1:5ffad9f24d63 1 # Example for Connection with AWS IoT thru MQTT/HTTPS on Mbed OS
ccli8 1:5ffad9f24d63 2
ccli8 1:5ffad9f24d63 3 This is an example to demonstrate connection with [AWS IoT](https://aws.amazon.com/iot)
ccli8 1:5ffad9f24d63 4 on Nuvoton Mbed-enabled boards.
ccli8 1:5ffad9f24d63 5
ccli8 1:5ffad9f24d63 6 ## Supported platforms
ccli8 1:5ffad9f24d63 7 On Mbed OS, connection with AWS IoT requires Mbed TLS. It requires more than 64 KB RAM.
ccli8 1:5ffad9f24d63 8 Currently, the following Nuvoton Mbed-enalbed boards can afford such memory footprint:
ccli8 1:5ffad9f24d63 9 - [NuMaker-PFM-NUC472](https://developer.mbed.org/platforms/Nuvoton-NUC472/)
ccli8 1:5ffad9f24d63 10 - [NuMaker-PFM-M487](https://developer.mbed.org/platforms/NUMAKER-PFM-M487/)
ccli8 1:5ffad9f24d63 11
ccli8 1:5ffad9f24d63 12 ## Access and manage AWS IoT Service
ccli8 1:5ffad9f24d63 13 To run the example, you need to register one [AWS account](https://aws.amazon.com/)
ccli8 1:5ffad9f24d63 14 to access and manage AWS IoT Service for your device to connect with.
ccli8 1:5ffad9f24d63 15 This [link](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) gives detailed
ccli8 1:5ffad9f24d63 16 information about it.
ccli8 1:5ffad9f24d63 17
ccli8 1:5ffad9f24d63 18 1. Sign in to [AWS Management Console](https://aws.amazon.com/console/).
ccli8 1:5ffad9f24d63 19 1. Enter AWS IoT Service.
ccli8 1:5ffad9f24d63 20 1. In AWS IoT Service, create a thing.
ccli8 1:5ffad9f24d63 21 The Console may prompt you to also create a certificate and a policy. Skip for creating them later.
ccli8 1:5ffad9f24d63 22 1. In AWS IoT Service, create a policy. A workable example would be below.
ccli8 1:5ffad9f24d63 23 Note that you need to replace **REGION** and **ACCOUNT** to match your case.
ccli8 1:5ffad9f24d63 24
ccli8 1:5ffad9f24d63 25 <pre>
ccli8 1:5ffad9f24d63 26 {
ccli8 1:5ffad9f24d63 27 "Version": "2012-10-17",
ccli8 1:5ffad9f24d63 28 "Statement": [
ccli8 1:5ffad9f24d63 29 {
ccli8 1:5ffad9f24d63 30 "Effect": "Allow",
ccli8 1:5ffad9f24d63 31 "Action": "iot:Connect",
ccli8 1:5ffad9f24d63 32 "Resource": "arn:aws:iot:<b>REGION</b>:<b>ACCOUNT</b>:client/*"
ccli8 1:5ffad9f24d63 33 },
ccli8 1:5ffad9f24d63 34 {
ccli8 1:5ffad9f24d63 35 "Effect": "Allow",
ccli8 1:5ffad9f24d63 36 "Action": "iot:Subscribe",
ccli8 1:5ffad9f24d63 37 "Resource": ["arn:aws:iot:<b>REGION</b>:<b>ACCOUNT</b>:topicfilter/*"]
ccli8 1:5ffad9f24d63 38 },
ccli8 1:5ffad9f24d63 39 {
ccli8 1:5ffad9f24d63 40 "Effect": "Allow",
ccli8 1:5ffad9f24d63 41 "Action": ["iot:Publish", "iot:Receive"],
ccli8 1:5ffad9f24d63 42 "Resource": "arn:aws:iot:<b>REGION</b>:<b>ACCOUNT</b>:topic/*"
ccli8 1:5ffad9f24d63 43 },
ccli8 1:5ffad9f24d63 44 {
ccli8 1:5ffad9f24d63 45 "Effect": "Allow",
ccli8 1:5ffad9f24d63 46 "Action": ["iot:UpdateThingShadow", "iot:GetThingShadow", "iot:DeleteThingShadow"],
ccli8 1:5ffad9f24d63 47 "Resource": "arn:aws:iot:<b>REGION</b>:<b>ACCOUNT</b>:thing/*"
ccli8 1:5ffad9f24d63 48 }
ccli8 1:5ffad9f24d63 49 ]
ccli8 1:5ffad9f24d63 50 }
ccli8 1:5ffad9f24d63 51 </pre>
ccli8 1:5ffad9f24d63 52
ccli8 1:5ffad9f24d63 53 1. In AWS IoT Service, create a certificate. You would get 4 security credential files from it.
ccli8 1:5ffad9f24d63 54 Download them for later use.
ccli8 1:5ffad9f24d63 55 - AWS IoT's CA certificate
ccli8 1:5ffad9f24d63 56 - User certificate
ccli8 1:5ffad9f24d63 57 - User private key
ccli8 1:5ffad9f24d63 58 - User public key
ccli8 1:5ffad9f24d63 59
ccli8 1:5ffad9f24d63 60 After creating the certificate, do:
ccli8 1:5ffad9f24d63 61 1. Activate the certificate
ccli8 1:5ffad9f24d63 62 1. Attach the thing created above to the certificate
ccli8 1:5ffad9f24d63 63 1. Attach the policy created above to the certificate
ccli8 1:5ffad9f24d63 64
ccli8 1:5ffad9f24d63 65 ## Configure your device with AWS IoT
ccli8 1:5ffad9f24d63 66 Before connecting your device with AWS IoT, you need to configure security credential and
ccli8 1:5ffad9f24d63 67 protocol dependent parameters into your device. These configurations are all centralized in `main.cpp`.
ccli8 1:5ffad9f24d63 68
ccli8 1:5ffad9f24d63 69 ### Configure certificate into your device
ccli8 1:5ffad9f24d63 70 From above, you've got 4 security credential files: CA certificate and user certificate/private key/public key.
ccli8 1:5ffad9f24d63 71 Configure CA certificate, user certificate, and user private key into your device.
ccli8 1:5ffad9f24d63 72 User public key has been included in user certificate and is not used here.
ccli8 1:5ffad9f24d63 73 1. Replace CA certificate with downloaded from the Console.
ccli8 1:5ffad9f24d63 74 ```
ccli8 1:5ffad9f24d63 75 const char SSL_CA_CERT_PEM[] = "-----BEGIN CERTIFICATE-----\n"
ccli8 1:5ffad9f24d63 76 "MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB\n"
ccli8 1:5ffad9f24d63 77 "yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL\n"
ccli8 1:5ffad9f24d63 78 ```
ccli8 1:5ffad9f24d63 79
ccli8 1:5ffad9f24d63 80 1. Replace user certificate with downloaded from the Console.
ccli8 1:5ffad9f24d63 81 ```
ccli8 1:5ffad9f24d63 82 const char SSL_USER_CERT_PEM[] = "-----BEGIN CERTIFICATE-----\n"
ccli8 1:5ffad9f24d63 83 "MIIDWjCCAkKgAwIBAgIVALN/H7tr8cgpl2zwg0JjEE106XilMA0GCSqGSIb3DQEB\n"
ccli8 1:5ffad9f24d63 84 "CwUAME0xSzBJBgNVBAsMQkFtYXpvbiBXZWIgU2VydmljZXMgTz1BbWF6b24uY29t\n"
ccli8 1:5ffad9f24d63 85 ```
ccli8 1:5ffad9f24d63 86
ccli8 1:5ffad9f24d63 87 1. Replace user private key with downloaded from the Console.
ccli8 1:5ffad9f24d63 88 ```
ccli8 1:5ffad9f24d63 89 const char SSL_USER_PRIV_KEY_PEM[] = "-----BEGIN RSA PRIVATE KEY-----\n"
ccli8 1:5ffad9f24d63 90 ```
ccli8 1:5ffad9f24d63 91
ccli8 1:5ffad9f24d63 92 ### Connect through MQTT
ccli8 1:5ffad9f24d63 93 To connect your device with AWS IoT through MQTT, you need to configure the following parameters.
ccli8 1:5ffad9f24d63 94
ccli8 1:5ffad9f24d63 95 1. Enable connection through MQTT.
ccli8 1:5ffad9f24d63 96 ```
ccli8 1:5ffad9f24d63 97 #define AWS_IOT_MQTT_TEST 1
ccli8 1:5ffad9f24d63 98 ```
ccli8 1:5ffad9f24d63 99
ccli8 1:5ffad9f24d63 100 1. Replace server name (endpoint). **Endpoint** has the following format and you just
ccli8 1:5ffad9f24d63 101 need to modify **IDENTIFIER** and **REGION** to match your case.
ccli8 1:5ffad9f24d63 102 <pre>
ccli8 1:5ffad9f24d63 103 #define AWS_IOT_MQTT_SERVER_NAME "<b>IDENTIFIER</b>.iot.<b>REGION</b>.amazonaws.com"
ccli8 1:5ffad9f24d63 104 </pre>
ccli8 1:5ffad9f24d63 105
ccli8 1:5ffad9f24d63 106 1. Server port number is fixed. Don't change it.
ccli8 1:5ffad9f24d63 107 ```
ccli8 1:5ffad9f24d63 108 #define AWS_IOT_MQTT_SERVER_PORT 8883
ccli8 1:5ffad9f24d63 109 ```
ccli8 1:5ffad9f24d63 110
ccli8 1:5ffad9f24d63 111 1. Replace **THINGNAME** to match your case. The **THINGNAME** is just the name of the thing you've created above.
ccli8 1:5ffad9f24d63 112 <pre>
ccli8 1:5ffad9f24d63 113 #define AWS_IOT_MQTT_THINGNAME "<b>THINGNAME</b>"
ccli8 1:5ffad9f24d63 114 </pre>
ccli8 1:5ffad9f24d63 115
ccli8 1:5ffad9f24d63 116 1. Replace **CLIENTNAME** to match your case. If you adopt the example policy above,
ccli8 1:5ffad9f24d63 117 you can modify it arbitrarily because the policy permits any client name bound to your account.
ccli8 1:5ffad9f24d63 118 <pre>
ccli8 1:5ffad9f24d63 119 #define AWS_IOT_MQTT_CLIENTNAME "<b>CLIENTNAME</b>"
ccli8 1:5ffad9f24d63 120 </pre>
ccli8 1:5ffad9f24d63 121
ccli8 1:5ffad9f24d63 122 AWS IoT MQTT protocol supports topic subscribe/publish. The example demonstrates:
ccli8 1:5ffad9f24d63 123 - Subscribe/publish with user topic
ccli8 1:5ffad9f24d63 124 - Subscribe/publish with reserved topic (starting with $) to:
ccli8 1:5ffad9f24d63 125 - Update thing shadow
ccli8 1:5ffad9f24d63 126 - Get thing shadow
ccli8 1:5ffad9f24d63 127 - Delete thing shadow
ccli8 1:5ffad9f24d63 128
ccli8 1:5ffad9f24d63 129 ### Connect through HTTPS
ccli8 1:5ffad9f24d63 130 To connect your device with AWS IoT through HTTPS, you need to configure the following parameters.
ccli8 1:5ffad9f24d63 131
ccli8 1:5ffad9f24d63 132 1. Enable connection through HTTPS.
ccli8 1:5ffad9f24d63 133 ```
ccli8 1:5ffad9f24d63 134 #define AWS_IOT_HTTPS_TEST 1
ccli8 1:5ffad9f24d63 135 ```
ccli8 1:5ffad9f24d63 136
ccli8 1:5ffad9f24d63 137 1. Replace server name (endpoint). **Endpoint** has the following format and you just
ccli8 1:5ffad9f24d63 138 need to modify **IDENTIFIER** and **REGION** to match your case.
ccli8 1:5ffad9f24d63 139 <pre>
ccli8 1:5ffad9f24d63 140 #define AWS_IOT_HTTPS_SERVER_NAME "<b>IDENTIFIER</b>.iot.<b>REGION</b>.amazonaws.com"
ccli8 1:5ffad9f24d63 141 </pre>
ccli8 1:5ffad9f24d63 142
ccli8 1:5ffad9f24d63 143 1. Server port number is fixed. Don't change it.
ccli8 1:5ffad9f24d63 144 ```
ccli8 1:5ffad9f24d63 145 #define AWS_IOT_HTTPS_SERVER_PORT 8443
ccli8 1:5ffad9f24d63 146 ```
ccli8 1:5ffad9f24d63 147
ccli8 1:5ffad9f24d63 148 1. Replace **THINGNAME** to match your case. The **THINGNAME** is just the name of the thing you've created above.
ccli8 1:5ffad9f24d63 149 <pre>
ccli8 1:5ffad9f24d63 150 #define AWS_IOT_HTTPS_THINGNAME "<b>THINGNAME</b>"
ccli8 1:5ffad9f24d63 151 </pre>
ccli8 1:5ffad9f24d63 152
ccli8 1:5ffad9f24d63 153 AWS IoT HTTPS protocol supports topic publish-only and RESTful API. The example demonstrates:
ccli8 1:5ffad9f24d63 154 - Publish to user topic
ccli8 1:5ffad9f24d63 155 - Publish to reserved topic (starting with $) to:
ccli8 1:5ffad9f24d63 156 - Update thing shadow
ccli8 1:5ffad9f24d63 157 - Get thing shadow
ccli8 1:5ffad9f24d63 158 - Delete thing shadow
ccli8 1:5ffad9f24d63 159 - RESTful API to:
ccli8 1:5ffad9f24d63 160 - Update thing shadow RESTfully through HTTPS/POST method
ccli8 1:5ffad9f24d63 161 - Get thing shadow RESTfully through HTTPS/GET method
ccli8 1:5ffad9f24d63 162 - Delete thing shadow RESTfully through HTTPS/DELETE method
ccli8 1:5ffad9f24d63 163
ccli8 1:5ffad9f24d63 164 ## Patch MQTT library
ccli8 1:5ffad9f24d63 165 Currently, MQTT library has one issue with unsubscribe from topic multiple times. Fix it:
ccli8 1:5ffad9f24d63 166
ccli8 1:5ffad9f24d63 167 In `MQTT/MQTTClient.h` > `MQTT::Client<Network, Timer, MAX_MQTT_PACKET_SIZE, b>::cycle`,
ccli8 1:5ffad9f24d63 168 <pre>
ccli8 1:5ffad9f24d63 169 switch (packet_type)
ccli8 1:5ffad9f24d63 170 {
ccli8 1:5ffad9f24d63 171 default:
ccli8 1:5ffad9f24d63 172 // no more data to read, unrecoverable. Or read packet fails due to unexpected network error
ccli8 1:5ffad9f24d63 173 rc = packet_type;
ccli8 1:5ffad9f24d63 174 goto exit;
ccli8 1:5ffad9f24d63 175 case 0: // timed out reading packet
ccli8 1:5ffad9f24d63 176 break;
ccli8 1:5ffad9f24d63 177 case CONNACK:
ccli8 1:5ffad9f24d63 178 case PUBACK:
ccli8 1:5ffad9f24d63 179 case SUBACK:
ccli8 1:5ffad9f24d63 180 <b>
ccli8 1:5ffad9f24d63 181 case UNSUBACK:
ccli8 1:5ffad9f24d63 182 </b>
ccli8 1:5ffad9f24d63 183 break;
ccli8 1:5ffad9f24d63 184 case PUBLISH:
ccli8 1:5ffad9f24d63 185 {
ccli8 1:5ffad9f24d63 186 </pre>
ccli8 1:5ffad9f24d63 187
ccli8 1:5ffad9f24d63 188 ## Monitor the application
ccli8 1:5ffad9f24d63 189 If you configure your terminal program with **9600/8-N-1**, you would see output similar to:
ccli8 1:5ffad9f24d63 190
ccli8 1:5ffad9f24d63 191 **NOTE:** Make sure that the network is functional before running the application.
ccli8 1:5ffad9f24d63 192
ccli8 1:5ffad9f24d63 193 <pre>
ccli8 1:5ffad9f24d63 194 Starting AWS IoT test
ccli8 1:5ffad9f24d63 195 Using Mbed OS 5.7.1
ccli8 1:5ffad9f24d63 196 [EasyConnect] IPv4 mode
ccli8 1:5ffad9f24d63 197 Connecting with a1fbcwaqfqeozo.iot.us-east-1.amazonaws.com:8883
ccli8 1:5ffad9f24d63 198 Connecting to a1fbcwaqfqeozo.iot.us-east-1.amazonaws.com:8883
ccli8 1:5ffad9f24d63 199 </pre>
ccli8 1:5ffad9f24d63 200
ccli8 1:5ffad9f24d63 201 If you get here successfully, it means configurations with security credential are correct.
ccli8 1:5ffad9f24d63 202 <pre>
ccli8 1:5ffad9f24d63 203 Starting the TLS handshake...
ccli8 1:5ffad9f24d63 204 TLS connection to a1fbcwaqfqeozo.iot.us-east-1.amazonaws.com:8883 established
ccli8 1:5ffad9f24d63 205 Server certificate:
ccli8 1:5ffad9f24d63 206 cert. version : 3
ccli8 1:5ffad9f24d63 207 serial number : 3C:AC:B3:D3:3E:D8:6A:C9:2B:EF:D2:C5:B1:DC:BF:66
ccli8 1:5ffad9f24d63 208 issuer name : C=US, O=Symantec Corporation, OU=Symantec Trust Network, CN=Symantec Class 3 ECC 256 bit SSL CA - G2
ccli8 1:5ffad9f24d63 209 subject name : C=US, ST=Washington, L=Seattle, O=Amazon.com, Inc., CN=*.iot.us-east-1.amazonaws.com
ccli8 1:5ffad9f24d63 210 issued on : 2017-03-07 00:00:00
ccli8 1:5ffad9f24d63 211 expires on : 2018-03-08 23:59:59
ccli8 1:5ffad9f24d63 212 signed using : ECDSA with SHA256
ccli8 1:5ffad9f24d63 213 EC key size : 256 bits
ccli8 1:5ffad9f24d63 214 basic constraints : CA=false
ccli8 1:5ffad9f24d63 215 subject alt name : iot.us-east-1.amazonaws.com, *.iot.us-east-1.amazonaws.com
ccli8 1:5ffad9f24d63 216 key usage : Digital Signature
ccli8 1:5ffad9f24d63 217 ext key usage : TLS Web Server Authentication, TLS Web Client Authentication
ccli8 1:5ffad9f24d63 218 Certificate verification passed
ccli8 1:5ffad9f24d63 219
ccli8 1:5ffad9f24d63 220 Connects with a1fbcwaqfqeozo.iot.us-east-1.amazonaws.com:8883 OK
ccli8 1:5ffad9f24d63 221 </pre>
ccli8 1:5ffad9f24d63 222
ccli8 1:5ffad9f24d63 223 MQTT handshake goes:
ccli8 1:5ffad9f24d63 224 <pre>
ccli8 1:5ffad9f24d63 225 MQTT connects OK
ccli8 1:5ffad9f24d63 226
ccli8 1:5ffad9f24d63 227 Subscribing/publishing user topic
ccli8 1:5ffad9f24d63 228 MQTT subscribes to Nuvoton/Mbed/+ OK
ccli8 1:5ffad9f24d63 229 Message to publish:
ccli8 1:5ffad9f24d63 230 { "message": "Hello from Nuvoton Mbed device" }
ccli8 1:5ffad9f24d63 231 MQTT publishes message to Nuvoton/Mbed/D001 OK
ccli8 1:5ffad9f24d63 232 Message arrived: qos 1, retained 0, dup 0, packetid 1
ccli8 1:5ffad9f24d63 233 Payload:
ccli8 1:5ffad9f24d63 234 { "message": "Hello from Nuvoton Mbed device" }
ccli8 1:5ffad9f24d63 235
ccli8 1:5ffad9f24d63 236 MQTT unsubscribes from Nuvoton/Mbed/+ OK
ccli8 1:5ffad9f24d63 237 Subscribes/publishes user topic OK
ccli8 1:5ffad9f24d63 238
ccli8 1:5ffad9f24d63 239 Subscribing/publishing UpdateThingShadow topic
ccli8 1:5ffad9f24d63 240 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/update/accepted OK
ccli8 1:5ffad9f24d63 241 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/update/rejected OK
ccli8 1:5ffad9f24d63 242 Message to publish:
ccli8 1:5ffad9f24d63 243 { "state": { "reported": { "attribute1": 3, "attribute2": "1" } } }
ccli8 1:5ffad9f24d63 244 MQTT publishes message to $aws/things/Nuvoton-Mbed-D001/shadow/update OK
ccli8 1:5ffad9f24d63 245 Message arrived: qos 1, retained 0, dup 0, packetid 1
ccli8 1:5ffad9f24d63 246 Payload:
ccli8 1:5ffad9f24d63 247 {"state":{"reported":{"attribute1":3,"attribute2":"1"}},"metadata":{"reported":{"attribute1":{"timestamp":1514962195},"attribute2":{"timestamp":1514962195}}},"version":77,"timestamp":1514962195}
ccli8 1:5ffad9f24d63 248
ccli8 1:5ffad9f24d63 249 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/update/accepted OK
ccli8 1:5ffad9f24d63 250 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/update/rejected OK
ccli8 1:5ffad9f24d63 251 Subscribes/publishes UpdateThingShadow topic OK
ccli8 1:5ffad9f24d63 252
ccli8 1:5ffad9f24d63 253 Subscribing/publishing GetThingShadow topic
ccli8 1:5ffad9f24d63 254 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/get/accepted OK
ccli8 1:5ffad9f24d63 255 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/get/rejected OK
ccli8 1:5ffad9f24d63 256 Message to publish:
ccli8 1:5ffad9f24d63 257
ccli8 1:5ffad9f24d63 258 MQTT publishes message to $aws/things/Nuvoton-Mbed-D001/shadow/get OK
ccli8 1:5ffad9f24d63 259 Message arrived: qos 1, retained 0, dup 0, packetid 1
ccli8 1:5ffad9f24d63 260 Payload:
ccli8 1:5ffad9f24d63 261 {"state":{"reported":{"attribute1":3,"attribute2":"1"}},"metadata":{"reported":{"attribute1":{"timestamp":1514962195},"attribute2":{"timestamp":1514962195}}},"version":77,"timestamp":1514962198}
ccli8 1:5ffad9f24d63 262
ccli8 1:5ffad9f24d63 263 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/get/accepted OK
ccli8 1:5ffad9f24d63 264 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/get/rejected OK
ccli8 1:5ffad9f24d63 265 Subscribes/publishes GetThingShadow topic OK
ccli8 1:5ffad9f24d63 266
ccli8 1:5ffad9f24d63 267 Subscribing/publishing DeleteThingShadow topic
ccli8 1:5ffad9f24d63 268 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/delete/accepted OK
ccli8 1:5ffad9f24d63 269 MQTT subscribes to $aws/things/Nuvoton-Mbed-D001/shadow/delete/rejected OK
ccli8 1:5ffad9f24d63 270 Message to publish:
ccli8 1:5ffad9f24d63 271
ccli8 1:5ffad9f24d63 272 MQTT publishes message to $aws/things/Nuvoton-Mbed-D001/shadow/delete OK
ccli8 1:5ffad9f24d63 273 Message arrived: qos 1, retained 0, dup 0, packetid 1
ccli8 1:5ffad9f24d63 274 Payload:
ccli8 1:5ffad9f24d63 275 {"version":77,"timestamp":1514962202}
ccli8 1:5ffad9f24d63 276
ccli8 1:5ffad9f24d63 277 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/delete/accepted OK
ccli8 1:5ffad9f24d63 278 MQTT unsubscribes from $aws/things/Nuvoton-Mbed-D001/shadow/delete/rejected OK
ccli8 1:5ffad9f24d63 279 Subscribes/publishes DeleteThingShadow topic OK
ccli8 1:5ffad9f24d63 280
ccli8 1:5ffad9f24d63 281 MQTT disconnects OK
ccli8 1:5ffad9f24d63 282 </pre>
ccli8 1:5ffad9f24d63 283
ccli8 1:5ffad9f24d63 284 Dynamic memory footprint (heap) is output below.
ccli8 1:5ffad9f24d63 285 Static memory footprint (global/stack) could be obtained by inspecting MAP file.
ccli8 1:5ffad9f24d63 286 You could get total memory footprint by adding these two together.
ccli8 1:5ffad9f24d63 287 <pre>
ccli8 1:5ffad9f24d63 288 Current heap size: 1351
ccli8 1:5ffad9f24d63 289 Max heap size: 63022
ccli8 1:5ffad9f24d63 290 </pre>