private Task StartBitmapWriterTask() { return(Task.Factory.StartNew(() => { while (true) { KeyValuePair <int, byte[]> res; try { res = imageQueue.Take(); } catch (InvalidOperationException) { break; } foreach (var report in OutputReportSplitter.Split(res.Value, Buffer, HardwareInfo.ReportSize, HardwareInfo.HeaderSize, res.Key, HardwareInfo.PrepareDataForTransmittion)) { DeckHid.WriteReport(report); } } }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default )); }
public string GetSerialNumber() { if (!DeckHid.ReadFeatureData(HardwareInfo.SerialNumberFeatureId, out var featureData)) { return(null); } return(Encoding.UTF8.GetString(featureData, HardwareInfo.SerialNumberReportSkip, featureData.Length - HardwareInfo.SerialNumberReportSkip).Trim('\0')); }
public string GetFirmwareVersion() { if (!DeckHid.ReadFeatureData(HardwareInfo.FirmwareVersionFeatureId, out var featureData)) { return(null); } return(Encoding.UTF8.GetString(featureData, HardwareInfo.FirmwareReportSkip, featureData.Length - HardwareInfo.FirmwareReportSkip).Trim('\0')); }
public virtual void SetKeyBitmap(int keyId, KeyBitmap bitmapData) { keyId = HardwareInfo.ExtKeyIdToHardwareKeyId(keyId); var payload = HardwareInfo.GeneratePayload(bitmapData); foreach (var report in OutputReportSplitter.Split(payload, Buffer, HardwareInfo.ReportSize, HardwareInfo.HeaderSize, keyId, HardwareInfo.PrepareDataForTransmittion)) { DeckHid.WriteReport(report); } }
public void Dispose() { lock (disposeLock) { if (IsDisposed) { return; } IsDisposed = true; } Shutdown(); ShowLogoWithoutDisposeVerification(); DeckHid.Dispose(); Dispose(true); }
public void SetBrightness(byte percent) { VerifyNotDisposed(); DeckHid.WriteFeature(HardwareInfo.GetBrightnessMessage(percent)); }
private void ShowLogoWithoutDisposeVerification() { DeckHid.WriteFeature(HardwareInfo.GetLogoMessage()); }