How To Get Information From A Shared Phidgets Dictionary Path

<< Back to the SharedPhidgets page

You can use the SharedPhidgets Util class, that provides a variety of static methods to get information from a shared dictionary path expression (or you can still parse the path string by yourself):

// Use one of the paths in the shared dictionary
string mypath = "/sharedphidgets/phidgetservo/148/attached";

int serial          = GroupLab.SharedPhidgets.Util.getSerialFromPath(mypath);
string type         = GroupLab.SharedPhidgets.Util.getTypeFromPath(mypath);
Array pathElements  = GroupLab.SharedPhidgets.Util.getPathElements(mypath);


// You can also use the filter methods to verify if a
// path expression matches to a particular device

bool test;
test = GroupLab.SharedPhidgets.Util.filterPhidgetType(mypath,
  GroupLab.SharedPhidgets.Constants.PHIDGET_IF); // false

test = GroupLab.SharedPhidgets.Util.filterPhidgetType(mypath,
  GroupLab.SharedPhidgets.Constants.PHIDGET_SERVO); //true

test = GroupLab.SharedPhidgets.Util.filterSerial(mypath, 921); // false

test = GroupLab.SharedPhidgets.Util.filterSerial(mypath, 148); // true