dbusconn

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// OperabilityOk state 'ok' for OperabilityState
	OperabilityOk OperabilityState = "OK"
	// OperabilityPartial state 'partial' for OperabilityState
	OperabilityPartial OperabilityState = "PARTIAL"
	// OperabilityKo state 'Ko' for OperabilityState
	OperabilityKo OperabilityState = "KO"
	// OperabilityUnknown state 'unknown' for OperabilityState
	OperabilityUnknown OperabilityState = "UNKNOWN"

	// PairingOk state 'ok' for PairingState
	PairingOk PairingState = "OK"
	// PairingInProgres state 'in progress' for PairingState
	PairingInProgress PairingState = "IN_PROGRESS"
	// PairingKo state 'ko' for PairingState
	PairingKo PairingState = "KO"
	// PairingUnknown state 'unknown' for PairingState
	PairingUnknown PairingState = "UNKNOWN"
	// PairingNotNeeded state 'not needed' for PairingState
	PairingNotNeeded PairingState = "NOT_NEEDED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeJson

type BridgeJson struct {
	Bridges map[string]string `json:"bridges"`
}

type BridgeProto

type BridgeProto struct {
	Protocol *Protocol
	// contains filtered or unexported fields
}

Protocol is a dbus object which represents the states of a bridge protocol

type Dbus

type Dbus struct {
	RootProtocol RootProto
	Bridges      map[string]*BridgeProto
	ProtocolName string
	Log          *logging.Logger
	// contains filtered or unexported fields
}

Dbus exported structure

func (*Dbus) InitDbus

func (dc *Dbus) InitDbus(protocolName string, cbs interface{}) *Protocol

InitDbus initialization dbus connection

type Device

type Device struct {
	sync.Mutex

	Protocol *Protocol

	DevID              string
	Address            string
	TypeID             string
	TypeVersion        string
	Options            []byte
	FirmwareVersion    string
	Operability        OperabilityState
	PairingState       PairingState
	OperabilityTimeout time.Duration

	Items map[string]*Item
	// contains filtered or unexported fields
}

Device object structure

func (*Device) AddItem

func (d *Device) AddItem(itemID string, typeID string, typeVersion string, options []byte) (bool, *dbus.Error)

AddItem adds a new item to device

func (*Device) EmitDbusSignal

func (d *Device) EmitDbusSignal(sigName string, args ...interface{})

EmitDbusSignal emit a dbus signal from device object

func (*Device) RemoveItem

func (d *Device) RemoveItem(itemID string) *dbus.Error

RemoveItem remove item from device

func (*Device) SetCallbacks

func (d *Device) SetCallbacks(cbs interface{})

SetCallbacks set new callbacks for this device

func (*Device) SetDbusMethods

func (d *Device) SetDbusMethods(externalMethods map[string]interface{}) bool

SetDbusMethods set new dbusMethods for this device

func (*Device) SetDbusProperties

func (d *Device) SetDbusProperties(externalProperties map[string]*prop.Prop) bool

SetDbusProperties set new DBus properties for this device

func (*Device) SetOperabilityState

func (d *Device) SetOperabilityState(state OperabilityState)

SetOperabilityState set the value of the property OperabilityState

func (*Device) SetOption

func (d *Device) SetOption(options []byte)

SetOption set the value of the property Option

func (*Device) SetPairingState

func (d *Device) SetPairingState(state PairingState)

SetPairingState set the value of the property PairingState

func (*Device) SetVersion

func (d *Device) SetVersion(newVersion string)

SetVersion set the value of the property Version

func (*Device) UpdateFirmware

func (d *Device) UpdateFirmware(data string) (string, *dbus.Error)

UpdateFirmware is the dbus method to update the firmware of the device

type DeviceJson

type DeviceJson struct {
	DevID          string          `json:"devID"`
	ComID          string          `json:"comID"`
	DevTypeID      string          `json:"devTypeID"`
	DevTypeVersion string          `json:"typeVersion"`
	DevOptions     json.RawMessage `json:"devOptions"`
	Items          []ItemJson      `json:"items"`
}

type Item

type Item struct {
	Device *Device

	ItemID      string
	Mac         string
	TypeID      string
	TypeVersion string
	Options     []byte
	Target      []byte
	Value       []byte
	// contains filtered or unexported fields
}

Item object structure

func (*Item) EmitDbusSignal

