demo/aia_demo.c
/**
 * @brief The function that runs the AIA demo, called by the demo runner.
 *
 * @param[in] awsIotMqttMode Specify if this demo is running with the AWS IoT
 * MQTT server. Set this to `false` if using another MQTT server.
 * @param[in] pIdentifier NULL-terminated MQTT client identifier.
 * @param[in] pNetworkServerInfo Passed to the MQTT connect function when
 * establishing the MQTT connection.
 * @param[in] pNetworkCredentialInfo Passed to the MQTT connect function when
 * establishing the MQTT connection.
 * @param[in] pNetworkInterface The network interface to use for this demo.
 *
 * @return `EXIT_SUCCESS` if the demo completes successfully; `EXIT_FAILURE` otherwise.
 */
@brief The function that runs the AIA demo, called by the demo runner.
@param[in] awsIotMqttMode Specify if this demo is running with the AWS IoT
MQTT server. Set this to `false` if using another MQTT server.
@param[in] pIdentifier NULL-terminated MQTT client identifier.
@param[in] pNetworkServerInfo Passed to the MQTT connect function when
establishing the MQTT connection.
@param[in] pNetworkCredentialInfo Passed to the MQTT connect function when
establishing the MQTT connection.
@param[in] pNetworkInterface The network interface to use for this demo.

@return `EXIT_SUCCESS` if the demo completes successfully; `EXIT_FAILURE` otherwise.
@brief The function that runs the AIA demo called by the demo runner . @param [ in ] awsIotMqttMode Specify if this demo is running with the AWS IoT MQTT server . Set this to ` false ` if using another MQTT server . @param [ in ] pIdentifier NULL - terminated MQTT client identifier . @param [ in ] pNetworkServerInfo Passed to the MQTT connect function when establishing the MQTT connection . @param [ in ] pNetworkCredentialInfo Passed to the MQTT connect function when establishing the MQTT connection . @param [ in ] pNetworkInterface The network interface to use for this demo . @return ` EXIT_SUCCESS ` if the demo completes successfully ; ` EXIT_FAILURE ` otherwise .
int RunAIADemo( bool awsIotMqttMode,
                const char * pIdentifier,
                void * pNetworkServerInfo,
                void * pNetworkCredentialInfo,
                const IotNetworkInterface_t * pNetworkInterface )
{
    int status = EXIT_SUCCESS;
    if( prvEstablishMqttConnection( awsIotMqttMode,
                                    pIdentifier,
                                    pNetworkServerInfo,
                                    pNetworkCredentialInfo,
                                    pNetworkInterface ) == pdFAIL )
    {
        goto aia_task_exit;
    }
    if( xClientInit( xMqttConnection ) == pdFAIL )
    {
        goto aia_task_exit;
    }
    xDemoTaskHandle = xTaskGetCurrentTaskHandle();
    if( xClientAIAInit() == pdFAIL )
    {
        goto aia_task_exit;
    }
    xTaskNotifyWait( 0, 0, NULL, portMAX_DELAY );
aia_task_exit:
    vTaskDelay(100);
    vClientCleanup();
    status = EXIT_FAILURE;
    return status;
}
int RunAIADemo ( bool awsIotMqttMode , const char * pIdentifier , void * pNetworkServerInfo , void * pNetworkCredentialInfo , const IotNetworkInterface_t * pNetworkInterface ) { int status = EXIT_SUCCESS ; if ( prvEstablishMqttConnection ( awsIotMqttMode , pIdentifier , pNetworkServerInfo , pNetworkCredentialInfo , pNetworkInterface ) == pdFAIL ) { goto aia_task_exit ; } if ( xClientInit ( xMqttConnection ) == pdFAIL ) { goto aia_task_exit ; } xDemoTaskHandle = xTaskGetCurrentTaskHandle ( ) ; if ( xClientAIAInit ( ) == pdFAIL ) { goto aia_task_exit ; } xTaskNotifyWait ( 0 , 0 , NULL , portMAX_DELAY ) ; aia_task_exit : vTaskDelay ( 100 ) ; vClientCleanup ( ) ; status = EXIT_FAILURE ; return status ; }
@brief The function that runs the AIA demo, called by the demo runner.
@brief The function that runs the AIA demo called by the demo runner .
/* Return value of this function and the exit status of this program. */ /* The demo task waits for the termination signal from AIA client. */ /* The demo only ends on failure. */