summaryrefslogtreecommitdiff
path: root/doc/attribute-api.txt
blob: 4b392b953de54d807e1f0a812c6bda71e867d5cb (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
BlueZ D-Bus Attribute API description
*************************************

Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>

Service details
---------------

All characteristics are presented as object paths in a single, flat list. Each
object has a "ServiceUUID" property which contains the 128-bit UUID of the
service that contains it, so clients can identify the correct characteristic if
multiple services contain the same characteristic.

This API is used for both local (added to the BlueZ GATT server) and remote
(found by GATT discovery) services.

Device Characteristic hierarchy
===============================

Service		org.bluez
Interface	org.bluez.Characteristic
Object path	freely definable

For local characteristics, it is recommended (for readability and debugging
purposes) to have the object path prefix as "[freely definable]/[busid]" where
"[busid]" is the application's D-Bus address. For remote characteristics, the
device address is added to the prefix. E.g.:

[freely definable]/[busid]/characteristic_1803_2A06 (local)
[freely definable]/dev_XX_XX_XX_XX_XX_XX/characteristic_1803_2A06 (remote)

Methods		void SetValue(array{byte} value)

			Update characteristic value.

			For a remote characteristic, this method triggers a
			GATT characteristic value write procedure setting a new
			value for this characteristic. The GATT sub-procedure
			is automatically selected based on the characteristic
			properties and value length.

		dict GetValue()

			Read characteristic value and descriptors. The returned
			dictionary has the following format:

			{
				"value": array{byte},
				"formatted value": string,
				// Optional descriptors
				"client configuration": uint16,
				"server configuration": uint16,
				"extended properties": uint16,
				"user description": string,
				// For unknown descriptors, use 128-bit UUID
				// as key
				"uuid": array{byte},
			}

Properties	string UUID [readonly]

			128-bit UUID of this characteristic.

		string ServiceUUID [readonly]

			128-bit UUID of the service which includes this
			characteristic.

		boolean Read [readonly]

			Characteristic value can be read.

		boolean WriteWithoutResponse [readonly]

			Characteristic value can be written using GATT Write
			Without Response sub-procedure.

		boolean Write [readonly]

			Characteristic value can be written using GATT Write
			Characteristic Value sub-procedures.

		boolean Notify [readonly]

			Characteristic value can be notified.

		boolean Indicate [readonly]

			Characteristic value can be indicated.

		boolean AuthenticatedSignedWrites [readonly]

			Characteristic value can be written using GATT Signed
			Write Without Response sub-procedure.

		boolean ExtendedProperties [readonly]

			Characteristic contains additional properties defined
			on the Extended Properties descriptor.

Characteristic Watcher hierarchy
===============================

Service		unique name
Interface	org.bluez.Watcher
Object path	freely definable

Methods		void ValueChanged(object characteristic, dict value)

			The value dictionary contains the new value for the
			Characteristic. The format is the same returned by
			Characteristic.GetValue().

			This method is only called when the "raw" setting is
			disabled on Adapter.RegisterCharacteristicsWatcher().

		void RawValueChanged(object characteristic, array{byte} value)

			New raw Characteristic value.

			This method is only called when the "raw" setting is
			enabled on Adapter.RegisterCharacteristicsWatcher().