device

package
v0.0.0-...-ac156b6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

BlueZ D-Bus Device API description [device-api.txt]

Index

Constants

This section is empty.

Variables

View Source
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 NewDevice

func NewDevice(adapterID string, address string) (*Device1, error)

func NewDevice1

func NewDevice1(objectPath dbus.ObjectPath) (*Device1, error)

NewDevice1 create a new instance of Device1

Args: - objectPath: [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX

func (*Device1) CancelPairing

func (a *Device1) CancelPairing() error

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

func (a *Device1) Client() *bluez.Client

Client return Device1 dbus client

func (*Device1) Close

func (a *Device1) Close()

Close the connection

func (*Device1) Connect

func (a *Device1) Connect() error

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

func (a *Device1) ConnectProfile(uuid string) error

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

func (a *Device1) Disconnect() error

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

func (a *Device1) DisconnectProfile(uuid string) error

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

func (a *Device1) GetAdapter() (dbus.ObjectPath, error)

GetAdapter get Adapter value

func (*Device1) GetAddress

func (a *Device1) GetAddress() (string, error)

GetAddress get Address value

func (*Device1) GetAddressType

func (a *Device1) GetAddressType() (string, error)

GetAddressType get AddressType value

func (*Device1) GetAdvertisingData

func (a *Device1) GetAdvertisingData() (map[string]interface{}, error)

GetAdvertisingData get AdvertisingData value

func (*Device1) GetAdvertisingFlags

func (a *Device1) GetAdvertisingFlags() ([]byte, error)

GetAdvertisingFlags get AdvertisingFlags value

func (*Device1) GetAlias

func (a *Device1) GetAlias() (string, error)

GetAlias get Alias value

func (*Device1) GetAllServicesAndUUID

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

GetAllServicesAndUUID return a list of uuid's with their corresponding services

func (*Device1) GetAppearance

func (a *Device1) GetAppearance() (uint16, error)

GetAppearance get Appearance value

func (*Device1) GetBlocked

func (a *Device1) GetBlocked() (bool, error)

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

func (d *Device1) GetCharacteristicsList() ([]dbus.ObjectPath, error)

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

func (a *Device1) GetClass() (uint32, error)

GetClass get Class value

func (*Device1) GetConnected

func (a *Device1) GetConnected() (bool, error)

GetConnected get Connected value

func (*Device1) GetDescriptorList

func (d *Device1) GetDescriptorList() ([]dbus.ObjectPath, error)

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

func (a *Device1) GetIcon() (string, error)

GetIcon get Icon value

func (*Device1) GetLegacyPairing

func (a *Device1) GetLegacyPairing() (bool, error)

GetLegacyPairing get LegacyPairing value

func (*Device1) GetManufacturerData

func (a *Device1) GetManufacturerData() (map[string]interface{}, error)

GetManufacturerData get ManufacturerData value

func (*Device1) GetModalias

func (a *Device1) GetModalias() (string, error)

GetModalias get Modalias value

func (*Device1) GetName

func (a *Device1) GetName() (string, error)

GetName get Name value

func (*Device1) GetObjectManagerSignal

func (a *Device1) GetObjectManagerSignal() (chan *dbus.Signal, func(), error)

GetObjectManagerSignal return a channel for receiving updates from the ObjectManager

func (*Device1) GetPaired

func (a *Device1) GetPaired() (bool, error)

GetPaired get Paired value

func (*Device1) GetProperties

func (a *Device1) GetProperties() (*Device1Properties, error)

GetProperties load all available properties

func (*Device1) GetPropertiesSignal

func (a *Device1) GetPropertiesSignal() (chan *dbus.Signal, error)

GetPropertiesSignal return a channel for receiving udpdates on property changes

func (*Device1) GetProperty

func (a *Device1) GetProperty(name string) (dbus.Variant, error)

GetProperty get a property

func (*Device1) GetRSSI

func (a *Device1) GetRSSI() (int16, error)

GetRSSI get RSSI value

func (*Device1) GetServiceData

func (a *Device1) GetServiceData() (map[string]interface{}, error)

GetServiceData get ServiceData value

func (*Device1) GetServicesResolved

func (a *Device1) GetServicesResolved() (bool, error)

GetServicesResolved get ServicesResolved value

func (*Device1) GetTrusted

func (a *Device1) GetTrusted() (bool, error)

GetTrusted get Trusted value

func (*Device1) GetTxPower

func (a *Device1) GetTxPower() (int16, error)

GetTxPower get TxPower value

func (*Device1) GetUUIDs

func (a *Device1) GetUUIDs() ([]string, error)

GetUUIDs get UUIDs value

func (*Device1) Interface

func (a *Device1) Interface() string

Interface return Device1 interface

func (*Device1) Pair

func (a *Device1) Pair() error

Pair

This method will connect to the remote device,

func (*Device1) Path

func (a *Device1) Path() dbus.ObjectPath

Path return Device1 object path

func (*Device1) SetAlias

func (a *Device1) SetAlias(v string) error

SetAlias set Alias value

func (*Device1) SetBlocked

func (a *Device1) SetBlocked(v bool) error

SetBlocked set Blocked value

func (*Device1) SetProperty

func (a *Device1) SetProperty(name string, value interface{}) error

SetProperty set a property

func (*Device1) SetTrusted

func (a *Device1) SetTrusted(v bool) error

SetTrusted set Trusted value

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 {

	/*
		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

	/*
		UUIDs List of 128-bit UUIDs that represents the available
				remote services.
	*/
	UUIDs []string

	/*
		Paired Indicates if the remote device is paired.
	*/
	Paired bool

	/*
		Connected Indicates if the remote device is currently connected.
				A PropertiesChanged signal indicate changes to this
				status.
	*/
	Connected bool

	/*
		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

	/*
		ServiceData Service advertisement data. Keys are the UUIDs in
				string format followed by its byte array value.
	*/
	ServiceData map[string]interface{}

	/*
		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

	/*
		RSSI Received Signal Strength Indicator of the remote
				device (inquiry or advertising).
	*/
	RSSI int16

	/*
		ManufacturerData Manufacturer specific advertisement data. Keys are
				16 bits Manufacturer ID followed by its byte array
				value.
	*/
	ManufacturerData map[uint16]interface{}

	/*
		AdvertisingFlags The Advertising Data Flags of the remote device.
	*/
	AdvertisingFlags []byte

	/*
		Address The Bluetooth device address of the remote device.
	*/
	Address string

	/*
		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

	/*
		Adapter The object path of the adapter the device belongs to.
	*/
	Adapter dbus.ObjectPath

	/*
		ServicesResolved Indicate whether or not service discovery has been
				resolved.
	*/
	ServicesResolved bool

	/*
		TxPower Advertised transmitted power level (inquiry or
				advertising).
	*/
	TxPower int16

	/*
		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{}

	/*
		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

	/*
		Icon Proposed icon name according to the freedesktop.org
				icon naming specification.
	*/
	Icon string

	/*
		Class The Bluetooth class of device of the remote device.
	*/
	Class uint32

	/*
		Appearance External appearance of device, as found on GAP service.
	*/
	Appearance uint16

	/*
		Trusted Indicates if the remote is seen as trusted. This
				setting can be changed by the application.
	*/
	Trusted bool

	/*
		Modalias Remote Device ID information in modalias format
				used by the kernel and udev.
	*/
	Modalias string
	// 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) Lock

func (p *Device1Properties) Lock()

Lock access to properties

func (*Device1Properties) ToMap

func (a *Device1Properties) ToMap() (map[string]interface{}, error)

ToMap convert a Device1Properties to map

func (*Device1Properties) Unlock

func (p *Device1Properties) Unlock()

Unlock access to properties

Jump to

Keyboard shortcuts

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