battery

package
v0.0.0-...-7f43d4a Latest Latest
Warning

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

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

Documentation

Overview

BlueZ D-Bus Battery API description [battery-api.txt]

Index

Constants

This section is empty.

Variables

View Source
var Battery1Interface = "org.bluez.Battery1"
View Source
var BatteryProvider1Interface = "org.bluez.BatteryProvider1"
View Source
var BatteryProviderManager1Interface = "org.bluez.BatteryProviderManager1"

Functions

This section is empty.

Types

type Battery1

type Battery1 struct {
	Properties *Battery1Properties
	// contains filtered or unexported fields
}

Battery1 Battery hierarchy

func NewBattery1

func NewBattery1(objectPath dbus.ObjectPath) (*Battery1, error)

NewBattery1 create a new instance of Battery1

Args: - objectPath: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX

func (*Battery1) Client

func (a *Battery1) Client() *bluez.Client

Client return Battery1 dbus client

func (*Battery1) Close

func (a *Battery1) Close()

Close the connection

func (*Battery1) GetObjectManagerSignal

func (a *Battery1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)

GetObjectManagerSignal return a channel for receiving updates from the ObjectManager

func (*Battery1) GetPercentage

func (a *Battery1) GetPercentage() (byte, error)

GetPercentage get Percentage value

func (*Battery1) GetProperties

func (a *Battery1) GetProperties() (*Battery1Properties, error)

GetProperties load all available properties

func (*Battery1) GetPropertiesSignal

func (a *Battery1) GetPropertiesSignal() (chan *dbus.Signal, error)

GetPropertiesSignal return a channel for receiving udpdates on property changes

func (*Battery1) GetProperty

func (a *Battery1) GetProperty(name string) (dbus.Variant, error)

GetProperty get a property

func (*Battery1) GetSource

func (a *Battery1) GetSource() (string, error)

GetSource get Source value

func (*Battery1) GetWatchPropertiesChannel

func (a *Battery1) GetWatchPropertiesChannel() chan *dbus.Signal

GetWatchPropertiesChannel return the dbus channel to receive properties interface

func (*Battery1) Interface

func (a *Battery1) Interface() string

Interface return Battery1 interface

func (*Battery1) Path

func (a *Battery1) Path() dbus.ObjectPath

Path return Battery1 object path

func (*Battery1) SetPercentage

func (a *Battery1) SetPercentage(v byte) error

SetPercentage set Percentage value

func (*Battery1) SetProperty

func (a *Battery1) SetProperty(name string, value interface{}) error

SetProperty set a property

func (*Battery1) SetSource

func (a *Battery1) SetSource(v string) error

SetSource set Source value

func (*Battery1) SetWatchPropertiesChannel

func (a *Battery1) SetWatchPropertiesChannel(c chan *dbus.Signal)

SetWatchPropertiesChannel set the dbus channel to receive properties interface

func (*Battery1) ToProps

func (a *Battery1) ToProps() bluez.Properties

ToProps return the properties interface

func (*Battery1) UnwatchProperties

func (a *Battery1) UnwatchProperties(ch chan *bluez.PropertyChanged) error

func (*Battery1) WatchProperties

func (a *Battery1) WatchProperties() (chan *bluez.PropertyChanged, error)

WatchProperties updates on property changes

type Battery1Properties

type Battery1Properties struct {

	/*
		Percentage The percentage of battery left as an unsigned 8-bit integer.
	*/
	Percentage byte

	/*
		Source Describes where the battery information comes from
				This property is informational only and may be useful
				for debugging purposes.
				Providers from BatteryProvider1 may make use of this
				property to indicate where the battery report comes from
				(e.g. "HFP 1.7", "HID", or the profile UUID).
	*/
	Source string
	// contains filtered or unexported fields
}

Battery1Properties contains the exposed properties of an interface

func (*Battery1Properties) FromDBusMap

func (a *Battery1Properties) FromDBusMap(props map[string]dbus.Variant) (*Battery1Properties, error)

FromDBusMap convert a map to an Battery1Properties

func (*Battery1Properties) FromMap

func (a *Battery1Properties) FromMap(props map[string]interface{}) (*Battery1Properties, error)

FromMap convert a map to an Battery1Properties

func (*Battery1Properties) Lock

func (p *Battery1Properties) Lock()

Lock access to properties

func (*Battery1Properties) ToMap

func (a *Battery1Properties) ToMap() (map[string]interface{}, error)

ToMap convert a Battery1Properties to map

func (*Battery1Properties) Unlock

func (p *Battery1Properties) Unlock()

