Documentation ¶
Overview ¶
BlueZ D-Bus Device API description [device-api.txt]
Index ¶
- Variables
- type Device1
- func (a *Device1) CancelPairing() error
- func (a *Device1) Client() *bluez.Client
- func (a *Device1) Close()
- func (a *Device1) Connect() error
- func (a *Device1) ConnectProfile(uuid string) error
- func (a *Device1) Disconnect() error
- func (a *Device1) DisconnectProfile(uuid string) error
- func (a *Device1) GetAdapter() (dbus.ObjectPath, error)
- func (a *Device1) GetAddress() (string, error)
- func (a *Device1) GetAddressType() (string, error)
- func (a *Device1) GetAdvertisingData() (map[string]interface{}, error)
- func (a *Device1) GetAdvertisingFlags() ([]byte, error)
- func (a *Device1) GetAlias() (string, error)
- func (d *Device1) GetAllServicesAndUUID() ([]string, error)
- func (a *Device1) GetAppearance() (uint16, error)
- func (a *Device1) GetBlocked() (bool, error)
- func (d *Device1) GetCharByUUID(uuid string) (*gatt.GattCharacteristic1, error)
- func (d *Device1) GetCharacteristics() ([]*gatt.GattCharacteristic1, error)
- func (d *Device1) GetCharacteristicsList() ([]dbus.ObjectPath, error)
- func (d *Device1) GetCharsByUUID(uuid string) ([]*gatt.GattCharacteristic1, error)
- func (a *Device1) GetClass() (uint32, error)
- func (a *Device1) GetConnected() (bool, error)
- func (d *Device1) GetDescriptorList() ([]dbus.ObjectPath, error)
- func (d *Device1) GetDescriptors(char *gatt.GattCharacteristic1) ([]*gatt.GattDescriptor1, error)
- func (a *Device1) GetIcon() (string, error)
- func (a *Device1) GetLegacyPairing() (bool, error)
- func (a *Device1) GetManufacturerData() (map[uint16]interface{}, error)
- func (a *Device1) GetModalias() (string, error)
- func (a *Device1) GetName() (string, error)
- func (a *Device1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)
- func (a *Device1) GetPaired() (bool, error)
- func (a *Device1) GetProperties() (*Device1Properties, error)
- func (a *Device1) GetPropertiesSignal() (chan *dbus.Signal, error)
- func (a *Device1) GetProperty(name string) (dbus.Variant, error)
- func (a *Device1) GetRSSI() (int16, error)
- func (a *Device1) GetServiceData() (map[string]interface{}, error)
- func (a *Device1) GetServicesResolved() (bool, error)
- func (a *Device1) GetTrusted() (bool, error)
- func (a *Device1) GetTxPower() (int16, error)
- func (a *Device1) GetUUIDs() ([]string, error)
- func (a *Device1) GetWakeAllowed() (bool, error)
- func (a *Device1) GetWatchPropertiesChannel() chan *dbus.Signal
- func (a *Device1) Interface() string
- func (a *Device1) Pair() error
- func (a *Device1) Path() dbus.ObjectPath
- func (a *Device1) SetAdapter(v dbus.ObjectPath) error
- func (a *Device1) SetAddress(v string) error
- func (a *Device1) SetAddressType(v string) error
- func (a *Device1) SetAdvertisingData(v map[string]interface{}) error
- func (a *Device1) SetAdvertisingFlags(v []byte) error
- func (a *Device1) SetAlias(v string) error
- func (a *Device1) SetAppearance(v uint16) error
- func (a *Device1) SetBlocked(v bool) error
- func (a *Device1) SetClass(v uint32) error
- func (a *Device1) SetConnected(v bool) error
- func (a *Device1) SetIcon(v string) error
- func (a *Device1) SetLegacyPairing(v bool) error
- func (a *Device1) SetManufacturerData(v map[uint16]interface{}) error
- func (a *Device1) SetModalias(v string) error
- func (a *Device1) SetName(v string) error
- func (a *Device1) SetPaired(v bool) error
- func (a *Device1) SetProperty(name string, value interface{}) error
- func (a *Device1) SetRSSI(v int16) error
- func (a *Device1) SetServiceData(v map[string]interface{}) error
- func (a *Device1) SetServicesResolved(v bool) error
- func (a *Device1) SetTrusted(v bool) error
- func (a *Device1) SetTxPower(v int16) error
- func (a *Device1) SetUUIDs(v []string) error
- func (a *Device1) SetWakeAllowed(v bool) error
- func (a *Device1) SetWatchPropertiesChannel(c chan *dbus.Signal)
- func (a *Device1) ToProps() bluez.Properties
- func (a *Device1) UnwatchProperties(ch chan *bluez.PropertyChanged) error
- func (a *Device1) WatchProperties() (chan *bluez.PropertyChanged, error)
- type Device1Properties
- func (a *Device1Properties) FromDBusMap(props map[string]dbus.Variant) (*Device1Properties, error)
- func (a *Device1Properties) FromMap(props map[string]interface{}) (*Device1Properties, error)
- func (p *Device1Properties) Lock()
- func (a *Device1Properties) ToMap() (map[string]interface{}, error)
- func (p *Device1Properties) Unlock()
- type SetsItem
Constants ¶
This section is empty.
Variables ¶
var Device1Interface = "org.bluez.Device1"
Functions ¶
This section is empty.
Types ¶
type Device1 ¶
type Device1 struct { Properties *Device1Properties // contains filtered or unexported fields }
Device1 Device hierarchy
func NewDevice1 ¶
NewDevice1 create a new instance of Device1
Args: - objectPath: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
func (*Device1) CancelPairing ¶
CancelPairing This method can be used to cancel a pairing
operation initiated by the Pair method. Possible errors: org.bluez.Error.DoesNotExist org.bluez.Error.Failed
func (*Device1) Connect ¶
Connect This is a generic method to connect any profiles
the remote device supports that can be connected to and have been flagged as auto-connectable on our side. If only subset of profiles is already connected it will try to connect currently disconnected ones. If at least one profile was connected successfully this method will indicate success. For dual-mode devices only one bearer is connected at time, the conditions are in the following order: 1. Connect the disconnected bearer if already connected. 2. Connect first the bonded bearer. If no bearers are bonded or both are skip and check latest seen bearer. 3. Connect last seen bearer, in case the timestamps are the same BR/EDR takes precedence. Possible errors: org.bluez.Error.NotReady org.bluez.Error.Failed org.bluez.Error.InProgress org.bluez.Error.AlreadyConnected
func (*Device1) ConnectProfile ¶
ConnectProfile This method connects a specific profile of this
device. The UUID provided is the remote service UUID for the profile. Possible errors: org.bluez.Error.Failed org.bluez.Error.InProgress org.bluez.Error.InvalidArguments org.bluez.Error.NotAvailable org.bluez.Error.NotReady
func (*Device1) Disconnect ¶
Disconnect This method gracefully disconnects all connected
profiles and then terminates low-level ACL connection. ACL connection will be terminated even if some profiles were not disconnected properly e.g. due to misbehaving device. This method can be also used to cancel a preceding Connect call before a reply to it has been received. For non-trusted devices connected over LE bearer calling this method will disable incoming connections until Connect method is called again. Possible errors: org.bluez.Error.NotConnected
func (*Device1) DisconnectProfile ¶
DisconnectProfile This method disconnects a specific profile of
this device. The profile needs to be registered client profile. There is no connection tracking for a profile, so as long as the profile is registered this will always succeed. Possible errors: org.bluez.Error.Failed org.bluez.Error.InProgress org.bluez.Error.InvalidArguments org.bluez.Error.NotSupported
func (*Device1) GetAdapter ¶
GetAdapter get Adapter value
func (*Device1) GetAddress ¶
GetAddress get Address value
func (*Device1) GetAddressType ¶
GetAddressType get AddressType value
func (*Device1) GetAdvertisingData ¶
GetAdvertisingData get AdvertisingData value
func (*Device1) GetAdvertisingFlags ¶
GetAdvertisingFlags get AdvertisingFlags value
func (*Device1) GetAllServicesAndUUID ¶
GetAllServicesAndUUID return a list of uuid's with their corresponding services
func (*Device1) GetAppearance ¶
GetAppearance get Appearance value
func (*Device1) GetBlocked ¶
GetBlocked get Blocked value
func (*Device1) GetCharByUUID ¶
func (d *Device1) GetCharByUUID(uuid string) (*gatt.GattCharacteristic1, error)
GetCharByUUID return a GattService by its uuid, return nil if not found
func (*Device1) GetCharacteristics ¶
func (d *Device1) GetCharacteristics() ([]*gatt.GattCharacteristic1, error)
GetCharacteristics return a list of characteristics
func (*Device1) GetCharacteristicsList ¶
GetCharacteristicsList return device characteristics object path list
func (*Device1) GetCharsByUUID ¶
func (d *Device1) GetCharsByUUID(uuid string) ([]*gatt.GattCharacteristic1, error)
GetCharsByUUID returns all characteristics that match the given UUID.
func (*Device1) GetConnected ¶
GetConnected get Connected value
func (*Device1) GetDescriptorList ¶
GetDescriptorList returns all descriptors
func (*Device1) GetDescriptors ¶
func (d *Device1) GetDescriptors(char *gatt.GattCharacteristic1) ([]*gatt.GattDescriptor1, error)
GetDescriptors returns all descriptors for a given characteristic
func (*Device1) GetLegacyPairing ¶
GetLegacyPairing get LegacyPairing value
func (*Device1) GetManufacturerData ¶
GetManufacturerData get ManufacturerData value
func (*Device1) GetModalias ¶
GetModalias get Modalias value
func (*Device1) GetObjectManagerSignal ¶
GetObjectManagerSignal return a channel for receiving updates from the ObjectManager
func (*Device1) GetProperties ¶
func (a *Device1) GetProperties() (*Device1Properties, error)
GetProperties load all available properties
func (*Device1) GetPropertiesSignal ¶
GetPropertiesSignal return a channel for receiving udpdates on property changes
func (*Device1) GetProperty ¶
GetProperty get a property
func (*Device1) GetServiceData ¶
GetServiceData get ServiceData value
func (*Device1) GetServicesResolved ¶
GetServicesResolved get ServicesResolved value
func (*Device1) GetTrusted ¶
GetTrusted get Trusted value
func (*Device1) GetTxPower ¶
GetTxPower get TxPower value
func (*Device1) GetWakeAllowed ¶
GetWakeAllowed get WakeAllowed value
func (*Device1) GetWatchPropertiesChannel ¶
func (a *Device1) GetWatchPropertiesChannel() chan *dbus.Signal
GetWatchPropertiesChannel return the dbus channel to receive properties interface
func (*Device1) Pair ¶
Pair This method will connect to the remote device,
initiate pairing and then retrieve all SDP records (or GATT primary services). If the application has registered its own agent, then that specific agent will be used. Otherwise it will use the default agent. Only for applications like a pairing wizard it would make sense to have its own agent. In almost all other cases the default agent will handle this just fine. In case there is no application agent and also no default agent present, this method will fail. Possible errors: org.bluez.Error.InvalidArguments org.bluez.Error.Failed org.bluez.Error.AlreadyExists org.bluez.Error.AuthenticationCanceled org.bluez.Error.AuthenticationFailed org.bluez.Error.AuthenticationRejected org.bluez.Error.AuthenticationTimeout org.bluez.Error.ConnectionAttemptFailed
func (*Device1) SetAdapter ¶
SetAdapter set Adapter value
func (*Device1) SetAddress ¶
SetAddress set Address value
func (*Device1) SetAddressType ¶
SetAddressType set AddressType value
func (*Device1) SetAdvertisingData ¶
SetAdvertisingData set AdvertisingData value
func (*Device1) SetAdvertisingFlags ¶
SetAdvertisingFlags set AdvertisingFlags value
func (*Device1) SetAppearance ¶
SetAppearance set Appearance value
func (*Device1) SetBlocked ¶
SetBlocked set Blocked value
func (*Device1) SetConnected ¶
SetConnected set Connected value
func (*Device1) SetLegacyPairing ¶
SetLegacyPairing set LegacyPairing value
func (*Device1) SetManufacturerData ¶
SetManufacturerData set ManufacturerData value
func (*Device1) SetModalias ¶
SetModalias set Modalias value
func (*Device1) SetProperty ¶
SetProperty set a property
func (*Device1) SetServiceData ¶
SetServiceData set ServiceData value
func (*Device1) SetServicesResolved ¶
SetServicesResolved set ServicesResolved value
func (*Device1) SetTrusted ¶
SetTrusted set Trusted value
func (*Device1) SetTxPower ¶
SetTxPower set TxPower value
func (*Device1) SetWakeAllowed ¶
SetWakeAllowed set WakeAllowed value
func (*Device1) SetWatchPropertiesChannel ¶
func (a *Device1) SetWatchPropertiesChannel(c chan *dbus.Signal)
SetWatchPropertiesChannel set the dbus channel to receive properties interface
func (*Device1) ToProps ¶
func (a *Device1) ToProps() bluez.Properties
ToProps return the properties interface
func (*Device1) UnwatchProperties ¶
func (a *Device1) UnwatchProperties(ch chan *bluez.PropertyChanged) error
func (*Device1) WatchProperties ¶
func (a *Device1) WatchProperties() (chan *bluez.PropertyChanged, error)
WatchProperties updates on property changes
type Device1Properties ¶
type Device1Properties struct { /* Adapter The object path of the adapter the device belongs to. */ Adapter dbus.ObjectPath /* Address The Bluetooth device address of the remote device. */ Address string /* AddressType The Bluetooth device Address Type. For dual-mode and BR/EDR only devices this defaults to "public". Single mode LE devices may have either value. If remote device uses privacy than before pairing this represents address type used for connection and Identity Address after pairing. Possible values: "public" - Public address "random" - Random address */ AddressType string /* AdvertisingData The Advertising Data of the remote device. Keys are are 8 bits AD Type followed by data as byte array. Note: Only types considered safe to be handled by application are exposed. Possible values: <type> <byte array> ... Example: <Transport Discovery> <Organization Flags...> 0x26 0x01 0x01... */ AdvertisingData map[string]interface{} /* AdvertisingFlags The Advertising Data Flags of the remote device. */ AdvertisingFlags []byte /* Alias The name alias for the remote device. The alias can be used to have a different friendly name for the remote device. In case no alias is set, it will return the remote device name. Setting an empty string as alias will convert it back to the remote device name. When resetting the alias with an empty string, the property will default back to the remote name. */ Alias string /* Appearance External appearance of device, as found on GAP service. */ Appearance uint16 /* Blocked If set to true any incoming connections from the device will be immediately rejected. Any device drivers will also be removed and no new ones will be probed as long as the device is blocked. */ Blocked bool /* Class The Bluetooth class of device of the remote device. */ Class uint32 /* Connected Indicates if the remote device is currently connected. A PropertiesChanged signal indicate changes to this status. */ Connected bool /* Icon Proposed icon name according to the freedesktop.org icon naming specification. */ Icon string /* LegacyPairing Set to true if the device only supports the pre-2.1 pairing mechanism. This property is useful during device discovery to anticipate whether legacy or simple pairing will occur if pairing is initiated. Note that this property can exhibit false-positives in the case of Bluetooth 2.1 (or newer) devices that have disabled Extended Inquiry Response support. */ LegacyPairing bool /* ManufacturerData Manufacturer specific advertisement data. Keys are 16 bits Manufacturer ID followed by its byte array value. */ ManufacturerData map[uint16]interface{} /* Modalias Remote Device ID information in modalias format used by the kernel and udev. */ Modalias string /* Name The Bluetooth remote name. This value can not be changed. Use the Alias property instead. This value is only present for completeness. It is better to always use the Alias property when displaying the devices name. If the Alias property is unset, it will reflect this value which makes it more convenient. */ Name string /* Paired Indicates if the remote device is paired. */ Paired bool /* RSSI Received Signal Strength Indicator of the remote device (inquiry or advertising). */ RSSI int16 /* ServiceData Service advertisement data. Keys are the UUIDs in string format followed by its byte array value. */ ServiceData map[string]interface{} /* ServicesResolved Indicate whether or not service discovery has been resolved. */ ServicesResolved bool /* Trusted Indicates if the remote is seen as trusted. This setting can be changed by the application. */ Trusted bool /* TxPower Advertised transmitted power level (inquiry or advertising). */ TxPower int16 /* UUIDs List of 128-bit UUIDs that represents the available remote services. */ UUIDs []string /* WakeAllowed If set to true this device will be allowed to wake the host from system suspend. */ WakeAllowed bool // contains filtered or unexported fields }
Device1Properties contains the exposed properties of an interface
func (*Device1Properties) FromDBusMap ¶
func (a *Device1Properties) FromDBusMap(props map[string]dbus.Variant) (*Device1Properties, error)
FromDBusMap convert a map to an Device1Properties
func (*Device1Properties) FromMap ¶
func (a *Device1Properties) FromMap(props map[string]interface{}) (*Device1Properties, error)
FromMap convert a map to an Device1Properties
func (*Device1Properties) ToMap ¶
func (a *Device1Properties) ToMap() (map[string]interface{}, error)
ToMap convert a Device1Properties to map