Esempio n. 1
0
    public void Init()
    {
      bool RemoteConfigured = false;
      using (Settings xmlreader = new MPSettings())
      {
        RemoteConfigured = xmlreader.GetValueAsBool("remote", "Centarea", false);
        _verboseLogging = xmlreader.GetValueAsBool("remote", "CentareaVerbose", false);
        _mapMouseButton = xmlreader.GetValueAsBool("remote", "CentareaMouseOkMap", true);
        _mapJoystick = xmlreader.GetValueAsBool("remote", "CentareaJoystickMap", false);
      }
      if (!RemoteConfigured)
      {
        return;
      }

      Log.Debug("Centarea: Initializing Centarea HID remote");

      _inputHandler = new InputHandler("Centarea HID");
      if (!_inputHandler.IsLoaded)
      {
        Log.Error("Centarea: Error loading default mapping file - please reinstall MediaPortal");
        DeInit();
        return;
      }
      else
      {
        Log.Info("Centarea: Centarea HID mapping loaded successfully");
        _remoteActive = true;
      }
    }
Esempio n. 2
0
 public void GetPathFallbackVersion()
 {
   string xmlFile = "TestFallbackVersion";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(Path.Combine(InputHandler.DefaultsDirectory, "TestFallbackVersion.xml"),
                   inputHandler.GetXmlPath(xmlFile));
 }
Esempio n. 3
0
 public void GetPathCustomXml()
 {
   string xmlFile = "TestCustom";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(Path.Combine(InputHandler.CustomizedMappingsDirectory, xmlFile + ".xml"),
                   inputHandler.GetXmlPath(xmlFile));
 }
        private void Init()
        {
            using (Settings xmlreader = new MPSettings())
            {
                controlEnabled = xmlreader.GetValueAsBool("remote", "AppCommand", false);
                controlEnabledGlobally = xmlreader.GetValueAsBool("remote", "AppCommandBackground", false);
                logVerbose = xmlreader.GetValueAsBool("remote", "AppCommandVerbose", false);
            }

            if (controlEnabled)
            {
                _inputHandler = new InputHandler("AppCommand");
                if (!_inputHandler.IsLoaded)
                {
                    controlEnabled = false;
                    Log.Info("AppCommand: Error loading default mapping file - please reinstall MediaPortal");
                }
            }

            if (controlEnabledGlobally)
            {
                _keyboardHook = new KeyboardHook();
                _keyboardHook.KeyDown += new KeyEventHandler(OnKeyDown);
                _keyboardHook.IsEnabled = true;
            }
        }
Esempio n. 5
0
    public CecRemoteClient()
    {
      _remoteHandler = new InputHandler("CecRemote");

      if (!_remoteHandler.IsLoaded)
      {
        Log.Error("CecRemote: Error loading mapping file - check configuration.");
      }

    }
Esempio n. 6
0
 public override void DeInit()
 {
   base.DeInit();
   _remoteHandler = null;
 }
Esempio n. 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public Communication()
 {
     remoteHandler = new InputHandler("WifiRemote");
     m_keyDownTimer = new StopWatch();
 }
