// SendNMEA // Sends a user-defined NMEA string to an external instrument. // The string sent is prefixed with the start character '$' // and appended with the checksum e.g. '*40'. The user needs only // to provide the text in between the '$' and '*'. // void InputEvents::eventSendNMEA(const TCHAR *misc) { if (misc != NULL) { PopupOperationEnvironment env; VarioWriteNMEA(misc, env); } }
static void OnSaveClicked(gcc_unused WndButton &Sender) { UpdateParameters(false); // make sure changes are sent to device VarioWriteNMEA(_T("PDVSC,S,StoreToEeprom,2")); if (!is_simulator()) Sleep(500); }
static void OnSaveClicked(WindowControl * Sender) { (void)Sender; UpdateParameters(false); // make sure changes are sent to device VarioWriteNMEA(_T("PDVSC,S,StoreToEeprom,2")); if (!is_simulator()) Sleep(500); }
void dlgVegaDemoShowModal() { WndForm *wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(), _T("IDR_XML_VEGADEMO")); if (!wf) return; PopupOperationEnvironment env; VarioWriteNMEA(_T("PDVSC,S,DemoMode,0"), env); VarioWriteNMEA(_T("PDVSC,S,DemoMode,3"), env); LoadFormProperty(*wf, _T("prpVegaDemoW"), UnitGroup::VERTICAL_SPEED, VegaDemoW); LoadFormProperty(*wf, _T("prpVegaDemoV"), UnitGroup::VERTICAL_SPEED, VegaDemoV); LoadFormProperty(*wf, _T("prpVegaDemoAudioClimb"), VegaDemoAudioClimb); wf->ShowModal(); delete wf; // deactivate demo. VarioWriteNMEA(_T("PDVSC,S,DemoMode,0"), env); }
static void VegaWriteDemo() { static PeriodClock last_time; if (!last_time.CheckUpdate(250)) return; TCHAR dbuf[100]; _stprintf(dbuf, _T("PDVDD,%d,%d"), iround(VegaDemoW * 10), iround(VegaDemoV * 10)); PopupOperationEnvironment env; VarioWriteNMEA(dbuf, env); }
static bool VegaConfigurationUpdated(const TCHAR *name, bool first, bool setvalue = false, long ext_setvalue = 0) { TCHAR updatename[100]; TCHAR fullname[100]; TCHAR propname[100]; TCHAR requesttext[100]; unsigned updated = 0; unsigned lvalue = 0; WndProperty* wp; #ifdef _WIN32_WCE if (first) ProgressGlue::Step(); #endif _stprintf(updatename, CONF("Vega%sUpdated"), name); _stprintf(fullname, CONF("Vega%s"), name); _stprintf(propname, _T("prp%s"), name); if (first) { Profile::Set(updatename, 0); // we are not ready, haven't received value from vario // (do request here) _stprintf(requesttext, _T("PDVSC,R,%s"), name); VarioWriteNMEA(requesttext); if (!is_simulator()) Sleep(250); } if (setvalue) { wp = (WndProperty*)wf->FindByName(propname); if (wp) { wp->GetDataField()->SetAsInteger((int)ext_setvalue); wp->RefreshDisplay(); } _stprintf(requesttext, _T("PDVSC,S,%s,%d"), name, ext_setvalue); VarioWriteNMEA(requesttext); if (!is_simulator()) Sleep(250); return true; } if (!Profile::Get(fullname, lvalue)) { // vario hasn't set the value in the registry yet, // so no sensible defaults return false; } else { // hack, fix the -1 (plug and play settings) if (_tcscmp(name, _T("HasTemperature")) == 0) { if (lvalue >= 255) lvalue = 2; } if (first) { // at start, set from last known registry value, this // helps if variables haven't been modified. wp = (WndProperty*)wf->FindByName(propname); if (wp) { wp->GetDataField()->SetAsInteger(lvalue); wp->RefreshDisplay(); } } } if (Profile::Get(updatename, updated)) { if (updated == 1) { // value is updated externally, so set the property and can proceed // to editing values Profile::Set(updatename, 2); wp = (WndProperty*)wf->FindByName(propname); if (wp) { wp->GetDataField()->SetAsInteger(lvalue); wp->RefreshDisplay(); } } else if (updated == 2) { wp = (WndProperty*)wf->FindByName(propname); if (wp) { unsigned newval = (wp->GetDataField()->GetAsInteger()); if (newval != lvalue) { // value has changed Profile::Set(updatename, 2); Profile::Set(fullname, lvalue); changed = true; // maybe represent all as text? // note that this code currently won't work for longs // hack, fix the -1 (plug and play settings) if (_tcscmp(name, _T("HasTemperature")) == 0) { if (newval == 2) newval = 255; } _stprintf(requesttext, _T("PDVSC,S,%s,%d"), name, newval); VarioWriteNMEA(requesttext); if (!is_simulator()) Sleep(250); return true; } } } } return false; }
// SendNMEA // Sends a user-defined NMEA string to an external instrument. // The string sent is prefixed with the start character '$' // and appended with the checksum e.g. '*40'. The user needs only // to provide the text in between the '$' and '*'. // void InputEvents::eventSendNMEA(const TCHAR *misc) { if (misc) VarioWriteNMEA(misc); }