Пример #1
0
        public string ConnectEquipment_old()
        {
            string message = @"{""method"": ""set_connected"", ""params"": [true], ""id"": 1}";

            message = message + "\r\n";
            string output = SocketServerClass.ConnectToServerAndSendMessage(IPAddress.Parse("127.0.0.1"), ServerPort, message, out Error);
            string attribs = "", id = "";

            Parse_PHD_ResponseString(output, out attribs, out id);
            if (!output.Contains("{\"jsonrpc\":\"2.0\",\"result\":0,\"id\":1}\r\n"))
            {
                Error = -2;
            }
            //good response: {"jsonrpc":"2.0","result":0,"id":2}
            //bad response:  {"jsonrpc":"2.0","error":{"code":1,"message":"cannot connect equipment when Connect Equipment dialog is open"},"id":1}
            ErrorSt = output;
            //Error = 0;
            if (Error < 0)
            {
                Logging.AddLog("PHD2 equipment connection error", LogLevel.Important, Highlight.Error);
                Logging.AddLog("Error: " + ErrorSt, LogLevel.Chat, Highlight.Error);
            }
            else
            {
                Logging.AddLog("PHD2 equipment connected", LogLevel.Activity);
            }
            return(output);
        }
Пример #2
0
        public string GET_TelescopePos()
        {
            string output = SocketServerClass.ConnectToServerAndSendMessage(IPAddress.Parse("127.0.0.1"), ServerPort, "GETSCOPERADEC\r\n", out Error);

            ErrorSt = output;
            Logging.AddLog("GET_TelescopePos: " + output, LogLevel.Debug, Highlight.Error);

            return(output);
        }
Пример #3
0
        public string PerformCommand(string CommandName)
        {
            string output = SocketServerClass.ConnectToServerAndSendMessage(IPAddress.Parse("127.0.0.1"), ServerPort, CommandName + "\r\n", out Error);

            ErrorSt = output;
            //Error = 0;
            if (Error < 0)
            {
                Logging.AddLog("Error for CdC command [" + CommandName + "]", LogLevel.Important, Highlight.Error);
            }
            else
            {
                Logging.AddLog("CdC command [" + CommandName + "] ok", LogLevel.Activity);
            }
            return(output);
        }
Пример #4
0
        public string ConnectTelescope_old(string ChartName = "")
        {
            //Select CHART or use default (i thing it will always be Chart_1

            string output = SocketServerClass.ConnectToServerAndSendMessage(IPAddress.Parse("127.0.0.1"), ServerPort, "CONNECTTELESCOPE\r\n", out Error);

            ErrorSt = output;
            //Error = 0;
            if (Error < 0)
            {
                Logging.AddLog("Telescope connection error in CdC", LogLevel.Important, Highlight.Error);
            }
            else
            {
                Logging.AddLog("Telescope connected in CdC", LogLevel.Activity);
            }
            return(output);
        }