Esempio n. 8
0
 public bool SetupKeypad(bool UseCustomKeypadMap)
 {
   bool flag = false;
   bool flag2 = false;
   if (!UseCustomKeypadMap)
   {
     return true;
   }
   try
   {
     if (this.TestXmlVersion(DefaultMappingPath) < 3)
     {
       Log.Info(
         "CFontz.CFDisplay.SetupKeypad(): Deleting CFontz_Keypad mapping file with the wrong version stamp.",
         new object[0]);
       File.Delete(DefaultMappingPath);
     }
     if (!File.Exists(DefaultMappingPath))
     {
       Log.Info("CFontz.Setup(): Creating default CFontz_Keypad mapping file");
       if (!AdvancedSettings.CreateDefaultKeyPadMapping())
       {
         Log.Info("CFontz.CFDisplay.SetupKeypad(): ERROR Creating default CFontz_Keypad mapping file",
                  new object[0]);
         flag2 = false;
       }
       else
       {
         flag2 = true;
       }
     }
     else
     {
       flag2 = true;
     }
   }
   catch (Exception exception)
   {
     Log.Info("CFontz.CFDisplay.SetupKeypad(): CAUGHT EXCEPTION while loading InputHander - {0}",
              new object[] {exception});
     flag2 = false;
     flag = false;
   }
   if (flag2)
   {
     Log.Info("CFontz.CFDisplay.SetupKeypad(): Loading InputHandler");
     this._inputHandler = new InputHandler("CFontz_Keypad");
     Log.Info("CFontz.CFDisplay.SetupKeypad(): InputHandler loaded = {0}",
              new object[] {this._inputHandler.IsLoaded});
     if (this._inputHandler.IsLoaded)
     {
       flag = true;
     }
     else
     {
       flag = false;
       Log.Info("CFontz.CFDisplay.SetupKeypad(): error loading InputHandler - remote support disabled",
                new object[0]);
     }
   }
   else
   {
     Log.Info("CFontz.CFDisplay.SetupKeypad(): Keypad support disabled - no keypad mapping file");
     flag = false;
   }
   if (flag && this._inputHandler.IsLoaded)
   {
     return flag;
   }
   Log.Info("CFontz.CFDisplay.SetupKeypad(): Error loading Keypad mapping file - Keypad support disabled",
            new object[0]);
   return false;
 }
Esempio n. 9
0
    /// <summary>
    /// Initialize MCE Remote
    /// </summary>
    private void Init()
    {
      using (Settings xmlreader = new MPSettings())
      {
        controlEnabled = xmlreader.GetValueAsBool("remote", "MCE", true);
        logVerbose = xmlreader.GetValueAsBool("remote", "MCEVerboseLog", false);
      }
      if (!controlEnabled)
      {
        return;
      }

      if (logVerbose)
      {
        Log.Info("MCE: Initializing MCE remote");
      }

      try
      {
        Remote.LogVerbose = logVerbose;
        // Register Device
        Remote.Click = null;
        Remote.Click += new RemoteEventHandler(OnRemoteClick);
        Remote.DeviceRemoval += new DeviceEventHandler(OnDeviceRemoval);
      }
      catch (Exception ex)
      {
        controlEnabled = false;
        Log.Info("MCE: {0} - support disabled until MP restart", ex.InnerException.Message);
        return;
      }

      // Kill ehtray.exe since that program catches the MCE remote keys and would start MCE 2005
      Process[] myProcesses;
      myProcesses = Process.GetProcesses();
      foreach (Process myProcess in myProcesses)
      {
        if (myProcess.ProcessName.ToLowerInvariant().Equals("ehtray"))
        {
          try
          {
            Log.Info("MCE: Stopping Microsoft ehtray");
            myProcess.Kill();
          }
          catch (Exception)
          {
            Log.Info("MCE: Cannot stop Microsoft ehtray");
            DeInit();
            return;
          }
        }
      }

      _inputHandler = new InputHandler("Microsoft MCE");
      if (!_inputHandler.IsLoaded)
      {
        Log.Info("MCE: Error loading default mapping file - please reinstall MediaPortal");
        DeInit();
        return;
      }
      else
      {
        Log.Info("MCE: MCE remote enabled");
      }
    }
Esempio n. 10
0
 public void CheckXmlVersionDefaultFail()
 {
   string xmlFile = "TestVersion";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(false, inputHandler.CheckXmlFile(Path.Combine(InputHandler.DefaultsDirectory, "TestVersion.xml")));
 }