func (i *Item) EmitDbusSignal(sigName string, args ...interface{})

EmitDbusSignal emit a dbus signal from item object

func (*Item) SetCallbacks

func (i *Item) SetCallbacks(cbs interface{})

SetCallbacks set new callbacks for this item

func (*Item) SetDbusMethods

func (i *Item) SetDbusMethods(externalMethods map[string]interface{}) bool

SetDbusMethods set new dbusMethods for this Item

func (*Item) SetDbusProperties

func (i *Item) SetDbusProperties(externalProperties map[string]*prop.Prop) bool

SetDbusProperties set new DBus properties for this item

func (*Item) SetOption

func (i *Item) SetOption(options []byte)

SetOption set the value of the property Option

func (*Item) SetValue

func (i *Item) SetValue(value []byte)

SetValue set the value of the property Value

type ItemJson

type ItemJson struct {
	ItemID          string          `json:"itemID"`
	ItemTypeID      string          `json:"itemTypeID"`
	ItemTypeVersion string          `json:"itemTypeVersion"`
	ItemOptions     json.RawMessage `json:"itemOptions"`
}

type OperabilityState

type OperabilityState string

OperabilityState informs if the device work

type PairingState

type PairingState string

PairingState informs the state of the pairing

type Protocol

type Protocol struct {
	BridgeID     string
	Devices      map[string]*Device
	Reachability ReachabilityState

	sync.Mutex
	// contains filtered or unexported fields
}

Protocol is a dbus object which represents the states of a protocol

func (*Protocol) AddDevice

func (p *Protocol) AddDevice(devID string, comID string, typeID string, typeVersion string, options []byte) (bool, *dbus.Error)

AddDevice is the dbus method to add a new device

func (*Protocol) EmitDbusSignal

func (p *Protocol) EmitDbusSignal(sigName string, args ...interface{})

EmitDbusSignal emit a dbus signal from protocol object

func (*Protocol) IsReady

func (p *Protocol) IsReady() (bool, *dbus.Error)

IsReady dbus method to know if the protocol is ready or not

func (*Protocol) Ready

func (p *Protocol) Ready()

Ready set the Protocol object parameter "ready" to true

func (*Protocol) RemoveDevice

func (p *Protocol) RemoveDevice(devID string) *dbus.Error

RemoveDevice is the dbus method to remove a device

func (*Protocol) SetDbusMethods

func (p *Protocol) SetDbusMethods(externalMethods map[string]interface{}) bool

SetDbusMethods set new dbusMethods for this protocol

func (*Protocol) SetDbusProperties

func (p *Protocol) SetDbusProperties(externalProperties map[string]*prop.Prop) bool

SetDbusProperties set new DBus properties for this protocol

func (*Protocol) SetProtocolCBs

func (p *Protocol) SetProtocolCBs(cbs interface{})

SetProtocolCBs set new callbacks for this protocol

func (*Protocol) SetReachabilityState

func (p *Protocol) SetReachabilityState(state ReachabilityState)

SetReachabilityState set the value of the property ReachabilityState

type ProtocolJson

type ProtocolJson struct {
	Protocols map[string][]DeviceJson `json:"Protocols"`
}

type ReachabilityState

type ReachabilityState string

ReachabilityState informs if the device is reachable

const (

	// ReachabilityOk state 'ok' for ReachabilityState
	ReachabilityOk ReachabilityState = "OK"
	// ReachabilityKo state 'ko' for ReachabilityState
	ReachabilityKo ReachabilityState = "KO"
	// ReachabilityUnknown state 'unknown' for ReachabilityState
	ReachabilityUnknown ReachabilityState = "UNKNOWN"
)

type RootProto

type RootProto struct {
	Protocol *Protocol
	// contains filtered or unexported fields
}

RootProtocol is a dbus object which represents the states of the root protocol

func (*RootProto) AddBridge

func (r *RootProto) AddBridge(bridgeID string) (bool, *dbus.Error)

AddBridge is the dbus method to add a new bridge

func (*RootProto) RemoveBridge

func (r *RootProto) RemoveBridge(bridgeID string) *dbus.Error

RemoveBridge is the dbus method to remove a bridge

func (*RootProto) SetRootProtocolCBs

func (r *RootProto) SetRootProtocolCBs(cbs interface{})

SetRootProtocolCBs set new callbacks for this Root protocol

Jump to

Keyboard shortcuts

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