gnomebluetooth

package
v0.0.0-...-a2d9da2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CHOOSER_COMBO_FIRST_DEVICE = "00:00:00:00:00:00"

CHOOSER_COMBO_FIRST_DEVICE: convenience value used to select the first device regardless of its address.

View Source
const TYPE_AUDIO = 1048800

TYPE_AUDIO: use this value to select any Bluetooth audio device where a Type enum is required.

View Source
const TYPE_INPUT = 13056

TYPE_INPUT: use this value to select any Bluetooth input device where a Type enum is required.

View Source
const UUID_A2DP = 4365
View Source
const UUID_A2DP_SINK = 4363
View Source
const UUID_A2DP_SOURCE = 4362
View Source
const UUID_AVRCP_CONTROL = 4366
View Source
const UUID_AVRCP_TARGET = 4364
View Source
const UUID_DUN = 4355
View Source
const UUID_FTP = 4358
View Source
const UUID_GENERIC_AUDIO = 4611
View Source
const UUID_GENERIC_NET = 4609
View Source
const UUID_HFP_AG = 4383
View Source
const UUID_HFP_HF = 4382
View Source
const UUID_HID = 4388
View Source
const UUID_HSP = 4360
View Source
const UUID_HSP_AG = 4370
View Source
const UUID_IRMC = 4356
View Source
const UUID_OPP = 4357
View Source
const UUID_PAN_GN = 4375
View Source
const UUID_PAN_NAP = 4374
View Source
const UUID_PAN_PANU = 4373
View Source
const UUID_PBAP = 4399
View Source
const UUID_PNP = 4608
View Source
const UUID_SAP = 4397
View Source
const UUID_SDP = 4096
View Source
const UUID_SPP = 4353
View Source
const UUID_VDP_SOURCE = 4867

Variables

glib.Type values for bluetooth-chooser.go.

glib.Type values for bluetooth-chooser-button.go.

glib.Type values for bluetooth-chooser-combo.go.

glib.Type values for bluetooth-client.go.

glib.Type values for bluetooth-filter-widget.go.

glib.Type values for bluetooth-settings-widget.go.

Functions

func SendToAddress

func SendToAddress(address, alias string)

SendToAddress: start a GUI application for transfering files over Bluetooth.

The function takes the following parameters:

  • address: remote device to use.
  • alias: remote device's name.

func TypeToFilterString

func TypeToFilterString(typ uint) string

TypeToFilterString returns a human-readable string representation of type usable for display to users, when type filters are displayed. Do not free the return value. The returned string is already translated with gettext().

The function takes the following parameters:

  • typ: Type.

The function returns the following values:

  • utf8: string.

func TypeToString

func TypeToString(typ uint) string

TypeToString returns a human-readable string representation of type usable for display to users. Do not free the return value. The returned string is already translated with gettext().

The function takes the following parameters:

  • typ: Type.

The function returns the following values:

  • utf8: string.

func UUIDToString

func UUIDToString(uuid string) string

UUIDToString returns a string representing a human-readable (but not usable for display to users) version of the uuid. Do not free the return value.

The function takes the following parameters:

  • uuid: string representing a Bluetooth UUID.

The function returns the following values:

  • utf8: string.

func VerifyAddress

func VerifyAddress(bdaddr string) bool

VerifyAddress returns whether the string is a valid Bluetooth address. This does not contact the device in any way.

The function takes the following parameters:

  • bdaddr: string representing a Bluetooth address.

The function returns the following values:

  • ok: TRUE if the address is valid, FALSE if not.

Types

type Category

type Category C.gint

Category: category of a Bluetooth devices.

const (
	// CategoryAll: all devices.
	CategoryAll Category = iota
	// CategoryPaired: paired devices.
	CategoryPaired
	// CategoryTrusted: trusted devices.
	CategoryTrusted
	// CategoryNotPairedOrTrusted: neither paired, nor trusted devices.
	CategoryNotPairedOrTrusted
	// CategoryPairedOrTrusted: paired and/or trusted devices.
	CategoryPairedOrTrusted
)

func (Category) String

func (c Category) String() string

String returns the name in string for Category.

type Chooser