Esempio n. 11
0
    /// <summary>
    /// Initialise the FireDTV remote
    /// </summary>
    /// <param name="hwnd">The window handler where the remote messages are send</param>
    public void Init(IntPtr hwnd)
    {
      try
      {
        // first read the configuration, to determine the initialisation is needed
        using (Settings xmlreader = new MPSettings())
        {
          _enabled = ((xmlreader.GetValueAsBool("remote", "FireDTV", false)));
          _name = xmlreader.GetValueAsString("remote", "FireDTVDeviceName", string.Empty);
          if (!_enabled)
          {
            return;
          }
        }

        // load the default input mapping
        _inputHandler = new InputHandler("FireDTV");
        if (!_inputHandler.IsLoaded)
        {
          _enabled = false;
          Log.Error("FireDTVRemote: Error loading default mapping file - please reinstall MediaPortal");
          return;
        }

        _fireDTV = new FireDTVControl(hwnd);
        Log.Info("FireDTVRemote: Starting on handler {0}", hwnd);

        // start communication with the FireDTV library
        StartFireDTVComms();
      }
      catch (FileNotFoundException eFileNotFound)
      {
        Log.Error(eFileNotFound);
      }
      catch (FireDTVException eFireDTV)
      {
        Log.Error(eFireDTV);
      }
    }
Esempio n. 12
0
 public void CorruptXml()
 {
   string xmlFile = "TestCorrupt";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(Path.Combine(InputHandler.DefaultsDirectory, "TestCorrupt.xml"), inputHandler.GetXmlPath(xmlFile));
 }
Esempio n. 13
0
 public void MapCommand()
 {
   string xmlFile = "TestDefault";
   int newCommand = 0;
   InputHandler inputHandler = new InputHandler(xmlFile);
   inputHandler.MapAction(newCommand);
 }
Esempio n. 14
0
 public void GetMappingNotFound()
 {
   string xmlFile = "TestDefault";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(null, inputHandler.GetMapping("1"));
 }
Esempio n. 15
0
    public void GetMapping()
    {
      string xmlFile = "TestDefault";
      InputHandler inputHandler = new InputHandler(xmlFile);

      int layer = 0;
      string condition = "*";
      string conProperty = "-1";
      string command = "ACTION";
      string cmdProperty = "93";
      int cmdKeyChar = 48;
      int cmdKeyCode = 0;
      string sound = "cursor.wav";
      bool focus = true;

      InputHandler.Mapping mapExpected = new InputHandler.Mapping(layer, condition, conProperty, command, cmdProperty,
                                                                  cmdKeyChar, cmdKeyCode, sound, focus);
      InputHandler.Mapping mapTest = inputHandler.GetMapping("0");

      Assert.AreEqual(mapExpected.Layer, mapTest.Layer);
      Assert.AreEqual(mapExpected.Condition, mapTest.Condition);
      Assert.AreEqual(mapExpected.ConProperty, mapTest.ConProperty);
      Assert.AreEqual(mapExpected.Command, mapTest.Command);
      Assert.AreEqual(mapExpected.CmdProperty, mapTest.CmdProperty);
      Assert.AreEqual(mapExpected.CmdKeyChar, mapTest.CmdKeyChar);
      Assert.AreEqual(mapExpected.CmdKeyCode, mapTest.CmdKeyCode);
      Assert.AreEqual(mapExpected.Sound, mapTest.Sound);
      Assert.AreEqual(mapExpected.Focus, mapTest.Focus);
    }
Esempio n. 16
0
 public void CheckXmlVersionCustomFail()
 {
   string xmlFile = "TestVersion2";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(false,
                   inputHandler.CheckXmlFile(Path.Combine(InputHandler.CustomizedMappingsDirectory,
                                                          "TestVersion2.xml")));
 }
