Exemple #1
0
        private RedEye(OnRemoteCommand remoteCommandCallback)
        {
            try
            {
                using (Settings xmlreader = new MPSettings())
                {
                    recInternalCommands = xmlreader.GetValueAsString("RedEye", "internal", "false") == "true";
                    commport            = xmlreader.GetValueAsString("RedEye", "commport", "COM1:");
                    baudrate            = xmlreader.GetValueAsInt("RedEye", "baudrate", 9600);
                    handshake           = xmlreader.GetValueAsString("RedEye", "handshake", "none");
                    irbytes             = xmlreader.GetValueAsInt("RedEye", "irbytes", 6);
                    uirirmaninit        = xmlreader.GetValueAsString("RedEye", "uirirmaninit", "true") == "true";
                    LearningTimeOut     = 1000 * xmlreader.GetValueAsInt("RedEye", "timeout", 4);
                    CommandDelay        = xmlreader.GetValueAsInt("RedEye", "delay", 300);
                }
                this.remoteCommandCallback = remoteCommandCallback;

                if (InternalCommandsActive)
                {
                    base.Open();
                }
            }
            catch (Exception)
            {
                //most users dont have serial device on their system so will get a exception here
            }
        }
Exemple #2
0
        private SerialUIR(OnRemoteCommand remoteCommandCallback) : this()
        {
            try
            {
                using (Settings xmlreader = new MPSettings())
                {
                    recInternalCommands = xmlreader.GetValueAsString("SerialUIR", "internal", "false") == "true";
                    commport            = xmlreader.GetValueAsString("SerialUIR", "commport", "COM1:");
                    baudrate            = xmlreader.GetValueAsInt("SerialUIR", "baudrate", 9600);
                    handshake           = xmlreader.GetValueAsString("SerialUIR", "handshake", "None");
                    irbytes             = xmlreader.GetValueAsInt("SerialUIR", "irbytes", 6);
                    uirirmaninit        = xmlreader.GetValueAsString("SerialUIR", "uirirmaninit", "true") == "true";
                    LearningTimeOut     = 1000 * xmlreader.GetValueAsInt("SerialUIR", "timeout", 4);
                    CommandDelay        = xmlreader.GetValueAsInt("SerialUIR", "delay", 300);
                }
                this.remoteCommandCallback = remoteCommandCallback;
                commandsLearned            = new Hashtable();
                if (File.Exists(remotefile))
                {
                    LoadValues();
                }

                if (InternalCommandsActive)
                {
                    base.Open();
                }
            }
            catch (Exception ex)
            {
                //most users dont have serial device on their system so will get a exception here
                Log.Error("SerialUIR:SerialUIR {0}", ex.Message);
            }
        }
Exemple #3
0
 public static RedEye Create(OnRemoteCommand remoteCommandCallback)
 {
     try
     {
         if (instance == null)
         {
             instance = new RedEye(remoteCommandCallback);
         }
     }
     catch (Exception) {}
     return(instance);
 }
 public static SerialUIR Create(OnRemoteCommand remoteCommandCallback)
 {
     try
     {
         if (instance == null)
         {
             instance = new SerialUIR(remoteCommandCallback);
         }
     }
     catch (Exception) {}
     return(instance);
 }
Exemple #5
0
 public static SerialUIR Create(OnRemoteCommand remoteCommandCallback)
 {
     try
     {
         if (instance == null)
         {
             instance = new SerialUIR(remoteCommandCallback);
         }
     }
     catch (Exception ex)
     {
         Log.Error("SerialUIR:Create {0}", ex.Message);
     }
     return(instance);
 }
Exemple #6
0
 public static RedEye Create(OnRemoteCommand remoteCommandCallback)
 {
     try
     {
         if (instance == null)
         {
             instance = new RedEye(remoteCommandCallback);
         }
     }
     catch (Exception ex)
     {
         Log.Error("RedEye Create: {0}", ex.Message);
     }
     return(instance);
 }
Exemple #7
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="remoteCommandCallback"></param>
    /// <returns></returns>
    public static USBUIRT Create(OnRemoteCommand remoteCommandCallback)
    {
      try
      {
        if (Instance == null)
        {
          Instance = new USBUIRT(remoteCommandCallback);
        }
      }
      catch (Exception) {}

      return Instance;
    }
