TransmitAsync() public méthode

Transmits an IR code asynchronously.
public TransmitAsync ( string irCode, object userState = null, Emitter emitter = null, CodeFormat codeFormat = null, int repeatCount = null, int inactivityWaitTime = null ) : Task
irCode string The IR code to transmit.
userState object An optional user state object that will be passed to the /// TransmitCompleted event.
emitter Emitter The emitter to transmit the IR code with
codeFormat CodeFormat The format of the IR code.
repeatCount int Indicates how many iterations of the code should be /// sent (in the case of a 2-piece code, the first stream is sent once followed /// by the second stream sent repeatCount times).
inactivityWaitTime int Time in milliseconds since the last received /// IR activity to wait before sending an IR code. Normally, pass 0 for this parameter.
Résultat Task
        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()));
            }
        }
    public UsbUirtProcessor(IList<IrCommandEvent> commands)
    {
      _driver = new Driver();
      Log.Debug(string.Format("Usbuirt found version {0}", Driver.GetVersion(_driver)));
      _receiver = new Receiver(_driver);
      _receiver.GenerateLegacyCodes = false;
      _receiver.Received += OnIrReceive;
      _transmitter = new Transmitter(_driver);
      _learner = new Learner(_driver);

      _commands = commands;
      _learnCommand = null;

      //Event from ep source
      OnSourceEvent = (@event, sender) =>
      {
        if (@event.Channel != Channel && !string.IsNullOrEmpty(@event.Channel)) return;

        switch (@event.Name)
        {
          case "ir-transmit":
            var ir = System.Text.Encoding.Default.GetString(@event.Data);
            _transmitter.TransmitAsync(ir);
            break;
          case "ir-learn":
            _learnCommand = @event as IrCommandEvent;
            _learner.LearnAsync(CodeFormat.Uuirt, LearnCodeModifier.Default, null);
            break;
        }
      };

      //Error from ep source
      OnSourceError = (exception, sender) =>
      {
        Log.Error("Error from source endpoint", exception);
      };

      //Close connection with ep source
      OnSourceClose = (sender) =>
      {
        //Close HBus endpoint
        Stop();

        Log.Debug("closed on source close");
      };

    }