Esempio n. 17
0
 public void Setup(string _port, int _lines, int _cols, int _delay, int _linesG, int _colsG, int _delayG,
                   bool _backLight, int _backLightLevel, bool _contrast, int _contrastLevel, bool _blankOnExit)
 {
   this.DoDebug = Assembly.GetEntryAssembly().FullName.Contains("Configuration") | Settings.Instance.ExtensiveLogging;
   Log.Info("{0}", new object[] {this.Description});
   Log.Info("xPL_Connector.Setup(): called");
   this._BlankDisplayOnExit = _blankOnExit;
   this.LoadAdvancedSettings();
   this._Trows = _lines;
   this._Tcols = _cols;
   this._IsConnected = false;
   Log.Info("xPL_Connector.Setup(): Loading MCE Remote mapping file");
   this.rHandler = new InputHandler("Microsoft MCE");
   if (this.rHandler.IsLoaded)
   {
     Log.Info("xPL_Connector.Setup(): MCE Remote mapping file loaded!");
   }
   else
   {
     Log.Info("xPL_Connector.Setup(): ERROR Could not Load MCE Remote mapping file");
   }
   Log.Info("xPL_Connector.Setup(): completed");
 }
Esempio n. 18
0
    /// <summary>
    /// Stop IR.exe and initiate HCW start
    /// </summary>
    public void Init()
    {
      _exit = false;
      using (Settings xmlreader = new MPSettings())
      {
        _controlEnabled = xmlreader.GetValueAsBool("remote", "HCW", false);
        _allowExternal = xmlreader.GetValueAsBool("remote", "HCWAllowExternal", false);
        _keepControl = xmlreader.GetValueAsBool("remote", "HCWKeepControl", false);
        _logVerbose = xmlreader.GetValueAsBool("remote", "HCWVerboseLog", false);
        _buttonRelease = TimeSpan.FromMilliseconds(xmlreader.GetValueAsInt("remote", "HCWButtonRelease", 200));
        _repeatFilter = xmlreader.GetValueAsInt("remote", "HCWRepeatFilter", 2);
        _repeatSpeed = xmlreader.GetValueAsInt("remote", "HCWRepeatSpeed", 0);
        _filterDoubleKlicks = xmlreader.GetValueAsBool("remote", "HCWFilterDoubleKlicks", false);
        _port = xmlreader.GetValueAsInt("remote", "HCWHelperPort", 2110);
      }
      if (_controlEnabled)
      {
        string exePath = irremote.GetHCWPath();
        string dllPath = irremote.GetDllPath();

        bool hcwDriverUpToDate = true;

        if (File.Exists(exePath + "Ir.exe"))
        {
          FileVersionInfo exeVersionInfo = FileVersionInfo.GetVersionInfo(exePath + "Ir.exe");
          if (exeVersionInfo.FileVersion.CompareTo(irremote.CurrentVersion) < 0)
          {
            hcwDriverUpToDate = false;
          }
        }

        if (File.Exists(dllPath + "irremote.DLL"))
        {
          FileVersionInfo dllVersionInfo = FileVersionInfo.GetVersionInfo(dllPath + "irremote.DLL");
          if (dllVersionInfo.FileVersion.CompareTo(irremote.CurrentVersion) < 0)
          {
            hcwDriverUpToDate = false;
          }
        }

        if (!hcwDriverUpToDate)
        {
          Log.Info("HCW: ==============================================================================================");
          Log.Info("HCW: Your remote control driver components are not up to date! To avoid problems, you should");
          Log.Info("HCW: get the latest Hauppauge drivers here: http://www.hauppauge.co.uk/board/showthread.php?p=25253");
          Log.Info("HCW: ==============================================================================================");
        }

        _inputHandler = new InputHandler("Hauppauge HCW");
        if (!_inputHandler.IsLoaded)
        {
          _controlEnabled = false;
          Log.Info("HCW: Error loading default mapping file - please reinstall MediaPortal");
        }
      }

      if (_controlEnabled)
      {
        _connection = new Connection(_logVerbose);

        _connection.Start(_port + 1);
        _connection.ReceiveEvent += new Connection.ReceiveEventHandler(OnReceive);

        Process process = Process.GetCurrentProcess();
        Log.Info("Process: {0}", process.ProcessName);

        Process procHelper = new Process();
        procHelper.StartInfo.FileName = string.Format("{0}\\HcwHelper.exe", Application.StartupPath);
        procHelper.Start();
        if (_allowExternal)
        {
          Log.Info("HCW: AllowExternal");
          Util.Utils.OnStartExternal += new Util.Utils.UtilEventHandler(OnStartExternal);
          Util.Utils.OnStopExternal += new Util.Utils.UtilEventHandler(OnStopExternal);
        }
        Thread checkThread = new Thread(new ThreadStart(CheckThread));
        checkThread.IsBackground = true;
        checkThread.Name = "HcwHelperCheck";
        checkThread.Priority = ThreadPriority.AboveNormal;
        checkThread.Start();
      }
    }
