Jaa


Best practices for finding available devices

The Unified POS specification, “UnifiedPOS Retail Peripheral Architecture” available at https://www.nrf-arts.org/UnifiedPOS/default.htm, makes a distinction between a Device Name and a Logical Device Name.  The device name is expected to be unique among other devices within the same device class.  The default value of the Device Name key is the Service Object Name.   There are cases, however, where the application or system administrator, may wish to add a level of isolation between the service object and the application.  In such cases, one or more logical device names may be created to represent a device.   The posdm.exe command line utility provides one way for administrators to assign logical device names. 

When writing an code, it is best to avoid any assumptions that all devices will have a logical device name.   When attempting to query available devices, it is recommend that one use the logical device name(s) if available; however, if a logical device name is not available, then the code should fall back to the service object name.  Finally, if the service object name is not available, the code should fall back to the device description. 

Below is an implementation of the GetDeviceDisplayName() method, taken from the sample Test Application included in the SDK, that demonstrates the above logic:

static string GetDeviceDisplayName(DeviceInfo device){ string name = CombineNames( device.LogicalNames ); if (name.Length == 0) { name = device.ServiceObjectName; if (name.Length == 0) name = device.Description; } return name;}

- Sylvester

Comments

  • Anonymous
    May 22, 2008
    hi, i have tried this method inmy POS application but its returning "NULL" value. can you help me out what is going wrong? Regards Ravi mcamail2002@gmail.com

  • Anonymous
    May 23, 2008
    Make sure that you are passing in a valid DeviceInfo (that was returned to  you from the PosExplorer).  Also, check to see if the service object is installed and configured. -- Sylvester