Ejemplo n.º 1
0
        public override void TurnOn(DeviceInterface type)
        {
            switch (type)
            {
            case Devices.DeviceInterface.IR:

                RemoteCommand rc = GetRemoteCommandFromString("Power (IR)");

                try
                {
                    IrToy.Send(rc.IrCode);
                }
                catch (Exception ex)
                {
                    Log.Error("Auto3D: IR Toy Send failed: " + ex.Message);
                }
                break;

            case DeviceInterface.Network:

                SendCommand(new RemoteCommand("On", 0, null));
                break;

            default:

                // error
                break;
            }
        }
Ejemplo n.º 2
0
        public override void TurnOn(DeviceInterface type)
        {
            if (!IsOn())
            {
                switch (type)
                {
                case DeviceInterface.IR:

                    RemoteCommand rc = GetRemoteCommandFromString("Power (IR)");

                    try
                    {
                        IrToy.Send(rc.IrCode);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Auto3D: IR Toy Send failed: " + ex.Message);
                    }
                    break;

                case DeviceInterface.Network:

                    Auto3DHelpers.WakeOnLan(MAC);
                    break;

                default:

                    break;
                }
            }
            else
            {
                Log.Debug("Auto3D: TV is already off");
            }
        }
Ejemplo n.º 3
0
        public override void TurnOff(DeviceInterface type)
        {
            if (IsOn())
            {
                switch (type)
                {
                case DeviceInterface.IR:

                    RemoteCommand rc = GetRemoteCommandFromString("Power (IR)");

                    try
                    {
                        IrToy.Send(rc.IrCode);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Auto3D: IR Toy Send failed: " + ex.Message);
                    }
                    break;

                case DeviceInterface.Network:

                    SendCommand(new RemoteCommand("Off", 0, null));
                    break;
                }
            }
            else
            {
                Log.Debug("Auto3D: TV is already off");
            }
        }
Ejemplo n.º 4
0
        public override bool SendCommand(RemoteCommand rc)
        {
            try
            {
                IrToy.Send(rc.IrCode);
                Log.Info("Auto3D: Code sent: " + rc.IrCode);
            }
            catch (Exception ex)
            {
                Auto3DHelpers.ShowAuto3DMessage("Sending code failed: " + ex.Message, false, 0);
                Log.Error("Auto3D: Sending code " + rc.IrCode + " failed: " + ex.Message);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
        public override void TurnOff(DeviceInterface type)
        {
            if (PingCheck && !IsOn())
            {
                Log.Debug("Auto3D: TV is already off");
                return;
            }

            if (type == DeviceInterface.IR)
            {
                RemoteCommand rc = GetRemoteCommandFromString("Power (IR)");

                try
                {
                    IrToy.Send(rc.IrCode);
                }
                catch (Exception ex)
                {
                    Log.Error("Auto3D: IR Toy Send failed: " + ex.Message);
                }
            }
        }