static void commTaskThread()

in source/cellular/comm_if_windows.c [363:409]


static void commTaskThread( void * pUserData )
{
    _cellularCommContext_t * pCellularCommContext = ( _cellularCommContext_t * ) pUserData;
    EventBits_t uxBits = 0;

    /* Inform thread ready. */
    CellularLogInfo( "Cellular commTaskThread started" );

    if( pCellularCommContext != NULL )
    {
        ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent,
                                     COMMTASK_EVT_MASK_STARTED );
    }

    while( true )
    {
        /* Wait for notification from eventqueue. */
        uxBits = xEventGroupWaitBits( ( pCellularCommContext->pCommTaskEvent ),
                                      ( ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ),
                                      pdTRUE,
                                      pdFALSE,
                                      pdMS_TO_TICKS( COMMTASK_POLLING_TIME_MS ) );

        if( ( uxBits & ( EventBits_t ) COMMTASK_EVT_MASK_ABORT ) != 0U )
        {
            CellularLogDebug( "Abort received, cleaning up!" );
            break;
        }
        else
        {
            /* Polling the global share variabe to trigger the interrupt. */
            if( rxEvent == true )
            {
                rxEvent = false;
                vPortGenerateSimulatedInterrupt( portINTERRUPT_UART );
            }
        }
    }

    /* Inform thread ready. */
    if( pCellularCommContext != NULL )
    {
        ( void ) xEventGroupSetBits( pCellularCommContext->pCommTaskEvent, COMMTASK_EVT_MASK_ABORTED );
    }

    CellularLogInfo( "Cellular commTaskThread exit" );
}