Ejemplo n.º 1
0
 private static extern bool UUIRTLearnIR(
     IntPtr hDrvHandle,
     int codeFormat,
     StringBuilder IRCode,
     LearnCallback progressProc,
     IntPtr userData,
     IntPtr pAbort,
     uint param1,
     IntPtr reserved0,
     IntPtr reserved1);
        public static void BeginLearn(LearnCallback learnCallback)
        {
            try
            {
                byte[] packet1 = new byte[] { 0x9F, 0x0C, 0x0F, 0xA0 };
                byte[] packet2 = new byte[] { 0x9F, 0x14, 0x01 };

                lock (_deviceSingleton) _deviceSingleton._packetArray = new ArrayList();

                _deviceSingleton._deviceStream.Write(packet1, 0, packet1.Length);
                _deviceSingleton._deviceStream.Write(packet2, 0, packet2.Length);
                _deviceSingleton._learnStartTick = Environment.TickCount;
                _deviceSingleton._deviceStream.BeginRead(_deviceSingleton._deviceBuffer, 0,
                                                         _deviceSingleton._deviceBuffer.Length, _deviceSingleton.OnReadComplete,
                                                         learnCallback);
            }
            catch
            {
                if (learnCallback != null)
                {
                    learnCallback(null);
                }
            }
        }
Ejemplo n.º 3
0
        private static extern bool UUIRTLearnIR(
			IntPtr hDrvHandle, 
			int codeFormat,
			StringBuilder IRCode, 
			LearnCallback progressProc, 
			IntPtr userData,
			IntPtr pAbort, 
			uint param1, 
			IntPtr reserved0, 
			IntPtr reserved1);
Ejemplo n.º 4
0
    public static void BeginLearn(LearnCallback learnCallback)
    {
      try
      {
        byte[] packet1 = new byte[] {0x9F, 0x0C, 0x0F, 0xA0};
        byte[] packet2 = new byte[] {0x9F, 0x14, 0x01};

        lock (_deviceSingleton) _deviceSingleton._packetArray = new ArrayList();

        _deviceSingleton._deviceStream.Write(packet1, 0, packet1.Length);
        _deviceSingleton._deviceStream.Write(packet2, 0, packet2.Length);
        _deviceSingleton._learnStartTick = Environment.TickCount;
        _deviceSingleton._deviceStream.BeginRead(_deviceSingleton._deviceBuffer, 0,
                                                 _deviceSingleton._deviceBuffer.Length, _deviceSingleton.OnReadComplete,
                                                 learnCallback);
      }
      catch
      {
        if (learnCallback != null) learnCallback(null);
      }
    }