dbusutil

package
v0.0.0-...-51dca1d Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: GPL-3.0 Imports: 17 Imported by: 226

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeError

func MakeError(v Implementer, name string, args ...interface{}) *dbus.Error

func MakeErrorJSON

func MakeErrorJSON(v Implementer, name string, detail interface{}) *dbus.Error

func MakeErrorf

func MakeErrorf(v Implementer, name, format string, args ...interface{}) *dbus.Error

func ToError

func ToError(err error) *dbus.Error

Types

type DBusError

type DBusError interface {
	Error() string
	Name() string
}

type ExportedMethod

type ExportedMethod struct {
	Name    string
	Fn      interface{}
	InArgs  []string
	OutArgs []string
}

type ExportedMethods

type ExportedMethods []ExportedMethod

func (ExportedMethods) Len

func (methods ExportedMethods) Len() int

func (ExportedMethods) Less

func (methods ExportedMethods) Less(i, j int) bool

func (ExportedMethods) Swap

func (methods ExportedMethods) Swap(i, j int)

type Implementer

type Implementer interface {
}

Implementer 对象实例

type ImplementerExt

type ImplementerExt interface {
	Implementer
	GetExportedMethods() ExportedMethods
}

ImplementerExt 对象实例拓展

type ImplementerV20

type ImplementerV20 interface {
	GetInterfaceName() string
}

ImplementerV20 兼容v20之前的方式

type MatchRule

type MatchRule struct {
	Str string
}

func (MatchRule) AddTo

func (mr MatchRule) AddTo(conn *dbus.Conn) error

func (MatchRule) RemoveFrom

func (mr MatchRule) RemoveFrom(conn *dbus.Conn) error

type MatchRuleBuilder

type MatchRuleBuilder struct {
	// contains filtered or unexported fields
}

func NewMatchRuleBuilder

func NewMatchRuleBuilder() *MatchRuleBuilder

func (*MatchRuleBuilder) Arg

func (b *MatchRuleBuilder) Arg(idx int, value string) *MatchRuleBuilder

func (*MatchRuleBuilder) ArgNamespace

func (b *MatchRuleBuilder) ArgNamespace(idx int, namespace string) *MatchRuleBuilder

func (*MatchRuleBuilder) ArgPath

func (b *MatchRuleBuilder) ArgPath(idx int, path string) *MatchRuleBuilder

func (*MatchRuleBuilder) Build

func (b *MatchRuleBuilder) Build() MatchRule

func (*MatchRuleBuilder) BuildStr

func (b *MatchRuleBuilder) BuildStr() string

func (*MatchRuleBuilder) Destination

func (b *MatchRuleBuilder) Destination(destination string) *MatchRuleBuilder

func (*MatchRuleBuilder) Eavesdrop

func (b *MatchRuleBuilder) Eavesdrop(eavesdrop bool) *MatchRuleBuilder

func (*MatchRuleBuilder) ExtPropertiesChanged

func (b *MatchRuleBuilder) ExtPropertiesChanged(path, interfaceName string) *MatchRuleBuilder

func (*MatchRuleBuilder) ExtSignal

func (b *MatchRuleBuilder) ExtSignal(path, interfaceName, name string) *MatchRuleBuilder

func (*MatchRuleBuilder) Interface

func (b *MatchRuleBuilder) Interface(interface0 string) *MatchRuleBuilder

func (*MatchRuleBuilder) Member

func (b *MatchRuleBuilder) Member(member string) *MatchRuleBuilder

func (*MatchRuleBuilder) Path

func (b *MatchRuleBuilder) Path(path string) *MatchRuleBuilder

func (*MatchRuleBuilder) PathNamespace

func (b *MatchRuleBuilder) PathNamespace(pathNamespace string) *MatchRuleBuilder

func (*MatchRuleBuilder) Sender

func (b *MatchRuleBuilder) Sender(sender string) *MatchRuleBuilder

func (*MatchRuleBuilder) Type

func (b *MatchRuleBuilder) Type(type0 string) *MatchRuleBuilder

type Property

type Property interface {
	SetValue(val interface{}) (changed bool, err *dbus.Error)
	GetValue() (val interface{}, err *dbus.Error)
	SetNotifyChangedFunc(func(val interface{}))
	GetType() reflect.Type
}

type PropertyAccess

type PropertyAccess struct {
	PropertyInfo
	Sender dbus.Sender
	// contains filtered or unexported fields
}

func (*PropertyAccess) GetPID

func (pa *PropertyAccess) GetPID() (uint32, error)

func (*PropertyAccess) GetUID

func (pa *PropertyAccess) GetUID() (uint32, error)

type PropertyChanged

type PropertyChanged struct {
	PropertyInfo
	Value interface{} // new value
}

type PropertyChangedCallback

type PropertyChangedCallback func(change *PropertyChanged)

type PropertyInfo

type PropertyInfo struct {
	Path      dbus.ObjectPath
	Interface string
	Name      string
}

type PropertyRead

type PropertyRead struct {
	PropertyAccess
}

type PropertyReadCallback

type PropertyReadCallback func(read *PropertyRead) *dbus.Error

type PropertyWrite

type PropertyWrite struct {
	PropertyAccess
	Value interface{} // new value
}

type PropertyWriteCallback

type PropertyWriteCallback func(write *PropertyWrite) *dbus.Error

type ServerObject

type ServerObject struct {
	// contains filtered or unexported fields
}

ServerObject 一个path对应一个obj

func (*ServerObject) ConnectChanged

func (so *ServerObject) ConnectChanged(v Implementer, propertyName string,
	cb PropertyChangedCallback) error

ConnectChanged V23兼容该接口。V23正常流程外部不再需要该接口

