Exemple #1
0
        private bool InternalSendCommand(String command)
        {
            if (UDAPnP.Protocol == UDAPnP.LGProtocol.LG2011 ||
                UDAPnP.Protocol == UDAPnP.LGProtocol.LG2012x)
            {
                if (!UDAPnP.HandleKeyInput(command))
                {
                    // if for some reason connection was lost, try to reconnect

                    if (!ConnectAndPair())
                    {
                        Auto3DHelpers.ShowAuto3DMessage("Connection to LG TV failed!", false, 0);
                        Log.Error("Auto3D: Connection to LG TV failed!");

                        return(false);
                    }

                    // second try to send the command

                    if (!UDAPnP.HandleKeyInput(command))
                    {
                        Log.Error("Auto3D: HandleKeyInput failed for command: " + command);
                        return(false);
                    }
                }
            }
            else // WebOS
            {
                WebOS.SendSpecialKey(command);
            }

            return(true);
        }
Exemple #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");
            }
        }
Exemple #3
0
        public override void ServiceAdded(UPnPService service)
        {
            base.ServiceAdded(service);

            Log.Info("Auto3D: Sony service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host);

            if (service.ParentDevice.UDN == UDN)
            {
                MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
                Log.Info("Auto3D: Sony service connected");
            }

            try
            {
                sonyDevice.initialize(service);
            }
            catch (Exception ex)
            {
                Log.Error("Auto3D: Initialize failed: " + ex.Message);
            }

            // show on GUI that device is not registered!)

            if (!sonyDevice.Registered)
            {
                Log.Error("Auto3D: Device " + service.ParentDevice.FriendlyName + " is not registered");
            }
            else
            {
                String CmdList = sonyDevice.get_remote_command_list();
                Log.Debug("Auto3D: Device " + service.ParentDevice.FriendlyName + " CmdList = " + CmdList);
            }

            ((SonyTVSetup)GetSetupControl()).SetRegisterButtonState(!sonyDevice.Registered);
        }
Exemple #4
0
        public override bool SendCommand(RemoteCommand rc)
        {
            switch (rc.Command)
            {
            case "Power (IR)":

                base.SendCommand(rc);
                break;

            case "On":

                if (!IsOn())
                {
                    Auto3DHelpers.WakeOnLan(Auto3DHelpers.RequestMACAddress(IpAddress));
                }
                break;

            default:

                if (_currentAdapter != null)
                {
                    return(_currentAdapter.SendCommand(rc.Command));
                }
                break;
            }

            return(false);
        }
Exemple #5
0
        public override void LoadSettings()
        {
            if (_serialPort != null && _serialPort.IsOpen)
            {
                _serialPort.Close();
            }

            using (Settings reader = new MPSettings())
            {
                DeviceModelName = reader.GetValueAsString("Auto3DPlugin", "EpsonModel", "Default");
                PortName        = reader.GetValueAsString("Auto3DPlugin", "EpsonPort", "None");
            }

            if (_serialPort != null)
            {
                _serialPort.PortName = PortName;

                try
                {
                    if (_serialPort.PortName != "None")
                    {
                        _serialPort.Open();
                    }
                }
                catch (Exception ex)
                {
                    Auto3DHelpers.ShowAuto3DMessage("Opening serial port failed: " + ex.Message, false, 0);
                    Log.Info("Auto3D: " + ex.Message);
                }
            }
        }
Exemple #6
0
        public void SetRegisterButtonState(bool enabled)
        {
            buttonRegister.Enabled = enabled;

            if (Auto3DHelpers.IsInSettings())
            {
                MessageBox.Show("If the PC was not paired with the TV yet,\nplease press the Register button.", "Initialize failed");
            }
        }
Exemple #7
0
        private void textBoxIP_TextChanged(object sender, EventArgs e)
        {
            _device.IpAddress = textBoxIP.Text;

            String mac = Auto3DHelpers.RequestMACAddress(textBoxIP.Text);

            if (!mac.StartsWith("00-00-00"))
            {
                _device.Mac = mac;
            }
        }
Exemple #8
0
 private void buttonPingGenericDevice_Click(object sender, EventArgs e)
 {
     if (_device.IsOn())
     {
         Auto3DHelpers.ShowAuto3DMessage("Ping was returned. TV seems to be on.", false, 0);
     }
     else
     {
         Auto3DHelpers.ShowAuto3DMessage("Ping was not returned. TV seems to be off.", false, 0);
     }
 }
Exemple #9
0
        public override void ServiceAdded(UPnPService service)
        {
            base.ServiceAdded(service);

            Log.Info("Auto3D: Panasonic service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host);

            if (service.ParentDevice.UDN == UDN)
            {
                MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
                Log.Info("Auto3D: Panasonic service connected");
            }
        }
Exemple #10
0
 static void internalStopGenericDevice()
 {
     try
     {
         _irToy.Close();
     }
     catch (Exception ex)
     {
         Auto3DHelpers.ShowAuto3DMessage("Could not close IrToy: " + ex.Message, false, 0);
         Log.Error("Auto3D: Could not close IrToy: " + ex.Message);
     }
 }
Exemple #11
0
        void _iRemote_addTVEvent(TVInfo info)
        {
            ((SamsungTVSetup)GetSetupControl()).TVAdded(ref info);

            if (info.ToString() == IPAddress)
            {
                MAC = Auto3DHelpers.RequestMACAddress(IPAddress);

                if (iRemote.ToString() != info.ToString())
                {
                    _iRemote.ConnectTo(info);
                }
            }
        }
Exemple #12
0
        protected string GetRequest(string url, string jsonString)
        {
            string result;

            try
            {
                Log.Debug("Auto3D: GetRequest to URL = \"" + url + "\"");

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                request.Timeout     = 3000;
                request.ContentType = ContentType;
                request.Accept      = ContentType;
                request.Method      = "GET";

                if (!string.IsNullOrEmpty(jsonString))
                {
                    Log.Debug("Auto3D: JSON-String = \"" + jsonString + "\"");

                    using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                    {
                        streamWriter.Write(jsonString);
                        streamWriter.Flush();
                        streamWriter.Close();
                    }
                }

                Application.DoEvents();
                Thread.Sleep(50);

                using (var httpResponse = (HttpWebResponse)request.GetResponse())
                {
                    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        result = streamReader.ReadToEnd();
                        Log.Debug(result);
                    }
                }

                Application.DoEvents();
            }
            catch (Exception ex)
            {
                Log.Info("Auto3D: GetRequest: " + ex.Message);
                Auto3DHelpers.ShowAuto3DMessage("Request to TV could not be sent: " + ex.Message, false, 0);
                result = string.Empty;
            }

            return(result);
        }
Exemple #13
0
        private bool InternalSendCommand(String command)
        {
            try
            {
                _serialPort.WriteLine(command);
            }
            catch (System.Exception ex)
            {
                Auto3DHelpers.ShowAuto3DMessage("Command to TV could not be sent: " + ex.Message, false, 0);
                Log.Error("Auto3D: Error sending command: " + ex.Message);
                return(false);
            }

            return(true);
        }
Exemple #14
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            RemoteCommand rc = (RemoteCommand)comboBoxCommands.SelectedItem;

            try
            {
                _device.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);
            }
        }
