Пример #1
0
        public async Task <bool> InitConnectionAsync(string ip, int port)
        {
            URL  = ip;
            Port = port;

            if (IPAddress.TryParse(ip, out var iP))
            {
                _connection = new RozumConnection($"http://{ip}:{port}/");

                if (await GetStatusMotionAsync() != "Robot does not respond")
                {
                    IsConnected = true;
                    return(true);
                }

                IsConnected = false;
                return(false);
            }
            else
            {
                _connection = new RozumConnection($"http://{ip}:{port}/");
                IsConnected = false;
                return(false);
            }
        }
Пример #2
0
        public async Task <bool> InitConnectionAsync()
        {
            if (IPAddress.TryParse(URL, out var iP))
            {
                _connection = new RozumConnection($"http://{URL}:{Port}/");

                if (await GetStatusMotionAsync() != "Robot does not respond")
                {
                    IsConnected = true;
                    return(true);
                }

                IsConnected = false;
                return(false);
            }
            else
            {
                _connection = new RozumConnection($"http://{URL}:{Port}/");
                IsConnected = false;
                return(false);
            }
        }