Demo application for using the AT&T IoT Starter Kit Powered by AWS.
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.
AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/timer_interface.h@23:b9ff83dc965f, 2016-12-15 (annotated)
- Committer:
- ampembeng
- Date:
- Thu Dec 15 18:05:09 2016 +0000
- Revision:
- 23:b9ff83dc965f
- Parent:
- 15:6f2798e45099
Added an alternate demo that publishes JSON data to a topic instead of using the device shadow. The topic (rule) is intended to be used along with DynamoDB and S3 (a static website).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ampembeng | 15:6f2798e45099 | 1 | /******************************************************************************* |
ampembeng | 15:6f2798e45099 | 2 | * Copyright (c) 2014 IBM Corp. |
ampembeng | 15:6f2798e45099 | 3 | * |
ampembeng | 15:6f2798e45099 | 4 | * All rights reserved. This program and the accompanying materials |
ampembeng | 15:6f2798e45099 | 5 | * are made available under the terms of the Eclipse Public License v1.0 |
ampembeng | 15:6f2798e45099 | 6 | * and Eclipse Distribution License v1.0 which accompany this distribution. |
ampembeng | 15:6f2798e45099 | 7 | * |
ampembeng | 15:6f2798e45099 | 8 | * The Eclipse Public License is available at |
ampembeng | 15:6f2798e45099 | 9 | * http://www.eclipse.org/legal/epl-v10.html |
ampembeng | 15:6f2798e45099 | 10 | * and the Eclipse Distribution License is available at |
ampembeng | 15:6f2798e45099 | 11 | * http://www.eclipse.org/org/documents/edl-v10.php. |
ampembeng | 15:6f2798e45099 | 12 | * |
ampembeng | 15:6f2798e45099 | 13 | * Contributors: |
ampembeng | 15:6f2798e45099 | 14 | * Allan Stockdill-Mander - initial API and implementation and/or initial documentation |
ampembeng | 15:6f2798e45099 | 15 | *******************************************************************************/ |
ampembeng | 15:6f2798e45099 | 16 | |
ampembeng | 15:6f2798e45099 | 17 | /** |
ampembeng | 15:6f2798e45099 | 18 | * @file timer_interface.h |
ampembeng | 15:6f2798e45099 | 19 | * @brief Timer interface definition for MQTT client. |
ampembeng | 15:6f2798e45099 | 20 | * |
ampembeng | 15:6f2798e45099 | 21 | * Defines an interface to timers that can be used by other system |
ampembeng | 15:6f2798e45099 | 22 | * components. MQTT client requires timers to handle timeouts and |
ampembeng | 15:6f2798e45099 | 23 | * MQTT keep alive. |
ampembeng | 15:6f2798e45099 | 24 | * Starting point for porting the SDK to the timer hardware layer of a new platform. |
ampembeng | 15:6f2798e45099 | 25 | */ |
ampembeng | 15:6f2798e45099 | 26 | |
ampembeng | 15:6f2798e45099 | 27 | #ifndef __TIMER_INTERFACE_H_ |
ampembeng | 15:6f2798e45099 | 28 | #define __TIMER_INTERFACE_H_ |
ampembeng | 15:6f2798e45099 | 29 | |
ampembeng | 15:6f2798e45099 | 30 | #ifdef __cplusplus |
ampembeng | 15:6f2798e45099 | 31 | extern "C" { |
ampembeng | 15:6f2798e45099 | 32 | #endif |
ampembeng | 15:6f2798e45099 | 33 | |
ampembeng | 15:6f2798e45099 | 34 | /** |
ampembeng | 15:6f2798e45099 | 35 | * The platform specific timer header that defines the Timer struct |
ampembeng | 15:6f2798e45099 | 36 | */ |
ampembeng | 15:6f2798e45099 | 37 | #include "timer_platform.h" |
ampembeng | 15:6f2798e45099 | 38 | |
ampembeng | 15:6f2798e45099 | 39 | #include <stdint.h> |
ampembeng | 15:6f2798e45099 | 40 | #include <stdbool.h> |
ampembeng | 15:6f2798e45099 | 41 | |
ampembeng | 15:6f2798e45099 | 42 | /** |
ampembeng | 15:6f2798e45099 | 43 | * @brief Timer Type |
ampembeng | 15:6f2798e45099 | 44 | * |
ampembeng | 15:6f2798e45099 | 45 | * Forward declaration of a timer struct. The definition of this struct is |
ampembeng | 15:6f2798e45099 | 46 | * platform dependent. When porting to a new platform add this definition |
ampembeng | 15:6f2798e45099 | 47 | * in "timer_<platform>.h" and include that file above. |
ampembeng | 15:6f2798e45099 | 48 | * |
ampembeng | 15:6f2798e45099 | 49 | */ |
ampembeng | 15:6f2798e45099 | 50 | //typedef mbed::Timer Timer; |
ampembeng | 15:6f2798e45099 | 51 | typedef TimerExt Timer; |
ampembeng | 15:6f2798e45099 | 52 | |
ampembeng | 15:6f2798e45099 | 53 | char expired(Timer* timer); |
ampembeng | 15:6f2798e45099 | 54 | void countdown(Timer* timer, unsigned int timeout); |
ampembeng | 15:6f2798e45099 | 55 | void InitTimer(Timer* timer); |
ampembeng | 15:6f2798e45099 | 56 | |
ampembeng | 15:6f2798e45099 | 57 | /** |
ampembeng | 15:6f2798e45099 | 58 | * @brief Check if a timer is expired |
ampembeng | 15:6f2798e45099 | 59 | * |
ampembeng | 15:6f2798e45099 | 60 | * Call this function passing in a timer to check if that timer has expired. |
ampembeng | 15:6f2798e45099 | 61 | * |
ampembeng | 15:6f2798e45099 | 62 | * @param Timer - pointer to the timer to be checked for expiration |
ampembeng | 15:6f2798e45099 | 63 | * @return bool - true = timer expired, false = timer not expired |
ampembeng | 15:6f2798e45099 | 64 | */ |
ampembeng | 15:6f2798e45099 | 65 | bool has_timer_expired(Timer *); |
ampembeng | 15:6f2798e45099 | 66 | |
ampembeng | 15:6f2798e45099 | 67 | /** |
ampembeng | 15:6f2798e45099 | 68 | * @brief Create a timer (milliseconds) |
ampembeng | 15:6f2798e45099 | 69 | * |
ampembeng | 15:6f2798e45099 | 70 | * Sets the timer to expire in a specified number of milliseconds. |
ampembeng | 15:6f2798e45099 | 71 | * |
ampembeng | 15:6f2798e45099 | 72 | * @param Timer - pointer to the timer to be set to expire in milliseconds |
ampembeng | 15:6f2798e45099 | 73 | * @param uint32_t - set the timer to expire in this number of milliseconds |
ampembeng | 15:6f2798e45099 | 74 | */ |
ampembeng | 15:6f2798e45099 | 75 | void countdown_ms(Timer *, uint32_t); |
ampembeng | 15:6f2798e45099 | 76 | |
ampembeng | 15:6f2798e45099 | 77 | /** |
ampembeng | 15:6f2798e45099 | 78 | * @brief Create a timer (seconds) |
ampembeng | 15:6f2798e45099 | 79 | * |
ampembeng | 15:6f2798e45099 | 80 | * Sets the timer to expire in a specified number of seconds. |
ampembeng | 15:6f2798e45099 | 81 | * |
ampembeng | 15:6f2798e45099 | 82 | * @param Timer - pointer to the timer to be set to expire in seconds |
ampembeng | 15:6f2798e45099 | 83 | * @param uint32_t - set the timer to expire in this number of seconds |
ampembeng | 15:6f2798e45099 | 84 | */ |
ampembeng | 15:6f2798e45099 | 85 | void countdown_sec(Timer *, uint32_t); |
ampembeng | 15:6f2798e45099 | 86 | |
ampembeng | 15:6f2798e45099 | 87 | /** |
ampembeng | 15:6f2798e45099 | 88 | * @brief Check the time remaining on a given timer |
ampembeng | 15:6f2798e45099 | 89 | * |
ampembeng | 15:6f2798e45099 | 90 | * Checks the input timer and returns the number of milliseconds remaining on the timer. |
ampembeng | 15:6f2798e45099 | 91 | * |
ampembeng | 15:6f2798e45099 | 92 | * @param Timer - pointer to the timer to be set to checked |
ampembeng | 15:6f2798e45099 | 93 | * @return int - milliseconds left on the countdown timer |
ampembeng | 15:6f2798e45099 | 94 | */ |
ampembeng | 15:6f2798e45099 | 95 | uint32_t left_ms(Timer *); |
ampembeng | 15:6f2798e45099 | 96 | |
ampembeng | 15:6f2798e45099 | 97 | /** |
ampembeng | 15:6f2798e45099 | 98 | * @brief Initialize a timer |
ampembeng | 15:6f2798e45099 | 99 | * |
ampembeng | 15:6f2798e45099 | 100 | * Performs any initialization required to the timer passed in. |
ampembeng | 15:6f2798e45099 | 101 | * |
ampembeng | 15:6f2798e45099 | 102 | * @param Timer - pointer to the timer to be initialized |
ampembeng | 15:6f2798e45099 | 103 | */ |
ampembeng | 15:6f2798e45099 | 104 | void init_timer(Timer *); |
ampembeng | 15:6f2798e45099 | 105 | |
ampembeng | 15:6f2798e45099 | 106 | #ifdef __cplusplus |
ampembeng | 15:6f2798e45099 | 107 | } |
ampembeng | 15:6f2798e45099 | 108 | #endif |
ampembeng | 15:6f2798e45099 | 109 | |
ampembeng | 15:6f2798e45099 | 110 | #endif //__TIMER_INTERFACE_H_ |
ampembeng | 15:6f2798e45099 | 111 | |
ampembeng | 15:6f2798e45099 | 112 | |
ampembeng | 15:6f2798e45099 | 113 |