battery

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 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"

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) 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) SetProperty

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

SetProperty set a property

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
	// 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

Jump to

Keyboard shortcuts

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