private void button_LeftRotate_Click(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("5|0"); } }
private void button_Backwards_Click(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("2|0"); } }
private void button_TurnRight_Click(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("4|0"); } }
private void slider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("11|" + slider_ServoControl.Value); } }
private void radioButton_RLedOn_Checked(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("10|1"); this.UiRLed.Fill = new SolidColorBrush(Colors.Red); } }
public void ArgumentExceptions() { var endpoint = NetworkAddress.Parse("127.0.0.1:11000").IPEndPoint; var s = new ClientSocketConnection(1, endpoint, new NetworkingOptions(), new SslOptions(), new NullLoggerFactory()); var c = new ClientMessageConnection(s, new NullLoggerFactory()); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await c.SendAsync(null)); }
private void OnExit_Click(object sender, EventArgs e) { if (connection != null) { connection.Stop(); connection = null; } this.ParentForm.Close(); }
public async Task Exceptions() { var endpoint = NetworkAddress.Parse("127.0.0.1:5701").IPEndPoint; var options = new SocketOptions(); await using var connection = new ClientSocketConnection(0, endpoint, options, new SslOptions(), new NullLoggerFactory(), 3); // OnReceiveMessageBytes is missing Assert.ThrowsAsync <InvalidOperationException>(async() => await connection.ConnectAsync(default));
private async void button_Ultrasonic_Click(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("12|0"); //txtUltrasonic.Text += await ClientSocketConnection.GetData() + "\n"; } }
private void btnConnect_Click(object sender, RoutedEventArgs e) { var server = txtBoxServer.Text; var port = txtBoxPort.Text; ClientSocketConnection.Connect(server, port); ClientSocketConnection.NewMessageReady += GetData; commandAllowed = true; txtBoxStatus.Text = ClientSocketConnection.Status.ToString(); }
public async Task OnReceiveMessage() { var endpoint = NetworkAddress.Parse("127.0.0.1:11000").IPEndPoint; var s = new ClientSocketConnection(1, endpoint, new NetworkingOptions(), new SslOptions(), new NullLoggerFactory()); var c = new ClientMessageConnection(s, new NullLoggerFactory()) { OnReceiveMessage = OnReceiveMessageNotImplemented }; Assert.That(c.OnReceiveMessage, Is.Not.Null); Assert.Throws <NotImplementedException>(() => c.OnReceiveMessage(default, default));
private void radioButton_RLedOff_Checked(object sender, RoutedEventArgs e) { if (commandAllowed) { ClientSocketConnection.SendMessage("10|0"); if (UiRLed != null) { this.UiRLed.Fill = new SolidColorBrush(Colors.Gray); } } }
// Use this for initialization void Start() { client = new ClientSocketConnection(); client.Connect("192.168.1.51", "8027"); EventManager.StartListening("RightButton", new UnityAction(RightButton)); EventManager.StartListening("LeftButton", new UnityAction(LeftButton)); EventManager.StartListening("ForwardButton", new UnityAction(ForwardButton)); EventManager.StartListening("ReverseButton", new UnityAction(ReverseButton)); EventManager.StartListening("StopButton", new UnityAction(StopButton)); }
private void SetLeftMotorSpeed(object sender, object e) { if (commandAllowed) { ClientSocketConnection.SendMessage("7|" + slider_LeftMotorSpeed.Value); if (this.checkBox_SyncLeftRightSpeed.IsChecked.Value) { ClientSocketConnection.SendMessage("8|" + slider_RightMotorSpeed.Value); } _timer.Stop(); _timer.Tick -= SetLeftMotorSpeed; } }
protected void InitConnections() { SocketSettings srvSet = new SocketSettings(); // srvSet. //Connect to UMD Server //umdSrv = new ClientSocketConnection(umdurl, umdport, name + "_ToUMD", ref sm, rm); umdSrv = new ClientSocketConnection(srvSet, ref sm, rm); umdSrv.Connect(); //Connect to WinSys Server winSys = new ClientSocketConnection(srvSet, ref sm, rm); winSys.Connect(); }
private void Connect(string address, int port) { if (connection != null) { connection.Stop(); } connection = new ClientSocketConnection(address, port); connection.OnConnectionEstablished += new Action(connection_OnConnectionEstablished); connection.OnServerNotFound += new Action(connection_OnServerNotFound); connection.OnMapReceived += new Action <SimpleImage>(connection_OnMapReceived); connection.OnFogReceived += new Action <SimpleImage>(connection_OnFogReceived); connection.OnFogUpdateReceived += new Action <FogUpdate>(connection_OnFogUpdateReceived); connection.OnGridSizeReceived += new Action <bool, int>(connection_OnGridSizeReceived); connection.OnGridColorReceived += new Action <SimpleColor>(connection_OnGridColorReceived); connection.OnBlackoutReceived += new Action <bool>(connection_OnBlackoutReceived); connection.OnExitReceived += new Action(connection_OnExitReceived); this.ParentForm.Text = string.Format("{0} - Connecting to {1}:{2}...", initialParentFormText, address, port); connection.Start(); }
//public virtual void InitConnections(string umdurl = "localhost", ushort umdport = 81, string winurl="localhost", ushort winport=8181) public virtual void InitConnections(SocketSettings srvSet) { if (winSys == null) { this.winurl = srvSet.clienturl; //winurl; this.winport = srvSet.clientport; // winport; rm = new ReceiveMsgDelegate(ReceiveMessageCB); //Connect to WinSys Server winSys = new ClientSocketConnection(srvSet, ref smWinsys, rm); winSys.Connect(); } if (umdSrv == null) { this.umdurl = srvSet.url; this.umdport = srvSet.port; //Connect to UMD Server umdSrv = new ClientSocketConnection(srvSet, ref smUMDSrv, rm); umdSrv.Connect(); } else { umdSrv.ReInit(ref smUMDSrv); } }