More than 20 ports in a PortSet?
Hi, As part of the definition of the operations of a service, I need to allocate more than 20 ports in a given PortSet.
However, I think I can only use this: Microsoft.Ccr.Core.PortSet<T0, ..., T19>
How could I add T20, T21, T22,...> ? Or, if not possible, how could I use a second PortSet and use the operations defined in the second and the first PortSet transparently?
Thanks.
Please use the new variable type PortSet, now available in 1.5. You can then have as many operation types as you want. Its explained on this post (you can use this portset for Desktop or CompactFramework .NET services)
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1442947&SiteID=1
(second reply shows the example of an operation port using the variable type port set)
Thanks! I got it working changing the code as follows:
Code Snippet
public class DriveControlEvents : PortSet
{
public DriveControlEvents() :
base( typeof(OnLoad), typeof(OnClosed), typeof(OnChangeJoystick), typeof(OnConnect), typeof(OnConnectMotor), typeof(OnConnectSonar), typeof(OnConnectSickLRF), typeof(OnConnectArticulatedArm), typeof(OnConnectWebCam), typeof(OnStartService), typeof(OnMove), typeof(OnRotate), typeof(OnTranslate), typeof(OnEStop), typeof(OnApplyJointParameters), typeof(OnDisconnectSonar), typeof(OnDisconnectSickLRF), typeof(OnDisconnectWebCam), typeof(OnLogSetting), typeof(OnQueryFrame), typeof(OnConnectSetting), typeof(OnOptionSettings)) {
}
}
Also, I had to replace the post messages (the service posts to itself a number of times) with the PostUnknownType method:
Code Snippet
private void btnConnectSonar_Click(object sender, EventArgs e)
{
string sonar = ServiceByContract(pxsonar.Contract.Identifier);
if (sonar != null)
{
_eventsPort.PostUnknownType(new OnConnectSonar(this, sonar));
}
}
Additionally, in the main Interleave I had to replace Arbiter.Receive with ArbiterReceiveFromPortSet and Arbiter.ReceiveWithIterator with Arbiter.ReceiveWithIteratorFromPortSet for those operations defined for port _eventPort.
Now, that I am using different ports with different PortSet definitions (generics PortSet<> and type PortSet) I wonder whether or not I should port everything to the new 1.5 PortSet type?
Is the PortSet<> going to be deprecated in the future or am I worrying too much?
Thanks