Demo application for using the AT&T IoT Starter Kit Powered by AWS.

Dependencies:   SDFileSystem

Fork of ATT_AWS_IoT_demo by Anthony Phillips

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers aws_iot_config.h Source File

aws_iot_config.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License").
00005  * You may not use this file except in compliance with the License.
00006  * A copy of the License is located at
00007  *
00008  *  http://aws.amazon.com/apache2.0
00009  *
00010  * or in the "license" file accompanying this file. This file is distributed
00011  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
00012  * express or implied. See the License for the specific language governing
00013  * permissions and limitations under the License.
00014  */
00015 
00016 /**
00017  * @file aws_iot_config.h
00018  * @brief AWS IoT specific configuration file
00019  */
00020 
00021 #ifndef SRC_SHADOW_IOT_SHADOW_CONFIG_H_
00022 #define SRC_SHADOW_IOT_SHADOW_CONFIG_H_
00023 
00024 //=====================================================================================================================
00025 //
00026 // NOTE: This defines where we pull our cert/config information from.  The options are:  
00027 // a) Hard code MQTT defines below and in certs.cpp
00028 // b) Pull certs and MQTT information from SD card.
00029 //
00030 // Pull information from SD card
00031 #define USING_SD_CARD
00032 //=====================================================================================================================
00033 
00034 // =================================================
00035 // USER ENTERED VALUES (only used when not using SD card)
00036 #define AWS_IOT_MQTT_HOST              "TODO" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
00037 #define AWS_IOT_MQTT_PORT              8883   ///< default port for MQTT/S
00038 #define AWS_IOT_MQTT_CLIENT_ID         "TODO" ///< MQTT client ID should be unique for every device
00039 #define AWS_IOT_MY_THING_NAME          "TODO" ///< Thing Name of the Shadow this device is associated with
00040 #define AWS_IOT_MY_TOPIC               "TODO/%s" ///< Topic name to publish to (used with alternate demo)
00041 
00042 //#ifdef USING_SD_CARD // These files are only valid when SD card is being used
00043 // Example format for mqtt_config.txt:
00044 /*
00045 AWS_IOT_MQTT_HOST=1234asdf.iot.us-west-2.amazonaws.com
00046 AWS_IOT_MQTT_PORT=8883
00047 AWS_IOT_MQTT_CLIENT_ID=MyThingName
00048 WS_IOT_MY_THING_NAME=MyThingName
00049 */
00050 #define AWS_MQTT_CONFIG_FILENAME       "/sd/certs/mqtt_config.txt"        ///< Contains the info for the four defines above
00051 #define AWS_IOT_ROOT_CA_FILENAME       "/sd/certs/rootCA-certificate.crt" ///< Root CA file name
00052 #define AWS_IOT_CERTIFICATE_FILENAME   "/sd/certs/certificate.pem.crt"    ///< device signed certificate file name
00053 #define AWS_IOT_PRIVATE_KEY_FILENAME   "/sd/certs/private.pem.key"        ///< Device private key filename
00054 //#endif
00055 // =================================================
00056 
00057 // MQTT PubSub
00058 #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
00059 #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.
00060 #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
00061 
00062 // Thing Shadow specific configs
00063 #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
00064 #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"
00065 #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
00066 #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
00067 #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
00068 #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
00069 #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
00070 #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
00071 #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
00072 #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
00073 
00074 // Auto Reconnect specific config
00075 #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
00076 #define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL 8000 ///< Maximum time interval after which exponential back-off will stop attempting to reconnect.
00077 
00078 // Links to our certs from certs.cpp
00079 extern const unsigned char AWS_IOT_ROOT_CA[];
00080 extern const unsigned char AWS_IOT_CERTIFICATE[];
00081 extern const unsigned char AWS_IOT_PRIVATE_KEY[];
00082 
00083 #endif /* SRC_SHADOW_IOT_SHADOW_CONFIG_H_ */
00084 
00085