Improve connection sharing demo (#362)

* Add a daemon socket listener so that the process loop will only execute if data is available on the socket.

* Set process loop timeout to 0 so that other commands do not have to wait for a process loop that isn't doing anything.

* Add an additional publisher task to show multiple tasks publishing simultaneously.

* Clarify what is meant by "synchronous" and "asynchronous" publishes.

* Fix possible race condition in task notification waits.

* Move task notification wait loop to its own function.

* The prvMQTTConnect function was doing more than just connecting, so it was split into more functions.

* Minor name changes for clarity.

* Add macros for AWS IoT metrics
This commit is contained in:
Muneeb Ahmed
2020-10-23 15:32:04 -07:00
committed by GitHub
parent 594c894699
commit ee588710dd
3 changed files with 607 additions and 285 deletions

View File

@ -227,7 +227,7 @@ extern UBaseType_t uxRand();
#define ipconfigUSE_TCP ( 1 ) #define ipconfigUSE_TCP ( 1 )
/* Use the TCP socket wake context with a callback. */ /* Use the TCP socket wake context with a callback. */
#define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK_WITH_CONTEXT ( 1 ) #define ipconfigSOCKET_HAS_USER_WAKE_CALLBACK ( 1 )
/* USE_WIN: Let TCP use windowing mechanism. */ /* USE_WIN: Let TCP use windowing mechanism. */
#define ipconfigUSE_TCP_WIN ( 1 ) #define ipconfigUSE_TCP_WIN ( 1 )

View File

@ -156,6 +156,70 @@
*/ */
#define democonfigDISABLE_SNI ( pdFALSE ) #define democonfigDISABLE_SNI ( pdFALSE )
/**
* @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 democonfigUSE_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 democonfigCLIENT_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 democonfigCLIENT_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 democonfigOS_NAME "FreeRTOS"
/**
* @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 democonfigOS_VERSION tskKERNEL_VERSION_NUMBER
/**
* @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 democonfigHARDWARE_PLATFORM_NAME "WinSim"
/**
* @brief The name of the MQTT library used and its version, following an "@"
* symbol.
*/
#define democonfigMQTT_LIB "core-mqtt@1.0.0"
/** /**
* @brief Whether to use mutual authentication. If this macro is not set to 1 * @brief Whether to use mutual authentication. If this macro is not set to 1
* or not defined, then plaintext TCP will be used instead of TLS over TCP. * or not defined, then plaintext TCP will be used instead of TLS over TCP.