Exemple #1
0
void CResourceManager::LoadAll( std::list< const char * > resources )
{
	// Loop through all resources
	for( std::list< const char* >::iterator iter = resources.begin(); iter != resources.end(); iter++ )
	{
		// Parse the resource
		StartResource( *iter ) ? iLoaded++ : iFailed++;
	}

	// Update resource loaded totals
	pCore->UpdateResourceTotals( iLoaded, iFailed );
}
/**
 \if INCLUDE_IN_HTML_ONLY
 \fn        void StateMachine( uint8_t e_StreamResource, uint8_t e_StreamCommand, uint8_t *pe_StreamResourceStatus )
 \brief     Low level common state machine to handle the start and stop to the sensor and Rx
 \param     e_StreamResource        :   The resource for which the machine has been invoked, possible values are StreamResource_e_Sensor and StreamResource_e_Rx
 \param     e_StreamCommand         :   The command for the e_StreamResource
 \param     pe_StreamResourceStatus :   Pointer to the status of the resource to allow update of the status
 \return    None
 \ingroup   Stream
 \callgraph
 \callergraph
 \endif
*/
static void
StateMachine(
uint8_t e_StreamResource,
uint8_t e_StreamCommand,
uint8_t *pe_StreamResourceStatus)
{
    volatile uint8_t    e_StreamResourceStatus;

    e_StreamResourceStatus = *pe_StreamResourceStatus;

    switch (e_StreamResourceStatus)
    {
        case StreamResourceStatus_e_Stopped:
            if (StreamCommand_e_Start == e_StreamCommand)
            {
                // command to start the resource
                // update the status
                e_StreamResourceStatus = StreamResourceStatus_e_Starting;

                // update the resource status as well
                *pe_StreamResourceStatus = StreamResourceStatus_e_Starting;

                // intentionally drop down to the next level
            }
            else
            {
                // nothing to do, break out
                break;
            }


        case StreamResourceStatus_e_Starting:
            // start the resource
            StartResource(e_StreamResource);

            // update the status
            e_StreamResourceStatus = StreamResourceStatus_e_WaitingToStart;

            // update the resource status as well
            *pe_StreamResourceStatus = StreamResourceStatus_e_WaitingToStart;

        // intentionally drop down to the next state
        case StreamResourceStatus_e_WaitingToStart:
            // wait for the resource to start
            // this is a blocking call and will
            // return only once the wait is over
            WaitForResourceToStart(e_StreamResource);

            if (StreamResource_e_Rx == e_StreamResource)
            {
                // Raise an event notification to signal that the ISP is streaming
                EventManager_ISPStreaming_Notify();

                //Once ISP Streaming Notification has raised ,we can read pixel order value
                // [NON_ISL_SUPPORT]: Non SMIA Sensor case
                if(SENSOR_VERSION_NON_SMIA == g_SensorInformation.u8_smia_version)
                {
                    g_SystemConfig_Status.e_PixelOrder = Get_ISP_SMIARX_ISP_SMIARX_PIXEL_ORDER_pixel_order_ovr();
                }
                else
                {
                    g_SystemConfig_Status.e_PixelOrder = Get_ISP_SMIARX_ISP_SMIARX_PIXEL_ORDER_pixel_order();
                }
            }
            else
            {
                // Raise an event notification to signal that the sensor is streaming
                EventManager_SensorStartStreaming_Notify();
            }


            // we have come out of the function
            // this means that the resource has started
            // update the status
            e_StreamResourceStatus = StreamResourceStatus_e_Running;

            // update the resource status as well
            *pe_StreamResourceStatus = StreamResourceStatus_e_Running;

        case StreamResourceStatus_e_Running:
            if (StreamCommand_e_Stop == e_StreamCommand)
            {
                // command to stop the resource
                // update the status
                e_StreamResourceStatus = StreamResourceStatus_e_Stopping;

                // update the resource status as well
                *pe_StreamResourceStatus = StreamResourceStatus_e_Stopping;

                // intentionally drop down to the next level
            }
            else
            {
                // nothing to do, break out
                break;
            }


        case StreamResourceStatus_e_Stopping:
            // stop the resource
            StopResource(e_StreamResource);

            // update the status
            e_StreamResourceStatus = StreamResourceStatus_e_WaitingToStop;

            // update the resource status as well
            *pe_StreamResourceStatus = StreamResourceStatus_e_WaitingToStop;

        // intentionally drop down to the next state
        case StreamResourceStatus_e_WaitingToStop:
            // wait for the resource to stop
            // this is a blocking call and will
            // return only once the wait is over
            WaitForResourceToStop(e_StreamResource);

            // we have come out of the function
            // this means that the resource has stopped
            // update the status
            e_StreamResourceStatus = StreamResourceStatus_e_Stopped;

            // update the resource status as well
            *pe_StreamResourceStatus = StreamResourceStatus_e_Stopped;

            break;
    }


    return;
}