func newDbusWatcher(isSystemBus bool) (dw *dbusWatcher) { dw = &dbusWatcher{isSystemBus: isSystemBus} var err error if dw.isSystemBus { dw.dbusObj, err = dbus.SystemBus() } else { dw.dbusObj, err = dbus.SessionBus() } if err != nil { logger.Error(err) return } dw.start() return }
func getNodeInfo(dest string, path dbus.ObjectPath) (*introspect.NodeInfo, error) { conn, err := dbus.SystemBus() if err != nil { return nil, err } var xmlString string dbusObj := conn.Object(dest, path) dbusObj.Call("org.freedesktop.DBus.Introspectable.Introspect", dbus.FlagNoAutoStart).Store(&xmlString) var node introspect.NodeInfo err = xml.Unmarshal([]byte(xmlString), &node) if err != nil { return nil, err } return &node, nil }
func (dbusIfc *DBusInterfaceTest) SetUpSuite(c *C.C) { _, err := dbus.SystemBus() if err != nil { c.Skip(err.Error()) } }