Esempio n. 19
0
 public void GetPathFail()
 {
   string xmlFile = "TestFail";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(string.Empty, inputHandler.GetXmlPath(xmlFile));
 }
Esempio n. 20
0
        public void Init()
        {
            using (Settings xmlreader = new MPSettings())
            {
                _controlEnabled       = xmlreader.GetValueAsBool("remote", "X10", false);
                _x10Medion            = xmlreader.GetValueAsBool("remote", "X10Medion", false);
                _x10Ati               = xmlreader.GetValueAsBool("remote", "X10ATI", false);
                _x10Firefly           = xmlreader.GetValueAsBool("remote", "X10Firefly", false);
                _logVerbose           = xmlreader.GetValueAsBool("remote", "X10VerboseLog", false);
                _x10UseChannelControl = xmlreader.GetValueAsBool("remote", "X10UseChannelControl", false);
                _x10Channel           = xmlreader.GetValueAsInt("remote", "X10Channel", 0);
            }

            //Setup the X10 Remote
            try
            {
                if (X10Inter == null)
                {
                    try
                    {
                        X10Inter = new X10Interface();
                    }
                    catch (COMException)
                    {
                        Log.Info("X10 debug: Could not get interface");
                        _remotefound = false;
                        return;
                    }
                    _remotefound = true;

                    //Bind the interface using a connection point

                    icpc = (IConnectionPointContainer)X10Inter;
                    Guid IID_InterfaceEvents = typeof(_DIX10InterfaceEvents).GUID;
                    icpc.FindConnectionPoint(ref IID_InterfaceEvents, out icp);
                    icp.Advise(this, out cookie);
                }
            }
            catch (COMException cex)
            {
                Log.Info("X10 Debug: Com error - " + cex.ToString());
            }

            if (_inputHandler == null)
            {
                if (_controlEnabled)
                {
                    if (_x10Medion)
                    {
                        _inputHandler = new InputHandler("Medion X10");
                    }
                    else if (_x10Ati)
                    {
                        _inputHandler = new InputHandler("ATI X10");
                    }
                    else if (_x10Firefly)
                    {
                        _inputHandler = new InputHandler("Firefly X10");
                    }
                    else
                    {
                        _inputHandler = new InputHandler("Other X10");
                    }
                }
                else
                {
                    return;
                }

                if (!_inputHandler.IsLoaded)
                {
                    _controlEnabled = false;
                    Log.Info("X10: Error loading default mapping file - please reinstall MediaPortal");
                    return;
                }

                if (_logVerbose)
                {
                    if (_x10Medion)
                    {
                        Log.Info("X10Remote: Start Medion");
                    }
                    else if (_x10Ati)
                    {
                        Log.Info("X10Remote: Start ATI");
                    }
                    else if (_x10Firefly)
                    {
                        Log.Info("X10Remote: Start Firefly");
                    }
                    else
                    {
                        Log.Info("X10Remote: Start Other");
                    }
                }
            }
        }
