Documentation
¶
Overview ¶
Package bluetooth contains helpers to interact with the system's bluetooth adapters.
Package bluetooth contains helpers to interact with the system's bluetooth adapters.
Index ¶
- func DisconnectAllDevices(ctx context.Context) error
- func Enable(ctx context.Context) error
- func IsDisabled(ctx context.Context) (bool, error)
- func IsEnabled(ctx context.Context) (bool, error)
- func PollForAdapterState(ctx context.Context, exp bool) error
- func PollForBTDisabled(ctx context.Context) error
- func PollForBTEnabled(ctx context.Context) error
- func SetDebugLogLevels(ctx context.Context, levels LogVerbosity) error
- func StartBTSnoopLogging(ctx context.Context, path string) *testexec.Cmd
- type Adapter
- func (a *Adapter) Address(ctx context.Context) (string, error)
- func (a *Adapter) Name(ctx context.Context) (string, error)
- func (a *Adapter) Path() dbus.ObjectPath
- func (a *Adapter) Powered(ctx context.Context) (bool, error)
- func (a *Adapter) SetPowered(ctx context.Context, powered bool) error
- func (a *Adapter) StartDiscovery(ctx context.Context) error
- func (a *Adapter) StopDiscovery(ctx context.Context) error
- type Device
- func (d *Device) Address(ctx context.Context) (string, error)
- func (d *Device) Alias(ctx context.Context) (string, error)
- func (d *Device) Connect(ctx context.Context) error
- func (d *Device) Connected(ctx context.Context) (bool, error)
- func (d *Device) Disconnect(ctx context.Context) error
- func (d *Device) Pair(ctx context.Context) error
- func (d *Device) Paired(ctx context.Context) (bool, error)
- func (d *Device) Path() dbus.ObjectPath
- type LogVerbosity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisconnectAllDevices ¶
DisconnectAllDevices disconnects all remote bluetooth devices.
func IsDisabled ¶
IsDisabled checks if bluetooth adapter present and powered off
func PollForAdapterState ¶
PollForAdapterState polls bluetooth adapter state until expected state is received or timeout occurs.
func PollForBTDisabled ¶
PollForBTDisabled polls bluetooth adapter state till Adapter is powered off
func PollForBTEnabled ¶
PollForBTEnabled polls bluetooth adapter state till Adapter is powered on
func SetDebugLogLevels ¶
func SetDebugLogLevels(ctx context.Context, levels LogVerbosity) error
SetDebugLogLevels sets the logging level for Bluetooth debug logs.
func StartBTSnoopLogging ¶
StartBTSnoopLogging starts capturing Bluetooth HCI "btsnoop" logs in a file at the specified path. Call Start on the returned command to start log collection, and call Kill when finished to end btmon.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter contains helper functions for getting and setting bluetooth adapter state.
func NewAdapter ¶
NewAdapter creates a new bluetooth Adapter from the passed D-Bus object path.
func (*Adapter) Path ¶
func (a *Adapter) Path() dbus.ObjectPath
Path gets the D-Bus path this adapter was created from.
func (*Adapter) SetPowered ¶
SetPowered turns a bluetooth adapter on or off
func (*Adapter) StartDiscovery ¶
StartDiscovery starts a discovery on the adapter.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is the bluz dbus remote device object abstraction.
func DeviceByAddress ¶
DeviceByAddress creates a new bluetooth device object by the address of the device.
func DeviceByAlias ¶
DeviceByAlias creates a new bluetooth device object by the alias name of the device.
func (*Device) Disconnect ¶
Disconnect disconnects the bluetooth remote device.
func (*Device) Path ¶
func (d *Device) Path() dbus.ObjectPath
Path gets the D-Bus path this device was created from.
type LogVerbosity ¶
LogVerbosity indicates whether or not to enable verbose logging for the different bluetooth modules.