Exemplo n.º 1
0
        public bool SwitchToUDP(string ipAddr, string port)
        {
            //If wireless connection exists
            //if SSID is PMC
            //if Is Currently Serial
            // ESX, ESY
            //If is currently TCP
            //ESY
            //Verify
            //Save result to ascom

            bool result = false;

            if (IsConnectedToWirelessNetwork)                        //If wireless connection exists
            {
                if (ConnectedSsidName.Contains("PMC"))               //if SSID is PMC
                {
                    if (ConnectionMethod == ConnectionMethod.Serial) //if Is Currently Serial
                    {
                        //esx
                        SerialSendMessage("ESX!");
                        if (MountModel == MountModel.iExos100)
                        {
                            //esy
                            TcpSendMessage("ESY!");
                        }
                    }
                    if (ConnectionMethod == ConnectionMethod.TCP)
                    {
                        //ESY
                        TcpSendMessage("ESY!");
                    }
                    this.IpAddress = ipAddr;
                    this.IpPort    = port;
                    result         = IsConnectedViaTcp();
                    if (result)
                    {
                        this.ConnectionMethod = ConnectionMethod.UDP;
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public bool SwitchToTCP(string ipAddr, string port)
        {
            //If Wireless connection exists
            //if SSID is PMC
            //If Is Currently Serial
            //ESX
            //If is currently UDP
            //ESY
            //Verify
            //Save result to ascom

            bool result = false;

            if (IsConnectedToWirelessNetwork)
            {
                if (ConnectedSsidName.Contains("PMC"))
                {
                    if (ConnectionMethod == ConnectionMethod.Serial)
                    {
                        SendRawCommand("ESX!");
                    }
                    if (ConnectionMethod == ConnectionMethod.UDP)
                    {
                        SendRawCommand("ESY!");
                    }
                    this.IpAddress = ipAddr;
                    this.IpPort    = port;
                    result         = IsConnectedViaTcp();
                    if (result)
                    {
                        this.ConnectionMethod = ConnectionMethod.TCP;
                        return(true);
                    }
                }
            }
            return(false);
        }