type Chooser struct {
	gtk.Box
	// contains filtered or unexported fields
}

Chooser: <structname>BluetoothChooser</structname> struct contains only private fields and should not be directly accessed.

func NewChooser

func NewChooser() *Chooser

NewChooser returns a new Chooser widget.

The function returns the following values:

  • chooser: Chooser widget.

func (*Chooser) ConnectSelectedDeviceActivated

func (self *Chooser) ConnectSelectedDeviceActivated(f func(address string)) externglib.SignalHandle

ConnectSelectedDeviceActivated signal is launched when a device is double-clicked in the chooser.

func (*Chooser) ConnectSelectedDeviceChanged

func (self *Chooser) ConnectSelectedDeviceChanged(f func(address string)) externglib.SignalHandle

ConnectSelectedDeviceChanged signal is launched when the selected device is changed, it will be NULL if a device was unselected.

func (*Chooser) DumpSelectedDevice

func (self *Chooser) DumpSelectedDevice()

DumpSelectedDevice prints all the known attributes for the currently selected device on the standard output. Useful for debugging.

func (*Chooser) ScrolledWindow

func (self *Chooser) ScrolledWindow() gtk.Widgetter

ScrolledWindow returns the ScrolledWindow object for the Chooser. This is useful to set a minimum height to the chooser using gtk_scrolled_window_set_min_content_height() or to join the chooser with a toolbar.

The function returns the following values:

  • widget: ScrolledWindow object.

func (*Chooser) SelectedDevice

func (self *Chooser) SelectedDevice() string

SelectedDevice returns the Bluetooth address for the currently selected device.

The function returns the following values:

  • utf8: bluetooth address for the currently selected device, or NULL.

func (*Chooser) SelectedDeviceIcon

func (self *Chooser) SelectedDeviceIcon() string

SelectedDeviceIcon returns the icon name to use to represent the currently selected device.

The function returns the following values:

  • utf8: icon name to use to represent the currently selected device, or NULL.

func (*Chooser) SelectedDeviceInfo

func (self *Chooser) SelectedDeviceInfo(field string, value *externglib.Value) bool

SelectedDeviceInfo returns whether the value has been set.

The function takes the following parameters:

  • field: identifier for the field to get data for.
  • value: empty #GValue to set.

The function returns the following values:

  • ok: TRUE if the value has been set.

func (*Chooser) SelectedDeviceIsConnected

func (self *Chooser) SelectedDeviceIsConnected() bool

SelectedDeviceIsConnected returns whether the selected device is connected to this computer.

The function returns the following values:

  • ok: whether the selected device is connected to this computer, will always be FALSE if no devices are selected.

func (*Chooser) SelectedDeviceName

func (self *Chooser) SelectedDeviceName() string

SelectedDeviceName returns the name for the currently selected device.

The function returns the following values:

  • utf8: name for the currently selected device, or NULL.

func (*Chooser) SelectedDeviceType

func (self *Chooser) SelectedDeviceType() Type

SelectedDeviceType returns the Type of the device selected.

The function returns the following values:

  • typ of the device selected, or '0' if unknown.

func (*Chooser) StartDiscovery

func (self *Chooser) StartDiscovery()

StartDiscovery starts a discovery on the default Bluetooth adapter. Note that this will only work if the Search label is visible, as otherwise the user has no visual feedback that the process is on-going.

See also: Chooser:show-searching.

func (*Chooser) StopDiscovery

func (self *Chooser) StopDiscovery()

StopDiscovery stops a discovery started with #bluetooth_chooser_start_discovery.

type ChooserButton

type ChooserButton struct {
	gtk.Button
	// contains filtered or unexported fields
}

ChooserButton: <structname>BluetoothChooserButton</structname> struct contains only private fields and should not be directly accessed.

func NewChooserButton

func NewChooserButton() *ChooserButton

NewChooserButton returns a new ChooserButton widget.

The function returns the following values:

  • chooserButton: ChooserButton widget.

func (*ChooserButton) Available

func (button *ChooserButton) Available() bool

Available returns whether there is a powered Bluetooth adapter.

The function returns the following values:

  • ok: TRUE if there is a powered Bluetooth adapter available, and the button should be sensitive.