Esempio n. 21
0
 public override void Setup(string _port, int _lines, int _cols, int _delay, int _linesG, int _colsG, int _delayG,
                   bool _backLightControl, int _backlightLevel, bool _contrastControl, int _contrastLevel,
                   bool _blankOnExit)
 {
   DoDebug = Assembly.GetEntryAssembly().FullName.Contains("Configuration") | Settings.Instance.ExtensiveLogging;
   Log.Info("{0}", new object[] {Description});
   Log.Info("VLSYS_Mplay.Setup(): called");
   MiniDisplayHelper.InitEQ(ref EQSettings);
   MiniDisplayHelper.InitDisplayControl(ref DisplaySettings);
   InitRemoteSettings(ref RemoteSettings);
   _ShutdownOnExit = _blankOnExit;
   _UseBrightness = _backLightControl;
   _Brightness = _backlightLevel;
   _EnableDisplay = false;
   LoadAdvancedSettings();
   bool flag = false;
   _UseRemote = false;
   Port = _port;
   if (!RemoteSettings.DisableRemote)
   {
     try
     {
       if (TestXmlVersion(DefaultMappingPath) < 3)
       {
         Log.Info("VLSYS_Mplay.Setup(): Deleting VLSYS_Mplay mapping file with the wrong version stamp.",
                  new object[0]);
         File.Delete(DefaultMappingPath);
       }
       if (!File.Exists(DefaultMappingPath))
       {
         Log.Info("VLSYS_Mplay.Setup(): Creating default VLSYS_Mplay mapping file");
         if (!AdvancedSettings.CreateDefaultRemoteMapping())
         {
           Log.Info("VLSYS_Mplay.Setup(): ERROR Creating default VLSYS_Mplay mapping file");
           flag = false;
         }
         else
         {
           flag = true;
         }
       }
       else
       {
         flag = true;
       }
     }
     catch (Exception exception)
     {
       Log.Info("VLSYS_Mplay.Setup(): CAUGHT EXCEPTION while loading InputHander - {0}", new object[] {exception});
       flag = false;
       _UseRemote = false;
     }
     if (flag)
     {
       Log.Info("VLSYS_Mplay.Setup(): Loading InputHandler");
       _inputHandler = new InputHandler("VLSYS_Mplay");
       Log.Info("VLSYS_Mplay.Setup(): InputHandler loaded = {0}", new object[] {_inputHandler.IsLoaded});
       if (_inputHandler.IsLoaded)
       {
         _UseRemote = true;
       }
       else
       {
         _UseRemote = false;
         Log.Info("VLSYS_Mplay.Setup(): error loading InputHandler - remote support disabled");
       }
     }
     else
     {
       Log.Info("VLSYS_Mplay.Setup(): Remote support disabled - no remote mapping file");
       _UseRemote = false;
     }
     if (!_UseRemote || !_inputHandler.IsLoaded)
     {
       Log.Info("VLSYS_Mplay.Setup(): Error loading remote mapping file - Remote support disabled");
       _UseRemote = false;
     }
   }
   else
   {
     _UseRemote = false;
   }
   if (EQSettings.UseEqDisplay || DisplaySettings.BlankDisplayWithVideo)
   {
     _EqThread = new Thread(new ThreadStart(EQ_Update));
     _EqThread.IsBackground = true;
     _EqThread.Priority = ThreadPriority.BelowNormal;
     _EqThread.Name = "EQ_Update";
     _EqThread.Start();
     if (_EqThread.IsAlive)
     {
       Log.Info("VLSYS_Mplay.Setup(): EQ_Update() Thread Started");
     }
     else
     {
       Log.Info("VLSYS_Mplay.Setup(): EQ_Update() FAILED TO START");
     }
   }
   Log.Info("VLSYS_Mplay.Setup() completed");
 }
Esempio n. 22
0
 public void LoadMapping()
 {
   string xmlFile = "TestDefault";
   string xmlPath = Path.Combine(InputHandler.DefaultsDirectory, "TestDefault.xml");
   InputHandler inputHandler = new InputHandler(xmlFile);
   inputHandler.LoadMapping(xmlPath);
 }
