private void ConnectionListItem_Selected(ConnectionListItem item, ConnectionSearchInfo connectionSearchInfo) { NGIMUConnection connection = FindObjectOfType <NGIMUConnection>(); if (connection == null) { Debug.LogError("No NGIMUConnection object could be found in the scene hierarchy."); return; } Deactivate(); connection.ConnectTo(connectionSearchInfo); }
private void AutoConnector_DeviceExpired(ConnectionSearchInfo obj) { Debug.Log("Device Expired: " + obj.DeviceDescriptor); lock (syncObject) { ConnectionListItemStub foundItem; if (foundConnections.TryGetValue(obj, out foundItem) == false) { return; } foundItem.ShouldRemove = true; } }
private void AutoConnector_DeviceDiscovered(ConnectionSearchInfo obj) { Debug.Log("Device Discovered: " + obj.DeviceDescriptor); lock (syncObject) { ConnectionListItemStub foundItem; if (foundConnections.TryGetValue(obj, out foundItem) == false) { foundConnections.Add(obj, new ConnectionListItemStub() { Info = obj }); return; } foundItem.ShouldRemove = false; } }
public void ConnectTo(ConnectionSearchInfo info) { reporter.Clear(); Debug.Log("ConnectTo (ConnectionSearchInfo)"); switch (info.ConnectionType) { case ConnectionType.Udp: UdpConnectionInfo udpInfo = info.ConnectionInfo as UdpConnectionInfo; Thread thread = new Thread(delegate() { try { Debug.Log("Configure unique UDP connection"); UdpConnectionInfo newInfo = Connection.ConfigureUniqueUdpConnection(udpInfo, reporter); ConnectTo(newInfo); } catch (Exception ex) { reporter.OnException(this, new ExceptionEventArgs("The device could not be configured to use a unique connection. " + ex.Message, ex)); } }); thread.Name = "Configure Unique UDP Connection"; thread.Start(); break; case ConnectionType.Serial: ConnectTo(info.ConnectionInfo as SerialConnectionInfo); break; default: break; } }