V.062 11/3

Dependencies:   FT6206 SDFileSystem ILI9341_t3

Fork of ATT_AWS_IoT_demo_v06 by attiot

Committer:
eggsylah
Date:
Thu Nov 16 21:45:54 2017 +0000
Revision:
31:255a2c6f8f47
Parent:
30:8c979815f533
V08 as loaded on demo hardware to AT&T

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ampembeng 15:6f2798e45099 1 /*
ampembeng 15:6f2798e45099 2 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
ampembeng 15:6f2798e45099 3 *
ampembeng 15:6f2798e45099 4 * Licensed under the Apache License, Version 2.0 (the "License").
ampembeng 15:6f2798e45099 5 * You may not use this file except in compliance with the License.
ampembeng 15:6f2798e45099 6 * A copy of the License is located at
ampembeng 15:6f2798e45099 7 *
ampembeng 15:6f2798e45099 8 * http://aws.amazon.com/apache2.0
ampembeng 15:6f2798e45099 9 *
ampembeng 15:6f2798e45099 10 * or in the "license" file accompanying this file. This file is distributed
ampembeng 15:6f2798e45099 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
ampembeng 15:6f2798e45099 12 * express or implied. See the License for the specific language governing
ampembeng 15:6f2798e45099 13 * permissions and limitations under the License.
ampembeng 15:6f2798e45099 14 */
ampembeng 15:6f2798e45099 15
ampembeng 15:6f2798e45099 16 /**
ampembeng 15:6f2798e45099 17 * @file aws_iot_config.h
ampembeng 15:6f2798e45099 18 * @brief AWS IoT specific configuration file
ampembeng 15:6f2798e45099 19 */
ampembeng 15:6f2798e45099 20
ampembeng 15:6f2798e45099 21 #ifndef SRC_SHADOW_IOT_SHADOW_CONFIG_H_
ampembeng 15:6f2798e45099 22 #define SRC_SHADOW_IOT_SHADOW_CONFIG_H_
ampembeng 15:6f2798e45099 23
ampembeng 18:6370da1de572 24 //=====================================================================================================================
ampembeng 18:6370da1de572 25 //
ampembeng 18:6370da1de572 26 // NOTE: This defines where we pull our cert/config information from. The options are:
ampembeng 18:6370da1de572 27 // a) Hard code MQTT defines below and in certs.cpp
ampembeng 18:6370da1de572 28 // b) Pull certs and MQTT information from SD card.
ampembeng 18:6370da1de572 29 //
ampembeng 18:6370da1de572 30 // Pull information from SD card
jilee 28:54d9a550adf1 31 //#define USING_SD_CARD
ampembeng 18:6370da1de572 32 //=====================================================================================================================
ampembeng 18:6370da1de572 33
ampembeng 15:6f2798e45099 34 // =================================================
ampembeng 18:6370da1de572 35 // USER ENTERED VALUES (only used when not using SD card)
eggsylah 30:8c979815f533 36
eggsylah 30:8c979815f533 37 #define AWS_HOST1 1
eggsylah 30:8c979815f533 38 #define AWS_HOST2 2
eggsylah 30:8c979815f533 39
eggsylah 30:8c979815f533 40 //EBJ TODO -- have this automatic not manual
eggsylah 31:255a2c6f8f47 41 #if 0 // Test Version ATT->Tomi, GD -> Eric
eggsylah 30:8c979815f533 42 // for V07
eggsylah 30:8c979815f533 43 #define AWS_IOT_MQTT_HOST1 "a1y8cz14q0xuey.iot.us-west-2.amazonaws.com" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
eggsylah 30:8c979815f533 44 #define AWS_IOT_MQTT_HOST2 "a30p5gs0yshqpi.iot.us-east-1.amazonaws.com" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
eggsylah 30:8c979815f533 45
eggsylah 30:8c979815f533 46 #else // Production Version
eggsylah 30:8c979815f533 47 // for V08
eggsylah 30:8c979815f533 48 #define AWS_IOT_MQTT_HOST1 "a3q2tlgkovs1ph.iot.us-east-2.amazonaws.com" ///ATT < Customer specific MQTT HOST. The same will be used for Thing Shadow
eggsylah 30:8c979815f533 49 #define AWS_IOT_MQTT_HOST2 "a1y8cz14q0xuey.iot.us-west-2.amazonaws.com" ///GD < Customer specific MQTT HOST. The same will be used for Thing Shadow
eggsylah 30:8c979815f533 50
eggsylah 30:8c979815f533 51 #endif
eggsylah 30:8c979815f533 52
jilee 29:f71a0be59b99 53 //#define AWS_IOT_MQTT_HOST2 "a68d627nm77ep.iot.us-west-2.amazonaws.com"
eggsylah 30:8c979815f533 54
eggsylah 30:8c979815f533 55
ampembeng 18:6370da1de572 56 #define AWS_IOT_MQTT_PORT 8883 ///< default port for MQTT/S
jilee 28:54d9a550adf1 57 #define AWS_IOT_MQTT_CLIENT_ID "ATT_IoT_Kit" ///< MQTT client ID should be unique for every device
jilee 28:54d9a550adf1 58 #define AWS_IOT_MY_THING_NAME "ATT_IoT_Kit" ///< Thing Name of the Shadow this device is associated with
jilee 28:54d9a550adf1 59 #define AWS_IOT_MY_TOPIC "ExampleTopic/%s" ///< Topic name to publish to (used with alternate demo)
ampembeng 15:6f2798e45099 60
ampembeng 23:b9ff83dc965f 61 //#ifdef USING_SD_CARD // These files are only valid when SD card is being used
ampembeng 18:6370da1de572 62 // Example format for mqtt_config.txt:
ampembeng 18:6370da1de572 63 /*
ampembeng 18:6370da1de572 64 AWS_IOT_MQTT_HOST=1234asdf.iot.us-west-2.amazonaws.com
ampembeng 18:6370da1de572 65 AWS_IOT_MQTT_PORT=8883
ampembeng 18:6370da1de572 66 AWS_IOT_MQTT_CLIENT_ID=MyThingName
ampembeng 18:6370da1de572 67 WS_IOT_MY_THING_NAME=MyThingName
ampembeng 18:6370da1de572 68 */
ampembeng 18:6370da1de572 69 #define AWS_MQTT_CONFIG_FILENAME "/sd/certs/mqtt_config.txt" ///< Contains the info for the four defines above
ampembeng 18:6370da1de572 70 #define AWS_IOT_ROOT_CA_FILENAME "/sd/certs/rootCA-certificate.crt" ///< Root CA file name
ampembeng 18:6370da1de572 71 #define AWS_IOT_CERTIFICATE_FILENAME "/sd/certs/certificate.pem.crt" ///< device signed certificate file name
ampembeng 18:6370da1de572 72 #define AWS_IOT_PRIVATE_KEY_FILENAME "/sd/certs/private.pem.key" ///< Device private key filename
ampembeng 23:b9ff83dc965f 73 //#endif
ampembeng 15:6f2798e45099 74 // =================================================
ampembeng 15:6f2798e45099 75
ampembeng 15:6f2798e45099 76 // MQTT PubSub
ampembeng 15:6f2798e45099 77 #define AWS_IOT_MQTT_TX_BUF_LEN 512 ///< Any time a message is sent out through the MQTT layer. The message is copied into this buffer anytime a publish is done. This will also be used in the case of Thing Shadow
ampembeng 15:6f2798e45099 78 #define AWS_IOT_MQTT_RX_BUF_LEN 512 ///< Any message that comes into the device should be less than this buffer size. If a received message is bigger than this buffer size the message will be dropped.
ampembeng 15:6f2798e45099 79 #define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS 5 ///< Maximum number of topic filters the MQTT client can handle at any given time. This should be increased appropriately when using Thing Shadow
ampembeng 15:6f2798e45099 80
ampembeng 15:6f2798e45099 81 // Thing Shadow specific configs
ampembeng 15:6f2798e45099 82 #define SHADOW_MAX_SIZE_OF_RX_BUFFER AWS_IOT_MQTT_RX_BUF_LEN+1 ///< Maximum size of the SHADOW buffer to store the received Shadow message
ampembeng 15:6f2798e45099 83 #define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80 ///< Maximum size of the Unique Client Id. For More info on the Client Id refer \ref response "Acknowledgments"
ampembeng 15:6f2798e45099 84 #define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10 ///< This is size of the extra sequence number that will be appended to the Unique client Id
ampembeng 15:6f2798e45099 85 #define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20 ///< This is size of the the total clientToken key and value pair in the JSON
ampembeng 15:6f2798e45099 86 #define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME 10 ///< At Any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested
ampembeng 15:6f2798e45099 87 #define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME 10 ///< We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time
ampembeng 15:6f2798e45099 88 #define MAX_JSON_TOKEN_EXPECTED 120 ///< These are the max tokens that is expected to be in the Shadow JSON document. Include the metadata that gets published
ampembeng 15:6f2798e45099 89 #define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME 60 ///< All shadow actions have to be published or subscribed to a topic which is of the format $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name
ampembeng 15:6f2798e45099 90 #define MAX_SIZE_OF_THING_NAME 20 ///< The Thing Name should not be bigger than this value. Modify this if the Thing Name needs to be bigger
ampembeng 15:6f2798e45099 91 #define MAX_SHADOW_TOPIC_LENGTH_BYTES MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME ///< This size includes the length of topic with Thing Name
ampembeng 15:6f2798e45099 92
ampembeng 15:6f2798e45099 93 // Auto Reconnect specific config
ampembeng 15:6f2798e45099 94 #define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL 1000 ///< Minimum time before the First reconnect attempt is made as part of the exponential back-off algorithm
ampembeng 15:6f2798e45099 95 #define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL 8000 ///< Maximum time interval after which exponential back-off will stop attempting to reconnect.
ampembeng 15:6f2798e45099 96
ampembeng 15:6f2798e45099 97 // Links to our certs from certs.cpp
jilee 29:f71a0be59b99 98 /*
jilee 29:f71a0be59b99 99 extern const unsigned char AWS_IOT_ROOT_CA[];
jilee 29:f71a0be59b99 100 extern const unsigned char AWS_IOT_CERTIFICATE[];
jilee 29:f71a0be59b99 101 extern const unsigned char AWS_IOT_PRIVATE_KEY[];
jilee 29:f71a0be59b99 102 */
jilee 28:54d9a550adf1 103
jilee 28:54d9a550adf1 104 extern unsigned char AWS_IOT_ROOT_CA[];
jilee 28:54d9a550adf1 105 extern unsigned char AWS_IOT_CERTIFICATE[];
jilee 28:54d9a550adf1 106 extern unsigned char AWS_IOT_PRIVATE_KEY[];
jilee 28:54d9a550adf1 107
jilee 28:54d9a550adf1 108 extern int AWS_IOT_ROOT_CA_LENGTH;
jilee 28:54d9a550adf1 109 extern int AWS_IOT_CERTIFICATE_LENGTH;
jilee 28:54d9a550adf1 110 extern int AWS_IOT_PRIVATE_KEY_LENGTH;
ampembeng 15:6f2798e45099 111
ampembeng 15:6f2798e45099 112 #endif /* SRC_SHADOW_IOT_SHADOW_CONFIG_H_ */
ampembeng 15:6f2798e45099 113
ampembeng 15:6f2798e45099 114