bluez

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrgBluezPath      = "/org/bluez"
	OrgBluezInterface = "org.bluez"

	//ObjectManagerInterface the dbus object manager interface
	ObjectManagerInterface = "org.freedesktop.DBus.ObjectManager"
	//InterfacesRemoved the DBus signal member for InterfacesRemoved
	InterfacesRemoved = "org.freedesktop.DBus.ObjectManager.InterfacesRemoved"
	//InterfacesAdded the DBus signal member for InterfacesAdded
	InterfacesAdded = "org.freedesktop.DBus.ObjectManager.InterfacesAdded"

	//PropertiesInterface the DBus properties interface
	PropertiesInterface = "org.freedesktop.DBus.Properties"
	//PropertiesChanged the DBus properties interface and member
	PropertiesChanged = "org.freedesktop.DBus.Properties.PropertiesChanged"

	// Introspectable introspectable interface
	Introspectable = "org.freedesktop.DBus.Introspectable"
)
View Source
const Device1IntrospectDataString = `` /* 1601-byte string literal not displayed */

Device1IntrospectDataString interface definition

View Source
const GattCharacteristic1IntrospectDataString = `` /* 694-byte string literal not displayed */

GattCharacteristic1IntrospectDataString interface definition

View Source
const GattDescriptor1IntrospectDataString = `` /* 428-byte string literal not displayed */

GattDescriptor1IntrospectDataString interface definition

View Source
const GattService1IntrospectDataString = `` /* 309-byte string literal not displayed */

GattService1IntrospectDataString interface definition

View Source
const ObjectManagerIntrospectDataString = `` /* 410-byte string literal not displayed */

ObjectManagerIntrospectDataString introspect ObjectManager description

Variables

View Source
var GattService1IntrospectData = introspect.Interface{
	Name: "org.bluez.GattService1",
	Properties: []introspect.Property{
		{
			Name:   "UUID",
			Access: "read",
			Type:   "s",
		},
		{
			Name:   "Device",
			Access: "read",
			Type:   "o",
		},
		{
			Name:   "Primary",
			Access: "read",
			Type:   "b",
		},
		{
			Name:   "Characteristics",
			Access: "read",
			Type:   "ao",
		},
	},
}

GattService1IntrospectData interface definition

View Source
var ObjectManagerIntrospectData = introspect.Interface{
	Name: "org.freedesktop.DBus.ObjectManager",
	Methods: []introspect.Method{
		{
			Name: "GetManagedObjects",
			Args: []introspect.Arg{
				{
					Name:      "objects",
					Type:      "a{oa{sa{sv}}}",
					Direction: "out",
				},
			},
		},
	},
	Signals: []introspect.Signal{
		{
			Name: "InterfacesAdded",
			Args: []introspect.Arg{
				{
					Name: "object",
					Type: "o",
				},
				{
					Name: "interfaces",
					Type: "a{sa{sv}}",
				},
			},
		},
		{
			Name: "InterfacesRemoved",
			Args: []introspect.Arg{
				{
					Name: "object",
					Type: "o",
				},
				{
					Name: "interfaces",
					Type: "as",
				},
			},
		},
	},
}

ObjectManagerIntrospectData introspect ObjectManager description

Functions

func CloseConnections

func CloseConnections() (err error)

CloseConnections close all open connection to DBus

func GetConnection

func GetConnection(connType BusType) (*dbus.Conn, error)

GetConnection get a DBus connection

func UnwatchProperties

func UnwatchProperties(wprop WatchableClient, ch chan *PropertyChanged) error

func WatchProperties

func WatchProperties(wprop WatchableClient) (chan *PropertyChanged, error)

WatchProperties updates on property changes

Types

type BusType

type BusType int

BusType a type of DBus connection

const (
	// SessionBus uses the session bus
	SessionBus BusType = iota
	// SystemBus uses the system bus
	SystemBus
)

type Client

type Client struct {
	Config *Config
	// contains filtered or unexported fields
}

Client implement a DBus client

func NewClient

func NewClient(config *Config) *Client

NewClient create a new client

func (*Client) Call

func (c *Client) Call(method string, flags dbus.Flags, args ...interface{}) *dbus.Call

Call a DBus method

func (*Client) Connect

func (c *Client) Connect() error

Connect connects to DBus

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect from DBus

func (*Client) Emit

func (c *Client) Emit(path dbus.ObjectPath, name string, values ...interface{}) error

Emit

func (*Client) GetProperties

func (c *Client) GetProperties(props interface{}) error

GetProperties load all the properties for an interface

func (*Client) GetProperty

func (c *Client) GetProperty(p string) (dbus.Variant, error)

GetProperty return a property value

func (*Client) Register

func (c *Client) Register(path dbus.ObjectPath, iface string) (chan *dbus.Signal, error)

Register for signals

func (*Client) SetProperty

func (c *Client) SetProperty(p string, v interface{}) error

SetProperty set a property value

func (*Client) Unregister

