title: Sharing a single resource (serial port) between multiple applications
body: <p>I need some architectural guidance. Here's my objective.</p>
  
  <p>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.</p>
  
  <p>I need to provide a service, the exposes several interfaces. The interfaces might be called something like:</p>
  
  <blockquote>
    <p>IRobotArm<br>
    IGrabberAttachment<br>
    IDrillAttachment</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Ideas please!</p>