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); } } }
public static void SendData(byte[] bytes) { if (CurrentMode == Mode.WiFiTCP) { StreamSocketCmd.SendDataToHost(bytes); } if (CurrentMode == Mode.WiFiUDP) { DatagramSocketCmd.SendDataToHost(bytes); } if (CurrentMode == Mode.Cellular) { WebSocketCmd.SendDataToHost(bytes); } }