-
Notifications
You must be signed in to change notification settings - Fork 0
/
bluezero.py
61 lines (51 loc) · 2.26 KB
/
bluezero.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import mock_pydbus
# General Bluez D-Bus Interfaces
#: BlueZ DBus Service Name
BLUEZ_SERVICE_NAME = 'org.bluez'
#: BlueZ DBus adapter interface
ADAPTER_INTERFACE = 'org.bluez.Adapter1'
#: BlueZ DBus device Interface
DEVICE_INTERFACE = 'org.bluez.Device1'
# Bluez GATT D-Bus Object Paths
#: BlueZ DBus GATT manager Interface
GATT_MANAGER_IFACE = 'org.bluez.GattManager1'
#: BlueZ DBus GATT Profile Interface
GATT_PROFILE_IFACE = 'org.bluez.GattProfile1'
#: BlueZ DBus GATT Service Interface
GATT_SERVICE_IFACE = 'org.bluez.GattService1'
#: BlueZ DBus GATT Characteristic Interface
GATT_CHRC_IFACE = 'org.bluez.GattCharacteristic1'
#: BlueZ DBus GATT Descriptor Interface
GATT_DESC_IFACE = 'org.bluez.GattDescriptor1'
def get_dbus_path(adapter=None,
device=None,
service=None,
characteristic=None,
descriptor=None):
"""
:param adapter: The address for the the adapter on which this device may be found.
For example "00:00:00:00:5A:AD"
:param device: The address of the remote device. This must be specified in colon-separated form.
For example "FD:6B:11:CD:4A:9B"
:param service: The UUID for the service on the remote device.
For example "e95d5899-251d-470a-a062-fa1922dfa9a8".
:param characteristic: The UUID for the characteristic associated with the service on the device.
For example "e95d93ee-251d-470a-a062-fa1922dfa9a8".
:param descriptor: The UUID for the descriptor associated with the characteristic of the service.
For example "00002902-0000-1000-8000-00805f9b34fb".
:return: The DBus object path for the requested adapter/device/service/characteristic/descriptor
You may specify:
* adapter
* adapter, device
* adapter, device, service
* adapter, device, service, characteristic
* adapter, device, service, characteristic, descriptor
The case of the letters in the addresses and UUIDs is not relevant.
The device path returned will always start "/org/bluez".
"""
_mngd_objs = mock_pydbus.GetManagedObjects()
_dbus_obj_path = None
"""
Insert your code here to get the requested DBus object path
"""
return _dbus_obj_path