Unlock access to properties

type BatteryProvider1

type BatteryProvider1 struct {
	Properties *BatteryProvider1Properties
	// contains filtered or unexported fields
}

BatteryProvider1 Battery Provider hierarchy

func NewBatteryProvider1

func NewBatteryProvider1(servicePath string, objectPath dbus.ObjectPath) (*BatteryProvider1, error)

NewBatteryProvider1 create a new instance of BatteryProvider1

Args: - servicePath: <client D-Bus address> - objectPath: {provider_root}/{unique battery object path}

func (*BatteryProvider1) Client

func (a *BatteryProvider1) Client() *bluez.Client

Client return BatteryProvider1 dbus client

func (*BatteryProvider1) Close

func (a *BatteryProvider1) Close()

Close the connection

func (*BatteryProvider1) GetDevice

func (a *BatteryProvider1) GetDevice() (dbus.ObjectPath, error)

GetDevice get Device value

func (*BatteryProvider1) GetObjectManagerSignal

func (a *BatteryProvider1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)

GetObjectManagerSignal return a channel for receiving updates from the ObjectManager

func (*BatteryProvider1) GetProperties

func (a *BatteryProvider1) GetProperties() (*BatteryProvider1Properties, error)

GetProperties load all available properties

func (*BatteryProvider1) GetPropertiesSignal

func (a *BatteryProvider1) GetPropertiesSignal() (chan *dbus.Signal, error)

GetPropertiesSignal return a channel for receiving udpdates on property changes

func (*BatteryProvider1) GetProperty

func (a *BatteryProvider1) GetProperty(name string) (dbus.Variant, error)

GetProperty get a property

func (*BatteryProvider1) GetWatchPropertiesChannel

func (a *BatteryProvider1) GetWatchPropertiesChannel() chan *dbus.Signal

GetWatchPropertiesChannel return the dbus channel to receive properties interface

func (*BatteryProvider1) Interface

func (a *BatteryProvider1) Interface() string

Interface return BatteryProvider1 interface

func (*BatteryProvider1) Path

func (a *BatteryProvider1) Path() dbus.ObjectPath

Path return BatteryProvider1 object path

func (*BatteryProvider1) SetDevice

func (a *BatteryProvider1) SetDevice(v dbus.ObjectPath) error

SetDevice set Device value

func (*BatteryProvider1) SetProperty

func (a *BatteryProvider1) SetProperty(name string, value interface{}) error

SetProperty set a property

func (*BatteryProvider1) SetWatchPropertiesChannel

func (a *BatteryProvider1) SetWatchPropertiesChannel(c chan *dbus.Signal)

SetWatchPropertiesChannel set the dbus channel to receive properties interface

func (*BatteryProvider1) ToProps

func (a *BatteryProvider1) ToProps() bluez.Properties

ToProps return the properties interface

func (*BatteryProvider1) UnwatchProperties

func (a *BatteryProvider1) UnwatchProperties(ch chan *bluez.PropertyChanged) error

func (*BatteryProvider1) WatchProperties

func (a *BatteryProvider1) WatchProperties() (chan *bluez.PropertyChanged, error)

WatchProperties updates on property changes

type BatteryProvider1Properties

type BatteryProvider1Properties struct {

	/*
		Device The object path of the device that has this battery.
	*/
	Device dbus.ObjectPath
	// contains filtered or unexported fields
}

BatteryProvider1Properties contains the exposed properties of an interface

func (*BatteryProvider1Properties) FromDBusMap

func (a *BatteryProvider1Properties) FromDBusMap(props map[string]dbus.Variant) (*BatteryProvider1Properties, error)

FromDBusMap convert a map to an BatteryProvider1Properties

func (*BatteryProvider1Properties) FromMap

func (a *BatteryProvider1Properties) FromMap(props map[string]interface{}) (*BatteryProvider1Properties, error)

FromMap convert a map to an BatteryProvider1Properties

func (*BatteryProvider1Properties) Lock

func (p *BatteryProvider1Properties) Lock()

Lock access to properties

func (*BatteryProvider1Properties) ToMap

func (a *BatteryProvider1Properties) ToMap() (map[string]interface{}, error)

ToMap convert a BatteryProvider1Properties to map

func (*BatteryProvider1Properties) Unlock

func (p *BatteryProvider1Properties) Unlock()

Unlock access to properties

type BatteryProviderManager1

type BatteryProviderManager1 struct {
	Properties *BatteryProviderManager1Properties
	// contains filtered or unexported fields
}

