api

package
Version: v0.0.0-...-0b043d8 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: Apache-2.0 Imports: 12 Imported by: 53

Documentation

Overview

package api wraps an high level API to simplify interaction

Index

Constants

View Source
const BaseAdvertismentPath = "/go_bluetooth/%s/advertisement/%d"

const baseAdvertismentPath = "/org/bluez/%s/apps/advertisement%d"

Variables

This section is empty.

Functions

func Discover

func Discover(
	a *adapter.Adapter1, filter *adapter.DiscoveryFilter,
) (
	chan *adapter.DeviceDiscovered, func(), error,
)

Discover start device discovery

func Exit

func Exit() error

Exit performs a clean exit

func ExposeAdvertisement

func ExposeAdvertisement(adapterID string, props *advertising.LEAdvertisement1Properties, discoverableTimeout uint32) (func(), error)

Expose to bluez an advertisment instance via the adapter advertisement manager

func ExposeDBusService

func ExposeDBusService(s ExposedDBusService) (err error)

Expose - Interface() (Service, Char or Descr) - Properties interface

func GetAdapter

func GetAdapter(adapterID string) (*adapter.Adapter1, error)

func GetDefaultAdapter

func GetDefaultAdapter() (*adapter.Adapter1, error)

func GetDefaultAdapterID

func GetDefaultAdapterID() string

func RemoveDBusService

func RemoveDBusService(s ExposedDBusService) error

Types

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

func NewAdvertisement

func NewAdvertisement(adapterID string, props *advertising.LEAdvertisement1Properties) (*Advertisement, error)

func (*Advertisement) DBusConn

func (a *Advertisement) DBusConn() *dbus.Conn

func (*Advertisement) DBusObjectManager

func (a *Advertisement) DBusObjectManager() *DBusObjectManager

func (*Advertisement) DBusProperties

func (a *Advertisement) DBusProperties() *DBusProperties

func (*Advertisement) GetProperties

func (a *Advertisement) GetProperties() bluez.Properties

func (*Advertisement) Interface

func (a *Advertisement) Interface() string

func (*Advertisement) Path

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

type DBusObjectManager

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

DBusObjectManager interface implementation

func NewDBusObjectManager

func NewDBusObjectManager(conn *dbus.Conn) (*DBusObjectManager, error)

NewDBusObjectManager create a new instance

func (*DBusObjectManager) AddObject

func (o *DBusObjectManager) AddObject(path dbus.ObjectPath, val map[string]bluez.Properties) error

AddObject add an object to the list

func (*DBusObjectManager) GetManagedObject

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

GetManagedObject return an up to date view of a single object state

func (*DBusObjectManager) GetManagedObjects

func (o *DBusObjectManager) GetManagedObjects() (map[dbus.ObjectPath]map[string]map[string]dbus.Variant, *dbus.Error)

GetManagedObjects return an up to date view of the object state

func (*DBusObjectManager) RemoveObject

func (o *DBusObjectManager) RemoveObject(path dbus.ObjectPath) error

RemoveObject remove an object from the list

func (*DBusObjectManager) SignalAdded

func (o *DBusObjectManager) SignalAdded(path dbus.ObjectPath) error

SignalAdded notify of interfaces being added

func (*DBusObjectManager) SignalRemoved

func (o *DBusObjectManager) SignalRemoved(path dbus.ObjectPath, ifaces []string) error

SignalRemoved notify of interfaces being removed

type DBusProperties

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

DBus Properties interface implementation

func NewDBusProperties

func NewDBusProperties(conn *dbus.Conn) (*DBusProperties, error)

NewDBusProperties create a new instance

func (*DBusProperties) AddProperties

func (p *DBusProperties) AddProperties(iface string, props bluez.Properties) error

AddProperties add a property set

func (*DBusProperties) Expose

func (p *DBusProperties) Expose(path dbus.ObjectPath)

Expose expose the properties interface

func (*DBusProperties) Instance

func (p *DBusProperties) Instance() *prop.Properties

Instance return the props instance

func (*DBusProperties) Introspection

func (p *DBusProperties) Introspection(iface string) []introspect.Property

Introspection return the props instance

func (*DBusProperties) RemoveProperties

func (p *DBusProperties) RemoveProperties(iface string)

RemoveProperties remove a property set

type ExposedDBusService

type ExposedDBusService interface {
	Path() dbus.ObjectPath
	Interface() string
	GetProperties() bluez.Properties
	// App() *App
	DBusProperties() *DBusProperties
	DBusObjectManager() *DBusObjectManager
	DBusConn() *dbus.Conn
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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