protected override ConnectedDeviceDefinition GetDeviceDefinition(string deviceId) { try { using (var safeFileHandle = HidService.CreateReadConnection(deviceId, FileAccessRights.None)) { if (safeFileHandle.IsInvalid) { throw new DeviceException($"{nameof(HidService.CreateReadConnection)} call with Id of {deviceId} failed."); } Logger?.Log($"Found device {deviceId}", nameof(WindowsHidDeviceFactory), null, LogLevel.Information); return(HidService.GetDeviceDefinition(deviceId, safeFileHandle)); } } catch (Exception ex) { Logger?.Log($"{nameof(GetDeviceDefinition)} error. Device Id: {deviceId}", nameof(WindowsHidDeviceFactory), ex, LogLevel.Error); return(null); } }
protected override Guid GetClassGuid() { return(HidService.GetHidGuid()); }