Documentation ¶
Index ¶
- Variables
- func NewGattCharacteristic1Properties(uuid string) *gatt.GattCharacteristic1Properties
- func NewGattDescriptor1Properties(uuid string) *gatt.GattDescriptor1Properties
- func NewGattService1Properties(uuid string) *gatt.GattService1Properties
- type App
- func (app *App) Adapter() *adapter.Adapter1
- func (app *App) AdapterID() string
- func (app *App) AddService(s *Service) error
- func (app *App) Advertise(timeout uint32) (func(), error)
- func (app *App) Agent() agent.Agent1Client
- func (app *App) Close()
- func (app *App) DBusConn() *dbus.Conn
- func (app *App) DBusObjectManager() *api.DBusObjectManager
- func (app *App) ExportTree() (err error)
- func (app *App) ExposeAgent(caps string, setAsDefaultAgent bool) error
- func (app *App) GenerateUUID(uuidVal string) string
- func (app *App) GetAdapter() *adapter.Adapter1
- func (app *App) GetAdvertisement() *advertising.LEAdvertisement1Properties
- func (app *App) GetServices() map[dbus.ObjectPath]*Service
- func (app *App) NewService(uuid string) (*Service, error)
- func (app *App) Path() dbus.ObjectPath
- func (app *App) RemoveService(service *Service) error
- func (app *App) Run() (err error)
- func (app *App) SetName(name string)
- type AppOptions
- type Char
- func (s *Char) AddDescr(descr *Descr) error
- func (c *Char) App() *App
- func (s *Char) Confirm() *dbus.Error
- func (s *Char) DBusConn() *dbus.Conn
- func (s *Char) DBusObjectManager() *api.DBusObjectManager
- func (s *Char) DBusProperties() *api.DBusProperties
- func (s *Char) Expose() error
- func (c *Char) GetDescr() map[dbus.ObjectPath]*Descr
- func (s *Char) GetProperties() bluez.Properties
- func (s *Char) Interface() string
- func (s *Char) NewDescr(uuid string) (*Descr, error)
- func (s *Char) OnRead(fx CharReadCallback) *Char
- func (s *Char) OnWrite(fx CharWriteCallback) *Char
- func (s *Char) Path() dbus.ObjectPath
- func (s *Char) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
- func (s *Char) Remove() error
- func (s *Char) RemoveDescr(descr *Descr) error
- func (c *Char) Service() *Service
- func (s *Char) StartNotify() *dbus.Error
- func (s *Char) StopNotify() *dbus.Error
- func (s *Char) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
- type CharReadCallback
- type CharWriteCallback
- type Descr
- func (s *Descr) App() *App
- func (s *Descr) Char() *Char
- func (s *Descr) DBusConn() *dbus.Conn
- func (s *Descr) DBusObjectManager() *api.DBusObjectManager
- func (s *Descr) DBusProperties() *api.DBusProperties
- func (s *Descr) Expose() error
- func (s *Descr) GetProperties() bluez.Properties
- func (s *Descr) Interface() string
- func (s *Descr) OnRead(fx DescrReadCallback) *Descr
- func (s *Descr) OnWrite(fx DescrWriteCallback) *Descr
- func (s *Descr) Path() dbus.ObjectPath
- func (s *Descr) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
- func (s *Descr) Remove() error
- func (s *Descr) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
- type DescrReadCallback
- type DescrWriteCallback
- type Service
- func (s *Service) AddChar(char *Char) error
- func (s *Service) App() *App
- func (s *Service) DBusConn() *dbus.Conn
- func (s *Service) DBusObjectManager() *api.DBusObjectManager
- func (s *Service) DBusProperties() *api.DBusProperties
- func (s *Service) Expose() error
- func (s *Service) GetChars() map[dbus.ObjectPath]*Char
- func (s *Service) GetProperties() bluez.Properties
- func (s *Service) Interface() string
- func (s *Service) NewChar(uuid string) (*Char, error)
- func (s *Service) Path() dbus.ObjectPath
- func (s *Service) Remove() error
- func (s *Service) RemoveChar(char *Char) error
Constants ¶
This section is empty.
Variables ¶
var AppPath = "/%s/apps/%d"
AppPath default app path
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
Types ¶
type App ¶
type App struct { Options AppOptions // contains filtered or unexported fields }
App wraps a bluetooth application exposing services
func NewApp ¶
func NewApp(options AppOptions) (*App, error)
NewApp initialize a new bluetooth service (app)
func (*App) AddService ¶
func (*App) Agent ¶
func (app *App) Agent() agent.Agent1Client
func (*App) DBusObjectManager ¶
func (app *App) DBusObjectManager() *api.DBusObjectManager
func (*App) ExportTree ¶
ExportTree update introspection data
func (*App) ExposeAgent ¶
Expose app agent on DBus
func (*App) GenerateUUID ¶
GenerateUUID generate a 128bit UUID
func (*App) GetAdapter ¶
GetAdapter return the adapter in use
func (*App) GetAdvertisement ¶
func (app *App) GetAdvertisement() *advertising.LEAdvertisement1Properties
func (*App) GetServices ¶
func (app *App) GetServices() map[dbus.ObjectPath]*Service
func (*App) RemoveService ¶
RemoveService remove an exposed service
type AppOptions ¶
type AppOptions struct { AdapterID string AgentCaps string AgentSetAsDefault bool UUIDSuffix string UUID string }
AppOptions contains App options
type Char ¶
type Char struct { UUID string Properties *gatt.GattCharacteristic1Properties // contains filtered or unexported fields }
func (*Char) Confirm ¶
Confirm This method doesn't expect a reply so it is just a confirmation that value was received.
Possible Errors: org.bluez.Error.Failed
func (*Char) DBusObjectManager ¶
func (s *Char) DBusObjectManager() *api.DBusObjectManager
func (*Char) DBusProperties ¶
func (s *Char) DBusProperties() *api.DBusProperties
func (*Char) GetProperties ¶
func (s *Char) GetProperties() bluez.Properties
func (*Char) OnRead ¶
func (s *Char) OnRead(fx CharReadCallback) *Char
OnRead Set the Read callback, called when a client attempt to read
func (*Char) OnWrite ¶
func (s *Char) OnWrite(fx CharWriteCallback) *Char
OnWrite Set the Write callback, called when a client attempt to write
func (*Char) Path ¶
func (s *Char) Path() dbus.ObjectPath
func (*Char) ReadValue ¶
ReadValue Issues a request to read the value of the characteristic and returns the value if the operation was successful.
Possible options: "offset": uint16 offset
"device": Object Device (Server only)
Possible Errors: org.bluez.Error.Failed
org.bluez.Error.InProgress org.bluez.Error.NotPermitted org.bluez.Error.NotAuthorized org.bluez.Error.InvalidOffset org.bluez.Error.NotSupported
func (*Char) RemoveDescr ¶
func (*Char) StartNotify ¶
StartNotify Starts a notification session from this characteristic if it supports value notifications or indications.
Possible Errors: org.bluez.Error.Failed
org.bluez.Error.NotPermitted org.bluez.Error.InProgress org.bluez.Error.NotSupported
func (*Char) StopNotify ¶
StopNotify This method will cancel any previous StartNotify transaction. Note that notifications from a characteristic are shared between sessions thus calling StopNotify will release a single session.
Possible Errors: org.bluez.Error.Failed
func (*Char) WriteValue ¶
WriteValue Issues a request to write the value of the characteristic.
Possible options: "offset": Start offset
"device": Device path (Server only) "link": Link type (Server only) "prepare-authorize": boolean Is prepare authorization request
Possible Errors: org.bluez.Error.Failed
org.bluez.Error.InProgress org.bluez.Error.NotPermitted org.bluez.Error.InvalidValueLength org.bluez.Error.NotAuthorized org.bluez.Error.NotSupported
type CharReadCallback ¶
type Descr ¶
type Descr struct { UUID string Properties *gatt.GattDescriptor1Properties // contains filtered or unexported fields }
func (*Descr) DBusObjectManager ¶
func (s *Descr) DBusObjectManager() *api.DBusObjectManager
func (*Descr) DBusProperties ¶
func (s *Descr) DBusProperties() *api.DBusProperties
func (*Descr) GetProperties ¶
func (s *Descr) GetProperties() bluez.Properties
func (*Descr) OnRead ¶
func (s *Descr) OnRead(fx DescrReadCallback) *Descr
Set the Read callback, called when a client attempt to read
func (*Descr) OnWrite ¶
func (s *Descr) OnWrite(fx DescrWriteCallback) *Descr
Set the Write callback, called when a client attempt to write
func (*Descr) Path ¶
func (s *Descr) Path() dbus.ObjectPath
type DescrReadCallback ¶
type Service ¶
type Service struct { UUID string Properties *gatt.GattService1Properties // contains filtered or unexported fields }
func (*Service) DBusObjectManager ¶
func (s *Service) DBusObjectManager() *api.DBusObjectManager
func (*Service) DBusProperties ¶
func (s *Service) DBusProperties() *api.DBusProperties
func (*Service) GetProperties ¶
func (s *Service) GetProperties() bluez.Properties
func (*Service) Path ¶
func (s *Service) Path() dbus.ObjectPath