func (c *Client) Unregister(path dbus.ObjectPath, iface string, signal chan *dbus.Signal) error

Unregister for signals

type Config

type Config struct {
	Name  string
	Iface string
	Path  dbus.ObjectPath
	Bus   BusType
}

Config pass configuration to a DBUS client

type ObjectManager

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

ObjectManager manges the list of all available objects

func GetObjectManager

func GetObjectManager() (*ObjectManager, error)

GetObjectManager return a client instance of the Bluez object manager

func NewObjectManager

func NewObjectManager(name string, path string) (*ObjectManager, error)

NewObjectManager create a new ObjectManager client

func (*ObjectManager) Close

func (o *ObjectManager) Close()

Close the connection

func (*ObjectManager) GetManagedObject

func (o *ObjectManager) GetManagedObject(objpath dbus.ObjectPath) (map[string]map[string]dbus.Variant, error)

GetManagedObject return an up to date view of a single object state. object is nil if the object path is not found

func (*ObjectManager) GetManagedObjects

func (o *ObjectManager) GetManagedObjects() (map[dbus.ObjectPath]map[string]map[string]dbus.Variant, error)

GetManagedObjects return a list of all available objects registered

func (*ObjectManager) Register

func (o *ObjectManager) Register() (chan *dbus.Signal, error)

Register watch for signal events

func (*ObjectManager) Unregister

func (o *ObjectManager) Unregister(signal chan *dbus.Signal) error

Unregister watch for signal events

type Properties

type Properties interface {
	ToMap() (map[string]interface{}, error)
	Lock()
	Unlock()
}

Properties dbus serializable struct Use struct tags to control how the field is handled by Properties interface Example: field `dbus:writable,emit,myCallback` See Prop in github.com/godbus/dbus/prop for configuration details Options: - writable: set the property as writable (Set will updated it). Omit for read-only - emit|invalidates: emit PropertyChanged, invalidates emit without disclosing the value. Omit for read-only - callback: a callable function in the struct compatible with the signature of Prop.Callback. Omit for no callback

type PropertyChanged

type PropertyChanged struct {
	Interface string
	Name      string
	Value     interface{}
}

PropertyChanged indicates that a change is notified

type WatchableClient

type WatchableClient interface {
	Client() *Client
	Path() dbus.ObjectPath
	ToProps() Properties
	GetWatchPropertiesChannel() chan *dbus.Signal
	SetWatchPropertiesChannel(chan *dbus.Signal)
}

Directories

Path Synopsis
BlueZ D-Bus Profile API description [profile-api.txt]
BlueZ D-Bus Profile API description [profile-api.txt]
adapter
BlueZ D-Bus Adapter API description [adapter-api.txt]
BlueZ D-Bus Adapter API description [adapter-api.txt]
advertising
BlueZ D-Bus LE Advertising API Description [advertising-api.txt] Advertising packets are structured data which is broadcast on the LE Advertising channels and available for all devices in range.
BlueZ D-Bus LE Advertising API Description [advertising-api.txt] Advertising packets are structured data which is broadcast on the LE Advertising channels and available for all devices in range.
agent
BlueZ D-Bus Agent API description [agent-api.txt]
BlueZ D-Bus Agent API description [agent-api.txt]
battery
BlueZ D-Bus Battery API description [battery-api.txt]
BlueZ D-Bus Battery API description [battery-api.txt]
device
BlueZ D-Bus Device API description [device-api.txt]
BlueZ D-Bus Device API description [device-api.txt]
gatt
BlueZ D-Bus GATT API description [gatt-api.txt] GATT local and remote services share the same high-level D-Bus API.
BlueZ D-Bus GATT API description [gatt-api.txt] GATT local and remote services share the same high-level D-Bus API.
health
BlueZ D-Bus Health API description [health-api.txt]
BlueZ D-Bus Health API description [health-api.txt]
input
BlueZ D-Bus Input API description [input-api.txt]
BlueZ D-Bus Input API description [input-api.txt]
media
BlueZ D-Bus Media API description [media-api.txt]
BlueZ D-Bus Media API description [media-api.txt]
network
BlueZ D-Bus Network API description [network-api.txt]
BlueZ D-Bus Network API description [network-api.txt]
obex
OBEX D-Bus API description [obex-api.txt]
OBEX D-Bus API description [obex-api.txt]
obex_agent
OBEX D-Bus Agent API description [obex-agent-api.txt]
OBEX D-Bus Agent API description [obex-agent-api.txt]
sap
BlueZ D-Bus Sim Access API description [sap-api.txt]
BlueZ D-Bus Sim Access API description [sap-api.txt]
thermometer
BlueZ D-Bus Thermometer API description [thermometer-api.txt] Santiago Carot-Nemesio <sancane@gmail.com>
BlueZ D-Bus Thermometer API description [thermometer-api.txt] Santiago Carot-Nemesio <sancane@gmail.com>

Jump to

Keyboard shortcuts

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