func (*ChooserButton) ConnectChooserCreated

func (button *ChooserButton) ConnectChooserCreated(f func(chooser *externglib.Object)) externglib.SignalHandle

ConnectChooserCreated: signal is sent when a popup dialogue is created for the user to select a device. This signal allows you to change the configuration and filtering of the tree from its defaults.

type ChooserButtonOverrider

type ChooserButtonOverrider interface {
	// The function takes the following parameters:
	//
	ChooserCreated(chooser gtk.Widgetter)
}

ChooserButtonOverrider contains methods that are overridable.

type ChooserCombo

type ChooserCombo struct {
	gtk.Box
	// contains filtered or unexported fields
}

func NewChooserCombo

func NewChooserCombo() *ChooserCombo

NewChooserCombo returns a new ChooserCombo widget.

The function returns the following values:

  • chooserCombo: ChooserCombo widget.

func (*ChooserCombo) ConnectChooserCreated

func (v *ChooserCombo) ConnectChooserCreated(f func(chooser *externglib.Object)) externglib.SignalHandle

ConnectChooserCreated: signal is sent when a popup dialogue is created for the user to select a device. This signal allows you to change the configuration and filtering of the tree from its defaults.

type ChooserComboOverrider

type ChooserComboOverrider interface {
}

ChooserComboOverrider contains methods that are overridable.

type ChooserOverrider

type ChooserOverrider interface {
	// The function takes the following parameters:
	//
	SelectedDeviceActivated(address string)
	// The function takes the following parameters:
	//
	SelectedDeviceChanged(address string)
}

ChooserOverrider contains methods that are overridable.

type Client

type Client struct {
	*externglib.Object
	// contains filtered or unexported fields
}

Client: <structname>BluetoothClient</structname> struct contains only private fields and should not be directly accessed.

func NewClient

func NewClient() *Client

NewClient returns a reference to the Client singleton. Use g_object_unref() when done with the object.

The function returns the following values:

  • client: Client object.

func (*Client) AdapterModel

func (client *Client) AdapterModel() *gtk.TreeModel

AdapterModel returns a TreeModelFilter with only adapters present.

The function returns the following values:

  • treeModel: TreeModel object.

func (*Client) ConnectDeviceRemoved

func (client *Client) ConnectDeviceRemoved(f func(device string)) externglib.SignalHandle

ConnectDeviceRemoved signal is launched when a device gets removed from the model.

func (*Client) ConnectService

func (client *Client) ConnectService(ctx context.Context, path string, connect bool, callback gio.AsyncReadyCallback)

ConnectService: when the connection operation is finished, callback will be called. You can then call bluetooth_client_connect_service_finish() to get the result of the operation.

The function takes the following parameters:

  • ctx (optional): optional #GCancellable object, NULL to ignore.
  • path: object path on which to operate.
  • connect: whether try to connect or disconnect from services on a device.
  • callback (optional) to call when the connection is complete.

func (*Client) ConnectServiceFinish

func (client *Client) ConnectServiceFinish(res gio.AsyncResulter) error

ConnectServiceFinish finishes the connection operation. See bluetooth_client_connect_service().

The function takes the following parameters:

  • res: Result.

func (*Client) DeviceModel

func (client *Client) DeviceModel() *gtk.TreeModel

DeviceModel returns a TreeModelFilter with only devices belonging to the default adapter listed. Note that the model will follow a specific adapter, and will not follow the default adapter. Also note that due to the way TreeModelFilter works, you will probably want to monitor signals on the "child-model" TreeModel to monitor for changes.

The function returns the following values:

  • treeModel: TreeModel object.

func (*Client) FilterModel

func (client *Client) FilterModel(fn gtk.TreeModelFilterVisibleFunc) *gtk.TreeModel

FilterModel returns a TreeModelFilter of devices filtered using the func, data and destroy arguments to pass to gtk_tree_model_filter_set_visible_func().

The function takes the following parameters:

  • fn: TreeModelFilterVisibleFunc.

The function returns the following values:

  • treeModel: TreeModel object.

func (*Client) Model

func (client *Client) Model() *gtk.TreeModel