BatteryProviderManager1 Battery Provider Manager hierarchy A battery provider starts by registering itself as a battery provider with the RegisterBatteryProvider method passing an object path as the provider ID. Then, it can start exposing org.bluez.BatteryProvider1 objects having the path starting with the given provider ID. It can also remove objects at any time. The objects and their properties exposed by battery providers will be reflected on org.bluez.Battery1 interface.

BlueZ will stop monitoring these exposed and removed objects after UnregisterBatteryProvider is called for that provider ID.

func NewBatteryProviderManager1

func NewBatteryProviderManager1(objectPath dbus.ObjectPath) (*BatteryProviderManager1, error)

NewBatteryProviderManager1 create a new instance of BatteryProviderManager1

Args: - objectPath: /org/bluez/{hci0,hci1,...}

func (*BatteryProviderManager1) Client

func (a *BatteryProviderManager1) Client() *bluez.Client

Client return BatteryProviderManager1 dbus client

func (*BatteryProviderManager1) Close

func (a *BatteryProviderManager1) Close()

Close the connection

func (*BatteryProviderManager1) GetObjectManagerSignal

func (a *BatteryProviderManager1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)

GetObjectManagerSignal return a channel for receiving updates from the ObjectManager

func (*BatteryProviderManager1) GetProperties

GetProperties load all available properties

func (*BatteryProviderManager1) GetPropertiesSignal

func (a *BatteryProviderManager1) GetPropertiesSignal() (chan *dbus.Signal, error)

GetPropertiesSignal return a channel for receiving udpdates on property changes

func (*BatteryProviderManager1) GetProperty

func (a *BatteryProviderManager1) GetProperty(name string) (dbus.Variant, error)

GetProperty get a property

func (*BatteryProviderManager1) GetWatchPropertiesChannel

func (a *BatteryProviderManager1) GetWatchPropertiesChannel() chan *dbus.Signal

GetWatchPropertiesChannel return the dbus channel to receive properties interface

func (*BatteryProviderManager1) Interface

func (a *BatteryProviderManager1) Interface() string

Interface return BatteryProviderManager1 interface

func (*BatteryProviderManager1) Path

func (a *BatteryProviderManager1) Path() dbus.ObjectPath

Path return BatteryProviderManager1 object path

func (*BatteryProviderManager1) RegisterBatteryProvider

func (a *BatteryProviderManager1) RegisterBatteryProvider(provider dbus.ObjectPath) error

RegisterBatteryProvider This registers a battery provider. A registered

battery provider can then expose objects with
org.bluez.BatteryProvider1 interface described below.

func (*BatteryProviderManager1) SetProperty

func (a *BatteryProviderManager1) SetProperty(name string, value interface{}) error

SetProperty set a property

func (*BatteryProviderManager1) SetWatchPropertiesChannel

func (a *BatteryProviderManager1) SetWatchPropertiesChannel(c chan *dbus.Signal)

SetWatchPropertiesChannel set the dbus channel to receive properties interface

func (*BatteryProviderManager1) ToProps

ToProps return the properties interface

func (*BatteryProviderManager1) UnregisterBatteryProvider

func (a *BatteryProviderManager1) UnregisterBatteryProvider(provider dbus.ObjectPath) error

UnregisterBatteryProvider This unregisters a battery provider. After

unregistration, the BatteryProvider1 objects provided
by this client are ignored by BlueZ.

func (*BatteryProviderManager1) UnwatchProperties

func (a *BatteryProviderManager1) UnwatchProperties(ch chan *bluez.PropertyChanged) error

func (*BatteryProviderManager1) WatchProperties

func (a *BatteryProviderManager1) WatchProperties() (chan *bluez.PropertyChanged, error)

WatchProperties updates on property changes

type BatteryProviderManager1Properties

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

BatteryProviderManager1Properties contains the exposed properties of an interface

func (*BatteryProviderManager1Properties) FromDBusMap

func (a *BatteryProviderManager1Properties) FromDBusMap(props map[string]dbus.Variant) (*BatteryProviderManager1Properties, error)

FromDBusMap convert a map to an BatteryProviderManager1Properties

func (*BatteryProviderManager1Properties) FromMap

FromMap convert a map to an BatteryProviderManager1Properties

func (*BatteryProviderManager1Properties) Lock

Lock access to properties

func (*BatteryProviderManager1Properties) ToMap

func (a *BatteryProviderManager1Properties) ToMap() (map[string]interface{}, error)

ToMap convert a BatteryProviderManager1Properties to map

func (*BatteryProviderManager1Properties) Unlock

Unlock access to properties

Jump to

Keyboard shortcuts

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