public Task SelectAsync(Func <bool> sync) { var r = new SelectCaseReceiver <T>(sync); return(Task = Task.WhenAny( Channels.Select(c => c.ReceiveInto(r).ContinueWith(t => ReceivedValue = t.Result, TaskContinuationOptions.ExecuteSynchronously)))); }
protected virtual void OnReceivedValue(string rawValue, double value) { if (!double.IsNaN(value)) { ReceivedValue?.Invoke(this, new ValueEventArgs <double>(rawValue, value)); } }
void Update() { received = NetworkManager.GetReceived(); if (received != null) { /* * Debug.Log("server message received as: " +received.arm_disarm+" " +received.flight_mode+" " +received.pressure+" " +received.clamp+" " +received.light+" " +received.throttle+" " +received.roll+" " +received.pitch+" " +received.yaw+" " * ); */ pressureIndicator1.SendMessage("Set", received.pressure); clampIndicator.SendMessage("Set", received.clamp); //lightIndicator.SendMessage("Set", received.light); pressureIndicator2.SendMessage("Set", received.pressure); pixhawkConection.SendMessage("Set", received.connection_pixhawk); } else { pixhawkConection.SendMessage("Set", false); } }
public void simple_synchronous_call_getreceivedvalue_returns_result_with_proxy() { AddressClient client = new AddressClient(); ReceivedValue result = client.GetReceivedValue(Network.Doge, "DFundmtrigzA6E25Swr2pRe4Eb79bGP8G1"); Assert.IsNotNull(result); Assert.IsTrue(result.Status == Consts.Success); Assert.IsTrue(result.Data.Address == "DFundmtrigzA6E25Swr2pRe4Eb79bGP8G1"); }
public Task SelectAsync(Func <bool> sync) { if (Channel == null || !Channel.IsOpen) { return(Task.FromResult(false)); } var r = new SelectCaseReceiver <T>(sync); return(Task = Channel.ReceiveInto(r).ContinueWith(t => ReceivedValue = t.Result, TaskContinuationOptions.ExecuteSynchronously)); }
void OnEnable() { if (_instance == null) { _instance = this; } Debug.Log("Activado"); ConnectionConstants connection = ConnectionSettings.Load(); string Host = connection.IP; int Port = connection.PORT; String message = ""; connectionStatus = GameObject.Find("ConnectionStatus").GetComponent <Image>(); connectionStatus.color = Color.red; receivedJSON = new ReceivedValue(); mySocket = new TcpClient(); //SET UP SOCKET CONNECTION try { Debug.Log("Trying to connect: " + Host + ":" + Port.ToString()); mySocket.Connect(Host, Port); theStream = mySocket.GetStream(); connectionStatus.color = Color.green; message += "Connection ready to write"; } catch (Exception e) { Debug.Log(e); message += "Connection NOT ready to write"; } try { clientReceiveThread = new Thread(new ThreadStart(Receive)); clientReceiveThread.IsBackground = true; clientReceiveThread.Start(); message += " and ready to read"; } catch (Exception e) { message += " and NOT ready to read"; } Debug.Log(message); }
public async Task <ReceivedValue> GetReceivedValueAsync(Network network, string address) { ReceivedValue response = await GetQuery <ReceivedValue, AddressReceivedValueError>(string.Format(GetReceivedValueUrl, network._network, address)); return(response); }