Esempio n. 1
0
        public static async Task Init()
        {
            CurrentMode = App.Mode;

            if (CurrentMode == Mode.Cellular)
            {
                if (App.isRPi)
                {
                    await WebSocketCmd.OpenSocket("drone", "controller");
                }
                else
                {
                    await WebSocketCmd.OpenSocket("controller", App.DroneName);
                }
            }
            else
            {
                var hostName = string.Empty;

                if (!App.isRPi)
                {
                    hostName = App.HostName;
                }

                if (CurrentMode == Mode.WiFiTCP)
                {
                    await StreamSocketCmd.NetworkInit(hostName);
                }
                if (CurrentMode == Mode.WiFiUDP)
                {
                    await DatagramSocketCmd.NetworkInit(hostName);
                }
            }
        }
Esempio n. 2
0
        private async void connectButton_Click(object sender, RoutedEventArgs e)
        {
            if (App.Mode == Mode.Cellular)
            {
                return;
            }

            WiFiFlyout.Hide();

            var hostName = App.HostName;

            if (!string.IsNullOrWhiteSpace(deviceName.Text))
            {
                hostName = deviceName.Text;
            }

            if (App.Mode == Mode.WiFiTCP)
            {
                await StreamSocketCmd.NetworkInit(hostName);
            }
            if (App.Mode == Mode.WiFiUDP)
            {
                await DatagramSocketCmd.NetworkInit(hostName);
            }
        }