In this post, I will attempt to give an overview of the various methods in which you can add/register a device with BizTalk RFID. You can use "RFID Manager" (the MMC based management console which ships with BizTalk RFID) to check out most of these concepts.  The following are the main ways in which a device can be registered with BizTalk RFID:

1. Device Discovery: If your device provider supports discovery, it can post a discovery message to BizTalk RFID. If BizTalk RFID determines that the discovery information corresponds to that of a new device, it will add this device to its list of devices and will set it to "Unconfigured" state. The newly added device will instantly appear in the Devices view in RFID Manager. The main thing to note here is that you need to "enable" the device before you can start using this device. Enabling such a device typically involves providing the authentication information required to connect to this device (if any). To do this, you can right-click on a device in the Devices node of RFID Manager, and click "Enable".

You can also use the "Trigger Discovery" functionality to manually trigger the above discovery process. To do this, you can right-click on a provider in the Providers node of RFID Manager, and click "Trigger Now".

2. Adding a device manually: You can use the Add Device Wizard in RFID Manager to add a device. You need to specify the following:

  • The name of the device provider: i.e. what provider should this new device use)
  • The connection information (i.e. how should BizTalk RFID connect to this device): For e.g. if you select TCP/IP, you need to specify the IP address and port number information of the device. In this list, you will see only those specific transport settings that are supported by your particular device provider. For e.g. if you don't see "Serial", it means your device provider doesn't support this particular transport setting.
  • The authentication information required to connect to the device (if applicable)
  • The DeviceGroup under which this device should be added (by default, it is "RootDeviceGroup" which is the root of the hierarchy)

Add Device Wizard will try to connect to the device based on the connection information you specified and will retrieve certain properties such as name, location and description. You can optionally change these values and complete the device addition. If RFID Manager is not able to connect based on the specified connection information, you still have the option of adding the device ("offline" mode). Unlike a device added through discovery, a device added in this way is by default in the "enabled" and usable state.

3. Bulk Addition of devices: Very similar to 2) above, but here you have the option of adding more than one device at the same time. In Add Device Wizard in RFID Manager, you can select the "Add Multiple Devices" option and you can specify a range of addresses. RFID Manager will attempt to connect to devices in this range and you also have the option to specify that devices found in this fashion be added automatically.

4. Your own client application: You can write your own client application which uses the BizTalk RFID Object Model to add a device. You can use DeviceManagerProxy.AddDevice() and specify the above details and choose whether you want to add the device in online mode or offline mode. You need to add references to "Microsoft.Rfid.Design.dll", "Microsoft.Rfid.SpiSdk.dll", "Microsoft.Rfid.ManagementWebServiceProxies.dll".

The following is the SAMPLE code for how this can be done (you need to have Contoso simulator running if you want to really see this in action):

using System;
using Microsoft.SensorServices.Rfid.Design;
using Microsoft.SensorServices.Rfid.Dspi;
using Microsoft.SensorServices.Rfid.Management;

namespace AddDeviceApp
{
    class Program
   
{
        
static void Main(string[] args)
         {
              TcpTransportSettings transportSettings = new TcpTransportSettings("127.0.0.1", 6666);
              ConnectionInformation connectionInformation = new ConnectionInformation("Contoso", transportSettings);
              
UserDeviceInformation deviceInfo = new UserDeviceInformation(connectionInformation, null);

             
// Build the device definition
             
DeviceDefinition deviceDefinition = new DeviceDefinition(deviceInfo, "ContosoTestDevice", null);
             
DeviceManagerProxy deviceManagerProxy = new DeviceManagerProxy();

              try
             
{
                  deviceManagerProxy.AddDevice(deviceDefinition,
DeviceGroupDefinition.RootDeviceGroupName, false);
                 
Console.WriteLine("Device added successfully in online mode");
              }
             
catch (RfidClientException rfidException)
              {
                    
// hit exception while trying to add in online mode
 
                    Console.WriteLine("Online AddDevice encountered exception {0}", rfidException);
                     // process exception appropriately
              }

              Console.ReadLine();
        }
   }
}

Isn't this cool :)?  You can explore the full power of the Object Model using Visual Studio Intellisense or by looking at the BizTalk RFID developer reference at http://msdn2.microsoft.com/en-us/library/bb769184.aspx.

That's it for now. If you have any specific topics that you would like to see, please do give me feedback and I will attempt to address it in future posts.

-Kalyan