Esempio n. 23
0
 /// <summary>
 /// Read Port number of IRTrans Server and Remote Key file as specified on Configuration
 /// and if IrTrans support enabled connect to the IRTRans Server.
 /// </summary>
 /// <param name="hwnd"></param>
 public void Init(IntPtr hwnd)
 {
   using (Settings xmlreader = new MPSettings())
   {
     irTransEnabled = xmlreader.GetValueAsBool("remote", "IRTrans", false);
     remoteModel = xmlreader.GetValueAsString("remote", "IRTransRemoteModel", "mediacenter");
     irTransServerPort = xmlreader.GetValueAsInt("remote", "IRTransServerPort", 21000);
     logVerbose = xmlreader.GetValueAsBool("remote", "IRTransVerboseLog", false);
   }
   if (irTransEnabled)
   {
     // Build the XML File name to be used for Button mapping.
     remoteKeyFile = "IrTrans " + remoteModel;
     irtransHandler = new InputHandler(remoteKeyFile);
   }
   else
   {
     return;
   }
   // Now Connect to the IRTransServer 
   if (Connect_IrTrans(irTransServerPort))
   {
     if (logVerbose)
     {
       Log.Info("IRTrans: Connection established.");
     }
     // Now Wait for data to be sent
     WaitForData();
   }
   else
   {
     return;
   }
 }
Esempio n. 24
0
 public void GetXmlVersion()
 {
   string xmlFile = "TestDefault";
   InputHandler inputHandler = new InputHandler(xmlFile);
   Assert.AreEqual(3, inputHandler.GetXmlVersion(Path.Combine(InputHandler.DefaultsDirectory, "TestDefault.xml")));
 }
Esempio n. 25
0
 /// <summary>
 /// Remove all device handling
 /// </summary>
 public void DeInit()
 {
   if (controlEnabled)
   {
     if (logVerbose)
     {
       Log.Info("MCE: Stopping MCE remote");
     }
     Remote.Click -= new RemoteEventHandler(OnRemoteClick);
     Remote.DeviceRemoval -= new DeviceEventHandler(OnDeviceRemoval);
     Remote.DeviceArrival -= new DeviceEventHandler(OnDeviceArrival);
     _inputHandler = null;
     controlEnabled = false;
   }
 }
Esempio n. 26
0
        /// <summary>
        /// Create and start this instance of the remote control.
        /// </summary>
        void IPlugin.Start()
        {
            try
            {
                rc = new RemoteClass();
                rc.Initialize();
                rc.OnRemoteData += ReceiveData;
                string mediaportalpath = System.Reflection.Assembly.GetEntryAssembly().FullName;
                rc.SwitchBeginAP(mediaportalpath);
                Log.Info("AverRMKV Plugin: Started by " + mediaportalpath);
            }
            catch (Exception e)
            {
                Log.Error("AverRMKV Plugin: AverRemote.exe not responding");
                Log.Error("AverRMKV Plugin: Exception: " + e);
            }

            inputhandler = new InputHandler(mappingfile);
            if (inputhandler == null || !inputhandler.IsLoaded)
            {
                Log.Error("AverRMKV Plugin: File " + mappingfile + " not loaded.");
            }
            lastTimeActionPerformed = DateTime.Now;
            lastTimeButtonPushed    = DateTime.Now;
            Log.Info("AverRMKV Plugin: Started.");
        }
