How To Iterate Through All Available Physical Devices

<< Back to the SharedPhidgets 3 page


You need the DeviceManager object to iterate through all the available hardware devices:

// DeviceManager object
GroupLab.SharedPhidgets.DeviceManager deviceManager =
  new GroupLab.SharedPhidgets.DeviceManager ();


// The devices
GroupLab.SharedPhidgets.DeviceDescriptions devices =
  deviceManager.Devices;


// Iterate through the device list
foreach(GroupLab.SharedPhidgets.DeviceDescription dev in devices)
{
  // Here you can read all the attributes of the device

  string serial    = dev.SerialNumber;
  string name      = dev.Name;
  string location  = dev.Location;
  string owner     = dev.Owner;
  string keywords  = dev.Keywords;
  string version   = dev.Version;  
}