Exemple #15
0
 static void internalStartGenericDevice()
 {
     if (!string.IsNullOrEmpty(IrPortName) && IrPortName != "None" && !IsIrConnected())
     {
         try
         {
             _irToy.Connect(IrPortName);
             Log.Info("Auto3D: IrToy connected");
         }
         catch (Exception ex)
         {
             Auto3DHelpers.ShowAuto3DMessage("Could not connect to IrToy: " + ex.Message, false, 0);
             Log.Error("Auto3D: Could not connect to IrToy: " + ex.Message);
         }
     }
 }
Exemple #16
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);
        }
Exemple #17
0
        public override void ServiceAdded(UPnPService service)
        {
            Log.Info("Auto3D: LG service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host + ", " + service.ParentDevice.UDN + ", " + UDAPnP.Protocol);

            base.ServiceAdded(service);

            if (!ConnectAndPair())
            {
                return;
            }

            if (service.ParentDevice.UDN == UDN)
            {
                MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
                Log.Info("Auto3D: LG service connected!");
            }
        }
Exemple #18
0
        protected bool PostRequest(string url, JointSpaceKey key)
        {
            try
            {
                Log.Debug("Auto3D: PostRequest to URL = \"" + url + "\"");

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                request.Timeout     = 3000;
                request.ContentType = ContentType;
                request.Method      = "POST";

                var jsonString = JsonConvert.SerializeObject(key, Formatting.None);
                Log.Debug("Auto3D: JSON-String = \"" + jsonString + "\"");

                using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                {
                    streamWriter.Write(jsonString);
                    streamWriter.Flush();
                    streamWriter.Close();
                }

                Application.DoEvents();
                Thread.Sleep(50);

                using (var httpResponse = (HttpWebResponse)request.GetResponse())
                {
                    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        var result = streamReader.ReadToEnd();
                        Log.Debug(result);
                    }
                }

                Application.DoEvents();
            }
            catch (Exception ex)
            {
                Log.Info("Auto3D: PostRequest: " + ex.Message);
                Auto3DHelpers.ShowAuto3DMessage("Command to TV could not be sent: " + ex.Message, false, 0);
                return(false);
            }

            return(true);
        }