Esempio n. 27
0
    public void Init()
    {
      using (Settings xmlreader = new MPSettings())
      {
        _controlEnabled = xmlreader.GetValueAsBool("remote", "X10", false);
        _x10Medion = xmlreader.GetValueAsBool("remote", "X10Medion", false);
        _x10Ati = xmlreader.GetValueAsBool("remote", "X10ATI", false);
        _x10Firefly = xmlreader.GetValueAsBool("remote", "X10Firefly", false);
        _logVerbose = xmlreader.GetValueAsBool("remote", "X10VerboseLog", false);
        _x10UseChannelControl = xmlreader.GetValueAsBool("remote", "X10UseChannelControl", false);
        _x10Channel = xmlreader.GetValueAsInt("remote", "X10Channel", 0);
      }

      //Setup the X10 Remote
      try
      {
        if (X10Inter == null)
        {
          try
          {
            X10Inter = new X10Interface();
          }
          catch (COMException)
          {
            Log.Info("X10 debug: Could not get interface");
            _remotefound = false;
            return;
          }
          _remotefound = true;

          //Bind the interface using a connection point

          icpc = (IConnectionPointContainer)X10Inter;
          Guid IID_InterfaceEvents = typeof (_DIX10InterfaceEvents).GUID;
          icpc.FindConnectionPoint(ref IID_InterfaceEvents, out icp);
          icp.Advise(this, out cookie);
        }
      }
      catch (COMException cex)
      {
        Log.Info("X10 Debug: Com error - " + cex.ToString());
      }

      if (_inputHandler == null)
      {
        if (_controlEnabled)
        {
          if (_x10Medion)
          {
            _inputHandler = new InputHandler("Medion X10");
          }
          else if (_x10Ati)
          {
            _inputHandler = new InputHandler("ATI X10");
          }
          else if (_x10Firefly)
          {
            _inputHandler = new InputHandler("Firefly X10");
          }
          else
          {
            _inputHandler = new InputHandler("Other X10");
          }
        }
        else
        {
          return;
        }

        if (!_inputHandler.IsLoaded)
        {
          _controlEnabled = false;
          Log.Info("X10: Error loading default mapping file - please reinstall MediaPortal");
          return;
        }

        if (_logVerbose)
        {
          if (_x10Medion)
          {
            Log.Info("X10Remote: Start Medion");
          }
          else if (_x10Ati)
          {
            Log.Info("X10Remote: Start ATI");
          }
          else if (_x10Firefly)
          {
            Log.Info("X10Remote: Start Firefly");
          }
          else
          {
            Log.Info("X10Remote: Start Other");
          }
        }
      }
    }
Esempio n. 28
0
 private void CreateMapper()
 {
   _inputHandler = new InputHandler("DirectInput");
 }
Esempio n. 29
0
 /// <summary>
 /// Remove all device handling
 /// </summary>
 public void DeInit()
 {
   if (_remoteActive)
   {
     Log.Info("Centarea: Stopping Centarea HID remote");
     _remoteActive = false;
     _inputHandler = null;
   }
 }
Esempio n. 30
0
        /// <summary>
        /// Initialize MCE Remote
        /// </summary>
        private void Init()
        {
            using (Settings xmlreader = new MPSettings())
            {
                controlEnabled = xmlreader.GetValueAsBool("remote", "MCE", true);
                logVerbose     = xmlreader.GetValueAsBool("remote", "MCEVerboseLog", false);
            }
            if (!controlEnabled)
            {
                return;
            }

            if (logVerbose)
            {
                Log.Info("MCE: Initializing MCE remote");
            }

            try
            {
                Remote.LogVerbose = logVerbose;
                // Register Device
                Remote.Click          = null;
                Remote.Click         += new RemoteEventHandler(OnRemoteClick);
                Remote.DeviceRemoval += new DeviceEventHandler(OnDeviceRemoval);
            }
            catch (Exception ex)
            {
                controlEnabled = false;
                Log.Info("MCE: {0} - support disabled until MP restart", ex.InnerException.Message);
                return;
            }

            // Kill ehtray.exe since that program catches the MCE remote keys and would start MCE 2005
            Process[] myProcesses;
            myProcesses = Process.GetProcesses();
            foreach (Process myProcess in myProcesses)
            {
                if (myProcess.ProcessName.ToLowerInvariant().Equals("ehtray"))
                {
                    try
                    {
                        Log.Info("MCE: Stopping Microsoft ehtray");
                        myProcess.Kill();
                    }
                    catch (Exception)
                    {
                        Log.Info("MCE: Cannot stop Microsoft ehtray");
                        DeInit();
                        return;
                    }
                }
            }

            _inputHandler = new InputHandler("Microsoft MCE");
            if (!_inputHandler.IsLoaded)
            {
                Log.Info("MCE: Error loading default mapping file - please reinstall MediaPortal");
                DeInit();
                return;
            }
            else
            {
                Log.Info("MCE: MCE remote enabled");
            }
        }