void LoggerImpl::guiStartLogger(const NMEA_INFO& gps_info, const SETTINGS_COMPUTER& settings, bool noAsk) { int i; if (!LoggerActive) { if (gps_info.Replay) { if (LoggerActive) guiStopLogger(gps_info, true); return; } TCHAR TaskMessage[1024]; _tcscpy(TaskMessage,TEXT("Start Logger With Declaration\r\n")); if (task.Valid()) { for (i = 0; task.ValidTaskPoint(i); i++) { _tcscat(TaskMessage, task.getWaypoint(i).Name); _tcscat(TaskMessage,TEXT("\r\n")); } } else { _tcscat(TaskMessage,TEXT("None")); } if(noAsk || (MessageBoxX(TaskMessage,gettext(TEXT("Start Logger")), MB_YESNO|MB_ICONQUESTION) == IDYES)) { if (LoggerClearFreeSpace(gps_info)) { StartLogger(gps_info, settings, strAssetNumber); LoggerHeader(gps_info); LoggerActive = true; // start logger after Header is completed. Concurrency if (task.Valid()) { int ntp = task.getFinalWaypoint(); StartDeclaration(gps_info,ntp); for (i = 0; task.ValidTaskPoint(i); i++) { const WAYPOINT &way_point = task.getWaypoint(i); AddDeclaration(way_point.Location.Latitude, way_point.Location.Longitude, way_point.Name); } EndDeclaration(); } ResetFRecord(); // reset timer & lastRecord string so if // logger is restarted, FRec appears at top // of file } else { MessageBoxX( gettext(TEXT("Logger inactive, insufficient storage!")), gettext(TEXT("Logger Error")), MB_OK| MB_ICONERROR); StartupStore(TEXT("Logger not started: Insufficient Storage\r\n")); } } } }
void LoggerImpl::guiToggleLogger(const NMEA_INFO& gps_info, const SETTINGS_COMPUTER& settings, bool noAsk) { if (LoggerActive) { guiStopLogger(gps_info, noAsk); } else { guiStartLogger(gps_info, settings, noAsk); } }
void Logger::guiToggleLogger(const NMEA_INFO& gps_info, const SETTINGS_COMPUTER& settings, const ProtectedTaskManager &protected_task_manager, bool noAsk) { if (isLoggerActive()) { guiStopLogger(gps_info, noAsk); } else { guiStartLogger(gps_info, settings, protected_task_manager, noAsk); } }
void Shutdown(void) { int i; // LKTOKEN _@M1219_ "Shutdown, please wait..." CreateProgressDialog(gettext(TEXT("_@M1219_"))); LKSound(_T("LK_DISCONNECT.WAV")); Poco::Thread::sleep(500); // real WAV length is 410+ms if (!GlobalRunning) { // shutdown on startup (before sim/fly or clicking on the window X) StartupStore(_T(". Quick shutdown requested before terminating startup%s"),NEWLINE); // force exit mode for the case of being in welcome screen: OnTimerNotify will catch it RUN_MODE=RUN_SHUTDOWN; CloseCalculations(); CloseGeoid(); DeInitCustomHardware(); LKRunStartEnd(false); return; } StartupStore(_T(". Entering shutdown %s%s"), WhatTimeIsIt(),NEWLINE); MapWindow::Event_Pan(0); // return from PAN restores the Task in case of Turnpoint moving #if TESTBENCH StartupLogFreeRamAndStorage(); #endif // turn off all displays GlobalRunning = false; // LKTOKEN _@M1220_ "Shutdown, saving logs..." CreateProgressDialog(gettext(TEXT("_@M1220_"))); // In case we quit while are still flying UpdateLogBook(false); // false=only log if still flying // stop logger guiStopLogger(true); // LKTOKEN _@M1221_ "Shutdown, saving profile..." CreateProgressDialog(gettext(TEXT("_@M1221_"))); extern void LKAircraftSave(const TCHAR *szFile); extern void LKPilotSave(const TCHAR *szFile); extern void LKDeviceSave(const TCHAR *szFile); LKPilotSave(defaultPilotFile); LKAircraftSave(defaultAircraftFile); LKProfileSave(defaultProfileFile); LKDeviceSave(defaultDeviceFile); #if TESTBENCH StartupStore(TEXT(". Save_Recent_WP_history%s"),NEWLINE); #endif SaveRecentList(); // Stop sound // Stop drawing // LKTOKEN _@M1219_ "Shutdown, please wait..." CreateProgressDialog(gettext(TEXT("_@M1219_"))); // 100526 this is creating problem in SIM mode when quit is called from X button, and we are in waypoint details // or probably in other menu related screens. However it cannot happen from real PNA or PDA because we don't have // that X button. MapWindow::CloseDrawingThread(); // Stop calculating too (wake up) dataTriggerEvent.set(); drawTriggerEvent.set(); // Clear data // LKTOKEN _@M1222_ "Shutdown, saving task..." CreateProgressDialog(gettext(TEXT("_@M1222_"))); #if TESTBENCH StartupStore(TEXT(".... Save default task%s"),NEWLINE); #endif SaveDefaultTask(); #if TESTBENCH StartupStore(TEXT(".... Clear task data%s"),NEWLINE); #endif LockTaskData(); Task[0].Index = -1; ActiveWayPoint = -1; AATEnabled = FALSE; CloseWayPoints(); UnlockTaskData(); // LKTOKEN _@M1219_ "Shutdown, please wait..." CreateProgressDialog(gettext(TEXT("_@M1219_"))); #if TESTBENCH StartupStore(TEXT(".... CloseTerrainTopology%s"),NEWLINE); #endif RasterTerrain::CloseTerrain(); CloseTopology(); #if USETOPOMARKS TopologyCloseMarks(); #endif CloseTerrainRenderer(); LiveTrackerShutdown(); #ifndef NO_DATARECORDER CloseFlightDataRecorder(); #endif // Stop COM devices StartupStore(TEXT(". Stop COM devices%s"),NEWLINE); devCloseAll(); CloseFLARMDetails(); ProgramStarted = psInitInProgress; // Kill windows #if TESTBENCH StartupStore(TEXT(".... Close Messages%s"),NEWLINE); #endif Message::Destroy(); #if TESTBENCH StartupStore(TEXT(".... Destroy Button Labels%s"),NEWLINE); #endif ButtonLabel::Destroy(); #if TESTBENCH StartupStore(TEXT(".... Delete Objects%s"),NEWLINE); #endif // Kill graphics objects #ifdef LXMINIMAP hBrushButtonHasFocus.Release(); #endif CAirspaceManager::Instance().CloseAirspaces(); #if TESTBENCH StartupStore(TEXT(".... Delete Critical Sections%s"),NEWLINE); #endif // Wait end of Calculation thread before deinit critical section. WaitThreadCalculation(); #if TESTBENCH StartupStore(TEXT(".... Close Progress Dialog%s"),NEWLINE); #endif CloseProgressDialog(); #if TESTBENCH StartupStore(TEXT(".... Close Calculations%s"),NEWLINE); #endif CloseCalculations(); CloseGeoid(); DeInitCustomHardware(); #if TESTBENCH StartupStore(TEXT(".... Close Windows%s"),NEWLINE); #endif #if TESTBENCH StartupLogFreeRamAndStorage(); #endif for (i=0;i<NUMDEV;i++) { if (ComPortStatus[i]!=0) { StartupStore(_T(". ComPort %d: status=%d Rx=%ld Tx=%ld ErrRx=%ld + ErrTx=%ld (==%ld)%s"), i, ComPortStatus[i], ComPortRx[i],ComPortTx[i], ComPortErrRx[i],ComPortErrTx[i],ComPortErrors[i],NEWLINE); } } StartupStore(_T(". Finished shutdown %s%s"), WhatTimeIsIt(),NEWLINE); LKRunStartEnd(false); #ifdef DEBUG TCHAR foop[80]; TASK_POINT wp; TASK_POINT *wpr = ℘ _stprintf(foop,TEXT(". Sizes %d %d %d%s"), sizeof(TASK_POINT), ((long)&wpr->AATTargetLocked)-((long)wpr), ((long)&wpr->Target)-((long)wpr), NEWLINE ); StartupStore(foop); #endif StartupStore(_T("Destroy MainWindow" NEWLINE)); MainWindow.Destroy(); }