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.

Committer:
rfinn
Date:
Tue Feb 07 16:18:57 2017 +0000
Revision:
27:2f486c766854
Parent:
15:6f2798e45099
changed SDFileSystem library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ampembeng 15:6f2798e45099 1 /* =====================================================================
ampembeng 15:6f2798e45099 2 Copyright © 2016, Avnet (R)
ampembeng 15:6f2798e45099 3
ampembeng 15:6f2798e45099 4 Contributors:
ampembeng 15:6f2798e45099 5 * James M Flynn, www.em.avnet.com
ampembeng 15:6f2798e45099 6
ampembeng 15:6f2798e45099 7 Licensed under the Apache License, Version 2.0 (the "License");
ampembeng 15:6f2798e45099 8 you may not use this file except in compliance with the License.
ampembeng 15:6f2798e45099 9 You may obtain a copy of the License at
ampembeng 15:6f2798e45099 10
ampembeng 15:6f2798e45099 11 http://www.apache.org/licenses/LICENSE-2.0
ampembeng 15:6f2798e45099 12
ampembeng 15:6f2798e45099 13 Unless required by applicable law or agreed to in writing,
ampembeng 15:6f2798e45099 14 software distributed under the License is distributed on an
ampembeng 15:6f2798e45099 15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
ampembeng 15:6f2798e45099 16 either express or implied. See the License for the specific
ampembeng 15:6f2798e45099 17 language governing permissions and limitations under the License.
ampembeng 15:6f2798e45099 18
ampembeng 15:6f2798e45099 19 @file WNCInterface.cpp
ampembeng 15:6f2798e45099 20 @version 1.0
ampembeng 15:6f2798e45099 21 @date Sept 2016
ampembeng 15:6f2798e45099 22
ampembeng 15:6f2798e45099 23 ======================================================================== */
ampembeng 15:6f2798e45099 24
ampembeng 15:6f2798e45099 25 #ifndef WNCTCPSOCKET_H
ampembeng 15:6f2798e45099 26 #define WNCTCPSOCKET_H
ampembeng 15:6f2798e45099 27
ampembeng 15:6f2798e45099 28 #include "WNCSocket/WNCSocket.h"
ampembeng 15:6f2798e45099 29 #include "WNCSocket/WNCEndpoint.h"
ampembeng 15:6f2798e45099 30
ampembeng 15:6f2798e45099 31 /**
ampembeng 15:6f2798e45099 32 TCP socket connection
ampembeng 15:6f2798e45099 33 */
ampembeng 15:6f2798e45099 34 class WNCTCPSocketConnection : public WNCSocket, public WNCEndpoint {
ampembeng 15:6f2798e45099 35
ampembeng 15:6f2798e45099 36 public:
ampembeng 15:6f2798e45099 37 WNCTCPSocketConnection();
ampembeng 15:6f2798e45099 38
ampembeng 15:6f2798e45099 39 /** Connects this TCP socket to the server
ampembeng 15:6f2798e45099 40 \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS.
ampembeng 15:6f2798e45099 41 \param port The host's port to connect to.
ampembeng 15:6f2798e45099 42 \return 0 on success, -1 on failure.
ampembeng 15:6f2798e45099 43 */
ampembeng 15:6f2798e45099 44 int connect(const char* host, const int port);
ampembeng 15:6f2798e45099 45
ampembeng 15:6f2798e45099 46 /** Check if the socket is connected
ampembeng 15:6f2798e45099 47 \return true if connected, false otherwise.
ampembeng 15:6f2798e45099 48 */
ampembeng 15:6f2798e45099 49 bool is_connected(void);
ampembeng 15:6f2798e45099 50
ampembeng 15:6f2798e45099 51 /** Send data to the remote host.
ampembeng 15:6f2798e45099 52 \param data The buffer to send to the host.
ampembeng 15:6f2798e45099 53 \param length The length of the buffer to send.
ampembeng 15:6f2798e45099 54 \return the number of written bytes on success (>=0) or -1 on failure
ampembeng 15:6f2798e45099 55 */
ampembeng 15:6f2798e45099 56 int send(char* data, int length);
ampembeng 15:6f2798e45099 57
ampembeng 15:6f2798e45099 58 /** Send all the data to the remote host.
ampembeng 15:6f2798e45099 59 \param data The buffer to send to the host.
ampembeng 15:6f2798e45099 60 \param length The length of the buffer to send.
ampembeng 15:6f2798e45099 61 \return the number of written bytes on success (>=0) or -1 on failure
ampembeng 15:6f2798e45099 62 */
ampembeng 15:6f2798e45099 63 int send_all(char* data, int length);
ampembeng 15:6f2798e45099 64
ampembeng 15:6f2798e45099 65 /** Receive data from the remote host.
ampembeng 15:6f2798e45099 66 \param data The buffer in which to store the data received from the host.
ampembeng 15:6f2798e45099 67 \param length The maximum length of the buffer.
ampembeng 15:6f2798e45099 68 \return the number of received bytes on success (>=0) or -1 on failure
ampembeng 15:6f2798e45099 69 */
ampembeng 15:6f2798e45099 70 int receive(char* data, int length);
ampembeng 15:6f2798e45099 71
ampembeng 15:6f2798e45099 72 /** Receive all the data from the remote host.
ampembeng 15:6f2798e45099 73 \param data The buffer in which to store the data received from the host.
ampembeng 15:6f2798e45099 74 \param length The maximum length of the buffer.
ampembeng 15:6f2798e45099 75 \return the number of received bytes on success (>=0) or -1 on failure
ampembeng 15:6f2798e45099 76 */
ampembeng 15:6f2798e45099 77 int receive_all(char* data, int length);
ampembeng 15:6f2798e45099 78
ampembeng 15:6f2798e45099 79 /** Set blocking or non-blocking mode of the socket and a timeout
ampembeng 15:6f2798e45099 80 \param blocking true for blocking mode, false for non-blocking mode.
ampembeng 15:6f2798e45099 81 \return none
ampembeng 15:6f2798e45099 82 */
ampembeng 15:6f2798e45099 83 void set_blocking (bool blocking, unsigned int timeout=1500);
ampembeng 15:6f2798e45099 84
ampembeng 15:6f2798e45099 85 /** Close the socket
ampembeng 15:6f2798e45099 86 \param none
ampembeng 15:6f2798e45099 87 \return 0 if closed successfully, -1 on failure
ampembeng 15:6f2798e45099 88 */
ampembeng 15:6f2798e45099 89 int close(void);
ampembeng 15:6f2798e45099 90
ampembeng 15:6f2798e45099 91 private:
ampembeng 15:6f2798e45099 92 bool _is_blocking;
ampembeng 15:6f2798e45099 93 unsigned int _btimeout;
ampembeng 15:6f2798e45099 94
ampembeng 15:6f2798e45099 95 };
ampembeng 15:6f2798e45099 96
ampembeng 15:6f2798e45099 97 #endif
ampembeng 15:6f2798e45099 98