I need some architectural guidance. Here's my objective.
I have a piece of robotic hardware that performs multiple functions (i.e. it has several distinct logical devices). For the sake of illustration, let's say it is a robot arm with interchangeable attachments. The hardware has a single serial port that it uses to connect to a PC, so that it can be controlled by various different applications. The arm itself and the interchangeable attachments are addressable over the single serial port.
I need to provide a service, the exposes several interfaces. The interfaces might be called something like:
IRobotArm
IGrabberAttachment
IDrillAttachment
and so on. Now, here's the tricky part. Each interface needs to be accessed by completely different, isolated applications. So the robot arm and the grabber attachment might be controlled by completely different applications, simultaneously - or they might be controlled by the same application.
So that's my architectural puzzle. How do I provide multiple interfaces to multiple client applications, while ensuring only one instance of the serial port is created and that commands can be correctly serialized, etc.
One more additional requirement: I'll be working in .NET/C# but the client applications may well expect to use a COM interface, so the solution needs to work with COM Interop.
Ideas please!