Model returns an unfiltered TreeModel representing the adapter and devices available on the system.

The function returns the following values:

  • treeModel: TreeModel object.

type ClientOverrider

type ClientOverrider interface {
}

ClientOverrider contains methods that are overridable.

type Column

type Column C.gint

Column: column identifier to pass to bluetooth_chooser_get_selected_device_info().

const (
	// ColumnProxy: BusProxy object.
	ColumnProxy Column = iota
	// ColumnProperties: used to be BusProxy object for DBus.Properties, now
	// always NULL.
	ColumnProperties
	// ColumnAddress: string representing a Bluetooth address.
	ColumnAddress
	// ColumnAlias: string to use for display (the name of the device, or its
	// address if the name is not known). Only available for devices.
	ColumnAlias
	// ColumnName: string representing the device or adapter's name.
	ColumnName
	// ColumnType of the device. Only available for devices.
	ColumnType
	// ColumnIcon: string representing the icon name for the device. Only
	// available for devices.
	ColumnIcon
	// ColumnDefault: whether the adapter is the default one. Only available for
	// adapters.
	ColumnDefault
	// ColumnPaired: whether the device is paired to its parent adapter. Only
	// available for devices.
	ColumnPaired
	// ColumnTrusted: whether the device is trusted. Only available for devices.
	ColumnTrusted
	// ColumnConnected: whether the device is connected. Only available for
	// devices.
	ColumnConnected
	// ColumnDiscoverable: whether the adapter is discoverable/visible. Only
	// available for adapters.
	ColumnDiscoverable
	// ColumnDiscovering: whether the adapter is discovering. Only available for
	// adapters.
	ColumnDiscovering
	// ColumnLegacypairing: whether the device does not support Bluetooth 2.1
	// Simple Secure Pairing. Only available for devices.
	ColumnLegacypairing
	// ColumnPowered: whether the adapter is powered. Only available for
	// adapters.
	ColumnPowered
	// ColumnServices: array of service names and Status connection statuses.
	ColumnServices
	// ColumnUuids: string array of human-readable UUIDs.
	ColumnUuids
)

func (Column) String

func (c Column) String() string

String returns the name in string for Column.

type FilterWidget

type FilterWidget struct {
	gtk.Box
	// contains filtered or unexported fields
}

func NewFilterWidget

func NewFilterWidget() *FilterWidget

NewFilterWidget creates a new FilterWidget which can be bound to a Chooser to control filtering of that Chooser. Usually used in conjunction with a Chooser which has the "has-internal-filter" property set to FALSE.

The function returns the following values:

  • filterWidget widget

    Note: Must call bluetooth_filter_widget_bind_filter () to bind the FilterWidget to a Chooser.

func (*FilterWidget) BindFilter

func (filter *FilterWidget) BindFilter(chooser *Chooser)

BindFilter binds a FilterWidget to a Chooser such that changing the FilterWidget results in filters being applied on the Chooser. Any properties set on a bound Chooser will also be set on the FilterWidget.

The function takes the following parameters:

  • chooser widget to bind the filter to.

func (*FilterWidget) SetTitle

func (filter *FilterWidget) SetTitle(title string)

SetTitle: used to set a different title for the FilterWidget than the default.

The function takes the following parameters:

  • title: title for the FilterWidget.

type FilterWidgetOverrider

type FilterWidgetOverrider interface {
}

FilterWidgetOverrider contains methods that are overridable.

type SettingsWidget

type SettingsWidget struct {
	gtk.Box
	// contains filtered or unexported fields
}

SettingsWidget: <structname>BluetoothSettingsWidget</structname> struct contains only private fields and should not be directly accessed.

func NewSettingsWidget

func NewSettingsWidget() *SettingsWidget

NewSettingsWidget returns a new SettingsWidget widget.

The function returns the following values:

  • settingsWidget: SettingsWidget widget.

func (*SettingsWidget) ConnectAdapterStatusChanged

func (widget *SettingsWidget) ConnectAdapterStatusChanged(f func()) externglib.SignalHandle

ConnectAdapterStatusChanged signal is launched when the status of the adapter changes (powered, available, etc.).

