Esempio n. 1
0
        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
                                         ));
        }
Esempio n. 2
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);
            }
        }