void OpenDCCCtrlDlg::OnTimer(wxTimerEvent& event) { if( !MutexOp.trywait( m_TimerMutex, 100 ) ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "timeout on timer mutex!" ); return; } TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "timer tick..." ); /* if( m_bStartUpProgress ) { m_bStartUpProgress = false; m_TimerCount = 0; sendGet(so_version); startProgress(); MutexOp.post( m_TimerMutex ); return; } */ if( m_bCleanUpProgress ) { if( m_Progress != NULL ) { m_Timer->Stop(); wxProgressDialog* dlg = m_Progress; m_Progress = NULL; dlg->EndModal(0); dlg->Destroy(); TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "cleaned up the progress dialog" ); } m_bCleanUpProgress = false; MutexOp.post( m_TimerMutex ); return; } m_TimerCount++; if( m_TimerCount >= 1000 ) { TraceOp.trc( "opendcc", TRCLEVEL_WARNING, __LINE__, 9999, "timeout on SO acknowledge" ); stopProgress(); } else if( m_Progress != NULL && !m_bCleanUpProgress ) { if( m_Progress->IsShownOnScreen() ) { if( !m_Progress->Pulse() ) { m_Timer->Stop(); stopProgress(); m_TimerCount = 1000; } else { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "timer for SO acknowledge" ); bool rc = m_Timer->Start( 1000, wxTIMER_ONE_SHOT ); } } } MutexOp.post( m_TimerMutex ); }
void ProgressBar::restartProgress() { VC3 tmp = this->progressPosition; float tmp2 = this->progressAngle; stopProgress(); startProgress(this->unit, tmp, tmp2); }
ProgressBar::~ProgressBar() { // NOTE: ProgressBarActor handles visualization deletion? if (isProgressing()) { stopProgress(); } }
void OGL_StopProgress() { stopProgress(); /* show_ogl_progress = false; if (OGL_LoadScreen::instance()->Use()) { OGL_LoadScreen::instance()->Stop(); } else{ close_progress_dialog(); } */ }
QueryModel::QueryModel(CorpusPtr corpus, QObject *parent) : QAbstractTableModel(parent), d_corpus(corpus), d_entryCache(new EntryCache()), d_timer(new QTimer) { connect(this, SIGNAL(queryEntryFound(QString)), SLOT(mapperEntryFound(QString))); connect(this, SIGNAL(queryFinished(int, int, QString, QString, bool, bool)), SLOT(finalizeQuery(int, int, QString, QString, bool, bool))); // Timer for progress updates. connect(d_timer.data(), SIGNAL(timeout()), SLOT(updateProgress())); connect(this, SIGNAL(queryStopped(int, int)), SLOT(stopProgress())); connect(this, SIGNAL(queryFinished(int, int, QString, QString, bool, bool)), SLOT(stopProgress())); connect(this, SIGNAL(queryFailed(QString)), SLOT(stopProgress())); }
void OpenDCCCtrlDlg::evaluateGet( int so, int value ) { m_soValue[so] = value; if( so == so_version ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "version = %d.%d", value/100, value%100 ); m_Version->SetValue( wxString::Format(_T("%d.%d"), value/100, value%100) ); sendGet( so_bps ); } else if( so == so_bps ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "baudrate = %d", value ); /* * Attention: * OpenDCC provides the baudrate values for read * depending on the selected protocol for communication. * The Dialog is using p50x values, so if XpressNet (Lenz) * protocol is selected the baudrate values must be * converted to Intellibox p50x values. */ if( m_bLenz ) { /* lenz 0: 9600 Baud 1: 19200 Baud (default) 2: 38400 Baud 3: 57600 Baud 4: 115200 Baud 5: 2400 Baud 6: 4800 Baud p50x 0: 2400 Baud 1: 4800 Baud 2: 9600 Baud 3: 19200 Baud 4: 38400 Baud 5: 57600 Baud 6: 115200 Baud */ /* The dialog is using p50x values, so convert lenz to p50x */ switch( value ) { case 0: value = 2; break; case 1: value = 3; break; case 2: value = 4; break; case 3: value = 5; break; case 4: value = 6; break; case 5: value = 0; break; case 6: value = 1; break; } } m_Baudrate->SetSelection(value); sendGet( so_mode ); } else if( so == so_mode ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "opendcc mode = %d", value ); m_Mode->SetValue( value & 0x01 ? _T("Xpressnet"):_T("Standard") ); m_Clock->SetValue(value & 0x10 ? true:false); iONode opendccini = wDigInt.getopendcc(m_Props); wOpenDCC.setfastclock(opendccini, value & 0x10 ? True:False); m_OpenDCCmode = value; sendGet( so_dcc_format ); } else if( so == so_dcc_format ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "dcc format = %d", value ); /* 0: DCC mit 14 Fahrstufen 1: reserviert (DCC mit 27 Fahrstufen, nicht implementiert) 2: DCC mit 28 Fahrstufen (Voreinstellung) 3: DCC mit 128 Fahrstufen (bzw. 126, um genau zu sein) */ m_DecSpeedSteps->SetSelection(value); sendGet( so_bidi ); } else if( so == so_bidi ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "bidi = %d", value ); m_BiDiCutOut->SetValue(value&0x01?true:false); m_BiDiIdNotify->SetValue(value&0x02?true:false); m_BiDiAccQuery->SetValue(value&0x04?true:false); sendGet( so_s88_timing ); } else if( so == so_s88_timing ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "s88 timing = %d", value ); m_S88Timing->SetValue(value); sendGet( so_s88_bus1 ); } else if( so == so_s88_bus1 ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "s88 bus1 = %d", value ); m_S88Bus1->SetValue(value); sendGet( so_s88_bus2 ); } else if( so == so_s88_bus2 ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "s88 bus2 = %d", value ); m_S88Bus2->SetValue(value); sendGet( so_s88_bus3 ); } else if( so == so_s88_bus3 ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "s88 bus3 = %d", value ); m_S88Bus3->SetValue(value); sendGet( so_s88_mode ); } else if( so == so_s88_mode ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "s88 mode = %d", value ); m_S88Active->SetValue( (value&0x01) ? true:false ); m_S88TurnoutSensors->SetValue( (value&0x02) ? true:false ); sendGet( so_pt_resets ); } else if( so == so_pt_resets ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "pt resets = %d", value ); m_PTResets->SetValue( value ); sendGet( so_pt_commands ); } else if( so == so_pt_commands ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "pt commands = %d", value ); m_PTCommands->SetValue( value ); sendGet( so_pt_pom ); } else if( so == so_pt_pom ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "pt pom = %d", value ); m_PTPOMrepeat->SetValue( value ); sendGet( so_scd_main ); } else if( so == so_scd_main ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "scd main = %d", value ); m_SCTimeMain->SetValue( value ); sendGet( so_scd_pt ); } else if( so == so_scd_pt ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "scd pt = %d", value ); m_SCTimePT->SetValue( value ); sendGet( so_sw_invert ); } else if( so == so_sw_invert ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "sw invert = %d", value ); m_SwitchInvert->SetValue( (value&0x01) ? true:false ); sendGet( so_sw_commands ); } else if( so == so_sw_commands ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "sw commands = %d", value ); m_SwitchCommands->SetValue( value ); sendGet( so_sw_time ); } else if( so == so_sw_time ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "sw time = %d", value ); m_SwitchTime->SetValue( value ); sendGet( so_sw_sensor_offset ); } else if( so == so_sw_sensor_offset ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "sw sensor offset = %d", value ); m_SwitchSensorOffset->SetValue( value ); sendGet( so_sw_sensor_mode ); } else if( so == so_sw_sensor_mode ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "sw sensor mode = %d", value ); m_SwitchSensorMode->SetSelection( value ); sendGet( so_serial_number ); } else if( so == so_serial_number ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "serial number = %d", value ); m_SerialNumber->SetValue( value ); sendGet( so_xpn_feedback_mapping ); } else if( so == so_xpn_feedback_mapping ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "xpn feedback mapping = %d", value ); m_XpnFeedbackMapping->SetSelection( value ); sendGet( so_xpn_sensors ); } else if( so == so_xpn_sensors ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "xpn sensors = %d", value ); m_XpressNetSensors->SetValue( value ); sendGet( so_loco_format_low ); } // TODO: get list of loco decoder exceptions // 64 pairs starting with: so_loco_format_low, so_loco_format_high else if( so >= so_loco_format_low && so <= so_loco_format_high + 64*2 ) { TraceOp.trc( "opendcc", TRCLEVEL_INFO, __LINE__, 9999, "loco format %d = %d", so, value ); if( m_OpenDCCmode & mode_type_xpr ) { /* TODO: handle mode_type_xpr database */ stopProgress(); } else { if( so % 2 == 1) { int index = ( so - so_loco_format_low ) / 2; int locoFormatLow = m_soValue[so-1]; int locoFormatHigh = m_soValue[so]; int address = locoFormatLow + ((locoFormatHigh & 0x3F) << 8); int format = (locoFormatHigh & 0xC0) >> 6; if( address > 0 ) { m_DecExceptions->InsertItem( index, wxString::Format(_T("%d"), address)); if( format == 0 ) m_DecExceptions->SetItem( index, 1, _T("DCC 14")); else if( format == 1 ) m_DecExceptions->SetItem( index, 1, _T("DCC 27")); else if( format == 2 ) m_DecExceptions->SetItem( index, 1, _T("DCC 28")); else if( format == 3 ) m_DecExceptions->SetItem( index, 1, _T("DCC 128")); else m_DecExceptions->SetItem( index, 1, _T("DCC ???")); if( index < 64 ) sendGet( so + 1 ); else stopProgress(); } else { stopProgress(); } } else