func (*SettingsWidget) ConnectPanelChanged

func (widget *SettingsWidget) ConnectPanelChanged(f func(panel string)) externglib.SignalHandle

ConnectPanelChanged signal is launched when a link to another settings panel is clicked.

func (*SettingsWidget) DefaultAdapterPowered

func (widget *SettingsWidget) DefaultAdapterPowered() bool

The function returns the following values:

  • ok: whether the default Bluetooth adapter is powered.

type SettingsWidgetOverrider

type SettingsWidgetOverrider interface {
}

SettingsWidgetOverrider contains methods that are overridable.

type Status

type Status C.gint

Status: connection status of a service on a particular device. Note that BLUETOOTH_STATUS_CONNECTING and BLUETOOTH_STATUS_PLAYING might not be available for all services.

const (
	// StatusInvalid: whether the status has been set yet.
	StatusInvalid Status = iota
	// StatusDisconnected: whether the service is disconnected.
	StatusDisconnected
	// StatusConnected: whether the service is connected.
	StatusConnected
	// StatusConnecting: whether the service is connecting.
	StatusConnecting
	// StatusPlaying: whether the service is playing (only used by the audio
	// service).
	StatusPlaying
)

func (Status) String

func (s Status) String() string

String returns the name in string for Status.

type Type

type Type C.guint

Type: type of a Bluetooth device. See also BLUETOOTH_TYPE_INPUT and BLUETOOTH_TYPE_AUDIO.

const (
	// TypeAny: any device, or a device of an unknown type.
	TypeAny Type = 0b1
	// TypePhone: telephone (usually a cell/mobile phone).
	TypePhone Type = 0b10
	// TypeModem: modem.
	TypeModem Type = 0b100
	// TypeComputer: computer, can be a laptop, a wearable computer, etc.
	TypeComputer Type = 0b1000
	// TypeNetwork: network device, such as a router.
	TypeNetwork Type = 0b10000
	// TypeHeadset: headset (usually a hands-free device).
	TypeHeadset Type = 0b100000
	// TypeHeadphones headphones (covers two ears).
	TypeHeadphones Type = 0b1000000
	// TypeOtherAudio: another type of audio device.
	TypeOtherAudio Type = 0b10000000
	// TypeKeyboard: keyboard.
	TypeKeyboard Type = 0b100000000
	// TypeMouse: mouse.
	TypeMouse Type = 0b1000000000
	// TypeCamera: camera (still or moving).
	TypeCamera Type = 0b10000000000
	// TypePrinter: printer.
	TypePrinter Type = 0b100000000000
	// TypeJoypad: joypad, joystick, or other game controller.
	TypeJoypad Type = 0b1000000000000
	// TypeTablet: drawing tablet.
	TypeTablet Type = 0b10000000000000
	// TypeVideo: video device, such as a webcam.
	TypeVideo Type = 0b100000000000000
	// TypeRemoteControl: remote control.
	TypeRemoteControl Type = 0b1000000000000000
	// TypeScanner: scanner.
	TypeScanner Type = 0b10000000000000000
	// TypeDisplay: display.
	TypeDisplay Type = 0b100000000000000000
	// TypeWearable: wearable computer.
	TypeWearable Type = 0b1000000000000000000
	// TypeToy: toy or game.
	TypeToy Type = 0b10000000000000000000
	// TypeSpeakers: audio speaker or speakers.
	TypeSpeakers Type = 0b100000000000000000000
)

func AppearanceToType

func AppearanceToType(appearance uint16) Type

AppearanceToType returns the type of device corresponding to the given appearance value, as usually found in the GAP service.

The function takes the following parameters:

  • appearance: bluetooth device appearance.

The function returns the following values:

  • typ: Type.

func ClassToType

func ClassToType(class uint32) Type

ClassToType returns the type of device corresponding to the given class value.

The function takes the following parameters:

  • class: bluetooth device class.

The function returns the following values:

  • typ: Type.

func (Type) Has

func (t Type) Has(other Type) bool

Has returns true if t contains other.

func (Type) String

func (t Type) String() string

String returns the names in string for Type.

Jump to

Keyboard shortcuts

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