Version: v0.0.0-...-efdff95 Latest Latest

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

Go to latest
Published: Apr 3, 2018 License: MIT Imports: 12 Imported by: 0




This section is empty.


This section is empty.


func AdapterExists

func AdapterExists(adapterID string) (bool, error)

AdapterExists checks if an adapter is available

func ClearDevice

func ClearDevice(d *Device)

ClearDevice free a device struct

func Exit

func Exit()

Exit performs a clean exit

func GetAdapter

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

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 GetHCIConfig

func GetHCIConfig(adapterID string) *linux.HCIConfig

GetHCIConfig return an HCIConfig struct

func Off

func Off(name string, fn *emitter.Callback)

Off remove an event handler

func On

func On(name string, fn *emitter.Callback)

On add an event handler

func StartDiscovery

func StartDiscovery() error

StartDiscovery on adapter hci0

func StartDiscoveryOn

func StartDiscoveryOn(adapterID string) error

StartDiscoveryOn start discovery on specified adapter

func StopDiscovery

func StopDiscovery() error

StopDiscovery on adapter hci0

func StopDiscoveryOn

func StopDiscoveryOn(adapterID string) error

StopDiscoveryOn start discovery on specified adapter

func ToggleAdapter

func ToggleAdapter(adapterID string) error

ToggleAdapter Swap Off/On a device

func ToggleBluetooth

func ToggleBluetooth() error

ToggleBluetooth toggle off/on the bluetooth support

func TurnOffAdapter

func TurnOffAdapter(adapterID string) error

TurnOffAdapter Enable a rfkill managed device

func TurnOffBluetooth

func TurnOffBluetooth() error

TurnOffBluetooth turn on bluetooth support

func TurnOnAdapter

func TurnOnAdapter(adapterID string) error

TurnOnAdapter Enable a rfkill managed device

func TurnOnBluetooth

func TurnOnBluetooth() error

TurnOnBluetooth turn on bluetooth support


type AdapterEvent

type AdapterEvent struct {
	Name   string
	Path   string
	Status DeviceStatus

AdapterEvent reports the availability of a bluetooth adapter

type DataEvent

type DataEvent struct {
	Device     *Device
	SensorType string

	AmbientTempValue interface{}
	AmbientTempUnit  string

	ObjectTempValue interface{}
	ObjectTempUnit  string

	SensorId string

	BarometericPressureValue interface{}
	BarometericPressureUnit  string

	BarometericTempValue interface{}
	BarometericTempUnit  string

	HumidityValue interface{}
	HumidityUnit  string

	HumidityTempValue interface{}
	HumidityTempUnit  string

	MpuGyroscopeValue interface{}
	MpuGyroscopeUnit  string

	MpuAccelerometerValue interface{}
	MpuAccelerometerUnit  string

	MpuMagnetometerValue interface{}
	MpuMagnetometerUnit  string

	LuxometerValue interface{}
	LuxometerUnit  string

	FirmwareVersion string
	HardwareVersion string
	Manufacturer    string
	Model           string

DataEvent triggered when a new data value is available

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

func GetDeviceByAddress(address string) (*Device, error)

GetDeviceByAddress return a Device object based on its address

func GetDevices

func GetDevices() ([]Device, error)

GetDevices returns a list of bluetooth discovered Devices

func NewDevice

func NewDevice(path string) *Device

NewDevice creates a new Device

func ParseDevice

func ParseDevice(path dbus.ObjectPath, propsMap map[string]dbus.Variant) (*Device, error)

ParseDevice parse a Device from a ObjectManager map

func (*Device) Connect

func (d *Device) Connect() error

Connect to device

func (*Device) Disconnect

func (d *Device) Disconnect() error

Disconnect from a device

func (*Device) Emit

func (d *Device) Emit(name string, data interface{})

Emit an event

func (*Device) GetAllServicesAndUUID

func (d *Device) GetAllServicesAndUUID() ([]string, error)

func (*Device) GetChar

func (d *Device) GetChar(path string) *profile.GattCharacteristic1

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) GetCharsList

func (d *Device) GetCharsList() []dbus.ObjectPath

GetCharsList return a device characteristics

func (*Device) GetClient

func (d *Device) GetClient() (*profile.Device1, error)

GetClient return a DBus Device1 interface client

func (*Device) GetProperties

func (d *Device) GetProperties() (*profile.Device1Properties, error)

GetProperties return the properties for the device

func (*Device) GetProperty

func (d *Device) GetProperty(name string) (data interface{}, err error)

GetProperty return a property value

func (*Device) GetService

func (d *Device) GetService(path string) *profile.GattService1

GetService return a GattService

func (*Device) IsConnected

func (d *Device) IsConnected() bool

IsConnected check if connected to the device

func (*Device) Off

func (d *Device) Off(name string, cb *emitter.Callback)

Off unregister callback for event

func (*Device) On

func (d *Device) On(name string, fn *emitter.Callback)

On register callback for event

func (*Device) Pair

func (d *Device) Pair() error

Pair a 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

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

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

func GetManager() *Manager

GetManager return the object manager reference

func NewManager

func NewManager() *Manager

NewManager creates a new manager instance

func (*Manager) Close

func (m *Manager) Close()

Close Close the Manager and free underlying resources

func (*Manager) GetObjects

func (m *Manager) GetObjects() *map[dbus.ObjectPath]map[string]map[string]dbus.Variant

GetObjects return the cached list of objects from the ObjectManager

func (*Manager) LoadObjects

func (m *Manager) LoadObjects() error

LoadObjects force reloading of cache objects list

func (*Manager) RefreshState

func (m *Manager) RefreshState() error

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

Jump to

Keyboard shortcuts

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