コード例 #1
0
ファイル: EpsonBeamer.cs プロジェクト: caomw/Auto3D
        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;
            }
        }
コード例 #2
0
ファイル: SonyTV.cs プロジェクト: caomw/Auto3D
        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");
            }
        }
コード例 #3
0
ファイル: PhilipsTV.cs プロジェクト: caomw/Auto3D
        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");
            }
        }
コード例 #4
0
ファイル: GenericDevice.cs プロジェクト: caomw/Auto3D
        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);
        }
コード例 #5
0
ファイル: GenericDevice.cs プロジェクト: caomw/Auto3D
        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);
                }
            }
        }