/* * AWS IoT Device Embedded C SDK for ZephyrRTOS * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef DEMO_CONFIG_H_ #define DEMO_CONFIG_H_ #define MINIMAL_STACK_SIZE ( 1024 ) /* Constants that select which demos to build into the project: * Set the following to 1 to include the demo in the build, or 0 to exclude the * demo. */ #define NUM_SIMPLE_SUB_PUB_TASKS_TO_CREATE 1 #define SIMPLE_SUB_PUB_TASK_STACK_SIZE ( MINIMAL_STACK_SIZE ) /** * @brief The MQTT client identifier used in this example. Each client identifier * must be unique so edit as required to ensure no two clients connecting to the * same broker use the same client identifier. * *!!! Please note a #defined constant is used for convenience of demonstration *!!! only. Production devices can use something unique to the device that can *!!! be read by software, such as a production serial number, instead of a *!!! hard coded constant. * */ #define CLIENT_IDENTIFIER "testclient" /** * @brief Endpoint of the MQTT broker to connect to. * * This demo application can be run with any MQTT broker, although it is * recommended to use one that supports mutual authentication. * * For AWS IoT MQTT broker, this is the Thing's REST API Endpoint. * * @note Your AWS IoT Core endpoint can be found in the AWS IoT console under * Settings/Custom Endpoint, or using the describe-endpoint REST API (with * AWS CLI command line tool). * * #define MQTT_BROKER_ENDPOINT "...insert here..." */ /** * @brief The port to use for the demo. * * In general, port 8883 is for secured MQTT connections, and port 1883 if not * using TLS. * * @note Port 443 requires use of the ALPN TLS extension with the ALPN protocol * name. Using ALPN with this demo would require additional changes, including * setting the `pAlpnProtos` member of the `NetworkCredentials_t` struct before * forming the TLS connection. When using port 8883, ALPN is not required. * * #define MQTT_BROKER_PORT ( insert here. ) */ #define MQTT_BROKER_PORT ( 8883 ) /** * @brief Server's root CA certificate. * * For AWS IoT MQTT broker, this certificate is used to identify the AWS IoT * server and is publicly available. Refer to the AWS documentation available * in the link below. * https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs * * The preset default value is of AmazonRootCA1.pem, which can be found in the link below. * https://www.amazontrust.com/repository/AmazonRootCA1.pem * * @note This certificate should be PEM-encoded. * * Must include the PEM header and footer: * "-----BEGIN CERTIFICATE-----\n"\ * "...base64 data...\n"\ * "-----END CERTIFICATE-----" * * #define ROOT_CA_PEM "...insert here..." */ #define ROOT_CA_PEM \ "-----BEGIN CERTIFICATE-----\n" \ "MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n" \ "ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n" \ "b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n" \ "MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n" \ "b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\n" \ "ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n" \ "9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\n" \ "IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\n" \ "VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n" \ "93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\n" \ "jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\n" \ "AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA\n" \ "A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\n" \ "U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\n" \ "N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\n" \ "o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n" \ "5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n" \ "rqXRfboQnoZsG4q5WTP468SQvvG5\n" \ "-----END CERTIFICATE-----" /** * @brief An option to disable Server Name Indication. * * @note When using a local Mosquitto server setup, SNI needs to be disabled * for an MQTT broker that only has an IP address but no hostname. However, * SNI should be enabled whenever possible. */ #define DISABLE_SNI ( 0 ) /** * @brief Configuration that indicates if the demo connection is made to the AWS IoT Core MQTT broker. * * If username/password based authentication is used, the demo will use appropriate TLS ALPN and * SNI configurations as required for the Custom Authentication feature of AWS IoT. * For more information, refer to the following documentation: * https://docs.aws.amazon.com/iot/latest/developerguide/custom-auth.html#custom-auth-mqtt * * #define USE_AWS_IOT_CORE_BROKER ( 1 ) */ #define USE_AWS_IOT_CORE_BROKER ( 1 ) /** * @brief The username value for authenticating client to the MQTT broker when * username/password based client authentication is used. * * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for * details regarding client authentication with a username and password. * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html * An authorizer setup needs to be done, as mentioned in the above link, to use * username/password based client authentication. * * #define CLIENT_USERNAME "...insert here..." */ /** * @brief The password value for authenticating client to the MQTT broker when * username/password based client authentication is used. * * For AWS IoT MQTT broker, refer to the AWS IoT documentation below for * details regarding client authentication with a username and password. * https://docs.aws.amazon.com/iot/latest/developerguide/custom-authentication.html * An authorizer setup needs to be done, as mentioned in the above link, to use * username/password based client authentication. * * #define CLIENT_PASSWORD "...insert here..." */ /** * @brief The name of the operating system that the application is running on. * The current value is given as an example. Please update for your specific * operating system. */ #define OS_NAME "Zephyr" /** * @brief The version of the operating system that the application is running * on. The current value is given as an example. Please update for your specific * operating system version. */ #define OS_VERSION "2.6.0" /** * @brief The name of the hardware platform the application is running on. The * current value is given as an example. Please update for your specific * hardware platform. */ #define HARDWARE_PLATFORM_NAME "ESP32" /** * @brief The name of the MQTT library used and its version, following an "@" * symbol. */ #define MQTT_LIB "core-mqtt@" MQTT_LIBRARY_VERSION /** * @brief Set the stack size of the main demo task. * */ #define DEMO_STACKSIZE MINIMAL_STACK_SIZE /** * @brief ALPN (Application-Layer Protocol Negotiation) protocol name for AWS IoT MQTT. * * This will be used if MQTT_BROKER_PORT is configured as 443 for the AWS IoT MQTT broker. * Please see more details about the ALPN protocol for AWS IoT MQTT endpoint * in the link below. * https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/ */ #define AWS_IOT_MQTT_ALPN "x-amzn-mqtt-ca" /** * @brief This is the ALPN (Application-Layer Protocol Negotiation) string * required by AWS IoT for password-based authentication using TCP port 443. */ #define AWS_IOT_CUSTOM_AUTH_ALPN "mqtt" /** * Provide default values for undefined configuration settings. */ #ifndef OS_NAME #define OS_NAME "Zephyr" #endif #ifndef OS_VERSION #define OS_VERSION tskKERNEL_VERSION_NUMBER #endif #ifndef HARDWARE_PLATFORM_NAME #define HARDWARE_PLATFORM_NAME "ESP32" #endif #ifndef MQTT_LIB #define MQTT_LIB "core-mqtt@1.0.0" #endif /** * @brief The MQTT metrics string expected by AWS IoT. */ #define AWS_IOT_METRICS_STRING \ "?SDK=" OS_NAME "&Version=" OS_VERSION \ "&Platform=" HARDWARE_PLATFORM_NAME "&MQTTLib=" MQTT_LIB /** * @brief The length of the MQTT metrics string expected by AWS IoT. */ #define AWS_IOT_METRICS_STRING_LENGTH ( ( uint16_t ) ( sizeof( AWS_IOT_METRICS_STRING ) - 1 ) ) #ifdef CLIENT_USERNAME /** * @brief Append the username with the metrics string if #CLIENT_USERNAME is defined. * * This is to support both metrics reporting and username/password based client * authentication by AWS IoT. */ #define CLIENT_USERNAME_WITH_METRICS CLIENT_USERNAME AWS_IOT_METRICS_STRING #endif /** * @brief Length of client identifier. */ #define CLIENT_IDENTIFIER_LENGTH ( ( uint16_t ) ( sizeof( CLIENT_IDENTIFIER ) - 1 ) ) /** * @brief Length of MQTT server host name. */ #define BROKER_ENDPOINT_LENGTH ( ( uint16_t ) ( sizeof( MQTT_BROKER_ENDPOINT ) - 1 ) ) #define MQTT_MAX_DEMO_COUNT ( 1 ) /** * @brief The name of the Wi-Fi network to join. * * #define WIFI_NETWORK_SSID "...insert here..." */ /** * @brief Password needed to join Wi-Fi network. If you are using WPA, set this * to your network password. If there is no password, use the empty string "". * * #define WIFI_NETWORK_PASSWORD "...insert here...." */ #endif /* DEMO_CONFIG_H_ */