Exemple #8
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="callback"></param>
    private USBUIRT(OnRemoteCommand callback)
    {
      try
      {
        Log.Info("USBUIRT:Open");
        _commandsLearned = new Hashtable();
        _jumpToCommands = new Hashtable();
        CreateJumpToCommands();

        _usbUirtHandle = UUIRTOpen();

        if (_usbUirtHandle != _empty)
        {
          IsUsbUirtLoaded = true;
          Log.Info("USBUIRT:Open success:{0}", GetVersions());
        }
        else
        {
          Log.Info("USBUIRT:Unable to open USBUIRT driver");
        }

        if (IsUsbUirtLoaded)
        {
          Initialize();
          //setup callback to receive IR messages
          _urcb = UUIRTReceiveCallback;
          UUIRTSetReceiveCallback(_usbUirtHandle, _urcb, 0);
          RemoteCommandCallback = callback;
        }
      }

      catch (DllNotFoundException)
      {
        //most users don't have the dll on their system so will get a exception here
        Log.Info("USBUIRT:uuirtdrv.dll not found");
      }
      catch (Exception)
      {
        //most users don't have the dll on their system so will get a exception here
      }
    }
Exemple #9
0
 private SerialUIR(OnRemoteCommand remoteCommandCallback) : this()
 {
   try
   {
     using (Settings xmlreader = new MPSettings())
     {
       recInternalCommands = xmlreader.GetValueAsString("SerialUIR", "internal", "false") == "true";
       commport = xmlreader.GetValueAsString("SerialUIR", "commport", "COM1:");
       baudrate = xmlreader.GetValueAsInt("SerialUIR", "baudrate", 9600);
       handshake = xmlreader.GetValueAsString("SerialUIR", "handshake", "None");
       irbytes = xmlreader.GetValueAsInt("SerialUIR", "irbytes", 6);
       uirirmaninit = xmlreader.GetValueAsString("SerialUIR", "uirirmaninit", "true") == "true";
       LearningTimeOut = 1000 * xmlreader.GetValueAsInt("SerialUIR", "timeout", 4);
       CommandDelay = xmlreader.GetValueAsInt("SerialUIR", "delay", 300);
     }
     this.remoteCommandCallback = remoteCommandCallback;
     commandsLearned = new Hashtable();
     if (File.Exists(remotefile))
     {
       LoadValues();
     }
     
     if (InternalCommandsActive)
       base.Open();
   }
   catch (Exception)
   {
     //most users dont have serial device on their system so will get a exception here
   }
 }
Exemple #10
0
 public static SerialUIR Create(OnRemoteCommand remoteCommandCallback)
 {
   try
   {
     if (instance == null)
     {
       instance = new SerialUIR(remoteCommandCallback);
     }
   }
   catch (Exception) {}
   return instance;
 }
Exemple #11
0
 public static RedEye Create(OnRemoteCommand remoteCommandCallback)
 {
   try
   {
     if (instance == null)
     {
       instance = new RedEye(remoteCommandCallback);
     }
   }
   catch (Exception) {}
   return instance;
 }
Exemple #12
0
 private RedEye(OnRemoteCommand remoteCommandCallback)
 {
   try
   {
     using (Settings xmlreader = new MPSettings())
     {
       recInternalCommands = xmlreader.GetValueAsString("RedEye", "internal", "false") == "true";
       commport = xmlreader.GetValueAsString("RedEye", "commport", "COM1:");
       baudrate = xmlreader.GetValueAsInt("RedEye", "baudrate", 9600);
       handshake = xmlreader.GetValueAsString("RedEye", "handshake", "none");
       irbytes = xmlreader.GetValueAsInt("RedEye", "irbytes", 6);
       uirirmaninit = xmlreader.GetValueAsString("RedEye", "uirirmaninit", "true") == "true";
       LearningTimeOut = 1000 * xmlreader.GetValueAsInt("RedEye", "timeout", 4);
       CommandDelay = xmlreader.GetValueAsInt("RedEye", "delay", 300);
     }
     this.remoteCommandCallback = remoteCommandCallback;
     base.Open();
   }
   catch (Exception)
   {
     //most users dont have serial device on their system so will get a exception here
   }
 }