Documentation ¶
Index ¶
- func AdapterExists(adapterID string) (bool, error)
- func ClearDevice(d *Device) error
- func ClearDevices() error
- func Exit()
- func FlushDevices(adapterID string) error
- func GetAdapter(adapterID string) (*profile.Adapter1, error)
- func GetAdapterStatus(adapterID string) (*linux.RFKillResult, error)
- func GetDeviceList() ([]dbus.ObjectPath, error)
- func GetGattManager(adapterID string) (*profile.GattManager1, error)
- func GetHCIConfig(adapterID string) *hciconfig.HCIConfig
- func Off(name string, fn *emitter.Callback) error
- func On(name string, fn *emitter.Callback) error
- func StartDiscovery() error
- func StartDiscoveryOn(adapterID string) error
- func StopDiscovery() error
- func StopDiscoveryOn(adapterID string) error
- func ToggleAdapter(adapterID string) error
- func ToggleBluetooth() error
- func TurnOffAdapter(adapterID string) error
- func TurnOffBluetooth() error
- func TurnOnAdapter(adapterID string) error
- func TurnOnBluetooth() error
- type AdapterEvent
- type DataEvent
- type Device
- func (d *Device) Connect() error
- func (d *Device) Disconnect() error
- func (d *Device) Emit(name string, data interface{}) error
- func (d *Device) GetAllServicesAndUUID() ([]string, error)
- func (d *Device) GetChar(path string) (*profile.GattCharacteristic1, error)
- func (d *Device) GetCharByUUID(uuid string) (*profile.GattCharacteristic1, error)
- func (d *Device) GetCharsByUUID(uuid string) ([]*profile.GattCharacteristic1, error)
- func (d *Device) GetCharsList() ([]dbus.ObjectPath, error)
- func (d *Device) GetClient() (*profile.Device1, error)
- func (d *Device) GetDescriptorList() ([]dbus.ObjectPath, error)
- func (d *Device) GetDescriptors(char *profile.GattCharacteristic1) ([]*profile.GattDescriptor1, error)
- func (d *Device) GetProperties() (*profile.Device1Properties, error)
- func (d *Device) GetProperty(name string) (data interface{}, err error)
- func (d *Device) GetService(path string) *profile.GattService1
- func (d *Device) IsConnected() bool
- func (d *Device) Off(name string, cb *emitter.Callback) error
- func (d *Device) On(name string, fn *emitter.Callback) error
- func (d *Device) Pair() error
- type DeviceStatus
- type DiscoveredDeviceEvent
- type EventStatus
- type GattCharacteristicEvent
- type GattDescriptorEvent
- type GattService
- type GattServiceEvent
- type Manager
- type PropertyChangedEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdapterExists ¶
AdapterExists checks if an adapter is available
func FlushDevices ¶
FlushDevices clears removes device and clears it from cached devices
func GetAdapter ¶
GetAdapter return an adapter object instance
func GetAdapterStatus ¶
func GetAdapterStatus(adapterID string) (*linux.RFKillResult, error)
GetAdapterStatus return the status of an adapter
func GetDeviceList ¶
func GetDeviceList() ([]dbus.ObjectPath, error)
GetDeviceList returns a list of discovered Devices paths
func GetGattManager ¶
func GetGattManager(adapterID string) (*profile.GattManager1, error)
GetGattManager return a GattManager1 instance
func GetHCIConfig ¶
GetHCIConfig return an HCIConfig struct
func StartDiscoveryOn ¶
StartDiscoveryOn start discovery on specified adapter
func StopDiscoveryOn ¶
StopDiscoveryOn start discovery on specified adapter
func ToggleBluetooth ¶
func ToggleBluetooth() error
ToggleBluetooth toggle off/on the bluetooth support
func TurnOffAdapter ¶
TurnOffAdapter Enable a rfkill managed device
func TurnOnAdapter ¶
TurnOnAdapter Enable a rfkill managed device
Types ¶
type AdapterEvent ¶
type AdapterEvent struct { Name string Path string Status DeviceStatus }
AdapterEvent reports the availability of a bluetooth adapter
type Device ¶
type Device struct { Path string Properties *profile.Device1Properties // contains filtered or unexported fields }
Device return an API to interact with a DBus device
func GetDeviceByAddress ¶
GetDeviceByAddress return a Device object based on its address
func GetDevices ¶
GetDevices returns a list of bluetooth discovered Devices
func ParseDevice ¶
ParseDevice parse a Device from a ObjectManager map
func (*Device) GetAllServicesAndUUID ¶
GetAllServicesAndUUID return a list of uuid's with their corresponding services
func (*Device) GetChar ¶
func (d *Device) GetChar(path string) (*profile.GattCharacteristic1, error)
GetChar return a GattService
func (*Device) GetCharByUUID ¶
func (d *Device) GetCharByUUID(uuid string) (*profile.GattCharacteristic1, error)
GetCharByUUID return a GattService by its uuid, return nil if not found
func (*Device) GetCharsByUUID ¶
func (d *Device) GetCharsByUUID(uuid string) ([]*profile.GattCharacteristic1, error)
GetCharsByUUID returns all characteristics that match the given UUID.
func (*Device) GetCharsList ¶
func (d *Device) GetCharsList() ([]dbus.ObjectPath, error)
GetCharsList return a device characteristics
func (*Device) GetDescriptorList ¶
func (d *Device) GetDescriptorList() ([]dbus.ObjectPath, error)
GetDescriptorList returns all descriptors
func (*Device) GetDescriptors ¶
func (d *Device) GetDescriptors(char *profile.GattCharacteristic1) ([]*profile.GattDescriptor1, error)
GetDescriptors returns all descriptors for a given characteristic
func (*Device) GetProperties ¶
func (d *Device) GetProperties() (*profile.Device1Properties, error)
GetProperties return the properties for the device
func (*Device) GetProperty ¶
GetProperty return a property value
func (*Device) GetService ¶
func (d *Device) GetService(path string) *profile.GattService1
GetService return a GattService
func (*Device) IsConnected ¶
IsConnected check if connected to the device
type DeviceStatus ¶
type DeviceStatus EventStatus
DeviceStatus indicate the status of a device
const ( //DeviceAdded indicates the device interface appeared DeviceAdded DeviceStatus = iota //DeviceRemoved indicates the device interface disappeared DeviceRemoved )
type DiscoveredDeviceEvent ¶
type DiscoveredDeviceEvent struct { Path string Status DeviceStatus Device *Device }
DiscoveredDeviceEvent contains detail regarding an ongoing discovery operation
type EventStatus ¶
type EventStatus int
EventStatus indicate the status related to an event
const ( // StatusAdded something has been added StatusAdded EventStatus = iota // StatusRemoved something has been removed StatusRemoved )
type GattCharacteristicEvent ¶
type GattCharacteristicEvent struct { Path string DevicePath string Properties *profile.GattCharacteristic1Properties Status EventStatus }
GattCharacteristicEvent triggered when a new GattCharacteristic1 is added or removed
type GattDescriptorEvent ¶
type GattDescriptorEvent struct { Path string DevicePath string Properties *profile.GattDescriptor1Properties Status EventStatus }
GattDescriptorEvent triggered when a new GattDescriptor1 is added or removed
type GattService ¶
type GattService struct {
Path string
}
GattService a GATT service for a Device
func NewGattService ¶
func NewGattService(path string) *GattService
NewGattService creates a new GATT Service
type GattServiceEvent ¶
type GattServiceEvent struct { Path string DevicePath string Properties *profile.GattService1Properties Status EventStatus }
GattServiceEvent triggered when a new GattService1 is added or removed
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager track changes in the bluez dbus tree reflecting protocol updates
func GetManager ¶
GetManager return the object manager reference
func (*Manager) Close ¶
func (m *Manager) Close()
Close Close the Manager and free underlying resources
func (*Manager) GetObjects ¶
GetObjects return the cached list of objects from the ObjectManager
func (*Manager) LoadObjects ¶
LoadObjects force reloading of cache objects list
func (*Manager) RefreshState ¶
RefreshState emit local manager objects and interfaces
type PropertyChangedEvent ¶
type PropertyChangedEvent struct { Iface string Field string Value interface{} Properties *profile.Device1Properties Device *Device }
PropertyChangedEvent an object to describe a changed property