bluez

package
v0.0.0-...-be66c10 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	Path         string
	Name         string
	Alias        string
	Address      string
	Discoverable bool
	Pairable     bool
	Powered      bool
	Discovering  bool
}

Adapter holds the bluetooth device adapter installed for a system. This can be retrieved by `hciconfig -a`.

type Bluez

type Bluez struct {
	Adapters []Adapter
	Devices  []Device
	// contains filtered or unexported fields
}

Bluez represents an overview of the bluetooth adapters and devices installed and configured on a system. A connection to `bluez` dbus is also used to interact with the bluetooth server on a system.

func NewBluez

func NewBluez(conn *dbus.Conn) *Bluez

NewBluez returns a new Bluez

func (*Bluez) CallAdapter

func (b *Bluez) CallAdapter(adapter, method string, flags dbus.Flags, args ...interface{}) *dbus.Call

CallAdapter is used to interact with the bluez Adapter dbus interface. https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt

func (*Bluez) CallDevice

func (b *Bluez) CallDevice(adapterName, deviceMac, method string, flags dbus.Flags, args ...interface{}) *dbus.Call

CallDevice is used to interact with the bluez Device dbus interface. https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt

func (*Bluez) Connect

func (b *Bluez) Connect(adapterName, deviceMac string) error

Connect will attempt to connect an already paired bluetooth device to an adapter.

func (*Bluez) ConvertToDevices

func (b *Bluez) ConvertToDevices(path string, values map[string]map[string]dbus.Variant) []Device

ConvertToDevices converts a map of dbus objects to a common Device structure.

func (*Bluez) Disconnect

func (b *Bluez) Disconnect(adapterName, deviceMac string) error

Disconnect will remove the bluetooth device from the adapter.

func (*Bluez) GetDeviceProperties

func (b *Bluez) GetDeviceProperties(adapterName, deviceMac string) (map[string]dbus.Variant, error)

GetDeviceProperties gathers all the properties for a bluetooth device.

func (*Bluez) ManagedObjects

func (b *Bluez) ManagedObjects() (map[dbus.ObjectPath]map[string]map[string]dbus.Variant, error)

ManagedObjects gets all bluetooth devices and adpaters that are currently managed by bluez.

func (*Bluez) Pair

func (b *Bluez) Pair(adapterName, deviceMac string) error

Pair will attempt to pair a bluetooth device that is in pairing mode.

func (*Bluez) PopulateCache

func (b *Bluez) PopulateCache() error

PopulateCache will query system for known bluetooth adapters and devices and will store them on the Bluez structure. TODO(vishen): Better name than 'PopulateCache'? This is gathering information about bluetooth devices and adapters...

func (*Bluez) RemoveDevice

func (b *Bluez) RemoveDevice(adapterName, deviceMac string) error

RemoveDevice will permantently remove the bluetooth device from the adapter. Once a device is removed, it can only be added again by being paired.

func (*Bluez) SetAdapterProperty

func (b *Bluez) SetAdapterProperty(adapterName, key string, value interface{}) error

SetAdapterProperty can be used to set certain properties for a bluetooth device.

func (*Bluez) SetDeviceProperty

func (b *Bluez) SetDeviceProperty(adapterName, deviceMac string, key string, value interface{}) error

SetDeviceProperty can be used to set certain properties for a bluetooth device.

func (*Bluez) StartDiscovery

func (b *Bluez) StartDiscovery(adapter string) error

StartDiscovery will put the adapter into "discovering" mode, which means the bluetooth device will be able to discover other bluetooth devices that are in pairing mode.

func (*Bluez) WatchSignal

func (b *Bluez) WatchSignal() chan *dbus.Signal

WatchSignal will register to receive events form the bluez dbus interface. Any events received are passed along to the returned channel for the caller to use.

type Device

type Device struct {
	Path      string
	Name      string
	Alias     string
	Address   string
	Adapter   string
	Paired    bool
	Connected bool
	Trusted   bool
	Blocked   bool
}

Device hold bluetooth device information.

Jump to

Keyboard shortcuts

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