FMCSoundStyleB::FMCSoundStyleB(Config* main_config, FMCControl* fmc_control) :
    FMCSounds(main_config, CFG_SOUNDS_STYLE_B_FILENAME, fmc_control)
{
    setupDefaultConfig();
    m_sounds_cfg->saveToFile();

    // load sounds

    loadBaseSounds();
    loadSound(CFG_SOUNDS_TOO_LOW_GEAR, m_sounds_cfg->getValue(CFG_SOUNDS_TOO_LOW_GEAR), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_TOO_LOW_FLAPS, m_sounds_cfg->getValue(CFG_SOUNDS_TOO_LOW_FLAPS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_APP_MINIMUMS, m_sounds_cfg->getValue(CFG_SOUNDS_APP_MINIMUMS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_MINIMUMS, m_sounds_cfg->getValue(CFG_SOUNDS_MINIMUMS), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT_CONT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT_CONT), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_AP_DISCO, m_sounds_cfg->getValue(CFG_SOUNDS_AP_DISCO), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_AT_DISCO, m_sounds_cfg->getValue(CFG_SOUNDS_AT_DISCO), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_STALL, m_sounds_cfg->getValue(CFG_SOUNDS_STALL), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_CHIME, m_sounds_cfg->getValue(CFG_SOUNDS_CHIME), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_OVERSPEED, m_sounds_cfg->getValue(CFG_SOUNDS_OVERSPEED), FMCSoundBase::SOUND_SOURCE_COMPUTER);
    loadSound(CFG_SOUNDS_ALT_ALERT_CONT, m_sounds_cfg->getValue(CFG_SOUNDS_ALT_ALERT_CONT), FMCSoundBase::SOUND_SOURCE_COMPUTER);

    if (getSound(CFG_SOUNDS_STALL)) getSound(CFG_SOUNDS_STALL)->setPlayLooped(true);
    if (getSound(CFG_SOUNDS_OVERSPEED)) getSound(CFG_SOUNDS_OVERSPEED)->setPlayLooped(true);
    if (getSound(CFG_SOUNDS_ALT_ALERT_CONT)) getSound(CFG_SOUNDS_ALT_ALERT_CONT)->setPlayLooped(true);
}
示例#2
0
FMCAutothrottle::FMCAutothrottle(ConfigWidgetProvider* config_widget_provider,
                                 Config* main_config, 
                                 const QString& autothrottle_cfg_filename,
                                 FMCControl* fmc_control) :
    m_main_config(main_config), m_fmc_control(fmc_control), m_fmc_data(fmc_control->fmcData()), 
    m_flightstatus(fmc_control->flightStatus()), m_ctrl_throttle(0), m_ctrl_speed(0), 
    m_last_flight_mode(FlightModeTracker::FLIGHT_MODE_UNKNOWN),
    m_was_acceleration_set(false), m_speed_mode_active(SPEED_MODE_NONE), 
    m_speed_mode_armed(SPEED_MODE_NONE), 
    m_current_takeoff_thrust(98.0), m_current_flex_thrust(95.0),
    m_current_max_continous_thrust(95.0), m_current_climb_thrust(90.0),
    m_more_drag_necessary(false), m_more_drag_necessary_timer_started(false),
    m_more_drag_necessary_end_timer_started(false), m_use_airbus_throttle_mode(false),
    m_current_airbus_throttle_mode(AIRBUS_THROTTLE_IDLE), m_was_airborne_with_thr_lever_below_flex_at_least_once(false)
{
    MYASSERT(config_widget_provider != 0);
    MYASSERT(m_main_config != 0);
    MYASSERT(m_fmc_control != 0);
    MYASSERT(m_flightstatus != 0);

    // setup config
    
    m_autothrottle_config = new Config(autothrottle_cfg_filename);
    MYASSERT(m_autothrottle_config != 0);
    setupDefaultConfig();
    m_autothrottle_config->loadfromFile();
    m_autothrottle_config->saveToFile();
    config_widget_provider->registerConfigWidget("Autothrottle", m_autothrottle_config);
    setUseAirbusThrottleModes(m_autothrottle_config->getIntValue(CFG_AP_AIRBUS_THROTTLE_MODE) != 0);

    // setup controller

    MYASSERT(connect(&m_fmc_control->aircraftData(), SIGNAL(signalChanged()), this, SLOT(slotAircraftDataChanged())));

    m_ctrl_throttle = new ControllerThrottle(*m_flightstatus);
    MYASSERT(m_ctrl_throttle != 0);
    m_ctrl_throttle->setTarget(m_fmc_data.fmcTakeoffThrustN1());
    m_ctrl_throttle->setMaxRate(m_fmc_control->aircraftData().throttleControllerMaxRate());
    m_ctrl_throttle->setTrendBoostFactor(m_fmc_control->aircraftData().throttleControllerTrendBoostFactor());
    m_ctrl_throttle->setRateFactor(m_fmc_control->aircraftData().throttleControllerRateFactor());

    m_ctrl_speed = new ControllerSpeed(*m_flightstatus, m_ctrl_throttle);
    MYASSERT(m_ctrl_speed != 0);
    m_ctrl_speed->setMaxTrend(m_fmc_control->aircraftData().speedControllerMaxTrend());
    m_ctrl_speed->setTrendBoostFactor(m_fmc_control->aircraftData().speedControllerTrendBoostFactor());
    m_ctrl_speed->setWrongDirectionTrendBoostFactor(m_fmc_control->aircraftData().speedControllerWrongDirectionTrendBoostFactor());
    m_ctrl_speed->setRateFactor(m_fmc_control->aircraftData().speedControllerRateFactor());

    // mode stuff

    m_speed_mode_calc_timer = QTime::currentTime().addSecs(-60);
    m_speed_mode_active_changed_time = QTime::currentTime().addSecs(-60);
    m_idle_thrust_timer_triggered = false;

    // climb thrust

    m_climb_thrust_calculate_timer.start();
}
static void load_config(PluginData* data, const char* filename) {
    const char* vice_exe = 0;
    const char* prg_file = 0;
    const char* kick_ass_symbols = 0;
    const char* breakpoint_file = 0;
    json_error_t error;

    setupDefaultConfig(data);

    json_t* root = json_load_file(filename, 0, &error);

    if (!root || !json_is_object(root)) {
        return;
	}

    log_debug("loaded config\n", "");

    json_unpack(root, "{s:s, s:s, s:s, s:s}",
                "vice_exe", &vice_exe,
                "prg_file", &prg_file,
                "kickass_symbols", &kick_ass_symbols,
                "breakpoints_file", &breakpoint_file);

    if (vice_exe && vice_exe[0] != 0) {
        data->config.vice_exe = strdup(vice_exe);
	}

    if (prg_file && prg_file[0] != 0) {
        data->config.prg_file = strdup(prg_file);
	}

    if (breakpoint_file && breakpoint_file[0] != 0) {
        data->config.breakpoint_file = strdup(breakpoint_file);
	}

    if (kick_ass_symbols && kick_ass_symbols[0] != 0) {
        data->config.kick_ass_symbols = strdup(kick_ass_symbols);
	}

    json_decref(root);
}
示例#4
0
IOCPServer::IOCPServer(const QString& config_filename, 
                       FMCControl* fmc_control) :
    m_fmc_control(fmc_control)
{
    // setup config

    m_cfg = new Config(config_filename);
    MYASSERT(m_cfg != 0);
    setupDefaultConfig();
    m_cfg->loadfromFile();
    m_cfg->saveToFile();

    m_tcp_server = new QTcpServer;
    MYASSERT(m_tcp_server != 0);
    MYASSERT(connect(m_tcp_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection())));

    if (!m_tcp_server->listen(QHostAddress::Any, m_cfg->getIntValue(CFG_TCP_PORT)))
        Logger::log(QString("IOCPServer: could not open TCP server on port %1").arg(m_cfg->getIntValue(CFG_TCP_PORT)));
    else
        Logger::log(QString("IOCPServer: TCP server listening on port %1").arg(m_cfg->getIntValue(CFG_TCP_PORT)));
}
示例#5
0
FMCConsole::FMCConsole(QWidget* parent, Qt::WFlags fl, const QString& style) :
#if !VASFMC_GAUGE
    QMainWindow(parent, fl),
