private bool IsDeviceWithinBlink1mk2Range(HidDevice device) { byte[] serialBytes; var readSerial = device.ReadSerialNumber(out serialBytes); if (!readSerial) { return false; } return serialBytes[0] == 0x32; }
static uint GetSerialNumber(HidDevice device) { byte[] sn; device.ReadSerialNumber(out sn); string snString = System.Text.Encoding.Unicode.GetString(sn).TrimEnd("\0".ToArray()); return (Convert.ToUInt32(snString, 16) * 10); }
private static Tuple<string, DeviceType> IdentityDevice(HidDevice device) { byte[] output; device.ReadSerialNumber(out output); var chars = (from o in output where o != 0 select (char) o).ToArray(); var deviceType = DetermineDeviceType(output[0]); var serialNumber = string.Format("0x{0}", string.Join(string.Empty, chars)); return Tuple.Create(serialNumber, deviceType); }