func (*ServerObject) Export

func (so *ServerObject) Export() error

func (*ServerObject) Path

func (so *ServerObject) Path() dbus.ObjectPath

func (*ServerObject) SetReadCallback

func (so *ServerObject) SetReadCallback(v Implementer, propertyName string,
	cb PropertyReadCallback) error

SetReadCallback V23兼容该接口。V23正常流程外部不再需要该接口

func (*ServerObject) SetWriteCallback

func (so *ServerObject) SetWriteCallback(v Implementer, propertyName string,
	cb PropertyWriteCallback) error

SetWriteCallback V23兼容该接口。V23正常流程外部不再需要该接口

func (*ServerObject) StopExport

func (so *ServerObject) StopExport() error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(conn *dbus.Conn) *Service

func NewSessionService

func NewSessionService() (*Service, error)

func NewSystemService

func NewSystemService() (*Service, error)

func (*Service) Conn

func (s *Service) Conn() *dbus.Conn

func (*Service) ConnectChanged

func (s *Service) ConnectChanged(v Implementer, propertyName string,
	cb PropertyChangedCallback) error

ConnectChanged 不再由ServerObject提供

func (*Service) DelayAutoQuit

func (s *Service) DelayAutoQuit()

func (*Service) DelayEmitPropertyChanged

func (s *Service) DelayEmitPropertyChanged(v Implementer) func() error

func (*Service) DumpProperties

func (s *Service) DumpProperties(v Implementer) (string, error)

func (*Service) Emit

func (s *Service) Emit(v Implementer, signalName string, values ...interface{}) error

func (*Service) EmitByPath

func (s *Service) EmitByPath(v Implementer, path dbus.ObjectPath, signalName string, values ...interface{}) error

func (*Service) EmitPropertiesChanged

func (s *Service) EmitPropertiesChanged(v Implementer, propValMap map[string]interface{},
	invalidatedProps ...string) error

func (*Service) EmitPropertyChanged

func (s *Service) EmitPropertyChanged(v Implementer, propertyName string, value interface{}) error

func (*Service) Export

func (s *Service) Export(path dbus.ObjectPath, implements ...Implementer) error

Export V20导出接口,不支持指定InterfaceName

func (*Service) ExportExt

func (s *Service) ExportExt(path dbus.ObjectPath, interfaceName string, impl Implementer) error

ExportExt V23导出接口,支持指定InterfaceName, interfaceName不和Implementer绑定

func (*Service) GetConnPID

func (s *Service) GetConnPID(name string) (pid uint32, err error)

func (*Service) GetConnUID

func (s *Service) GetConnUID(name string) (uid uint32, err error)

func (*Service) GetNameOwner

func (s *Service) GetNameOwner(name string) (owner string, err error)

func (*Service) GetServerObject

func (s *Service) GetServerObject(impl Implementer) *ServerObject

GetServerObject v20接口,暴露给外部应用,实际不合理,V23兼容该接口。V23正常流程外部不再需要该接口

func (*Service) GetServerObjectByPath

func (s *Service) GetServerObjectByPath(path dbus.ObjectPath) *ServerObject

func (*Service) IsExported

func (s *Service) IsExported(impl Implementer) bool

func (*Service) NameHasOwner

func (s *Service) NameHasOwner(name string) (hasOwner bool, err error)

func (*Service) NewServerObject

func (s *Service) NewServerObject(path dbus.ObjectPath,
	implementers ...Implementer) (*ServerObject, error)

NewServerObject v20接口,暴露给外部应用,实际不合理,V23兼容该接口。V23正常流程外部不再需要该接口

func (*Service) Quit

func (s *Service) Quit()

func (*Service) ReleaseName

func (s *Service) ReleaseName(name string) error

func (*Service) RequestName

func (s *Service) RequestName(name string) error

func (*Service) SetAutoQuitHandler

func (s *Service) SetAutoQuitHandler(interval time.Duration, canQuit func() bool)

func (*Service) SetReadCallback

func (s *Service) SetReadCallback(v Implementer, propertyName string,
	cb PropertyReadCallback) error

SetReadCallback 不再由ServerObject提供

func (*Service) SetWriteCallback

func (s *Service) SetWriteCallback(v Implementer, propertyName string,
	cb PropertyWriteCallback) error

SetReadCallback 不再由ServerObject提供

func (*Service) StopExport

func (s *Service) StopExport(impl Implementer) error

func (*Service) StopExportByPath

func (s *Service) StopExportByPath(path dbus.ObjectPath) error

func (*Service) Wait

func (s *Service) Wait()

type SignalHandler

type SignalHandler struct {
	// contains filtered or unexported fields
}

type SignalHandlerFunc

type SignalHandlerFunc func(sig *dbus.Signal)

type SignalHandlerId

type SignalHandlerId int

type SignalLoop

type SignalLoop struct {
	// contains filtered or unexported fields
}

func NewSignalLoop

func NewSignalLoop(conn *dbus.Conn, bufSize int) *SignalLoop

func (*SignalLoop) AddHandler

func (sl *SignalLoop) AddHandler(rule *SignalRule, cb SignalHandlerFunc) SignalHandlerId

func (*SignalLoop) Conn

func (sl *SignalLoop) Conn() *dbus.Conn

func (*SignalLoop) RemoveHandler

func (sl *SignalLoop) RemoveHandler(id SignalHandlerId)

func (*SignalLoop) Start

func (sl *SignalLoop) Start()

func (*SignalLoop) Stop

func (sl *SignalLoop) Stop()

type SignalRule

type SignalRule struct {
	Sender string
	Path   dbus.ObjectPath
	Name   string
}

Directories

Path Synopsis
_tool

Jump to

Keyboard shortcuts

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