introspect

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: BSD-2-Clause, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package introspect provides some utilities for dealing with the DBus introspection format.

Index

Constants

View Source
const IntrospectDataString = `` /* 158-byte string literal not displayed */

The introspection data for the org.freedesktop.DBus.Introspectable interface, as a string.

View Source
const IntrospectDeclarationString = `` /* 147-byte string literal not displayed */

XML document type declaration of the introspection format version 1.0

Variables

View Source
var IntrospectData = Interface{
	Name: "org.freedesktop.DBus.Introspectable",
	Methods: []Method{
		{
			Name: "Introspect",
			Args: []Arg{
				{"out", "s", "out"},
			},
		},
	},
}

The introspection data for the org.freedesktop.DBus.Introspectable interface.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

Annotation is an annotation in the introspection format.

type Arg

type Arg struct {
	Name      string `xml:"name,attr,omitempty"`
	Type      string `xml:"type,attr"`
	Direction string `xml:"direction,attr,omitempty"`
}

Arg represents an argument of a method or a signal.

type Interface

type Interface struct {
	Name        string       `xml:"name,attr"`
	Methods     []Method     `xml:"method"`
	Signals     []Signal     `xml:"signal"`
	Properties  []Property   `xml:"property"`
	Annotations []Annotation `xml:"annotation"`
}

Interface describes a DBus interface that is available on the message bus.

type Introspectable

type Introspectable string

Introspectable implements org.freedesktop.Introspectable.

You can create it by converting the XML-formatted introspection data from a string to an Introspectable or call NewIntrospectable with a Node. Then, export it as org.freedesktop.Introspectable on you object.

func NewIntrospectable

func NewIntrospectable(n *Node) Introspectable

NewIntrospectable returns an Introspectable that returns the introspection data that corresponds to the given Node. If n.Interfaces doesn't contain the data for org.freedesktop.DBus.Introspectable, it is added automatically.

func (Introspectable) Introspect

func (i Introspectable) Introspect() (string, *dbus.Error)

Introspect implements org.freedesktop.Introspectable.Introspect.

type Method

type Method struct {
	Name        string       `xml:"name,attr"`
	Args        []Arg        `xml:"arg"`
	Annotations []Annotation `xml:"annotation"`
}

Method describes a Method on an Interface as retured by an introspection.

func Methods

func Methods(v interface{}) []Method

Methods returns the description of the methods of v. This can be used to create a Node which can be passed to NewIntrospectable.

type Node

type Node struct {
	XMLName    xml.Name    `xml:"node"`
	Name       string      `xml:"name,attr,omitempty"`
	Interfaces []Interface `xml:"interface"`
	Children   []Node      `xml:"node,omitempty"`
}

Node is the root element of an introspection.

func Call

func Call(o dbus.BusObject) (*Node, error)

Call calls org.freedesktop.Introspectable.Introspect on a remote object and returns the introspection data.

type Property

type Property struct {
	Name        string       `xml:"name,attr"`
	Type        string       `xml:"type,attr"`
	Access      string       `xml:"access,attr"`
	Annotations []Annotation `xml:"annotation"`
}

Property describes a property of an Interface.

type Signal

type Signal struct {
	Name        string       `xml:"name,attr"`
	Args        []Arg        `xml:"arg"`
	Annotations []Annotation `xml:"annotation"`
}

Signal describes a Signal emitted on an Interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL