static RootDevice addRootDevice(string serial, string url) { foreach (RootDevice root in __rootDevices) { if (root.getSerial() == serial) { return(root); } } RootDevice rootDevice = new RootDevice(serial, url); __rootDevices.Add(rootDevice); return(rootDevice); }
static void arrivalCallback(YModule module) { string serial = module.get_serialNumber(); string parentHub = module.get_parentHub(); if (parentHub == "") { // root device ( string url = module.get_url(); addRootDevice(serial, url); } else { RootDevice hub = getYoctoHub(parentHub); if (hub != null) { hub.addSubDevice(serial); } } }