public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
        {
            try
            {
                if (_dcsbiosOutputFormula == null || _closing)
                {
                    return;
                }

                lock (_formulaLockObject)
                {
                    if (_dcsbiosOutputFormula.CheckForMatch(e.Address, e.Data))
                    {
                        try
                        {
                            Dispatcher?.BeginInvoke((Action)(() =>
                                                             LabelResult.Content = "Result : " + _dcsbiosOutputFormula.Evaluate(true)));
                        }
                        catch (Exception ex)
                        {
                            Dispatcher?.BeginInvoke((Action)(() => TextBlockFormulaErrors.Text = ex.Message));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "DcsBiosDataReceived()");
            }
        }
Example #2
0
 public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     lock (_dcsBiosDataReceivedLock)
     {
         UpdateCounter(e.Address, e.Data);
     }
 }
Example #3
0
 public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     if (SettingsLoading)
     {
         return;
     }
     UpdateCounter(e.Address, e.Data);
 }
Example #4
0
        public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
        {
            UpdateCounter(e.Address, e.Data);
            CheckDcsDataForColorChangeHook(e.Address, e.Data);

            if (_dcsbiosBrightnessControl != null && e.Address == _dcsbiosBrightnessControl.Address)
            {
                _ledBrightness = (uint)(((double)100 / 0xFFFF) * e.Data);
                SetLedStrength();
            }
        }
Example #5
0
        public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
        {
            try
            {
                if (_dcsbiosDecoder.FormulaInstance == null || _closing)
                {
                    return;
                }

                _dcsbiosDecoder.FormulaInstance.CheckForMatchAndNewValue(e.Address, e.Data, 20);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "DcsBiosDataReceived()");
            }
        }
        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.
             */

            //Set once
            DataHasBeenReceivedFromDCSBIOS = true;
            ShowFrequenciesOnPanel();
        }
 public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     if (_dcsbiosOutput?.Address == e.Address)
     {
         if (!Equals(DCSBiosValue, e.Data))
         {
             DCSBiosValue = e.Data;
             ButtonText   = e.Data.ToString(CultureInfo.InvariantCulture);
             try
             {
                 if (!string.IsNullOrEmpty(_formula))
                 {
                     _formulaResult = EvaluateFormula();
                     ButtonText     = _formulaResult.ToString(CultureInfo.InvariantCulture); //In case string converter not used
                 }
                 if (_dcsbiosNumberToTexts.Count > 0)
                 {
                     foreach (var dcsbiosNumberToText in _dcsbiosNumberToTexts)
                     {
                         var tmp = dcsbiosNumberToText.ConvertNumber((string.IsNullOrEmpty(_formula) == false ? _formulaResult : DCSBiosValue), out var resultFound);
                         if (resultFound)
                         {
                             ButtonText = tmp;
                             break;
                         }
                     }
                 }
                 if (IsVisible)
                 {
                     Show();
                 }
                 _lastFormulaError = "";
             }
             catch (Exception exception)
             {
                 _lastFormulaError = exception.Message;
             }
             _valueUpdated = true;
         }
     }
 }
Example #8
0
 public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     if (SettingsLoading)
     {
         return;
     }
     UpdateCounter(e.Address, e.Data);
     foreach (var dcsbiosBindingLCDPZ70 in _dcsBiosLcdBindings)
     {
         if (!dcsbiosBindingLCDPZ70.UseFormula && dcsbiosBindingLCDPZ70.DialPosition == _pz70DialPosition && e.Address == dcsbiosBindingLCDPZ70.DCSBIOSOutputObject.Address)
         {
             lock (_lcdDataVariablesLockObject)
             {
                 var tmp = dcsbiosBindingLCDPZ70.CurrentValue;
                 dcsbiosBindingLCDPZ70.CurrentValue = (int)dcsbiosBindingLCDPZ70.DCSBIOSOutputObject.GetUIntValue(e.Data);
                 if (tmp != dcsbiosBindingLCDPZ70.CurrentValue)
                 {
                     Interlocked.Add(ref _doUpdatePanelLCD, 1);
                 }
             }
         }
         else if (dcsbiosBindingLCDPZ70.DialPosition == _pz70DialPosition && dcsbiosBindingLCDPZ70.UseFormula)
         {
             if (dcsbiosBindingLCDPZ70.DCSBIOSOutputFormulaObject.CheckForMatch(e.Address, e.Data))
             {
                 lock (_lcdDataVariablesLockObject)
                 {
                     var tmp = dcsbiosBindingLCDPZ70.CurrentValue;
                     dcsbiosBindingLCDPZ70.CurrentValue = dcsbiosBindingLCDPZ70.DCSBIOSOutputFormulaObject.Evaluate();
                     if (tmp != dcsbiosBindingLCDPZ70.CurrentValue)
                     {
                         Interlocked.Add(ref _doUpdatePanelLCD, 1);
                     }
                 }
             }
         }
     }
     UpdateLCD();
 }
        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()");
            }
        }
