示例#1
0
文件: main.cpp 项目: asakyurek/S2Sim
int
main( int argc, char **argv )
{    
    LOG_FUNCTION_START();
    LogPrint( "S2Sim Started" );
    
    GetConnectionManager();
    GetMatlabManager();
    GetControlManager();
    GetSystemManager();
    
    auto iterationNumber = 0;
    
    GetControlManager().WaitUntilReady();
    while ( 1 )
    {
        try
        {
            GetSystemManager().AdvanceTimeStep();
        }
        catch ( ... )
        {
            ErrorPrint( "System Error, Exiting" );
            break;
        }
        
        ++iterationNumber;
        LogPrint( "Time: ", iterationNumber );
    }
    LOG_FUNCTION_END();
    return ( EXIT_SUCCESS );
}
VL53L0X_Error VL53L0X_PollingDelay(VL53L0X_DEV Dev){
    VL53L0X_Error status = VL53L0X_ERROR_NONE;
    volatile uint32_t i;
    LOG_FUNCTION_START("");

    for(i=0;i<VL53L0X_POLLINGDELAY_LOOPNB;i++){
        //Do nothing
        asm("nop");
    }

    LOG_FUNCTION_END(status);
    return status;
}
示例#3
0
VL53L0X_Error VL53L0X_PollingDelay(VL53L0X_DEV Dev){
    VL53L0X_Error status = VL53L0X_ERROR_NONE;
    LOG_FUNCTION_START("");

    const DWORD cTimeout_ms = 1;
    HANDLE hEvent = CreateEvent(0, TRUE, FALSE, 0);
    if(hEvent != NULL)
    {
        WaitForSingleObject(hEvent,cTimeout_ms);
    }

    LOG_FUNCTION_END(status);
    return status;
}
示例#4
0
void
ThreadedTCPServer::SetNotificationCallback( TNotification notification )
{
    LOG_FUNCTION_START();
    if ( this->m_notification != nullptr && this->m_started )
    {
        ErrorPrint( "Multiple notification callbacks not allowed" );
    }
    this->m_notification = notification;
    if ( this->m_notification != nullptr )
    {
        this->m_started = true;
        this->Listen();
        this->m_thread = std::thread( &ThreadedTCPServer::ExecutionBody, this );
        this->m_thread.detach();
    }
    LOG_FUNCTION_END();
}