service

package
v0.0.0-...-ac156b6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppPath = "/org/bluez/%s/apps/app%d"
View Source
var UseRandomUUID = false

Functions

func NewGattCharacteristic1Properties

func NewGattCharacteristic1Properties(uuid string) *gatt.GattCharacteristic1Properties

Create a new GattCharacteristic1Properties

func NewGattDescriptor1Properties

func NewGattDescriptor1Properties(uuid string) *gatt.GattDescriptor1Properties

Create a new GattDescriptor1Properties

func NewGattService1Properties

func NewGattService1Properties(uuid string) *gatt.GattService1Properties

Create a new GattService1Properties

func RandomUUID

func RandomUUID() (string, error)

Types

type App

type App struct {
	AgentCaps         string
	AgentSetAsDefault bool
	// contains filtered or unexported fields
}

Wrap a bluetooth application exposing services

func NewApp

func NewApp(adapterID string) (*App, error)

Initialize a new bluetooth service (app)

func (*App) Adapter

func (app *App) Adapter() *adapter.Adapter1

func (*App) AdapterID

func (app *App) AdapterID() string

func (*App) AddService

func (app *App) AddService(s *Service) error

func (*App) Advertise

func (app *App) Advertise(timeout uint32) (func(), error)

func (*App) Agent

func (app *App) Agent() agent.Agent1Client

func (*App) Close

func (app *App) Close()

func (*App) DBusConn

func (app *App) DBusConn() *dbus.Conn

return the dbus connection

func (*App) DBusObjectManager

func (app *App) DBusObjectManager() *api.DBusObjectManager

func (*App) ExposeAgent

func (app *App) ExposeAgent(caps string, setAsDefaultAgent bool) error

Expose app agent on DBus

func (*App) GetAdvertisement

func (app *App) GetAdvertisement() *advertising.LEAdvertisement1Properties

func (*App) GetServices

func (app *App) GetServices() map[dbus.ObjectPath]*Service

func (*App) NewService

func (app *App) NewService() (*Service, error)

func (*App) Path

func (app *App) Path() dbus.ObjectPath

return the app dbus path

func (*App) RemoveService

func (app *App) RemoveService(service *Service) error

RemoveService remove an exposed service

func (*App) Run

func (app *App) Run() (err error)

func (*App) SetName

func (app *App) SetName(name string)

type Char

type Char struct {
	ID int

	Properties *gatt.GattCharacteristic1Properties
	// contains filtered or unexported fields
}

func (*Char) AddDescr

func (s *Char) AddDescr(descr *Descr) error

Add descr to dbus

func (*Char) App

func (c *Char) App() *App

func (*Char) DBusConn

func (s *Char) DBusConn() *dbus.Conn

func (*Char) DBusObjectManager

func (s *Char) DBusObjectManager() *api.DBusObjectManager

func (*Char) DBusProperties

func (s *Char) DBusProperties() *api.DBusProperties

func (*Char) Expose

func (s *Char) Expose() error

Expose char to dbus

func (*Char) GetDescr

func (c *Char) GetDescr() map[dbus.ObjectPath]*Descr

func (*Char) GetProperties

func (s *Char) GetProperties() bluez.Properties

func (*Char) Interface

func (s *Char) Interface() string

func (*Char) NewDescr

func (s *Char) NewDescr() (*Descr, error)

Init new descr

func (*Char) OnRead

func (s *Char) OnRead(fx CharReadCallback) *Char

Set the Read callback, called when a client attempt to read

func (*Char) OnWrite

func (s *Char) OnWrite(fx CharWriteCallback) *Char

Set the Write callback, called when a client attempt to write

func (*Char) Path

func (s *Char) Path() dbus.ObjectPath

func (*Char) ReadValue

func (s *Char) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)

ReadValue read a value

func (*Char) Remove

func (s *Char) Remove() error

Remove char from dbus

func (*Char) RemoveDescr

func (s *Char) RemoveDescr(descr *Descr) error

func (*Char) Service

func (c *Char) Service() *Service

func (*Char) StartNotify

func (s *Char) StartNotify() *dbus.Error

start notification session

func (*Char) StopNotify

func (s *Char) StopNotify() *dbus.Error

stop notification session

func (*Char) WriteValue

func (s *Char) WriteValue(value []byte, options map[string]interface{}) *dbus.Error

WriteValue write a value

type CharReadCallback

type CharReadCallback func(c *Char, options map[string]interface{}) ([]byte, error)

type CharWriteCallback

type CharWriteCallback func(c *Char, value []byte) ([]byte, error)

type Descr

type Descr struct {
	ID int

	Properties *gatt.GattDescriptor1Properties
	// contains filtered or unexported fields
}

func (*Descr) App

func (s *Descr) App() *App

func (*Descr) Char

func (s *Descr) Char() *Char

func (*Descr) DBusConn

func (s *Descr) DBusConn() *dbus.Conn

func (*Descr) DBusObjectManager

func (s *Descr) DBusObjectManager() *api.DBusObjectManager

func (*Descr) DBusProperties

func (s *Descr) DBusProperties() *api.DBusProperties

func (*Descr) Expose

func (s *Descr) Expose() error

Expose descr to dbus

func (*Descr) GetProperties

func (s *Descr) GetProperties() bluez.Properties

func (*Descr) Interface

func (s *Descr) Interface() string

func (*Descr) Path

func (s *Descr) Path() dbus.ObjectPath

func (*Descr) ReadValue

func (s *Descr) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)

ReadValue read a value

func (*Descr) Remove

func (s *Descr) Remove() error

Remove descr from dbus

func (*Descr) WriteValue

func (s *Descr) WriteValue(value []byte, options map[string]interface{}) *dbus.Error

WriteValue write a value

type DescrReadCallback

type DescrReadCallback func(c *Descr, options map[string]interface{}) ([]byte, error)

type DescrWriteCallback

type DescrWriteCallback func(c *Descr, value []byte) ([]byte, error)

type Service

type Service struct {
	ID int

	Properties *gatt.GattService1Properties
	// contains filtered or unexported fields
}

func (*Service) AddChar

func (s *Service) AddChar(char *Char) error

func (*Service) App

func (s *Service) App() *App

func (*Service) DBusConn

func (s *Service) DBusConn() *dbus.Conn

func (*Service) DBusObjectManager

func (s *Service) DBusObjectManager() *api.DBusObjectManager

func (*Service) DBusProperties

func (s *Service) DBusProperties() *api.DBusProperties

func (*Service) Expose

func (s *Service) Expose() error

Expose service to dbus

func (*Service) GetChars

func (s *Service) GetChars() map[dbus.ObjectPath]*Char

func (*Service) GetProperties

func (s *Service) GetProperties() bluez.Properties

func (*Service) Interface

func (s *Service) Interface() string

func (*Service) NewChar

func (s *Service) NewChar() (*Char, error)

Create a new characteristic

func (*Service) Path

func (s *Service) Path() dbus.ObjectPath

func (*Service) Remove

func (s *Service) Remove() error

Remove service from dbus

func (*Service) RemoveChar

func (s *Service) RemoveChar(char *Char) error

Jump to

Keyboard shortcuts

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