]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/iot_config_common.h
Add MQTT project that builds on the task pool project - currently the library is...
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_IoT_Libraries / mqtt / iot_config_common.h
diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/iot_config_common.h b/FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/mqtt/iot_config_common.h
new file mode 100644 (file)
index 0000000..7867744
--- /dev/null
@@ -0,0 +1,203 @@
+/*\r
+ * Amazon FreeRTOS V201906.00 Major\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://aws.amazon.com/freertos\r
+ * http://www.FreeRTOS.org\r
+ */\r
+\r
+/* This file contains default configuration settings for the demos on FreeRTOS. */\r
+\r
+#ifndef IOT_CONFIG_COMMON_H_\r
+#define IOT_CONFIG_COMMON_H_\r
+\r
+/* FreeRTOS include. */\r
+#include "FreeRTOS.h" //_RB_Makes common config file FreeRTOS specific\r
+\r
+/* Use platform types on FreeRTOS. */\r
+#include "platform/iot_platform_types_freertos.h" //_RB_Makes common config file FreeRTOS specific\r
+\r
+/* Used to get the cloud broker endpoint for FreeRTOS. */\r
+//_RB_#include "aws_clientcredential.h"\r
+\r
+/* SDK version. */\r
+#define IOT_SDK_VERSION    "4.0.0"\r
+\r
+/* This config file is for the demos; disable any test code. */\r
+#define IOT_BUILD_TESTS    ( 0 )\r
+\r
+/* Logging puts function. */\r
+#define IotLogging_Puts( str )                 configPRINTF( ( "%s\r\n", str ) )\r
+\r
+/* Enable asserts in libraries by default. */\r
+#ifndef IOT_METRICS_ENABLE_ASSERTS\r
+    #define IOT_METRICS_ENABLE_ASSERTS         ( 1 )\r
+#endif\r
+#ifndef IOT_CONTAINERS_ENABLE_ASSERTS\r
+    #define IOT_CONTAINERS_ENABLE_ASSERTS      ( 1 )\r
+#endif\r
+#ifndef IOT_TASKPOOL_ENABLE_ASSERTS\r
+    #define IOT_TASKPOOL_ENABLE_ASSERTS        ( 1 )\r
+#endif\r
+#ifndef IOT_MQTT_ENABLE_ASSERTS\r
+    #define IOT_MQTT_ENABLE_ASSERTS            ( 1 )\r
+#endif\r
+#ifndef AWS_IOT_SHADOW_ENABLE_ASSERTS\r
+    #define AWS_IOT_SHADOW_ENABLE_ASSERTS      ( 1 )\r
+#endif\r
+#ifndef AWS_IOT_DEFENDER_ENABLE_ASSERTS\r
+    #define AWS_IOT_DEFENDER_ENABLE_ASSERTS    ( 1 )\r
+#endif\r
+#ifndef IOT_BLE_ENABLE_ASSERTS\r
+    #define IOT_BLE_ENABLE_ASSERTS             ( 1 )\r
+#endif\r
+\r
+/* Assert functions. */\r
+#define IotMetrics_Assert( expression )        configASSERT( expression )\r
+#define IotContainers_Assert( expression )     configASSERT( expression )\r
+#define IotTaskPool_Assert( expression )       configASSERT( expression )\r
+#define IotMqtt_Assert( expression )           configASSERT( expression )\r
+#define AwsIotShadow_Assert( expression )      configASSERT( expression )\r
+#define AwsIotDefender_Assert( expression )    configASSERT( expression )\r
+#define IotBle_Assert( expression )            configASSERT( expression )\r
+\r
+/* Control the usage of dynamic memory allocation. */\r
+#ifndef IOT_STATIC_MEMORY_ONLY\r
+    #define IOT_STATIC_MEMORY_ONLY    ( 0 )\r
+#endif\r
+\r
+/* Memory allocation configuration. Note that these functions will not be affected\r
+ * by IOT_STATIC_MEMORY_ONLY. */\r
+#define IotNetwork_Malloc    pvPortMalloc\r
+#define IotNetwork_Free      vPortFree\r
+#define IotThreads_Malloc    pvPortMalloc\r
+#define IotThreads_Free      vPortFree\r
+#define IotLogging_Malloc    pvPortMalloc\r
+#define IotLogging_Free      vPortFree\r
+#define IotBle_Malloc        pvPortMalloc\r
+#define IotBle_Free          vPortFree\r
+/* #define IotLogging_StaticBufferSize */\r
+\r
+/* Memory allocation function configuration for the MQTT and Defender library.\r
+ * These libraries will be affected by IOT_STATIC_MEMORY_ONLY. */\r
+#if IOT_STATIC_MEMORY_ONLY == 0\r
+    #define IotMetrics_MallocTcpConnection       pvPortMalloc\r
+    #define IotMetrics_FreeTcpConnection         vPortFree\r
+    #define IotMetrics_MallocIpAddress           pvPortMalloc\r
+    #define IotMetrics_FreeIpAddress             vPortFree\r
+\r
+    #define IotTaskPool_MallocTaskPool           pvPortMalloc\r
+    #define IotTaskPool_FreeTaskPool             vPortFree\r
+    #define IotTaskPool_MallocJob                pvPortMalloc\r
+    #define IotTaskPool_FreeJob                  vPortFree\r
+    #define IotTaskPool_MallocTimerEvent         pvPortMalloc\r
+    #define IotTaskPool_FreeTimerEvent           vPortFree\r
+\r
+    #define IotMqtt_MallocConnection             pvPortMalloc\r
+    #define IotMqtt_FreeConnection               vPortFree\r
+    #define IotMqtt_MallocMessage                pvPortMalloc\r
+    #define IotMqtt_FreeMessage                  vPortFree\r
+    #define IotMqtt_MallocOperation              pvPortMalloc\r
+    #define IotMqtt_FreeOperation                vPortFree\r
+    #define IotMqtt_MallocSubscription           pvPortMalloc\r
+    #define IotMqtt_FreeSubscription             vPortFree\r
+\r
+    #define IotSerializer_MallocCborEncoder      pvPortMalloc\r
+    #define IotSerializer_FreeCborEncoder        vPortFree\r
+    #define IotSerializer_MallocCborParser       pvPortMalloc\r
+    #define IotSerializer_FreeCborParser         vPortFree\r
+    #define IotSerializer_MallocCborValue        pvPortMalloc\r
+    #define IotSerializer_FreeCborValue          vPortFree\r
+    #define IotSerializer_MallocDecoderObject    pvPortMalloc\r
+    #define IotSerializer_FreeDecoderObject      vPortFree\r
+\r
+    #define AwsIotShadow_MallocOperation         pvPortMalloc\r
+    #define AwsIotShadow_FreeOperation           vPortFree\r
+    #define AwsIotShadow_MallocString            pvPortMalloc\r
+    #define AwsIotShadow_FreeString              vPortFree\r
+    #define AwsIotShadow_MallocSubscription      pvPortMalloc\r
+    #define AwsIotShadow_FreeSubscription        vPortFree\r
+\r
+    #define AwsIotDefender_MallocReport          pvPortMalloc\r
+    #define AwsIotDefender_FreeReport            vPortFree\r
+    #define AwsIotDefender_MallocTopic           pvPortMalloc\r
+    #define AwsIotDefender_FreeTopic             vPortFree\r
+#endif /* if IOT_STATIC_MEMORY_ONLY == 0 */\r
+\r
+/* Default platform thread stack size and priority. */\r
+#ifndef IOT_THREAD_DEFAULT_STACK_SIZE\r
+    #define IOT_THREAD_DEFAULT_STACK_SIZE    2048\r
+#endif\r
+#ifndef IOT_THREAD_DEFAULT_PRIORITY\r
+    #define IOT_THREAD_DEFAULT_PRIORITY      tskIDLE_PRIORITY\r
+#endif\r
+\r
+/* Platform network configuration. */\r
+#ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY\r
+    #define IOT_NETWORK_RECEIVE_TASK_PRIORITY      ( tskIDLE_PRIORITY + 1 )\r
+#endif\r
+#ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE\r
+    #define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE    IOT_THREAD_DEFAULT_STACK_SIZE\r
+#endif\r
+\r
+/* Platform and SDK name for AWS IoT MQTT metrics. Only used when\r
+ * AWS_IOT_MQTT_ENABLE_METRICS is 1. */\r
+#define IOT_SDK_NAME             "AmazonFreeRTOS"\r
+#ifdef configPLATFORM_NAME\r
+    #define IOT_PLATFORM_NAME    configPLATFORM_NAME\r
+#else\r
+    #define IOT_PLATFORM_NAME    "Unknown"\r
+#endif\r
+\r
+/* Cloud endpoint to which the device connects to. */\r
+#define IOT_CLOUD_ENDPOINT                    clientcredentialMQTT_BROKER_ENDPOINT\r
+\r
+/**\r
+ * @brief Unique identifier used to recognize a device by the cloud.\r
+ * This could be SHA-256 of the device certificate.\r
+ */\r
+extern const char *getDeviceIdentifier( void );\r
+#define IOT_DEVICE_IDENTIFIER                getDeviceIdentifier()\r
+\r
+/**\r
+ * @brief Metrics emitted by the device.\r
+ */\r
+extern const char *getDeviceMetrics( void );\r
+#define AWS_IOT_METRICS_USERNAME     getDeviceMetrics()\r
+\r
+/**\r
+ * @brief Length of the metrics emitted by device.\r
+ */\r
+extern uint16_t getDeviceMetricsLength( void );\r
+#define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength()\r
+\r
+/* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */\r
+#define IotMetricsConnectionId_t            void *\r
+\r
+/* Configuration for defender demo: set format to CBOR. */\r
+#define AWS_IOT_DEFENDER_FORMAT             AWS_IOT_DEFENDER_FORMAT_CBOR\r
+\r
+/* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */\r
+#define AWS_IOT_DEFENDER_USE_LONG_TAG       ( 1 )\r
+\r
+/* Demo runner configuration. */\r
+//_RB_#include "aws_demo_config.h"\r
+\r
+#endif /* ifndef IOT_CONFIG_COMMON_H_ */\r