def __init__(self, devicefile):
# by default, log!
self.do_data_logging = True
# initially set the standard logger
self.set_logger(logging.getLogger(__name__))
# initially set an empty configuration
self.set_config(configparser.ConfigParser())
# use glib as default mailoop for dbus
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
dbus.mainloop.glib.threads_init()
GLib.threads_init()
self.systembus = dbus.SystemBus() # the system bus
self.systembus.request_name(CO2MONITOR_BUSNAME) # request the bus name
bus_name = dbus.service.BusName(CO2MONITOR_BUSNAME, self.systembus) # create bus name
self.devicefile = devicefile
# set up the device
self.device = device.co2device(self.devicefile)
# register the object on the bus name
objectpath = "/".join([CO2MONITOR_OBJECTPATH,
utils.devicefile2objectname(self.devicefile)])
dbus.service.Object.__init__(self, bus_name, objectpath)
self.update_status(_("idle"))
threading.Thread.__init__(self)
# set the config
评论列表
文章目录