public void LedLightChanged(string uniqueId, SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor) { try { //todo } catch (Exception ex) { Common.ShowErrorMessageBox(2012, ex); } }
public override DcsOutputAndColorBinding CreateDcsOutputAndColorBinding(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor, DCSBIOSOutput dcsBiosOutput) { var dcsOutputAndColorBinding = new DcsOutputAndColorBindingPZ55 { DCSBiosOutputLED = dcsBiosOutput, LEDColor = panelLEDColor, SaitekLEDPosition = saitekPanelLEDPosition }; return(dcsOutputAndColorBinding); }
protected virtual void OnLedLightChanged(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor) { OnLedLightChangedA?.Invoke(this, new LedLightChangeEventArgs() { UniqueId = HIDInstanceId, LEDPosition = saitekPanelLEDPosition, LEDColor = panelLEDColor }); }
public override DcsOutputAndColorBinding CreateDcsOutputAndColorBinding(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor, DCSBIOSOutput dcsBiosOutput) { //todo var dcsOutputAndColorBinding = new DcsOutputAndColorBindingPZ55(); dcsOutputAndColorBinding.DCSBiosOutputLED = dcsBiosOutput; dcsOutputAndColorBinding.LEDColor = panelLEDColor; dcsOutputAndColorBinding.SaitekLEDPosition = saitekPanelLEDPosition; return(dcsOutputAndColorBinding); }
private SwitchPanelPZ55LEDs GetSwitchPanelPZ55LEDColor(SwitchPanelPZ55LEDPosition switchPanelPZ55LEDPosition, PanelLEDColor panelLEDColor) { var result = SwitchPanelPZ55LEDs.ALL_DARK; switch (switchPanelPZ55LEDPosition) { case SwitchPanelPZ55LEDPosition.UP: { switch (panelLEDColor) { case PanelLEDColor.DARK: { result = SwitchPanelPZ55LEDs.ALL_DARK; break; } case PanelLEDColor.GREEN: { result = SwitchPanelPZ55LEDs.UP_GREEN; break; } case PanelLEDColor.RED: { result = SwitchPanelPZ55LEDs.UP_RED; break; } case PanelLEDColor.YELLOW: { result = SwitchPanelPZ55LEDs.UP_YELLOW; break; } } break; } case SwitchPanelPZ55LEDPosition.LEFT: { switch (panelLEDColor) { case PanelLEDColor.DARK: { result = SwitchPanelPZ55LEDs.ALL_DARK; break; } case PanelLEDColor.GREEN: { result = SwitchPanelPZ55LEDs.LEFT_GREEN; break; } case PanelLEDColor.RED: { result = SwitchPanelPZ55LEDs.LEFT_RED; break; } case PanelLEDColor.YELLOW: { result = SwitchPanelPZ55LEDs.LEFT_YELLOW; break; } } break; } case SwitchPanelPZ55LEDPosition.RIGHT: { switch (panelLEDColor) { case PanelLEDColor.DARK: { result = SwitchPanelPZ55LEDs.ALL_DARK; break; } case PanelLEDColor.GREEN: { result = SwitchPanelPZ55LEDs.RIGHT_GREEN; break; } case PanelLEDColor.RED: { result = SwitchPanelPZ55LEDs.RIGHT_RED; break; } case PanelLEDColor.YELLOW: { result = SwitchPanelPZ55LEDs.RIGHT_YELLOW; break; } } break; } } return(result); }
public abstract DcsOutputAndColorBinding CreateDcsOutputAndColorBinding(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor, DCSBIOSOutput dcsBiosOutput);
public override DcsOutputAndColorBinding CreateDcsOutputAndColorBinding(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor, DCSBIOSOutput dcsBiosOutput) { return(null); }
public void SetLandingGearLED(SwitchPanelPZ55LEDPosition switchPanelPZ55LEDPosition, PanelLEDColor switchPanelPZ55LEDColor) { try { switch (switchPanelPZ55LEDPosition) { case SwitchPanelPZ55LEDPosition.UP: { _ledUpperColor = GetSwitchPanelPZ55LEDColor(switchPanelPZ55LEDPosition, switchPanelPZ55LEDColor); break; } case SwitchPanelPZ55LEDPosition.LEFT: { _ledLeftColor = GetSwitchPanelPZ55LEDColor(switchPanelPZ55LEDPosition, switchPanelPZ55LEDColor); break; } case SwitchPanelPZ55LEDPosition.RIGHT: { _ledRightColor = GetSwitchPanelPZ55LEDColor(switchPanelPZ55LEDPosition, switchPanelPZ55LEDColor); break; } } OnLedLightChanged(new SaitekPanelLEDPosition(switchPanelPZ55LEDPosition), switchPanelPZ55LEDColor); SetLandingGearLED(_ledUpperColor | _ledLeftColor | _ledRightColor); } catch (Exception e) { Common.DebugP("SetLandingGearLED() :\n" + e.Message + e.StackTrace); SetLastException(e); } }
//Used by descendants that wants to raise the event protected virtual void OnLedLightChanged(SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor) { if (OnLedLightChangedA != null) { OnLedLightChangedA(InstanceId, saitekPanelLEDPosition, panelLEDColor); } }
public void SetLED(BIPLedPositionEnum bipLedPositionEnum, PanelLEDColor panelLEDColor) { try { var row = GetRow(bipLedPositionEnum); var index = GetIndex(bipLedPositionEnum); byte[] array = { 0x0 }; byte mask = 0; switch (row) { case 1: { array = _upperRowBytes; break; } case 2: { array = _middleRowBytes; break; } case 3: { array = _lowerRowBytes; break; } } switch (index) { case 1: { mask = _1BIPMask; break; } case 2: { mask = _2BIPMask; break; } case 3: { mask = _3BIPMask; break; } case 4: { mask = _4BIPMask; break; } case 5: { mask = _5BIPMask; break; } case 6: { mask = _6BIPMask; break; } case 7: { mask = _7BIPMask; break; } case 8: { mask = _8BIPMask; break; } } switch (panelLEDColor) { case PanelLEDColor.DARK: { //Set all to 0 array[0] = (array[0] &= (byte)~mask); array[1] = (array[1] &= (byte)~mask); break; } case PanelLEDColor.GREEN: { //Set first byte's bit to 1 array[0] = array[0] |= mask; array[1] = (array[1] &= (byte)~mask); break; } case PanelLEDColor.YELLOW: { //Set both byte's bit to 1 array[0] = array[0] |= mask; array[1] = array[1] |= mask; break; } case PanelLEDColor.RED: { //Set second byte's bit to 1 array[0] = (array[0] &= (byte)~mask); array[1] = array[1] |= mask; break; } } /* * 01000000 2nd BIP from left GREEN * 00000000 * * 01000000 2nd BIP from left YELLOW * 01000000 * * 00000000 2nd BIP from left RED * 01000000 * * 00000000 2nd BIP from left DARK * 00000000 * */ //_upperRowBytes = { (byte)0x0, (byte)0x0 }; //byte 1 & 4 //_middleRowBytes = { (byte)0x0, (byte)0x0 };//byte 2 & 5 //_lowerRowBytes = { (byte)0x0, (byte)0x0 }; //byte 3 & 6 var finalArray = new byte[7]; finalArray[0] = 0xb8; finalArray[1] = _upperRowBytes[0]; finalArray[2] = _middleRowBytes[0]; finalArray[3] = _lowerRowBytes[0]; finalArray[4] = _upperRowBytes[1]; finalArray[5] = _middleRowBytes[1]; finalArray[6] = _lowerRowBytes[1]; if (Common.DebugOn && 1 == 2) { Common.DebugP("UPPER: " + Common.PrintBitStrings(_upperRowBytes)); Common.DebugP("MIDDLE: " + Common.PrintBitStrings(_middleRowBytes)); Common.DebugP("LOWER: " + Common.PrintBitStrings(_lowerRowBytes)); Common.DebugP(Common.PrintBitStrings(finalArray)); } SendLEDData(finalArray); } catch (Exception ex) { Common.ShowErrorMessageBox(1070, ex); } }
public void SetLED(BIPLedPositionEnum bipLedPositionEnum, PanelLEDColor panelLEDColor) { try { var row = GetRow(bipLedPositionEnum); var index = GetIndex(bipLedPositionEnum); byte[] array = { 0x0 }; byte mask = 0; switch (row) { case 1: { array = _upperRowBytes; break; } case 2: { array = _middleRowBytes; break; } case 3: { array = _lowerRowBytes; break; } } switch (index) { case 1: { mask = _1BIPMask; break; } case 2: { mask = _2BIPMask; break; } case 3: { mask = _3BIPMask; break; } case 4: { mask = _4BIPMask; break; } case 5: { mask = _5BIPMask; break; } case 6: { mask = _6BIPMask; break; } case 7: { mask = _7BIPMask; break; } case 8: { mask = _8BIPMask; break; } } switch (panelLEDColor) { case PanelLEDColor.DARK: { // Set all to 0 array[0] = (array[0] &= (byte)~mask); array[1] = (array[1] &= (byte)~mask); break; } case PanelLEDColor.GREEN: { // Set first byte's bit to 1 array[0] = array[0] |= mask; array[1] = (array[1] &= (byte)~mask); break; } case PanelLEDColor.YELLOW: { // Set both byte's bit to 1 array[0] = array[0] |= mask; array[1] = array[1] |= mask; break; } case PanelLEDColor.RED: { // Set second byte's bit to 1 array[0] = (array[0] &= (byte)~mask); array[1] = array[1] |= mask; break; } } /* * 01000000 2nd BIP from left GREEN * 00000000 * * 01000000 2nd BIP from left YELLOW * 01000000 * * 00000000 2nd BIP from left RED * 01000000 * * 00000000 2nd BIP from left DARK * 00000000 * */ // _upperRowBytes = { (byte)0x0, (byte)0x0 }; //byte 1 & 4 // _middleRowBytes = { (byte)0x0, (byte)0x0 };//byte 2 & 5 // _lowerRowBytes = { (byte)0x0, (byte)0x0 }; //byte 3 & 6 var finalArray = new byte[7]; finalArray[0] = 0xb8; finalArray[1] = _upperRowBytes[0]; finalArray[2] = _middleRowBytes[0]; finalArray[3] = _lowerRowBytes[0]; finalArray[4] = _upperRowBytes[1]; finalArray[5] = _middleRowBytes[1]; finalArray[6] = _lowerRowBytes[1]; SendLEDData(finalArray); AppEventHandler.LedLightChanged(this, HIDInstance, null, PanelLEDColor.DARK); } catch (Exception ex) { Common.ShowErrorMessageBox(ex); } }
private void SetPhysicalLED(Image image, PanelLEDColor newColor) { var position = GetLedPosition(image.Name); _backlitPanelBIP.SetLED(position, newColor); }
public override void ImportSettings(GenericPanelBinding genericPanelBinding) { ClearSettings(); BindingHash = genericPanelBinding.BindingHash; var settings = genericPanelBinding.Settings; foreach (var setting in settings) { if (!setting.StartsWith("#") && setting.Length > 2) { if (setting.StartsWith("SwitchPanelKey{")) { var keyBinding = new KeyBindingPZ55(); keyBinding.ImportSettings(setting); _keyBindings.Add(keyBinding); } else if (setting.StartsWith("SwitchPanelOSPZ55")) { var operatingSystemCommand = new OSCommandBindingPZ55(); operatingSystemCommand.ImportSettings(setting); _operatingSystemCommandBindings.Add(operatingSystemCommand); } else if (setting.StartsWith("SwitchPanelLed")) { var colorOutput = new DcsOutputAndColorBindingPZ55(); colorOutput.ImportSettings(setting); _listColorOutputBinding.Add(colorOutput); } else if (setting.StartsWith("SwitchPanelDCSBIOSControl{")) { var dcsBIOSBindingPZ55 = new DCSBIOSActionBindingPZ55(); dcsBIOSBindingPZ55.ImportSettings(setting); _dcsBiosBindings.Add(dcsBIOSBindingPZ55); } else if (setting.StartsWith("SwitchPanelBIPLink{")) { var bipLinkPZ55 = new BIPLinkPZ55(); bipLinkPZ55.ImportSettings(setting); _bipLinks.Add(bipLinkPZ55); } else if (setting.StartsWith("ManualLandingGearLEDs{")) { _manualLandingGearLeds = setting.Contains("True"); } else if (setting.StartsWith("ManualLandingGearLedsColorDown{")) { _manualLandingGearLedsColorDown = GetSettingPanelLEDColor(setting); } else if (setting.StartsWith("ManualLandingGearLedsColorUp{")) { _manualLandingGearLedsColorUp = GetSettingPanelLEDColor(setting); } else if (setting.StartsWith("ManualLandingGearLedsColorTrans{")) { _manualLandingGearLedsColorTrans = GetSettingPanelLEDColor(setting); } else if (setting.StartsWith("ManualLandingGearTransTimeSeconds{")) { _manualLandingGearTransTimeSeconds = Convert.ToInt16(GetValueFromSetting(setting)); } } } AppEventHandler.SettingsApplied(this, HIDSkeletonBase.HIDInstance, TypeOfPanel); _keyBindings = KeyBindingPZ55.SetNegators(_keyBindings); }
public static void LedLightChanged(object sender, string hidInstance, SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor) { OnLedLightChangedA?.Invoke(sender, new LedLightChangeEventArgs { HIDInstance = hidInstance, LEDPosition = saitekPanelLEDPosition, LEDColor = panelLEDColor }); }
public void LedLightChanged(string uniqueId, SaitekPanelLEDPosition saitekPanelLEDPosition, PanelLEDColor panelLEDColor) { try { if (!_loaded) { return; } Dispatcher.BeginInvoke((Action)(ShowGraphicConfiguration)); } catch (Exception ex) { Common.ShowErrorMessageBox(2033, ex); } }