in leda_python/deviceMbus.py [0:0]
def driver_init_with_driverId(self, driver_id):
global mbusLoopFlag
if (False == mbusLoopFlag):
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
if (False == isinstance(driver_id, str)):
raise exception.LedaParamsException("driver_init_with_driverId: driver_id type is invalid")
try:
wkn = mbusConfig.CMP_DRIVER_WKN_PREFIX + driver_id
self.driverMbusHandle = mbus.MbusConnect(wkn)
self._openMonitorMbusDaemon()
self.driverMbusObject = self._createMbusDynamicObject(driver_id)
self.driver_id = driver_id
except SystemExit:
raise exception.LedaException("mbus existed")
except:
_logger.exception("Err")
raise exception.LedaException("mbus connect failed")
if (False == mbusLoopFlag):
t = threading.Thread(target=mbus_loop, name="mbusLoop")
t.setDaemon(True)
t.start()
mbusLoopFlag = True