Learn() public méthode

Learns an IR code synchronously.
public Learn ( CodeFormat codeFormat = null, LearnCodeModifier learnCodeFormat = null, uint forcedFrequency = null, System.TimeSpan timeout = null ) : string
codeFormat CodeFormat The format of the IR code to use in learning.
learnCodeFormat LearnCodeModifier The modifier used for the code format.
forcedFrequency uint The frequency to use in learning.
timeout System.TimeSpan The timeout after which to abort learning if it has not completed.
Résultat string
        private static void LearnAndTransmitACode()
        {
            using (var driver = new Driver())
            {
                Console.WriteLine(Driver.GetVersion(driver).ToString());

                Console.WriteLine("Receiving...");
                var receiver = new Receiver(driver);
                receiver.GenerateLegacyCodes = false;
                receiver.Received += OnReceive;

                var learner = new Learner(driver);
                learner.Learning += OnLearning;
                Console.WriteLine("Learning...");
                var result = learner.Learn();
                Console.WriteLine("Learned code: " + result);

                Console.WriteLine("Hit enter to Transmit");
                Console.ReadLine();
                var transmitter = new Transmitter(driver);
                transmitter.TransmitCompleted += OnTransmitComplete;
                transmitter.TransmitAsync(result, emitter: Emitter.Internal)
                    .ContinueWith(t => Console.WriteLine(t.Exception == null
                                        ? "Transmit Complete - from task"
                                        : t.Exception.ToString()));
            }
        }
Exemple #2
0
 public void Learn(CodeFormat?codeFormat             = null,
                   LearnCodeModifier?learnCodeFormat = null,
                   uint?forcedFrequency = null,
                   TimeSpan?timeout     = null)
 {
     _waitHandle.WaitOne();
     _learner.Learn(codeFormat, learnCodeFormat, forcedFrequency, timeout);
 }