protected void UpdateCounter(uint address, uint data) { lock (UpdateCounterLockObject) { if (_updateCounterDCSBIOSOutput.Address == address) { var newCount = _updateCounterDCSBIOSOutput.GetUIntValue(data); if (!_synchedOnce) { _count = newCount; _synchedOnce = true; return; } //Max is 255 if ((newCount == 0 && _count == 255) || newCount - _count == 1) { //All is well _count = newCount; } else if (newCount - _count != 1) { //Not good if (OnUpdatesHasBeenMissed != null) { OnUpdatesHasBeenMissed(this, new DCSBIOSUpdatesMissedEventArgs() { UniqueId = HIDSkeletonBase.InstanceId, GamingPanelEnum = _typeOfGamingPanel, Count = (int)(newCount - _count) }); _count = newCount; } } } } }
protected void UpdateCounter(uint address, uint data) { lock (_updateCounterLockObject) { if (_updateCounterDCSBIOSOutput.Address == address) { var newCount = _updateCounterDCSBIOSOutput.GetUIntValue(data); if (!_synchedOnce) { _count = newCount; _synchedOnce = true; return; } //Max is 255 if ((newCount == 0 && _count == 255) || newCount - _count == 1) { //All is well _count = newCount; } else if (newCount - _count != 1) { //Not good if (OnUpdatesHasBeenMissed != null) { OnUpdatesHasBeenMissed(HIDSkeletonBase.InstanceId, _typeOfSaitekPanel, (int)(newCount - _count)); _count = newCount; } } } } }
public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { try { if (_decoderSourceType == DCSBiosOutputType.STRING_TYPE) { return; } if (_dcsbiosOutput?.Address == e.Address) { if (!Equals(UintDcsBiosValue, e.Data)) { UintDcsBiosValue = _dcsbiosOutput.GetUIntValue(e.Data); _valueUpdated = true; } } } catch (Exception ex) { Common.LogError(ex, "DcsBiosDataReceived()"); } }
public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { try { UpdateCounter(e.Address, e.Data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ //FuG 16ZY Preset Channel Dial if (e.Address == _fug16ZyPresetDcsbiosOutputPresetDial.Address) { lock (_lockFug16ZyPresetDialObject1) { var tmp = _fug16ZyPresetCockpitDialPos; _fug16ZyPresetCockpitDialPos = _fug16ZyPresetDcsbiosOutputPresetDial.GetUIntValue(e.Data); if (tmp != _fug16ZyPresetCockpitDialPos) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //FuG 16ZY Fine Tune Dial if (e.Address == _fug16ZyFineTuneDcsbiosOutputDial.Address) { lock (_lockFug16ZyFineTuneDialObject1) { var tmp = _fug16ZyFineTuneCockpitDialPos; _fug16ZyFineTuneCockpitDialPos = _fug16ZyFineTuneDcsbiosOutputDial.GetUIntValue(e.Data); if (tmp != _fug16ZyFineTuneCockpitDialPos) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //FuG 25A IFF Channel Dial if (e.Address == _fug25aIFFDcsbiosOutputDial.Address) { lock (_lockFUG25AIFFDialObject1) { var tmp = _fug25aIFFCockpitDialPos; _fug25aIFFCockpitDialPos = _fug25aIFFDcsbiosOutputDial.GetUIntValue(e.Data); if (tmp != _fug25aIFFCockpitDialPos) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //FuG 16ZY Homing Switch if (e.Address == _homingDcsbiosOutputPresetDial.Address) { lock (_lockHomingDialObject1) { var tmp = _homingCockpitDialPos; _homingCockpitDialPos = _homingDcsbiosOutputPresetDial.GetUIntValue(e.Data); if (tmp != _homingCockpitDialPos) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); } catch (Exception ex) { Common.LogError(82001, ex); } }
public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { UpdateCounter(e.Address, e.Data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ //Radio if (e.Address == _radioDcsbiosOutputFreqSelectorPosition.Address) { lock (_lockRadioFreqSelectorPositionObject) { var tmp = _radioFreqSelectorPositionCockpit; if (tmp != _radioFreqSelectorPositionCockpit) { Interlocked.Add(ref _doUpdatePanelLCD, 1); _radioFreqSelectorPositionCockpit = _radioDcsbiosOutputFreqSelectorPosition.GetUIntValue(e.Data); } } } //RSBN Nav if (e.Address == _rsbnNavChannelCockpitOutput.Address) { lock (_lockRsbnNavChannelObject) { var tmp = _rsbnNavChannelCockpit; _rsbnNavChannelCockpit = _rsbnNavChannelCockpitOutput.GetUIntValue(e.Data); if (tmp != _rsbnNavChannelCockpit) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //RSBN ILS if (e.Address == _rsbnILSChannelCockpitOutput.Address) { lock (_lockRsbnilsChannelObject) { var tmp = _rsbnILSChannelCockpit; _rsbnILSChannelCockpit = _rsbnILSChannelCockpitOutput.GetUIntValue(e.Data); if (tmp != _rsbnILSChannelCockpit) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //ARC Sector if (e.Address == _arcSectorCockpitOutput.Address) { lock (_lockARCSectorObject) { var tmp = _arcSectorCockpit; _arcSectorCockpit = _arcSectorCockpitOutput.GetUIntValue(e.Data); if (tmp != _arcSectorCockpit) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //ARC Preset if (e.Address == _arcPresetChannelCockpitOutput.Address) { lock (_lockARCPresetChannelObject) { var tmp = _arcPresetChannelCockpit; _arcPresetChannelCockpit = _arcPresetChannelCockpitOutput.GetUIntValue(e.Data) + 1; if (tmp != _arcPresetChannelCockpit) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); }
public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { try { UpdateCounter(e.Address, e.Data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ //TILS Channel Selector if (e.Address == _tilsChannelSelectorDcsbiosOutput.Address) { lock (_lockTilsChannelSelectorDialObject1) { var tmp = _tilsChannelCockpitValue; _tilsChannelCockpitValue = _tilsChannelSelectorDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _tilsChannelCockpitValue) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //TILS Channel Mode if (e.Address == _tilsChannelLayerSelectorDcsbiosOutput.Address) { lock (_lockTilsChannelLayerSelectorObject2) { var tmp = _tilsChannelLayerSelectorCockpitValue; _tilsChannelLayerSelectorCockpitValue = _tilsChannelLayerSelectorDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _tilsChannelLayerSelectorCockpitValue) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //Master Mode Selector if (e.Address == _masterModeSelectorDcsbiosOutput.Address) { lock (_lockMasterModeSelectorObject) { var tmp = _masterModeSelectorCockpitValue; _masterModeSelectorCockpitValue = _masterModeSelectorDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _masterModeSelectorCockpitValue) { Interlocked.Add(ref _doUpdatePanelLCD, 1); } } } //Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); } catch (Exception ex) { Common.ShowErrorMessageBox(ex); } }
public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { try { UpdateCounter(e.Address, e.Data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ // HF Radio Off Button if (e.Address == _hfRadioOffDcsbiosOutput.Address) { lock (_lockHFRadioPresetDialObject1) { var tmp = _hfRadioOffCockpitButton; _hfRadioOffCockpitButton = _hfRadioOffDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioOffCockpitButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Channel A Button if (e.Address == _hfRadioChannelAPresetDcsbiosOutput.Address) { lock (_lockHFRadioPresetDialObject1) { var tmp = _hfRadioChannelACockpitButton; _hfRadioChannelACockpitButton = _hfRadioChannelAPresetDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioChannelACockpitButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Channel B Button if (e.Address == _hfRadioChannelBPresetDcsbiosOutput.Address) { lock (_lockHFRadioPresetDialObject1) { var tmp = _hfRadioChannelBCockpitButton; _hfRadioChannelBCockpitButton = _hfRadioChannelBPresetDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioChannelBCockpitButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Channel C Button if (e.Address == _hfRadioChannelCPresetDcsbiosOutput.Address) { lock (_lockHFRadioPresetDialObject1) { var tmp = _hfRadioChannelCCockpitButton; _hfRadioChannelCCockpitButton = _hfRadioChannelCPresetDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioChannelCCockpitButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Channel B Button if (e.Address == _hfRadioChannelDPresetDcsbiosOutput.Address) { lock (_lockHFRadioPresetDialObject1) { var tmp = _hfRadioChannelDCockpitButton; _hfRadioChannelDCockpitButton = _hfRadioChannelDPresetDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioChannelDCockpitButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Mode if (e.Address == _hfRadioModeDialPresetDcsbiosOutput.Address) { lock (_lockHFRadioModeDialObject1) { var tmp = _hfRadioModeCockpitDialPosition; _hfRadioModeCockpitDialPosition = _hfRadioModeDialPresetDcsbiosOutput.GetUIntValue(e.Data); if (tmp != _hfRadioModeCockpitDialPosition) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // IFF B if (e.Address == _iffBiffDcsbiosOutputDial.Address) { lock (_lockIFFDialObject1) { var tmp = _iffBiffCockpitDialPos; _iffBiffCockpitDialPos = _iffBiffDcsbiosOutputDial.GetUIntValue(e.Data); if (tmp != _iffBiffCockpitDialPos) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // HF Radio Channel B Button if (e.Address == _iffDiffDcsbiosOutputDial.Address) { lock (_lockIFFDialObject1) { var tmp = _iffDiffCockpitDialPos; _iffDiffCockpitDialPos = _iffDiffDcsbiosOutputDial.GetUIntValue(e.Data); if (tmp != _iffDiffCockpitDialPos) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); } catch (Exception ex) { logger.Error(ex); } }
public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { try { UpdateCounter(e.Address, e.Data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ // VHF On Off if (e.Address == _vhf1DcsbiosOutputPresetButton0.Address) { lock (_lockVhf1DialObject1) { var tmp = _vhf1CockpitPresetActiveButton; if (_vhf1DcsbiosOutputPresetButton0.GetUIntValue(e.Data) == 1) { // Radio is off _vhf1CockpitPresetActiveButton = 0; } if (tmp != _vhf1CockpitPresetActiveButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // VHF A if (e.Address == _vhf1DcsbiosOutputPresetButton1.Address) { lock (_lockVhf1DialObject1) { var tmp = _vhf1CockpitPresetActiveButton; if (_vhf1DcsbiosOutputPresetButton1.GetUIntValue(e.Data) == 1) { // Radio is on A _vhf1CockpitPresetActiveButton = 1; } if (tmp != _vhf1CockpitPresetActiveButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // VHF B if (e.Address == _vhf1DcsbiosOutputPresetButton2.Address) { lock (_lockVhf1DialObject1) { var tmp = _vhf1CockpitPresetActiveButton; if (_vhf1DcsbiosOutputPresetButton2.GetUIntValue(e.Data) == 1) { // Radio is on A _vhf1CockpitPresetActiveButton = 2; } if (tmp != _vhf1CockpitPresetActiveButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // VHF C if (e.Address == _vhf1DcsbiosOutputPresetButton3.Address) { lock (_lockVhf1DialObject1) { var tmp = _vhf1CockpitPresetActiveButton; if (_vhf1DcsbiosOutputPresetButton3.GetUIntValue(e.Data) == 1) { // Radio is on A _vhf1CockpitPresetActiveButton = 3; } if (tmp != _vhf1CockpitPresetActiveButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // VHF D if (e.Address == _vhf1DcsbiosOutputPresetButton4.Address) { lock (_lockVhf1DialObject1) { var tmp = _vhf1CockpitPresetActiveButton; if (_vhf1DcsbiosOutputPresetButton4.GetUIntValue(e.Data) == 1) { // Radio is on A _vhf1CockpitPresetActiveButton = 4; } if (tmp != _vhf1CockpitPresetActiveButton) { Interlocked.Increment(ref _doUpdatePanelLCD); } } } // Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); } catch (Exception ex) { logger.Error(ex); } }
public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e) { if (_dcsbiosOutput1?.Address == e.Address) { Debug.WriteLine(_dcsbiosOutput1.GetUIntValue(e.Data)); if (!Equals(_value1, _dcsbiosOutput1.GetUIntValue(e.Data))) { _value1 = _dcsbiosOutput1.GetUIntValue(e.Data); _dataChanged = true; Dispatcher?.BeginInvoke( (Action) delegate { LabelSourceRawValue1.Content = "Value : " + _value1; }); } } if (_dcsbiosOutput2?.Address == e.Address) { if (!Equals(_value2, _dcsbiosOutput2.GetUIntValue(e.Data))) { _value2 = _dcsbiosOutput2.GetUIntValue(e.Data); _dataChanged = true; Dispatcher?.BeginInvoke( (Action) delegate { LabelSourceRawValue2.Content = "Value : " + _value2; }); } } if (_dcsbiosOutput3?.Address == e.Address) { if (!Equals(_value3, _dcsbiosOutput3.GetUIntValue(e.Data))) { _value3 = _dcsbiosOutput3.GetUIntValue(e.Data); _dataChanged = true; Dispatcher?.BeginInvoke( (Action) delegate { LabelSourceRawValue3.Content = "Value : " + _value3; }); } } if (_dcsbiosOutput4?.Address == e.Address) { if (!Equals(_value4, _dcsbiosOutput4.GetUIntValue(e.Data))) { _value4 = _dcsbiosOutput4.GetUIntValue(e.Data); _dataChanged = true; Dispatcher?.BeginInvoke( (Action) delegate { LabelSourceRawValue4.Content = "Value : " + _value4; }); } } if (_dcsbiosOutput5?.Address == e.Address) { if (!Equals(_value5, _dcsbiosOutput5.GetUIntValue(e.Data))) { _value5 = _dcsbiosOutput5.GetUIntValue(e.Data); _dataChanged = true; Dispatcher?.BeginInvoke( (Action) delegate { LabelSourceRawValue5.Content = "Value : " + _value5; }); } } }
public override void DcsBiosDataReceived(uint address, uint data) { //Common.DebugP("PZ69 MiG21 READ ENTERING"); UpdateCounter(address, data); /* * IMPORTANT INFORMATION REGARDING THE _*WaitingForFeedback variables * Once a dial has been deemed to be "off" position and needs to be changed * a change command is sent to DCS-BIOS. * Only after a *change* has been acknowledged will the _*WaitingForFeedback be * reset. Reading the dial's position with no change in value will not reset. */ //Radio if (address == _radioDcsbiosOutputFreqSelectorPosition.Address) { //Common.DebugP("Radio freq pos arrived, waiting for lock." + Environment.TickCount); lock (_lockRadioFreqSelectorPositionObject) { //Common.DebugP("Just read Radio freq. sel. pos.: " + _radioFreqSelectorPositionActive + " " + Environment.TickCount); _radioFreqSelectorPositionActive = _radioDcsbiosOutputFreqSelectorPosition.GetUIntValue(data); } } //RSBN Nav if (address == _rsbnNavChannelActiveOutput.Address) { //Common.DebugP("RSBN Nav channel arrived, waiting for lock." + Environment.TickCount); lock (_lockRSBNNavChannelObject) { //Common.DebugP("Just read RSBN Nav channel : " + _rsbnNavChannelActive + " " + Environment.TickCount); _rsbnNavChannelActive = _rsbnNavChannelActiveOutput.GetUIntValue(data); } } //RSBN ILS if (address == _rsbnILSChannelActiveOutput.Address) { //Common.DebugP("RSBN ILS channel arrived, waiting for lock." + Environment.TickCount); lock (_lockRSBNILSChannelObject) { //Common.DebugP("Just read RSBN Nav channel : " + _rsbnILSChannelActive + " " + Environment.TickCount); _rsbnILSChannelActive = _rsbnILSChannelActiveOutput.GetUIntValue(data); } } //ARC Sector if (address == _arcSectorActiveOutput.Address) { //Common.DebugP("ARC Sector arrived, waiting for lock." + Environment.TickCount); lock (_lockARCSectorObject) { //Common.DebugP("Just read ARC Sector : " + _arcSectorActive + " " + Environment.TickCount); _arcSectorActive = _arcSectorActiveOutput.GetUIntValue(data); } } //ARC Preset if (address == _arcPresetChannelActiveOutput.Address) { //Common.DebugP("ARC Preset Channel, waiting for lock." + Environment.TickCount); lock (_lockARCPresetChannelObject) { //Common.DebugP("Just read ARC Preset Channel : " + _arcPresetChannelActive + " " + Environment.TickCount); _arcPresetChannelActive = _arcPresetChannelActiveOutput.GetUIntValue(data) + 1; } } //Set once DataHasBeenReceivedFromDCSBIOS = true; ShowFrequenciesOnPanel(); //Common.DebugP("PZ69 MiG21 READ EXITING"); }