The BizTalk-RFID infrastructure is designed to allow one connection at time only. This seems to be a bad design decision, but it is not.
This is a really good design, because devices are individual hardware units, which mostly can deal with one task only. If you have a more intelligent device,
there is always a way to capture the device-magic in the DSPI implementation itself.
The reason why I post this is following. Imagine you have an application which synchronously opens the connection to device as shown in the next example:
public void OpenConnectionTest() { DeviceConnection connection = new DeviceConnection("localhost", "Device01"); connection.Open(); } |
Imagine now there is also another application, or even more of them, which would like to obtain the connection to the same RFID device too. By design is this not possible, but you can write the code which simultaneously is trying to obtain the connection. This is what you can control, but what you cannot do is to take a control of the code of some application which you do not own.
This is bad, but it could be a common scenario. This could make you a trouble if some other application crashes and forget to close the connection. In this case there is no way to obtain the new connection until the RFID service is restarted.
Following code shows how to obtain a special kind of connection, so called administrative connection. By using of such kind of the connection you can do with device whatever you want (almost). Following code shows how to kill the connection opened by some other device:
public void OpenConnectionTest()
{ DeviceStatus[] statuses = proxy.GetDeviceStatus(new string[]{"Device01"}); foreach (DeviceStatus status in statuses) { if (status.ConnectionState == DeviceConnectionState.Open) { proxy.KillConnection(status.Name); }
// Shows how to open an administrative connection. else Guid guid = proxy.OpenAdministrationConnection(status.Name); } } |
Posted
Jun 10 2007, 08:19 PM
by
Damir Dobric