Transmit() public method

Transmits an IR code synchronously using the default code format.
public Transmit ( string irCode ) : void
irCode string The IR code to transmit.
return void
コード例 #1
0
 public static void Test(string IRCode)
 {
     try
     {
         Controller mc = new Controller();
         mc.Transmit(IRCode, CodeFormat.Pronto, 10, TimeSpan.Zero);
         EventLog.WriteEntry("Carousel Monitor Control", "The monitor has been powered on.", EventLogEntryType.Information);
     }
     catch (Exception e)
     {
         EventLog.WriteEntry("Carousel Monitor Control", "Error powering monitor on, " + e.Message, EventLogEntryType.Error);
     }
 }
コード例 #2
0
ファイル: TestApp.cs プロジェクト: sjroesink/zVirtualScenes
        private static bool DoLoop(Controller mc)
        {
            string toDo = String.Empty;
            do
            {
                Console.WriteLine("\nUsbUirt Managed Wrapper Test Menu v0.5:");
                Console.WriteLine("---------------------------------------");
                Console.WriteLine("(1) Transmit IR Code (blocking)");
                Console.WriteLine("(2) Transmit IR Code (non-blocking)");
                Console.WriteLine("(3) Learn IR Code (Pronto Format)");
                Console.WriteLine("(4) Learn IR Code (UIRT-Raw Format)");
                Console.WriteLine("(5) Learn IR Code (UIRT-Struct Format)");
                Console.WriteLine("(6) Turn BlinkOnReceive {0}", mc.BlinkOnReceive ? "off" : "on");
                Console.WriteLine("(7) Turn BlinkOnTransmit {0}", mc.BlinkOnTransmit ? "off" : "on");
                Console.WriteLine("(8) Turn GenerateLegacyCodesOnReceive {0}", mc.GenerateLegacyCodesOnReceive ? "off" : "on");
                Console.WriteLine("(x) Exit");
                Console.WriteLine("---------------------------------------");

                Console.WriteLine("Press a key...");
                toDo = Console.ReadLine();
            } while(toDo == String.Empty);

            switch(toDo[0])
            {
                case '1':
                    Console.WriteLine("Transmitting IR Code (blocking)...");
                    try
                    {
                        mc.Transmit(irCode, transmitFormat, 10, TimeSpan.Zero);
                    }
                    catch(Exception ex)
                    {
                        Console.WriteLine("*** ERROR calling Transmit! ***");
                        throw;
                    }
                    Console.WriteLine("...Returned from call (Done)!");
                break;

                case '2':
                    using (ManualResetEvent waitEvent = new ManualResetEvent(false))
                    {
                        mc.TransmitCompleted += new UsbUirt.Controller.TransmitCompletedEventHandler(mc_TransmitCompleted);
                        Console.WriteLine("\nTransmitting IR Code (non-blocking)...");
                        try
                        {
                            mc.TransmitAsync(irCode, transmitFormat, 10, TimeSpan.Zero, waitEvent);
                            Console.WriteLine("...Returned from call...");
                            if (waitEvent.WaitOne(5000, false))
                            {
                                Console.WriteLine("...IR Transmission Complete!");
                            }
                            else
                            {
                                Console.WriteLine("*** ERROR: Timeout error waiting for IR to finish!");
                            }
                        }
                        catch(Exception ex)
                        {
                            Console.WriteLine("*** ERROR calling TransmitAsync! ***");
                            throw;
                        }
                        finally
                        {
                            mc.TransmitCompleted -= new UsbUirt.Controller.TransmitCompletedEventHandler(mc_TransmitCompleted);
                        }
                    }
                    break;

                case '3':
                    TestLearn(mc, CodeFormat.Pronto, LearnCodeModifier.None);
                    break;

                case '4':
                    TestLearn(mc, CodeFormat.Uuirt, LearnCodeModifier.None);
                    break;

                case '5':
                    TestLearn(mc, CodeFormat.Uuirt, LearnCodeModifier.ForceStruct);
                    break;

                case '6':
                    mc.BlinkOnReceive = ! mc.BlinkOnReceive;
                    break;

                case '7':
                    mc.BlinkOnTransmit = ! mc.BlinkOnTransmit;
                    break;

                case '8':
                    mc.GenerateLegacyCodesOnReceive = ! mc.GenerateLegacyCodesOnReceive;
                    break;

                case 'x':
                    return false;

                default:
                    break;
            }
            return true;
        }
コード例 #3
0
 public static void PowerOn()
 {
     try
     {
         Properties.Settings settings = new Properties.Settings();
         Controller mc = new Controller();
         mc.Transmit(settings.USBUIRTOn, CodeFormat.Pronto, 10, TimeSpan.Zero);
         EventLog.WriteEntry("Carousel Monitor Control", "The monitor has been powered on.", EventLogEntryType.Information);
     }
     catch (Exception e)
     {
         EventLog.WriteEntry("Carousel Monitor Control", "Error powering monitor on, " + e.Message, EventLogEntryType.Error);
     }
 }