当前位置: 首页>>代码示例>>Golang>>正文


Golang Conn.Object方法代码示例

本文整理汇总了Golang中github.com/godbus/dbus.Conn.Object方法的典型用法代码示例。如果您正苦于以下问题:Golang Conn.Object方法的具体用法?Golang Conn.Object怎么用?Golang Conn.Object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/godbus/dbus.Conn的用法示例。


在下文中一共展示了Conn.Object方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: recurseObjects

func recurseObjects(bus *dbus.Conn, service, prefix string) ([]string, error) {
	var s string

	err := bus.Object(service, dbus.ObjectPath(prefix)).Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&s)
	if err != nil {
		return nil, err
	}

	var n introspect.Node
	err = xml.Unmarshal([]byte(s), &n)
	if err != nil {
		return nil, err
	}

	names := make([]string, 0, 100)
	if len(n.Interfaces) > 1 {
		names = append(names, prefix)
	}

	for _, child := range n.Children {
		childPath := path.Join(prefix, child.Name)
		items, err := recurseObjects(bus, service, childPath)
		if err != nil {
			return nil, err
		}
		names = append(names, items...)
	}

	return names, nil
}
开发者ID:mastercactapus,项目名称:dbus-inspector,代码行数:30,代码来源:app.go

示例2: traverseDbusObjects

func traverseDbusObjects(bus *dbus.Conn, dbusService, dbusPath string, fn func(path string, node *introspect.Node)) {
	var xmldata string
	var node introspect.Node

	var o = bus.Object(dbusService, dbus.ObjectPath(dbusPath))
	err := o.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&xmldata)

	if err != nil {
		log.Printf("Error getting introspect from [%s, %s]: %s", dbusService, dbusPath, err)
	}

	err = xml.NewDecoder(strings.NewReader(xmldata)).Decode(&node)
	if err != nil {
		log.Printf("Error decoding introspect from [%s, %s]: %s", dbusService, dbusPath, err)
	}
	// log.Printf("Introspect: %+v", node)

	if node.Name != "" && len(node.Interfaces) > 0 {
		fn(dbusPath, &node)
	}

	for _, child := range node.Children {
		traverseDbusObjects(bus, dbusService, dbusPath+"/"+child.Name, fn)
	}
}
开发者ID:sjenning,项目名称:IoT-framework,代码行数:25,代码来源:devicehive-alljoyn.go

示例3: newPrompter

func newPrompter(conn *dbus.Conn) *prompter {
	p := new(prompter)
	p.cond = sync.NewCond(&p.lock)
	p.dbusObj = conn.Object("com.subgraph.FirewallPrompt", "/com/subgraph/FirewallPrompt")
	p.policyMap = make(map[string]*Policy)
	go p.promptLoop()
	return p
}
开发者ID:Safe3,项目名称:fw-daemon,代码行数:8,代码来源:prompt.go

示例4: New

func New(conn *dbus.Conn, name string) *Player {
	obj := conn.Object(name, dbusObjectPath).(*dbus.Object)

	return &Player{
		&base{obj},
		&player{obj},
	}
}
开发者ID:emersion,项目名称:go-mpris,代码行数:8,代码来源:mpris.go

示例5: SendNotification

// SendNotification is same as Notifier.SendNotification
// Provided for convenience.
func SendNotification(conn *dbus.Conn, note Notification) (uint32, error) {
	obj := conn.Object(dbusNotificationsInterface, objectPath)
	call := obj.Call(notify, 0,
		note.AppName,
		note.ReplacesID,
		note.AppIcon,
		note.Summary,
		note.Body,
		note.Actions,
		note.Hints,
		note.ExpireTimeout)
	if call.Err != nil {
		return 0, call.Err
	}
	var ret uint32
	err := call.Store(&ret)
	if err != nil {
		log.Printf("error getting uint32 ret value: %v", err)
		return ret, err
	}
	return ret, nil
}
开发者ID:emersion,项目名称:notify,代码行数:24,代码来源:notification.go

示例6: dbusPath

// dbusPath returns the dbus path of the job object.
func (j *job) dbusPath(conn *dbus.Conn) (dbus.ObjectPath, error) {

	var jobpath dbus.ObjectPath

	// get the job path
	err := conn.
		Object(upstartServiceDBusPath, upstartManagerObject).
		Call("com.ubuntu.Upstart0_6.GetJobByName", 0, j.Name).
		Store(&jobpath)
	if err != nil {
		return jobpath, err
	}

	return jobpath, nil
}
开发者ID:amoghe,项目名称:go-upstart,代码行数:16,代码来源:job.go

示例7: systemdObject

func systemdObject(conn *dbus.Conn) dbus.BusObject {
	return conn.Object("org.freedesktop.systemd1", dbus.ObjectPath("/org/freedesktop/systemd1"))
}
开发者ID:Clarifai,项目名称:kubernetes,代码行数:3,代码来源:dbus.go

示例8: NewNotificationObject

func NewNotificationObject(conn *dbus.Conn) *NotificationObject {
	return &NotificationObject{
		conn.Object("org.freedesktop.Notifications", "/org/freedesktop/Notifications"),
	}
}
开发者ID:sarifsystems,项目名称:sarif,代码行数:5,代码来源:dbus.go

示例9: NewCollection

func NewCollection(conn *dbus.Conn, path dbus.ObjectPath) *Collection {
	return &Collection{
		conn: conn,
		dbus: conn.Object(DBusServiceName, path),
	}
}
开发者ID:99designs,项目名称:aws-vault,代码行数:6,代码来源:collection.go

示例10: NewLogindObject

func NewLogindObject(conn *dbus.Conn) *LogindObject {
	return &LogindObject{
		conn.Object("org.freedesktop.login1", "/org/freedesktop/login1"),
	}
}
开发者ID:sarifsystems,项目名称:sarif,代码行数:5,代码来源:systemd.go

示例11: NewItem

func NewItem(conn *dbus.Conn, path dbus.ObjectPath) *Item {
	return &Item{
		conn: conn,
		dbus: conn.Object(DBusServiceName, path),
	}
}
开发者ID:99designs,项目名称:aws-vault,代码行数:6,代码来源:item.go

示例12: NewSession

func NewSession(conn *dbus.Conn, path dbus.ObjectPath) *Session {
	return &Session{
		conn: conn,
		dbus: conn.Object(DBusServiceName, path),
	}
}
开发者ID:99designs,项目名称:aws-vault,代码行数:6,代码来源:session.go


注:本文中的github.com/godbus/dbus.Conn.Object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。