Exemple #19
0
        public static void ShowAuto3DMessage(String msg, bool forceMPGUI, int seconds)
        {
            try
            {
                if (msg == null)
                {
                    return;
                }
                Form mainForm = Auto3DHelpers.GetMainForm();

                if (Auto3DHelpers.GetMainForm().IsDisposed)
                {
                    return;
                }

                if (mainForm.InvokeRequired)
                {
                    mainForm.Invoke(new ShowMessageDelegate(ShowAuto3DMessage), msg, forceMPGUI, seconds);
                    return;
                }

                if (GUIGraphicsContext.IsFullScreenVideo || forceMPGUI)
                {
                    GUIMessage guiMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_REFRESHRATE_CHANGED, 0, 0, 0, 0, 0, null);

                    guiMsg.Label  = "Auto3D";
                    guiMsg.Label2 = msg;
                    guiMsg.Param1 = seconds;

                    GUIGraphicsContext.SendMessage(guiMsg);
                }
                else
                {
                    MessageBox.Show(msg, "Auto3D");
                }
            }
            catch (Exception ex)
            {
                Log.Error("ShowAuto3DMessage failed: " + ex.Message);
            }
        }
Exemple #20
0
        public override bool SendCommand(RemoteCommand rc)
        {
            try
            {
                Client.Open();
                Client.SetName("Auto3D");
                Client.SetPriority(0);
                Client.TriggerEventsByName(rc.Command);
                Client.Close();
                Log.Info("Auto3D: Trigger Event: " + rc.Command);
            }
            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);
        }
