コード例 #1
0
        private RaspberryIRDotNet.IRPulseMessage LearnButton()
        {
            var ir = new RaspberryIRDotNet.RX.IRMessageLearn()
            {
                CaptureDevice           = IRRXUtilities.RxDevicePath.Value,
                LeadInPattern           = RaspberryIRDotNet.PulseSpaceUnitList.LoadFromString(RemoteConfig.LeadIn),
                MessageMinimumUnitCount = RemoteConfig.MinimumUnitCount,
                MessageMaximumUnitCount = RemoteConfig.MaximumUnitCount,
                UnitDurationMicrosecs   = RemoteConfig.UnitDuration,
            };

            IRRXUtilities.SetUpRxFeedback(ir);
            IRRXUtilities.WriteButtonPressInstructions("the button", false);

            return(ir.LearnMessage());
        }
コード例 #2
0
        private RaspberryIRDotNet.IRPulseMessage LearnKey(string keyName, RaspberryIRDotNet.IReadOnlyPulseSpaceDurationList leadInDurations, int unitDuration, int unitCount)
        {
            var recorder = new RaspberryIRDotNet.RX.IRMessageLearn()
            {
                CaptureDevice           = DemoConfig.GetRxDevice(),
                UnitDurationMicrosecs   = unitDuration,
                MessageMinimumUnitCount = unitCount,
                MessageMaximumUnitCount = unitCount
            };

            recorder.SetLeadInPatternAsMicrosecs(leadInDurations);

            SetUpRxFeedback(recorder);
            WriteKeyPressInstructions($"the '{keyName}' key", false);

            var result = recorder.LearnMessage();

            Console.WriteLine("Key captured.");
            Breather();
            return(result);
        }
コード例 #3
0
        private RaspberryIRDotNet.RX.IRMessageLearn NewIRMessageLearn(FileSystem.IFileSystem fileSystem)
        {
            var subject = new RaspberryIRDotNet.RX.IRMessageLearn()
            {
                CaptureDevice = LircPath,
                CaptureDelay  = TimeSpan.Zero,
                LeadInPattern = new PulseSpaceUnitList()
                {
                    5, 4
                },
                UnitDurationMicrosecs     = 100,
                MessageMinimumUnitCount   = 15,
                MessageMaximumUnitCount   = 15,
                MinimumMatchingCaptures   = 3,
                ErrorAfterBadCaptureCount = 5,
                ThrowOnUnknownPacket      = true
            };

            subject.SetFileSystem(fileSystem);
            return(subject);
        }