Documentation ¶
Overview ¶
Package dbus provides an injectable interface and implementations for D-Bus communication
Index ¶
- type Call
- type Connection
- type DBusFake
- type DBusFakeConnection
- func (conn *DBusFakeConnection) AddObject(name, path string, handler DBusFakeHandler)
- func (conn *DBusFakeConnection) BusObject() Object
- func (conn *DBusFakeConnection) EmitSignal(name, path, iface, signal string, args ...interface{})
- func (conn *DBusFakeConnection) Object(name, path string) Object
- func (conn *DBusFakeConnection) SetBusObject(handler DBusFakeHandler)
- func (conn *DBusFakeConnection) Signal(ch chan<- *godbus.Signal)
- type DBusFakeHandler
- type Interface
- type Object
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call interface { // Store returns a completed call's return values, or an error Store(retvalues ...interface{}) error }
Call represents a pending or completed D-Bus method call
type Connection ¶
type Connection interface { // Returns an Object representing the bus itself BusObject() Object // Object creates a representation of a remote D-Bus object Object(name, path string) Object // Signal registers or unregisters a channel to receive D-Bus signals Signal(ch chan<- *godbus.Signal) }
Connection represents a D-Bus connection
type DBusFake ¶
type DBusFake struct {
// contains filtered or unexported fields
}
DBusFake is a simple fake Interface type.
func NewFake ¶
func NewFake(systemBus *DBusFakeConnection, sessionBus *DBusFakeConnection) *DBusFake
NewFake returns a new Interface which will fake talking to D-Bus
func (*DBusFake) SessionBus ¶
func (db *DBusFake) SessionBus() (Connection, error)
SessionBus is part of Interface
func (*DBusFake) SystemBus ¶
func (db *DBusFake) SystemBus() (Connection, error)
SystemBus is part of Interface
type DBusFakeConnection ¶
type DBusFakeConnection struct {
// contains filtered or unexported fields
}
DBusFakeConnection represents a fake D-Bus connection
func NewFakeConnection ¶
func NewFakeConnection() *DBusFakeConnection
func (*DBusFakeConnection) AddObject ¶
func (conn *DBusFakeConnection) AddObject(name, path string, handler DBusFakeHandler)
AddObject adds a handler for the Object at name and path
func (*DBusFakeConnection) BusObject ¶
func (conn *DBusFakeConnection) BusObject() Object
BusObject is part of the Connection interface
func (*DBusFakeConnection) EmitSignal ¶
func (conn *DBusFakeConnection) EmitSignal(name, path, iface, signal string, args ...interface{})
EmitSignal emits a signal on conn
func (*DBusFakeConnection) Object ¶
func (conn *DBusFakeConnection) Object(name, path string) Object
Object is part of the Connection interface
func (*DBusFakeConnection) SetBusObject ¶
func (conn *DBusFakeConnection) SetBusObject(handler DBusFakeHandler)
SetBusObject sets the handler for the BusObject of conn
func (*DBusFakeConnection) Signal ¶
func (conn *DBusFakeConnection) Signal(ch chan<- *godbus.Signal)
Signal is part of the Connection interface
type DBusFakeHandler ¶
DBusFakeHandler is used to handle fake D-Bus method calls
type Interface ¶
type Interface interface { // SystemBus returns a connection to the system bus, connecting to it // first if necessary SystemBus() (Connection, error) // SessionBus returns a connection to the session bus, connecting to it // first if necessary SessionBus() (Connection, error) }
Interface is an interface that presents a subset of the godbus/dbus API. Use this when you want to inject fakeable/mockable D-Bus behavior.