Exemple #21
0
        public static bool Init(String ipAddress)
        {
            int repeat = 0;

            // wait up to 5 seconds for TV

            while (!Auto3DHelpers.Ping(ipAddress))
            {
                Thread.Sleep(1000);

                repeat++;

                if (repeat == 5)
                {
                    return(false);
                }
            }

            if (Auto3DHelpers.Ping(ipAddress))
            {
                unsafe
                {
                    String[] argv  = null;
                    int      count = 0;
                    DirectFBInit(&count, argv);
                    DirectFBSetOption("remote", ipAddress);

                    int ret = jslibrc_Init(&count, argv);
                    _connected = (ret == 0);
                    return(_connected);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #22
0
        private void StartSerial()
        {
            if (_serialPort != null && _serialPort.IsOpen)
            {
                _serialPort.Close();
            }

            _serialPort               = new SerialPort(PortName, 9600, Parity.None, 8, StopBits.One);
            _serialPort.NewLine       = "\r";
            _serialPort.DataReceived += _serialPort_DataReceived;

            try
            {
                if (_serialPort.PortName != "None")
                {
                    _serialPort.Open();
                }
            }
            catch (Exception ex)
            {
                Auto3DHelpers.ShowAuto3DMessage("Opening serial port failed: " + ex.Message, false, 0);
                Log.Info("Auto3D: " + ex.Message);
            }
        }
Exemple #23
0
        public override bool SendCommand(RemoteCommand rc)
        {
            switch (rc.Command)
            {
            case "Home":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("67"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("21"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("HOME"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Back":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("40"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("412"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("BACK"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "OK":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("68"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("20"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("ENTER"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "CursorLeft":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("7"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("14"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("LEFT"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "CursorRight":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("6"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("15"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("RIGHT"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "CursorUp":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("64"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("12"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("UP"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "CursorDown":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("65"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("13"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("DOWN"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Mode3D":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("220"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("400"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("3D_MODE"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Exit":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("91"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("412"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (!InternalSendCommand("EXIT"))
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Off":

                switch (UDAPnP.Protocol)
                {
                case UDAPnP.LGProtocol.LG2011:

                    if (!InternalSendCommand("8"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.LG2012x:

                    if (!InternalSendCommand("1"))
                    {
                        return(false);
                    }
                    break;

                case UDAPnP.LGProtocol.WebOS:

                    if (Auto3DHelpers.Ping(IPAddress))
                    {
                        WebOS.TurnOff();
                    }
                    break;
                }
                break;

            case "Delay":

                // do nothing here
                break;

            default:

                Log.Info("Auto3D: Unknown command - " + rc.Command);
                break;
            }

            return(true);
        }
Exemple #24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="aNewVideoFormat"></param>
        public void DisplayFormatChangeMessage(VideoFormat aNewVideoFormat)
        {
            if (/*GUIGraphicsContext.IsFullScreenVideo &&*/ bShowMessageOnModeChange)
            {
                String format = "";

                switch (aNewVideoFormat)
                {
                case VideoFormat.Fmt2D:

                    switch (GUIGraphicsContext.Render3DMode)
                    {
                    case GUIGraphicsContext.eRender3DMode.None:
                    case GUIGraphicsContext.eRender3DMode.SideBySide:
                    case GUIGraphicsContext.eRender3DMode.TopAndBottom:

                        format = "2D";
                        break;

                    case GUIGraphicsContext.eRender3DMode.SideBySideTo2D:

                        format = "3D SBS -> 2D via MediaPortal";
                        break;

                    case GUIGraphicsContext.eRender3DMode.TopAndBottomTo2D:

                        format = "3D TAB -> 2D via MediaPortal";
                        break;
                    }
                    break;

                case VideoFormat.Fmt3DSBS:

                    format = "3D Side by Side";

                    if (GUIGraphicsContext.Switch3DSides)
                    {
                        format += " Reverse";
                    }
                    break;

                case VideoFormat.Fmt3DTAB:

                    format = "3D Top and Bottom";

                    if (GUIGraphicsContext.Switch3DSides)
                    {
                        format += " Reverse";
                    }
                    break;

                case VideoFormat.Fmt2D3D:

                    format = "2D -> 3D via TV";
                    break;

                case VideoFormat.Mvc3D:

                    format = "3D MVC mode";
                    break;
                }

                Auto3DHelpers.ShowAuto3DMessage("VideoFormat: " + format, true, 4);
            }
        }
Exemple #25
0
 public override bool IsOn()
 {
     return(Auto3DHelpers.Ping(UPnPService.ParentDevice.WebAddress.Host));
 }
Exemple #26
0
 public override bool IsOn()
 {
     return(Auto3DHelpers.Ping(IPAddress));
 }
Exemple #27
0
 public override bool IsOn()
 {
     return(Auto3DHelpers.Ping(_iRemote.GetCurrentTV().Ip));
 }
Exemple #28
0
        public bool SwitchFormat(VideoFormat fmtOld, VideoFormat fmtNew)
        {
            if (/*GUIGraphicsContext.IsFullScreenVideo &&*/ bShowMessageOnModeChange)
            {
                String format = "";

                switch (fmtNew)
                {
                case VideoFormat.Fmt2D:

                    switch (GUIGraphicsContext.Render3DMode)
                    {
                    case GUIGraphicsContext.eRender3DMode.None:
                    case GUIGraphicsContext.eRender3DMode.SideBySide:
                    case GUIGraphicsContext.eRender3DMode.TopAndBottom:

                        format = "2D";
                        break;

                    case GUIGraphicsContext.eRender3DMode.SideBySideTo2D:

                        format = "3D SBS -> 2D via MediaPortal";
                        break;

                    case GUIGraphicsContext.eRender3DMode.TopAndBottomTo2D:

                        format = "3D TAB -> 2D via MediaPortal";
                        break;
                    }
                    break;

                case VideoFormat.Fmt3DSBS:

                    format = "3D Side by Side";

                    if (GUIGraphicsContext.Switch3DSides)
                    {
                        format += " Reverse";
                    }
                    break;

                case VideoFormat.Fmt3DTAB:

                    format = "3D Top and Bottom";

                    if (GUIGraphicsContext.Switch3DSides)
                    {
                        format += " Reverse";
                    }
                    break;

                case VideoFormat.Fmt2D3D:

                    format = "2D -> 3D via TV";
                    break;
                }

                Auto3DHelpers.ShowAuto3DMessage("VideoFormat: " + format, true, 4);
            }

            Log.Info("Auto3D: Begin SwitchToFormat");

            try
            {
                switch (fmtNew)
                {
                case VideoFormat.Fmt3DSBS:

                    if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands2D3DSBS))
                    {
                        return(false);
                    }
                    break;

                case VideoFormat.Fmt3DTAB:

                    if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands2D3DTAB))
                    {
                        return(false);
                    }
                    break;

                case VideoFormat.Fmt2D3D:

                    if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands2D3D))
                    {
                        return(false);
                    }
                    break;

                case VideoFormat.Fmt2D:

                    switch (fmtOld)
                    {
                    case VideoFormat.Fmt3DSBS:

                        if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands3DSBS2D))
                        {
                            return(false);
                        }
                        break;

                    case VideoFormat.Fmt3DTAB:

                        if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands3DTAB2D))
                        {
                            return(false);
                        }
                        break;

                    case VideoFormat.Fmt2D3D:

                        if (!SendCommandList(SelectedDeviceModel.RemoteCommandSequences.Commands3D2D))
                        {
                            return(false);
                        }
                        break;
                    }

                    break;
                }

                if (bSendEventGhostEvents)
                {
                    SendEventGhostEvent(fmtNew);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Log.Info("Auto3D: " + ex.Message);
                return(false);
            }
            finally
            {
                Log.Info("Auto3D: End SwitchToFormat");
            }
        }