Exemplo n.º 1
0
 /// <summary>
 /// Stop the IR Server plugin.
 /// </summary>
 public override void Stop()
 {
     if (X10Inter != null)
     {
         icp.Unadvise(cookie);
         icpc     = null;
         X10Inter = null;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Start the IR Server plugin.
        /// </summary>
        public override void Start()
        {
            LoadSettings();
            X10Inter = new X10Interface();
            if (X10Inter == null)
            {
                throw new InvalidOperationException("Failed to start X10 interface");
            }

            // 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);
        }
Exemplo n.º 3
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");
          }
        }
      }
    }
Exemplo n.º 4
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");
                    }
                }
            }
        }
 /// <summary>
 /// Stop the IR Server plugin.
 /// </summary>
 public override void Stop()
 {
   if (X10Inter != null)
   {
     icp.Unadvise(cookie);
     icpc = null;
     X10Inter = null;
   }
 }
    /// <summary>
    /// Start the IR Server plugin.
    /// </summary>
    public override void Start()
    {
      LoadSettings();
      X10Inter = new X10Interface();
      if (X10Inter == null)
        throw new InvalidOperationException("Failed to start X10 interface");

      // 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);
    }