dbus

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dbus provides a helper function for creating new D-Bus client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	AddMatchSignal(matchOptions ...godbus.MatchOption) error
	Signal(ch chan<- *godbus.Signal)
	Object(dest string, path godbus.ObjectPath) godbus.BusObject
	Close() error
}

Client is an interface describing capabilities of internal D-Bus client.

func New

func New(connector Connector) (Client, error)

New creates new D-Bus client using given connector.

type Connection

type Connection interface {
	Auth(authMethods []godbus.Auth) error
	Hello() error

	Client
}

Connection is an interface describing how much functionality we need from object providing D-Bus connection.

func SystemPrivateConnector

func SystemPrivateConnector() (Connection, error)

SystemPrivateConnector is a standard connector using system bus.

type Connector

type Connector func() (Connection, error)

Connector is a constructor function providing D-Bus connection.

type MockConnection

type MockConnection struct {
	AuthF           func(authMethods []godbus.Auth) error
	HelloF          func() error
	CloseF          func() error
	AddMatchSignalF func(...godbus.MatchOption) error
	SignalF         func(chan<- *godbus.Signal)
	ObjectF         func(string, godbus.ObjectPath) godbus.BusObject
}

MockConnection is a test helper for mocking godbus.Conn.

func (*MockConnection) AddMatchSignal

func (m *MockConnection) AddMatchSignal(matchOptions ...godbus.MatchOption) error

AddMatchSignal ...

func (*MockConnection) Auth

func (m *MockConnection) Auth(authMethods []godbus.Auth) error

Auth ...

func (*MockConnection) Close

func (m *MockConnection) Close() error

Close ...

func (*MockConnection) Hello

func (m *MockConnection) Hello() error

Hello ...

func (*MockConnection) Object

func (m *MockConnection) Object(dest string, path godbus.ObjectPath) godbus.BusObject

Object ...

func (*MockConnection) Signal

func (m *MockConnection) Signal(ch chan<- *godbus.Signal)

Signal ...

type MockObject

type MockObject struct {
	CallWithContextF func(context.Context, string, godbus.Flags, ...interface{}) *godbus.Call
	CallF            func(string, godbus.Flags, ...interface{}) *godbus.Call
}

MockObject is a mock of godbus.BusObject.

func (*MockObject) AddMatchSignal

func (m *MockObject) AddMatchSignal(iface, member string, options ...godbus.MatchOption) *godbus.Call

AddMatchSignal ...

func (*MockObject) Call

func (m *MockObject) Call(method string, flags godbus.Flags, args ...interface{}) *godbus.Call

Call ...

func (*MockObject) CallWithContext

func (m *MockObject) CallWithContext(
	ctx context.Context, method string, flags godbus.Flags, args ...interface{},
) *godbus.Call

CallWithContext ...

func (*MockObject) Destination

func (m *MockObject) Destination() string

Destination ...

func (*MockObject) GetProperty

func (m *MockObject) GetProperty(p string) (godbus.Variant, error)

GetProperty ...

func (*MockObject) Go

func (m *MockObject) Go(method string, flags godbus.Flags, ch chan *godbus.Call, args ...interface{}) *godbus.Call

Go ...

func (*MockObject) GoWithContext

func (m *MockObject) GoWithContext(
	ctx context.Context, method string, flags godbus.Flags, ch chan *godbus.Call, args ...interface{},
) *godbus.Call

GoWithContext ...

func (*MockObject) Path

func (m *MockObject) Path() godbus.ObjectPath

Path ...

func (*MockObject) RemoveMatchSignal

func (m *MockObject) RemoveMatchSignal(iface, member string, options ...godbus.MatchOption) *godbus.Call

RemoveMatchSignal ...

func (*MockObject) SetProperty

func (m *MockObject) SetProperty(p string, v interface{}) error

SetProperty ...

func (*MockObject) StoreProperty

func (m *MockObject) StoreProperty(p string, value interface{}) error

StoreProperty ...

Jump to

Keyboard shortcuts

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