/// <summary> /// searchForNew is used when panel has been detached => attached but not found again because there is no hook (new HID instance ID). /// So already found panels should be left as is. /// </summary> /// <param name="loadStreamDeck"></param> /// <param name="searchForNew"></param> public void Startup(bool loadStreamDeck) { try { foreach (var gamingPanelSkeleton in Common.GamingPanelSkeletons) { foreach (var hidDevice in HidDevices.Enumerate(gamingPanelSkeleton.VendorId, gamingPanelSkeleton.ProductId)) { if (hidDevice != null) { if (!loadStreamDeck && gamingPanelSkeleton.VendorId == (int)GamingPanelVendorEnum.Elgato) { continue; } var hidIinstance = hidDevice.DevicePath; if (!HIDDeviceAlreadyExists(hidIinstance)) { var hidSkeleton = new HIDSkeleton(gamingPanelSkeleton, hidIinstance); HIDSkeletons.Add(hidSkeleton); hidDevice.MonitorDeviceEvents = true; hidDevice.Inserted += hidSkeleton.HIDDeviceOnInserted; hidDevice.Removed += hidSkeleton.HIDDeviceOnRemoved; //Only Saitek needs this hid library, Stream Deck uses an other. But Stream Deck is added in order to have references. if (hidSkeleton.PanelInfo.VendorId == (int)GamingPanelVendorEnum.Saitek || hidSkeleton.PanelInfo.VendorId == (int)GamingPanelVendorEnum.MadCatz) { hidSkeleton.HIDReadDevice = hidDevice; hidSkeleton.HIDReadDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); hidSkeleton.HIDReadDevice.MonitorDeviceEvents = true; hidSkeleton.HIDWriteDevice = hidDevice; hidSkeleton.HIDWriteDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); hidSkeleton.HIDWriteDevice.MonitorDeviceEvents = true; } } } } } /*foreach (var hidSkeleton in HIDSkeletons) * { * if (hidSkeleton.IsAttached) * { * Debug.WriteLine(hidSkeleton.GamingPanelType + " " + hidSkeleton.HIDInstance); * } * }*/ Debug.WriteLine("*** HIDSkeleton count is " + HIDSkeletons.Count); //Broadcast that this panel was found. HIDSkeletons.FindAll(o => o.IsAttached).ToList().ForEach(o => AppEventHandler.PanelEvent(this, o.HIDInstance, o, PanelEventType.Found)); //Broadcast that panel search is over and all panels have been found that exists. AppEventHandler.PanelEvent(this, null, null, PanelEventType.AllPanelsFound); } catch (Exception ex) { Common.ShowErrorMessageBox(ex); } }
public RadioPanelPZ69P51D(HIDSkeleton hidSkeleton) : base(hidSkeleton) { VendorId = 0x6A3; ProductId = 0xD05; CreateRadioKnobs(); Startup(); }
public RadioPanelPZ69EmulatorFull(HIDSkeleton hidSkeleton) : base(hidSkeleton) { VendorId = 0x6A3; ProductId = 0xD05; CreateSwitchKeys(); Startup(); }
public static void SetNotInUse(HIDSkeleton hidSkeleton) { lock (_genericBindingsLock) { _genericBindings.FindAll(o => o.Match(hidSkeleton)).ToList().ForEach(u => u.InUse = false); } }
public void Startup() { try { Common.DebugP("Entering HIDHandler.Startup()"); foreach (var gamingPanelSkeleton in Common.GamingPanelSkeletons) { foreach (var hidDevice in HidDevices.Enumerate(gamingPanelSkeleton.VendorId, gamingPanelSkeleton.ProductId)) { if (hidDevice != null) { var instanceId = hidDevice.DevicePath; if (!HIDDeviceAlreadyExists(instanceId)) { var hidSkeleton = new HIDSkeleton(gamingPanelSkeleton, instanceId); _hidSkeletons.Add(hidSkeleton); } } } } foreach (var hidSkeleton in _hidSkeletons) { if (hidSkeleton.PanelInfo.VendorId == (int)GamingPanelVendorEnum.Saitek) { //Creating read devices foreach (var hidDevice in HidDevices.Enumerate(hidSkeleton.InstanceId)) { if (hidDevice != null) { hidSkeleton.HIDReadDevice = hidDevice; hidSkeleton.HIDReadDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); //hidSkeleton.HIDReadDevice.Inserted += DeviceAttachedHandler; //hidSkeleton.HIDReadDevice.Removed += DeviceRemovedHandler; hidSkeleton.HIDReadDevice.MonitorDeviceEvents = true; Common.DebugP(hidSkeleton.PanelInfo.GamingPanelType + " [Saitek]HIDReadDevice has entered the building..."); } } //Creating write devices foreach (var hidDevice in HidDevices.Enumerate(hidSkeleton.InstanceId)) { if (hidDevice != null) { hidSkeleton.HIDWriteDevice = hidDevice; hidSkeleton.HIDWriteDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); //hidSkeleton.HIDWriteDevice.Inserted += DeviceAttachedHandler; //hidSkeleton.HIDWriteDevice.Removed += DeviceRemovedHandler; hidSkeleton.HIDWriteDevice.MonitorDeviceEvents = true; Common.DebugP(hidSkeleton.PanelInfo.GamingPanelType + " [Saitek]HIDWriteDevice has entered the building..."); } } } } } catch (Exception ex) { Common.ShowErrorMessageBox(1073, ex); } }
/* * 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 * */ public BacklitPanelBIP(int ledBrightness, HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.BackLitPanel, hidSkeleton) { VendorId = 0x6A3; ProductId = 0xB4E; _ledBrightness = ledBrightness; Startup(); }
public TPMPanel(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.TPM, hidSkeleton) { //Fixed values VendorId = 0x6A3; ProductId = 0xB4D; CreateSwitchKeys(); Startup(); }
public MultiPanelPZ70(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.PZ70MultiPanel, hidSkeleton) { VendorId = 0x6A3; ProductId = 0xD06; CreateMultiKnobs(); Startup(); }
public SwitchPanelPZ55(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.PZ55SwitchPanel, hidSkeleton) { //Fixed values VendorId = 0x6A3; ProductId = 0xD67; CreateSwitchKeys(); //SwitchPanelPZ55SO = this; Startup(); }
public RadioPanelPZ69SRS(int portFrom, string ipAddressTo, int portTo, HIDSkeleton hidSkeleton) : base(hidSkeleton) { SRSListenerFactory.SetParams(portFrom, ipAddressTo, portTo); SRSListenerFactory.GetSRSListener().Attach(this); VendorId = 0x6A3; ProductId = 0xD05; CreateRadioKnobs(); Startup(); }
protected GamingPanel(GamingPanelEnum typeOfGamingPanel, HIDSkeleton hidSkeleton) { _typeOfGamingPanel = typeOfGamingPanel; HIDSkeletonBase = hidSkeleton; if (Common.IsOperationModeFlagSet(OperationFlag.DCSBIOSOutputEnabled)) { _updateCounterDCSBIOSOutput = DCSBIOSOutput.GetUpdateCounter(); } _hash = Common.GetMd5Hash(hidSkeleton.InstanceId); }
/* * 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 * */ public BacklitPanelBIP(int ledBrightness, HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.BackLitPanel, hidSkeleton) { if (hidSkeleton.PanelType != SaitekPanelsEnum.BackLitPanel) { throw new ArgumentException(); } VendorId = 0x6A3; ProductId = 0xB4E; _ledBrightness = ledBrightness; BipFactory.RegisterBip(this); Startup(); }
public TPMPanel(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.TPM, hidSkeleton) { if (hidSkeleton.PanelType != SaitekPanelsEnum.TPM) { throw new ArgumentException(); } //Fixed values VendorId = 0x6A3; ProductId = 0xB4D; CreateSwitchKeys(); Startup(); }
public SwitchPanelPZ55(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.PZ55SwitchPanel, hidSkeleton) { if (hidSkeleton.PanelType != SaitekPanelsEnum.PZ55SwitchPanel) { throw new ArgumentException(); } //Fixed values VendorId = 0x6A3; ProductId = 0xD67; CreateSwitchKeys(); //SwitchPanelPZ55SO = this; Startup(); }
private long _syncOKDelayTimeout = 50000000; //5s public RadioPanelPZ69Base(HIDSkeleton hidSkeleton) : base(SaitekPanelsEnum.PZ69RadioPanel, hidSkeleton) { VendorId = 0x6A3; ProductId = 0xD05; NumberFormatInfoFullDisplay = new NumberFormatInfo(); NumberFormatInfoFullDisplay.NumberDecimalSeparator = "."; NumberFormatInfoFullDisplay.NumberDecimalDigits = 4; NumberFormatInfoFullDisplay.NumberGroupSeparator = ""; NumberFormatInfoEmpty = new NumberFormatInfo(); NumberFormatInfoEmpty.NumberDecimalSeparator = "."; NumberFormatInfoEmpty.NumberGroupSeparator = ""; }
public static void SendBinding(HIDSkeleton hidSkeleton) { lock (_genericBindingsLock) { foreach (var genericPanelBinding in _genericBindings) { if (genericPanelBinding.Match(hidSkeleton)) { genericPanelBinding.InUse = true; AppEventHandler.ProfileEvent(null, ProfileEventEnum.ProfileSettings, genericPanelBinding, DCSFPProfile.SelectedProfile); } } } }
protected GamingPanel(GamingPanelEnum typeOfGamingPanel, HIDSkeleton hidSkeleton) { _typeOfGamingPanel = typeOfGamingPanel; HIDSkeletonBase = hidSkeleton; if (Common.IsOperationModeFlagSet(EmulationMode.DCSBIOSOutputEnabled)) { _updateCounterDCSBIOSOutput = DCSBIOSOutput.GetUpdateCounter(); } GamingPanels.Add(this); if (hidSkeleton.HIDReadDevice != null) { hidSkeleton.HIDReadDevice.Inserted += DeviceInsertedHandler; } }
public void Startup(bool loadStreamDeck) { try { foreach (var gamingPanelSkeleton in Common.GamingPanelSkeletons) { foreach (var hidDevice in HidDevices.Enumerate(gamingPanelSkeleton.VendorId, gamingPanelSkeleton.ProductId)) { if (hidDevice != null) { if (!loadStreamDeck && gamingPanelSkeleton.VendorId == (int)GamingPanelVendorEnum.Elgato) { continue; } var instanceId = hidDevice.DevicePath; if (!HIDDeviceAlreadyExists(instanceId)) { var hidSkeleton = new HIDSkeleton(gamingPanelSkeleton, instanceId); HIDSkeletons.Add(hidSkeleton); if (hidSkeleton.PanelInfo.VendorId == (int)GamingPanelVendorEnum.Saitek) { hidSkeleton.HIDReadDevice = hidDevice; hidSkeleton.HIDReadDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); //hidSkeleton.HIDReadDevice.Inserted += DeviceAttachedHandler; //hidSkeleton.HIDReadDevice.Removed += DeviceRemovedHandler; hidSkeleton.HIDReadDevice.MonitorDeviceEvents = true; hidSkeleton.HIDWriteDevice = hidDevice; hidSkeleton.HIDWriteDevice.OpenDevice(DeviceMode.NonOverlapped, DeviceMode.NonOverlapped, ShareMode.ShareRead | ShareMode.ShareWrite); //hidSkeleton.HIDWriteDevice.Inserted += DeviceAttachedHandler; //hidSkeleton.HIDWriteDevice.Removed += DeviceRemovedHandler; hidSkeleton.HIDWriteDevice.MonitorDeviceEvents = true; } } } } } } catch (Exception ex) { Common.ShowErrorMessageBox(ex); } }
protected SaitekPanel(SaitekPanelsEnum typeOfSaitekPanel, HIDSkeleton hidSkeleton) { _typeOfSaitekPanel = typeOfSaitekPanel; HIDSkeletonBase = hidSkeleton; _updateCounterDCSBIOSOutput = DCSBIOSOutput.GetUpdateCounter(); }