#endif
    //m_is_minimized(true), 
    m_main_config(0), m_fmc_control(0), m_splash(0), m_info_dlg(0),
    m_gps_handler(0), m_fcu_handler(0), m_cdu_left_handler(0), m_cdu_right_handler(0), m_navdisplay_left_handler(0), 
    m_pfd_left_handler(0), m_navdisplay_right_handler(0), m_pfd_right_handler(0), m_logline_count(0),
    m_quit_action(0), m_fsaccess_msfs_action(0), m_fsaccess_xplane_action(0), m_fsaccess_fgfs_action(0), 
    m_style_a_action(0), m_style_b_action(0), m_style_g_action(0)
{
    Logger::log(QString("FMCConsole: current_dir=%1").arg(QDir::currentPath()));

#if !VASFMC_GAUGE
    setupUi(this);

#else
    Q_UNUSED(parent);
    Q_UNUSED(fl);
#endif

    // setup main config
    Logger::log("Setup main config");
    m_main_config = new Config(CFG_MAIN_FILENAME);
    MYASSERT(m_main_config != 0);
    setupDefaultConfig();
    QDir vasfmc_dir(m_main_config->getValue(CFG_VASFMC_DIR));
    MYASSERT(vasfmc_dir.exists());
    vasfmc_dir.mkdir("cfg");
    vasfmc_dir.mkdir(m_main_config->getValue(CFG_FLIGHTPLAN_SUBDIR));
    vasfmc_dir.mkdir(m_main_config->getValue(CFG_AIRCRAFT_DATA_SUBDIR));
    vasfmc_dir.mkdir(m_main_config->getValue(CFG_CHECKLIST_SUBDIR));
    m_main_config->loadfromFile();
    loadWindowGeometry();
    if (!m_main_config->contains(CFG_STARTUP_COUNTER)) m_main_config->setValue(CFG_STARTUP_COUNTER, 1);
    else m_main_config->setValue(CFG_STARTUP_COUNTER, m_main_config->getIntValue(CFG_STARTUP_COUNTER)+1);
    m_main_config->saveToFile();
    Logger::log("Setup main config: fin");

    if (!style.isEmpty())
    {
        if (style == "G") slotStyleG();
        if (style == "B") slotStyleB();
        else              slotStyleA();
    }

    // setup console
    setWindowTitle(QString("vasFMC ")+VERSION+" - (c) "+COPYRIGHT);
    setStatusBar(0);
    show();

    MYASSERT(connect(Logger::getLogger(), SIGNAL(signalLogging(const QString&)), this, SLOT(slotLogging(const QString&))));

    if (m_main_config->getIntValue(CFG_CONSOLE_WINDOW_STATUS) == 0) showMinimized();

    MYASSERT(connect(pfd_left_btn, SIGNAL(clicked()), this, SLOT(slotPFDLeftButton())));
    MYASSERT(connect(nd_left_btn, SIGNAL(clicked()), this, SLOT(slotNDLeftButton())));
    MYASSERT(connect(cdu_left_btn, SIGNAL(clicked()), this, SLOT(slotCDULeftButton())));
    MYASSERT(connect(cdu_right_btn, SIGNAL(clicked()), this, SLOT(slotCDURightButton())));
    MYASSERT(connect(upper_ecam_btn, SIGNAL(clicked()), this, SLOT(slotUpperECAMButton())));
    MYASSERT(connect(fcu_btn, SIGNAL(clicked()), this, SLOT(slotFCUButton())));
    MYASSERT(connect(gps_btn, SIGNAL(clicked()), this, SLOT(slotGPSButton())));
    //TODO
    gps_btn->setEnabled(false);
    //TODOMYASSERT(connect(lower_ecam_btn, SIGNAL(clicked()), this, SLOT(slotLowerECAMButton())));
    MYASSERT(connect(pfd_right_btn, SIGNAL(clicked()), this, SLOT(slotPFDRightButton())));
    MYASSERT(connect(nd_right_btn, SIGNAL(clicked()), this, SLOT(slotNDRightButton())));

    // setup config widget
    config_tab->clear();
    if (m_main_config->getIntValue(CFG_ENABLE_CONFIG_ACCESS) == 0) 
    {
        config_tab->setEnabled(false);
        config_tab->hide();
        overall_tab->removeTab(1);
    }

    registerConfigWidget("Main", m_main_config);

    // setup FMC control
    m_fmc_control = new FMCControl(this, m_main_config, CFG_CONTROL_FILENAME);
    MYASSERT(m_fmc_control != 0);
    MYASSERT(connect(m_fmc_control, SIGNAL(signalSetGLFontSize(uint)), this, SLOT(slotSetGLFontSize(uint))));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleA()), this, SLOT(slotStyleA())));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleB()), this, SLOT(slotStyleB())));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalStyleG()), this, SLOT(slotStyleG())));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalFcuLeftOnlyModeChanged()), this, SLOT(slotFcuLeftOnlyModeChanged())));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalRestartFMC()), this, SLOT(slotTriggerRestartFMC())));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalRestartCDU()), this, SLOT(slotTriggerRestartCDU())));

    // setup FMC sounds
    m_fmc_sounds_handler = new FMCSoundsHandler(m_main_config, m_fmc_control);
    MYASSERT(m_fmc_sounds_handler != 0);

    // setup left FMC CDU
    m_cdu_left_handler = new FMCCDUHandler(this, m_main_config, CFG_CDU_LEFT_FILENAME, m_fmc_control, true);
    MYASSERT(m_cdu_left_handler != 0);

    // setup right FMC CDU
    m_cdu_right_handler = new FMCCDUHandler(this, m_main_config, CFG_CDU_RIGHT_FILENAME, m_fmc_control, false);
    MYASSERT(m_cdu_right_handler != 0);

    // create menus
    createMenus();

    // connect profiling stuff

#if DO_PROFILING

    MYASSERT(connect(m_pfd_left_handler->fmcPFD(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_navdisplay_left_handler->fmcNavdisplay(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_upper_ecam_handler->fmcECAM(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_cdu_left_handler->fmcCduBase(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_fcu_handler->fmcFcuBase(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_fmc_control->fmcProcessor(), SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));
    MYASSERT(connect(m_fmc_control, SIGNAL(signalTimeUsed(const QString&, uint)),
                     this, SLOT(slotTimeUsed(const QString&, uint))));

#endif
}