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(); }
void OnPortRegistration(uint portId, int register, IntPtr args) { if (PortChanged != null) { PortReference port = MapPort(portId); PortChanged(this, new PortRegistrationEventArgs(port, register > 0 ? ChangeType.New : ChangeType.Deleted)); } }
void OnPortRename(uint portId, string oldName, string newName, IntPtr arg) { if (PortChanged != null) { PortReference port = MapPort(portId); port.FullName = newName; PortChanged(this, new PortRegistrationEventArgs(port, ChangeType.Renamed)); } }
void OnPortConnect(uint a, uint b, int connect, IntPtr args) { if (ConnectionChanged != null) { PortReference outlet = MapPort(a); PortReference inlet = MapPort(b); ConnectionChanged(this, new ConnectionChangeEventArgs(outlet, inlet, connect > 0 ? ChangeType.New : ChangeType.Deleted)); } }
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(); }
protected override void Check() { var d = new D { A = 7, C = 3 }; var r = new PortReference(d, typeof(D), "M", new[] { typeof(bool), typeof(int) }, typeof(bool), false); var p = new PortReference(d, typeof(D), "Q", new[] { typeof(bool), typeof(int) }, typeof(bool), true); d.B = new PortBinding(r, p); var m = InitializeModel(d); Create(m); ExecutableStateFormulas.ShouldBeEmpty(); RootComponents.Length.ShouldBe(1); StateSlotCount.ShouldBe(2); var root = RootComponents[0]; root.ShouldBeOfType <D>(); r = ((D)root).B.RequiredPort; p = ((D)root).B.ProvidedPort; r.TargetObject.ShouldBe(root); r.DeclaringType.ShouldBe(typeof(D)); r.PortName.ShouldBe("M"); r.ArgumentTypes.ShouldBe(new[] { typeof(bool), typeof(int) }); r.ReturnType.ShouldBe(typeof(bool)); r.IsVirtualCall.ShouldBe(false); p.TargetObject.ShouldBe(root); p.DeclaringType.ShouldBe(typeof(D)); p.PortName.ShouldBe("Q"); p.ArgumentTypes.ShouldBe(new[] { typeof(bool), typeof(int) }); p.ReturnType.ShouldBe(typeof(bool)); p.IsVirtualCall.ShouldBe(true); ((D)root).A.ShouldBe(7); ((D)root).C.ShouldBe(3); }
/// <summary> /// Initializes a new instance of the <see cref="JackSharp.Events.ConnectionChangeEventArgs"/> class. /// </summary> /// <param name="outlet">Outlet.</param> /// <param name="inlet">Inlet.</param> /// <param name="changeType">Change type.</param> public ConnectionChangeEventArgs(PortReference outlet, PortReference inlet, ChangeType changeType) { Outlet = outlet; Inlet = inlet; ChangeType = changeType; }
/// <summary> /// Disconnect the specified outPort and inPort. /// </summary> /// <param name="outPort">Out port.</param> /// <param name="inPort">In port.</param> public bool Disconnect(PortReference outPort, PortReference inPort) { unsafe { return(PortApi.Disconnect(JackClient, outPort.FullName, inPort.FullName) == 0); } }
/// <summary> /// Initializes a new instance of the <see cref="JackSharp.Events.PortRenameEventArgs"/> class. /// </summary> /// <param name="port">Port.</param> public PortRenameEventArgs(PortReference port) { Port = port; }
/// <summary> /// Initializes a new instance of the <see cref="JackSharp.Events.PortRegistrationEventArgs"/> class. /// </summary> /// <param name="port">Port.</param> /// <param name="changeType">Change type.</param> public PortRegistrationEventArgs(PortReference port, ChangeType changeType) { Port = port; ChangeType = changeType; }