Documentation
¶
Index ¶
- Constants
- Variables
- type Application
- func (app *Application) AddService(service *GattService1) error
- func (app *Application) CreateService(props *profile.GattService1Properties, advertisedOptional ...bool) (*GattService1, error)
- func (app *Application) GenerateUUID(uuidVal string) string
- func (app *Application) GetObjectManager() *ObjectManager
- func (app *Application) GetServices() map[dbus.ObjectPath]*GattService1
- func (app *Application) HandleDescriptorRead(srvUUID string, charUUID string, descUUID string) ([]byte, *CallbackError)
- func (app *Application) HandleDescriptorWrite(srvUUID string, charUUID string, descUUID string, value []byte) *CallbackError
- func (app *Application) HandleRead(srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath) ([]byte, *CallbackError)
- func (app *Application) HandleWrite(srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath, value []byte) *CallbackError
- func (app *Application) Name() string
- func (app *Application) Path() dbus.ObjectPath
- func (app *Application) RemoveService(service *GattService1) error
- func (app *Application) Run() error
- func (app *Application) StartAdvertising(deviceInterface string) error
- func (app *Application) StopAdvertising() error
- type ApplicationConfig
- type CallbackError
- type GattCharacteristic1
- func (s *GattCharacteristic1) AddDescriptor(desc *GattDescriptor1) error
- func (s *GattCharacteristic1) CreateDescriptor(props *profile.GattDescriptor1Properties) (*GattDescriptor1, error)
- func (s *GattCharacteristic1) Expose() error
- func (s *GattCharacteristic1) GetDescriptorPaths() []dbus.ObjectPath
- func (s *GattCharacteristic1) GetDescriptors() map[dbus.ObjectPath]*GattDescriptor1
- func (s *GattCharacteristic1) Interface() string
- func (s *GattCharacteristic1) Path() dbus.ObjectPath
- func (s *GattCharacteristic1) Properties() map[string]bluez.Properties
- func (s *GattCharacteristic1) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
- func (s *GattCharacteristic1) RemoveDescriptor(char *GattDescriptor1) error
- func (s *GattCharacteristic1) StartNotify() *dbus.Error
- func (s *GattCharacteristic1) StopNotify() *dbus.Error
- func (s *GattCharacteristic1) UpdateValue(value []byte)
- func (s *GattCharacteristic1) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
- type GattCharacteristic1Config
- type GattDescriptor1
- func (s *GattDescriptor1) Expose() error
- func (s *GattDescriptor1) Interface() string
- func (s *GattDescriptor1) Path() dbus.ObjectPath
- func (s *GattDescriptor1) Properties() map[string]bluez.Properties
- func (s *GattDescriptor1) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
- func (s *GattDescriptor1) UpdateValue(value []byte) error
- func (s *GattDescriptor1) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
- type GattDescriptor1Config
- type GattDescriptorReadCallback
- type GattDescriptorWriteCallback
- type GattReadCallback
- type GattService1
- func (s *GattService1) AddCharacteristic(char *GattCharacteristic1) error
- func (s *GattService1) Advertised() bool
- func (s *GattService1) CreateCharacteristic(props *profile.GattCharacteristic1Properties) (*GattCharacteristic1, error)
- func (s *GattService1) Expose() error
- func (s *GattService1) GetApp() *Application
- func (s *GattService1) GetCharacteristicPaths() []dbus.ObjectPath
- func (s *GattService1) GetCharacteristics() map[dbus.ObjectPath]*GattCharacteristic1
- func (s *GattService1) GetProperties() *profile.GattService1Properties
- func (s *GattService1) Interface() string
- func (s *GattService1) Path() dbus.ObjectPath
- func (s *GattService1) Properties() map[string]bluez.Properties
- func (s *GattService1) RemoveCharacteristic(char *GattCharacteristic1) error
- type GattService1Config
- type GattWriteCallback
- type LEAdvertisement1
- type LEAdvertisement1Config
- type ObjectManager
- func (o *ObjectManager) AddObject(path dbus.ObjectPath, val map[string]bluez.Properties) error
- func (o *ObjectManager) GetManagedObject(objpath dbus.ObjectPath) (map[string]map[string]dbus.Variant, error)
- func (o *ObjectManager) GetManagedObjects() (map[dbus.ObjectPath]map[string]map[string]dbus.Variant, *dbus.Error)
- func (o *ObjectManager) RemoveObject(path dbus.ObjectPath) error
- func (o *ObjectManager) SignalAdded(path dbus.ObjectPath) error
- func (o *ObjectManager) SignalRemoved(path dbus.ObjectPath, ifaces []string) error
- type Properties
- func (p *Properties) AddProperties(iface string, props bluez.Properties) error
- func (p *Properties) Expose(path dbus.ObjectPath)
- func (p *Properties) Instance() *prop.Properties
- func (p *Properties) Introspection(iface string) []introspect.Property
- func (p *Properties) RemoveProperties(iface string)
Constants ¶
const CallbackFunctionError = -2
CallbackFunctionError callback reported an error
const CallbackNotRegistered = -1
CallbackNotRegistered callback not registered
const UUIDSuffix = "-0000-1000-8000-00805F9B34FB"
UUIDSuffix fixed 128bit UUID [0000]+[xxxx]+[-0000-1000-8000-00805F9B34FB]
Variables ¶
var DbusErr = dbus.NewError("org.freedesktop.Dbus.Error", nil)
DbusErr a generic dbus Error
var DbusErrIfaceNotFound = prop.ErrIfaceNotFound
DbusErrIfaceNotFound interface not found
var DbusErrPropNotFound = prop.ErrPropNotFound
DbusErrPropNotFound property not found
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application a bluetooth service exposed by bluez
func NewApplication ¶
func NewApplication(config *ApplicationConfig) (*Application, error)
NewApplication instantiate a new application service
func (*Application) AddService ¶
func (app *Application) AddService(service *GattService1) error
AddService add service to expose
func (*Application) CreateService ¶
func (app *Application) CreateService(props *profile.GattService1Properties, advertisedOptional ...bool) (*GattService1, error)
CreateService create a new GattService1 instance
func (*Application) GenerateUUID ¶
func (app *Application) GenerateUUID(uuidVal string) string
GenerateUUID generate a 128bit UUID
func (*Application) GetObjectManager ¶
func (app *Application) GetObjectManager() *ObjectManager
GetObjectManager return the object manager interface handler
func (*Application) GetServices ¶
func (app *Application) GetServices() map[dbus.ObjectPath]*GattService1
GetServices return the registered services
func (*Application) HandleDescriptorRead ¶
func (app *Application) HandleDescriptorRead(srvUUID string, charUUID string, descUUID string) ([]byte, *CallbackError)
HandleDescriptorRead handle descriptor read
func (*Application) HandleDescriptorWrite ¶
func (app *Application) HandleDescriptorWrite(srvUUID string, charUUID string, descUUID string, value []byte) *CallbackError
HandleDescriptorWrite handle descriptor write
func (*Application) HandleRead ¶
func (app *Application) HandleRead(srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath) ([]byte, *CallbackError)
HandleRead Handle application read
func (*Application) HandleWrite ¶
func (app *Application) HandleWrite(srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath, value []byte) *CallbackError
HandleWrite handle application write
func (*Application) Path ¶
func (app *Application) Path() dbus.ObjectPath
Path return the object path
func (*Application) RemoveService ¶
func (app *Application) RemoveService(service *GattService1) error
RemoveService remove an exposed service
func (*Application) StartAdvertising ¶
func (app *Application) StartAdvertising(deviceInterface string) error
StartAdvertising advertise information for a service
func (*Application) StopAdvertising ¶
func (app *Application) StopAdvertising() error
StopAdvertising stop advertising information on a service
type ApplicationConfig ¶
type ApplicationConfig struct { UUIDSuffix string UUID string ObjectName string ObjectPath dbus.ObjectPath LocalName string WriteFunc GattWriteCallback ReadFunc GattReadCallback DescWriteFunc GattDescriptorWriteCallback DescReadFunc GattDescriptorReadCallback // contains filtered or unexported fields }
ApplicationConfig configuration for the bluetooth service
type CallbackError ¶
type CallbackError struct {
// contains filtered or unexported fields
}
CallbackError error from a callback
func NewCallbackError ¶
func NewCallbackError(code int, msg string) *CallbackError
NewCallbackError create a new callback error
func (*CallbackError) Error ¶
func (e *CallbackError) Error() string
type GattCharacteristic1 ¶
type GattCharacteristic1 struct { PropertiesInterface *Properties // contains filtered or unexported fields }
GattCharacteristic1 client
func NewGattCharacteristic1 ¶
func NewGattCharacteristic1(config *GattCharacteristic1Config, props *profile.GattCharacteristic1Properties) (*GattCharacteristic1, error)
NewGattCharacteristic1 create a new GattCharacteristic1 client
func (*GattCharacteristic1) AddDescriptor ¶
func (s *GattCharacteristic1) AddDescriptor(desc *GattDescriptor1) error
AddDescriptor add a characteristic
func (*GattCharacteristic1) CreateDescriptor ¶
func (s *GattCharacteristic1) CreateDescriptor(props *profile.GattDescriptor1Properties) (*GattDescriptor1, error)
CreateDescriptor create a new characteristic
func (*GattCharacteristic1) Expose ¶
func (s *GattCharacteristic1) Expose() error
Expose the char to dbus
func (*GattCharacteristic1) GetDescriptorPaths ¶
func (s *GattCharacteristic1) GetDescriptorPaths() []dbus.ObjectPath
GetDescriptorPaths return the characteristics object paths
func (*GattCharacteristic1) GetDescriptors ¶
func (s *GattCharacteristic1) GetDescriptors() map[dbus.ObjectPath]*GattDescriptor1
GetDescriptors return the characteristics of the service
func (*GattCharacteristic1) Interface ¶
func (s *GattCharacteristic1) Interface() string
Interface return the dbus interface name
func (*GattCharacteristic1) Path ¶
func (s *GattCharacteristic1) Path() dbus.ObjectPath
Path return the object path
func (*GattCharacteristic1) Properties ¶
func (s *GattCharacteristic1) Properties() map[string]bluez.Properties
Properties return the properties of the service
func (*GattCharacteristic1) ReadValue ¶
func (s *GattCharacteristic1) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
ReadValue read a value
func (*GattCharacteristic1) RemoveDescriptor ¶
func (s *GattCharacteristic1) RemoveDescriptor(char *GattDescriptor1) error
RemoveDescriptor remove a characteristic
func (*GattCharacteristic1) StartNotify ¶
func (s *GattCharacteristic1) StartNotify() *dbus.Error
StartNotify start notification
func (*GattCharacteristic1) StopNotify ¶
func (s *GattCharacteristic1) StopNotify() *dbus.Error
StopNotify stop notification
func (*GattCharacteristic1) UpdateValue ¶
func (s *GattCharacteristic1) UpdateValue(value []byte)
UpdateValue update a value
func (*GattCharacteristic1) WriteValue ¶
func (s *GattCharacteristic1) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
WriteValue write a value
type GattCharacteristic1Config ¶
type GattCharacteristic1Config struct { ID int // contains filtered or unexported fields }
GattCharacteristic1Config GattCharacteristic1 configuration
type GattDescriptor1 ¶
type GattDescriptor1 struct { PropertiesInterface *Properties // contains filtered or unexported fields }
GattDescriptor1 client
func NewGattDescriptor1 ¶
func NewGattDescriptor1(config *GattDescriptor1Config, props *profile.GattDescriptor1Properties) (*GattDescriptor1, error)
NewGattDescriptor1 create a new GattDescriptor1 client
func (*GattDescriptor1) Interface ¶
func (s *GattDescriptor1) Interface() string
Interface return the Dbus interface
func (*GattDescriptor1) Path ¶
func (s *GattDescriptor1) Path() dbus.ObjectPath
Path return the object path
func (*GattDescriptor1) Properties ¶
func (s *GattDescriptor1) Properties() map[string]bluez.Properties
Properties return the properties of the service
func (*GattDescriptor1) ReadValue ¶
func (s *GattDescriptor1) ReadValue(options map[string]interface{}) ([]byte, *dbus.Error)
ReadValue read a value
func (*GattDescriptor1) UpdateValue ¶
func (s *GattDescriptor1) UpdateValue(value []byte) error
UpdateValue update a descriptor value
func (*GattDescriptor1) WriteValue ¶
func (s *GattDescriptor1) WriteValue(value []byte, options map[string]interface{}) *dbus.Error
WriteValue write a value
type GattDescriptor1Config ¶
type GattDescriptor1Config struct { ID int // contains filtered or unexported fields }
GattDescriptor1Config GattDescriptor1 configuration
type GattDescriptorReadCallback ¶
type GattDescriptorReadCallback func(app *Application, service_uuid string, charUUID string, descUUID string) ([]byte, error)
GattDescriptorReadCallback A callback we can register to handle descriptor ead requests
type GattDescriptorWriteCallback ¶
type GattDescriptorWriteCallback func(app *Application, service_uuid string, charUUID string, descUUID string, value []byte) error
GattDescriptorWriteCallback A callback we can register to handle descriptor write requests
type GattReadCallback ¶
type GattReadCallback func(app *Application, srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath) ([]byte, error)
GattReadCallback A callback we can register to handle read requests
type GattService1 ¶
type GattService1 struct { PropertiesInterface *Properties // contains filtered or unexported fields }
GattService1 interface implementation
func NewGattService1 ¶
func NewGattService1(config *GattService1Config, props *profile.GattService1Properties) (*GattService1, error)
NewGattService1 create a new instance of GattService1
func (*GattService1) AddCharacteristic ¶
func (s *GattService1) AddCharacteristic(char *GattCharacteristic1) error
AddCharacteristic add a characteristic
func (*GattService1) Advertised ¶
func (s *GattService1) Advertised() bool
Advertised indicate if the service has been advertised
func (*GattService1) CreateCharacteristic ¶
func (s *GattService1) CreateCharacteristic(props *profile.GattCharacteristic1Properties) (*GattCharacteristic1, error)
CreateCharacteristic create a new characteristic
func (*GattService1) GetApp ¶
func (s *GattService1) GetApp() *Application
GetApp return the parent app
func (*GattService1) GetCharacteristicPaths ¶
func (s *GattService1) GetCharacteristicPaths() []dbus.ObjectPath
GetCharacteristicPaths return the characteristics object paths
func (*GattService1) GetCharacteristics ¶
func (s *GattService1) GetCharacteristics() map[dbus.ObjectPath]*GattCharacteristic1
GetCharacteristics return the characteristics of the service
func (*GattService1) GetProperties ¶
func (s *GattService1) GetProperties() *profile.GattService1Properties
Properties return the properties of the service
func (*GattService1) Interface ¶
func (s *GattService1) Interface() string
Interface return the dbus interface name
func (*GattService1) Path ¶
func (s *GattService1) Path() dbus.ObjectPath
Path return the object path
func (*GattService1) Properties ¶
func (s *GattService1) Properties() map[string]bluez.Properties
Properties return the properties of the service
func (*GattService1) RemoveCharacteristic ¶
func (s *GattService1) RemoveCharacteristic(char *GattCharacteristic1) error
RemoveCharacteristic remove a characteristic
type GattService1Config ¶
type GattService1Config struct { ID int // contains filtered or unexported fields }
GattService1Config GattService configuration
type GattWriteCallback ¶
type GattWriteCallback func(app *Application, srviceObjPath dbus.ObjectPath, charObjPath dbus.ObjectPath, value []byte) error
GattWriteCallback A callback we can register to handle write requests
type LEAdvertisement1 ¶
type LEAdvertisement1 struct { PropertiesInterface *Properties // contains filtered or unexported fields }
LEAdvertisement1 client
func NewLEAdvertisement1 ¶
func NewLEAdvertisement1(config *LEAdvertisement1Config, props *profile.LEAdvertisement1Properties) (*LEAdvertisement1, error)
NewLEAdvertisement1 create a new LEAdvertisement1 client
func (*LEAdvertisement1) Interface ¶
func (s *LEAdvertisement1) Interface() string
Interface return the dbus interface name
func (*LEAdvertisement1) Path ¶
func (s *LEAdvertisement1) Path() dbus.ObjectPath
Path return the object path
func (*LEAdvertisement1) Properties ¶
func (s *LEAdvertisement1) Properties() map[string]bluez.Properties
Properties return the properties of the service
func (*LEAdvertisement1) Release ¶
func (s *LEAdvertisement1) Release()
Release This method gets called when the service daemon removes the Advertisement. A client can use it to do cleanup tasks. There is no need to call UnregisterAdvertisement because when this method gets called it has already been unregistered.
type LEAdvertisement1Config ¶
type LEAdvertisement1Config struct {
// contains filtered or unexported fields
}
LEAdvertisement1Config LEAdvertisement1 configuration
type ObjectManager ¶
type ObjectManager struct {
// contains filtered or unexported fields
}
ObjectManager interface implementation
func NewObjectManager ¶
func NewObjectManager(conn *dbus.Conn) (*ObjectManager, error)
NewObjectManager create a new instance
func (*ObjectManager) AddObject ¶
func (o *ObjectManager) AddObject(path dbus.ObjectPath, val map[string]bluez.Properties) error
AddObject add an object to the list
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
func (*ObjectManager) GetManagedObjects ¶
func (o *ObjectManager) GetManagedObjects() (map[dbus.ObjectPath]map[string]map[string]dbus.Variant, *dbus.Error)
GetManagedObjects return an up to date view of the object state
func (*ObjectManager) RemoveObject ¶
func (o *ObjectManager) RemoveObject(path dbus.ObjectPath) error
RemoveObject remove an object from the list
func (*ObjectManager) SignalAdded ¶
func (o *ObjectManager) SignalAdded(path dbus.ObjectPath) error
SignalAdded notify of interfaces being added
func (*ObjectManager) SignalRemoved ¶
func (o *ObjectManager) SignalRemoved(path dbus.ObjectPath, ifaces []string) error
SignalRemoved notify of interfaces being removed
type Properties ¶
type Properties struct {
// contains filtered or unexported fields
}
Properties interface implementation
func NewProperties ¶
func NewProperties(conn *dbus.Conn) (*Properties, error)
NewProperties create a new instance
func (*Properties) AddProperties ¶
func (p *Properties) AddProperties(iface string, props bluez.Properties) error
AddProperties add a property set
func (*Properties) Expose ¶
func (p *Properties) Expose(path dbus.ObjectPath)
Expose expose the properties interface
func (*Properties) Instance ¶
func (p *Properties) Instance() *prop.Properties
Instance return the props instance
func (*Properties) Introspection ¶
func (p *Properties) Introspection(iface string) []introspect.Property
Introspection return the props instance
func (*Properties) RemoveProperties ¶
func (p *Properties) RemoveProperties(iface string)
RemoveProperties remove a property set