Example #10
0
 public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     UpdateCounter(e.Address, e.Data);
     foreach (var dcsbiosBindingLCD in _dcsBiosLcdBindings)
     {
         if (!dcsbiosBindingLCD.UseFormula && e.Address == dcsbiosBindingLCD.DCSBIOSOutputObject.Address)
         {
             lock (_lcdDataVariablesLockObject)
             {
                 var tmp = dcsbiosBindingLCD.CurrentValue;
                 dcsbiosBindingLCD.CurrentValue = (int)dcsbiosBindingLCD.DCSBIOSOutputObject.GetUIntValue(e.Data);
                 if (tmp != dcsbiosBindingLCD.CurrentValue && (dcsbiosBindingLCD.DialPosition == _pz69UpperDialPosition || dcsbiosBindingLCD.DialPosition == _pz69LowerDialPosition))
                 {
                     //Update only if this LCD binding is in current use
                     Interlocked.Add(ref _doUpdatePanelLCD, 1);
                 }
             }
         }
         else if (dcsbiosBindingLCD.UseFormula)
         {
             if (dcsbiosBindingLCD.DCSBIOSOutputFormulaObject.CheckForMatch(e.Address, e.Data))
             {
                 lock (_lcdDataVariablesLockObject)
                 {
                     var tmp = dcsbiosBindingLCD.CurrentValue;
                     dcsbiosBindingLCD.CurrentValue = dcsbiosBindingLCD.DCSBIOSOutputFormulaObject.Evaluate();
                     if (tmp != dcsbiosBindingLCD.CurrentValue && (dcsbiosBindingLCD.DialPosition == _pz69UpperDialPosition || dcsbiosBindingLCD.DialPosition == _pz69LowerDialPosition))
                     {
                         //Update only if this LCD binding is in current use
                         Interlocked.Add(ref _doUpdatePanelLCD, 1);
                     }
                 }
             }
         }
     }
     ShowFrequenciesOnPanel();
 }
Example #11
0
 public override void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     UpdateCounter(e.Address, e.Data);
     CheckDcsDataForColorChangeHook(e.Address, e.Data);
 }
 public void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e)
 {
     if (_dcsbiosOutput1?.Address == e.Address)
     {
         if (!Equals(_value1, e.Data))
         {
             _value1      = e.Data;
             _dataChanged = true;
             Dispatcher?.BeginInvoke(
                 (Action) delegate
             {
                 LabelSourceRawValue1.Content = "Value : " + _value1;
             });
         }
     }
     if (_dcsbiosOutput2?.Address == e.Address)
     {
         if (!Equals(_value2, e.Data))
         {
             _value2      = e.Data;
             _dataChanged = true;
             Dispatcher?.BeginInvoke(
                 (Action) delegate
             {
                 LabelSourceRawValue2.Content = "Value : " + _value2;
             });
         }
     }
     if (_dcsbiosOutput3?.Address == e.Address)
     {
         if (!Equals(_value3, e.Data))
         {
             _value3      = e.Data;
             _dataChanged = true;
             Dispatcher?.BeginInvoke(
                 (Action) delegate
             {
                 LabelSourceRawValue3.Content = "Value : " + _value3;
             });
         }
     }
     if (_dcsbiosOutput4?.Address == e.Address)
     {
         if (!Equals(_value4, e.Data))
         {
             _value4      = e.Data;
             _dataChanged = true;
             Dispatcher?.BeginInvoke(
                 (Action) delegate
             {
                 LabelSourceRawValue4.Content = "Value : " + _value4;
             });
         }
     }
     if (_dcsbiosOutput5?.Address == e.Address)
     {
         if (!Equals(_value5, e.Data))
         {
             _value5      = e.Data;
             _dataChanged = true;
             Dispatcher?.BeginInvoke(
                 (Action) delegate
             {
                 LabelSourceRawValue5.Content = "Value : " + _value5;
             });
         }
     }
 }
 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;
             });
         }
     }
 }
Example #14
0
        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);
            }
        }
Example #15
0
        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 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();
        }
Example #17
0
        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);
            }
        }
Example #18
0
        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 abstract void DcsBiosDataReceived(object sender, DCSBIOSDataEventArgs e);