public virtual void CorrectPortsOnConnectionChanged() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; PortReference inPort = null; PortReference outPort = null; _controller.ConnectionChanged += (sender, e) => { inPort = e.Inlet; outPort = e.Outlet; }; _controller.Start(); _controller.Connect(receiver.FirstOutPort, receiver.FirstInPort); Thread.Sleep(100); Assert.AreNotEqual(null, inPort); Assert.AreNotEqual(null, outPort); Assert.AreEqual(Direction.In, inPort.Direction); Assert.AreEqual(Direction.Out, outPort.Direction); inPort = null; outPort = null; _controller.Disconnect(receiver.FirstOutPort, receiver.FirstInPort); Thread.Sleep(100); Assert.AreNotEqual(null, inPort); Assert.AreNotEqual(null, outPort); Assert.AreEqual(Direction.In, inPort.Direction); Assert.AreEqual(Direction.Out, outPort.Direction); _controller.Stop(); }
public virtual void InitialPorts() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; _controller.Start(); Thread.Sleep(100); _controller.Stop(); Assert.AreNotEqual(0, receiver.PortsFound); }
public virtual void PortAndClientNames() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; _controller.Start(); Thread.Sleep(100); PortReference outPort = receiver.FirstOutPort; Assert.IsTrue(!string.IsNullOrEmpty(outPort.ClientName)); Assert.IsTrue(!string.IsNullOrEmpty(outPort.PortName)); _controller.Stop(); }
public virtual void PortsEquality() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; _controller.ConnectionChanged += receiver.IsConnectionEqual; _controller.Start(); _controller.Connect(receiver.FirstOutPort, receiver.FirstInPort); Thread.Sleep(100); _controller.Disconnect(receiver.FirstOutPort, receiver.FirstInPort); Thread.Sleep(100); Assert.AreEqual(1, receiver.ConnectionsFound); _controller.Stop(); }
public virtual void CallbacksOnRestart() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; _controller.Start(); Thread.Sleep(100); _controller.Stop(); int firstRun = receiver.PortsFound; _controller.Start(); Thread.Sleep(100); _controller.Stop(); Assert.AreNotEqual(firstRun, receiver.PortsFound); }
public virtual void DisconnectDisconnectedPorts() { ControllerReceiver receiver = new ControllerReceiver(); _controller.PortChanged += receiver.PortChanged; _controller.ConnectionChanged += receiver.ConnectionChanged; _controller.Start(); Assert.True(_controller.Connect(receiver.FirstOutPort, receiver.FirstInPort)); Thread.Sleep(100); Assert.True(_controller.Disconnect(receiver.FirstOutPort, receiver.FirstInPort)); Thread.Sleep(100); Assert.False(_controller.Disconnect(receiver.FirstOutPort, receiver.FirstInPort)); Thread.Sleep(100); _controller.Stop(); }
public virtual void AutoConnect() { using (Controller controller = new Controller("testController")) using (Processor client = new Processor("testClient", 2, 2, 0, 0, true)) { ControllerReceiver receiver = new ControllerReceiver(); controller.ConnectionChanged += receiver.ConnectionChanged; controller.Start(); Thread.Sleep(100); int connectionsWithoutClient = receiver.ConnectionsFound; client.Start(); Thread.Sleep(100); Assert.AreNotEqual(connectionsWithoutClient, receiver.ConnectionsFound); client.Stop(); controller.Stop(); } }
// Update is called once per frame void Update() { myTrans.rotation = Quaternion.RotateTowards(myTrans.rotation, ControllerReceiver.GetQuaternion("GyroAttitudeRaw"), 90); myTrans.position = myTrans.position + new Vector3(ControllerReceiver.GetVector2("Joystick").x, ControllerReceiver.GetVector2("Joystick").y, 0) * speed * Time.deltaTime; }