\r
/* Standard inclues. */\r
#include <string.h>\r
+#include <stdio.h>\r
\r
/* Kernel includes. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
\r
-/* MQTT include. */\r
+/* IoT SDK includes. */\r
#include "iot_mqtt.h"\r
-\r
-/* Platform FreeRTOS network include. */\r
+#include "iot_taskpool.h"\r
#include "platform/iot_network_freertos.h"\r
\r
/**\r
* @brief Details of the MQTT broker to connect to.\r
*\r
* @note This example does not use TLS and therefore won't work with AWS IoT.\r
+ *\r
*/\r
-#define mqttexampleMQTT_BROKER_ENDPOINT "10.60.214.105"\r
+#define mqttexampleMQTT_BROKER_ENDPOINT "test.mosquitto.org"\r
#define mqttexampleMQTT_BROKER_PORT 1883\r
\r
/**\r
* @brief The MQTT connection handle used in this example.\r
*/\r
static IotMqttConnection_t xMQTTConnection = IOT_MQTT_CONNECTION_INITIALIZER;\r
+\r
+/**\r
+ * @brief Parameters used to create the system task pool.\r
+ */\r
+static const IotTaskPoolInfo_t xTaskPoolParameters = {\r
+ /* Minimum number of threads in a task pool.\r
+ * Note the slimmed down version of the task\r
+ * pool used by this library does not autoscale\r
+ * the number of tasks in the pool so in this\r
+ * case this sets the number of tasks in the\r
+ * pool. */\r
+ 2,\r
+ /* Maximum number of threads in a task pool.\r
+ * Note the slimmed down version of the task\r
+ * pool used by this library does not autoscale\r
+ * the number of tasks in the pool so in this\r
+ * case this parameter is just ignored. */\r
+ 2,\r
+ /* Stack size for every task pool thread - in\r
+ * bytes, hence multiplying by the number of bytes\r
+ * in a word as configMINIMAL_STACK_SIZE is\r
+ * specified in words. */\r
+ configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ),\r
+ /* Priority for every task pool thread. */\r
+ tskIDLE_PRIORITY,\r
+ };\r
/*-----------------------------------------------------------*/\r
\r
/**\r
/* Remove compiler warnings about unused parameters. */\r
( void ) pvParameters;\r
\r
+ /* The MQTT library needs a task pool, so create the system task pool. */\r
+ xResult = IotTaskPool_CreateSystemTaskPool( &( xTaskPoolParameters ) );\r
+ configASSERT( xResult == IOT_TASKPOOL_SUCCESS );\r
+\r
/* MQTT library must be initialized before it can be used. This is just one\r
* time initialization. */\r
xResult = IotMqtt_Init();\r
&( ulNotificationValue ), /* Obtain the notification value. */\r
pdMS_TO_TICKS( mqttexampleMQTT_TIMEOUT_MS ) );\r
configASSERT( ( ulNotificationValue & mqttexampleDISCONNECTED_BIT ) == mqttexampleDISCONNECTED_BIT );\r
+\r
+ printf( "prvMQTTDemoTask() completed an iteration without hitting an assert.\r\n" );\r
+ fflush( stdout );\r
+\r
+ /* Wait for some time between two iterations to ensure that we do not\r
+ * bombard the public test mosquitto broker. */\r
+ vTaskDelay( pdMS_TO_TICKS( 5000 ) );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\mqtt\include;..\..\..\Source\FreeRTOS-Plus-TCP\include;..\..\..\Source\FreeRTOS-Plus-TCP\portable\BufferManagement;..\..\..\Source\FreeRTOS-Plus-TCP\portable\Compiler\MSVC;.\DemoTasks\include;.\WinPCap;..\..\..\..\FreeRTOS\Source\include;..\..\..\..\FreeRTOS\Source\portable\MSVC-MingW;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include\private;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\c_sdk\standard\common\include;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\include;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\platform\freertos\include;..\..\..\Source\FreeRTOS-Plus-IoT-SDK\abstractions\secure_sockets\include;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0500;WINVER=0x400;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <MinimalRebuild>true</MinimalRebuild>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<PrecompiledHeaderOutputFile>.\Debug/WIN32.pch</PrecompiledHeaderOutputFile>\r