Added logitech support (unfinished: HID-Ids and layouts are missing)

This commit is contained in:
DarthAffe committed 2017-02-04 17:09:00 +01:00
1 parent 5bd1012fbe
commit 2af55146cc
22 files changed
+1310

No files matched your search

@@ -0,0 +1,57 @@
using System.Collections.Generic;
using HidSharp;
namespace RGB.NET.Devices.Logitech.HID
{
//TODO DarthAffe 04.02.2017: Rewrite this once the SDK supports per-device lighting to get all the devices connected.
internal static class DeviceChecker
{
#region Constants
//TODO DarthAffe 04.02.2017: Add IDs
private const int VENDOR_ID = 0x0;
private const int G910_ID = 0x0;
private const int G810_ID = 0x0;
#endregion
#region Properties & Fields
public static string ConnectedDeviceModel
{
get
{
if (IsG910Connected) return "G910";
if (IsG810Connected) return "G810";
return null;
}
}
public static bool IsDeviceConnected => IsG910Connected || IsG810Connected;
public static bool IsG910Connected { get; private set; }
public static bool IsG810Connected { get; private set; }
#endregion
#region Methods
internal static void LoadDeviceList()
{
IsG910Connected = false;
IsG810Connected = false;
HidDeviceLoader loader = new HidDeviceLoader();
IEnumerable<HidDevice> devices = loader.GetDevices();
foreach (HidDevice hidDevice in devices)
if (hidDevice.VendorID == VENDOR_ID)
{
if (hidDevice.ProductID == G910_ID)
IsG910Connected = true;
else if (hidDevice.ProductID == G810_ID)
IsG810Connected = true;
}
}
#endregion
}
}