Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
BTGattChar.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2020 Gothel Software e.K.
4 * Copyright (c) 2020 ZAFENA AB
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#ifndef BT_GATT_CHARACTERISTIC_HPP_
27#define BT_GATT_CHARACTERISTIC_HPP_
28
29#include <cstring>
30#include <string>
31#include <memory>
32#include <cstdint>
33
34#include <mutex>
35#include <atomic>
36
37#include <jau/java_uplink.hpp>
38#include <jau/octets.hpp>
39#include <jau/uuid.hpp>
40
41#include "BTTypes0.hpp"
42#include "ATTPDUTypes.hpp"
43
44#include "BTTypes1.hpp"
45
46#include "BTGattDesc.hpp"
47#include "jau/int_types.hpp"
48
49
50/**
51 * - - - - - - - - - - - - - - -
52 *
53 * Module BTGattChar:
54 *
55 * - BT Core Spec v5.2: Vol 3, Part G Generic Attribute Protocol (GATT)
56 * - BT Core Spec v5.2: Vol 3, Part G GATT: 2.6 GATT Profile Hierarchy
57 */
58namespace direct_bt {
59
60 class BTGattHandler; // forward
61 typedef std::shared_ptr<BTGattHandler> BTGattHandlerRef;
62
63 class BTDevice; // forward
64 typedef std::shared_ptr<BTDevice> BTDeviceRef;
65
66 class BTGattService; // forward
67 typedef std::shared_ptr<BTGattService> BTGattServiceRef;
68
69 class BTGattCharListener; // forward
70 typedef std::shared_ptr<BTGattCharListener> BTGattCharListenerRef;
71
72 /** @defgroup DBTUserClientAPI Direct-BT Central-Client User Level API
73 * User level Direct-BT API types and functionality addressing the central-client ::GATTRole::Client perspective,
74 * [see Direct-BT Overview](namespacedirect__bt.html#details).
75 *
76 * @{
77 */
78
79 /**
80 * Representing a Gatt Characteristic object from the ::GATTRole::Client perspective.
81 *
82 * A list of shared BTGattChar instances is available from BTGattService
83 * via BTGattService::characteristicList.
84 *
85 * See [Direct-BT Overview](namespacedirect__bt.html#details).
86 *
87 * BT Core Spec v5.2: Vol 3, Part G GATT: 3.3 Characteristic Definition
88 *
89 * BT Core Spec v5.2: Vol 3, Part G GATT: 4.6.1 Discover All Characteristics of a Service
90 *
91 * The handle represents a service's characteristics-declaration
92 * and the value the Characteristics Property, Characteristics Value Handle _and_ Characteristics UUID.
93 */
94 class BTGattChar : public BTObject {
95 private:
96 /** Characteristics's service weak back-reference */
97 std::weak_ptr<BTGattService> wbr_service;
98 bool enabledNotifyState = false;
99 bool enabledIndicateState = false;
100
101 std::string toShortString() const noexcept;
102
103 public:
104 /** BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.1.1 Characteristic Properties */
105 enum PropertyBitVal : uint8_t {
106 NONE = 0,
107 Broadcast = (1 << 0),
108 Read = (1 << 1),
109 WriteNoAck = (1 << 2),
110 WriteWithAck = (1 << 3),
111 Notify = (1 << 4),
112 Indicate = (1 << 5),
113 AuthSignedWrite = (1 << 6),
114 ExtProps = (1 << 7)
115 };
116
119
120 /**
121 * Characteristic Handle of this instance.
122 * <p>
123 * Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle).
124 * </p>
125 */
126 const uint16_t handle;
127
128 /* Characteristics Property */
130
131 /**
132 * Characteristics Value Handle.
133 * <p>
134 * Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle).
135 * </p>
136 */
137 const uint16_t value_handle;
138
139 /* Characteristics Value Type UUID */
140 std::unique_ptr<const jau::uuid_t> value_type;
141
142 /** List of Characteristic Descriptions as shared reference */
144
145 /* Optional Client Characteristic Configuration index within descriptorList */
147
148 /* Optional Characteristic User Description index within descriptorList */
150
151 BTGattChar(const BTGattServiceRef & service_, const uint16_t handle_,
152 const PropertyBitVal properties_, const uint16_t value_handle_, std::unique_ptr<const jau::uuid_t> && value_type_) noexcept
153 : wbr_service(service_), handle(handle_),
154 properties(properties_), value_handle(value_handle_), value_type(std::move(value_type_)) {}
155
156 std::string get_java_class() const noexcept override {
157 return java_class();
158 }
159 static std::string java_class() noexcept {
160 return std::string(JAVA_DBT_PACKAGE "DBTGattChar");
161 }
162
163 BTGattServiceRef getServiceUnchecked() const noexcept { return wbr_service.lock(); }
165 BTDeviceRef getDeviceUnchecked() const noexcept;
166
167 bool hasProperties(const PropertyBitVal v) const noexcept { return v == ( properties & v ); }
168
169 /**
170 * Find a BTGattDesc by its desc_uuid.
171 *
172 * @parameter desc_uuid the UUID of the desired BTGattDesc
173 * @return The matching descriptor or null if not found
174 */
175 std::shared_ptr<BTGattDesc> findGattDesc(const jau::uuid_t& desc_uuid) noexcept;
176
177 std::string toString() const noexcept override;
178
179 void clearDescriptors() noexcept {
183 }
184
185 /**
186 * Return the Client Characteristic Configuration BTGattDescRef if available or nullptr.
187 *
188 * The BTGattDesc::Type::CLIENT_CHARACTERISTIC_CONFIGURATION has been indexed while
189 * retrieving the GATT database from the server.
190 */
192 if( 0 > clientCharConfigIndex ) {
193 return nullptr;
194 }
195 return descriptorList.at(static_cast<size_t>(clientCharConfigIndex)); // abort if out of bounds
196 }
197
198 /**
199 * Return the User Description BTGattDescRef if available or nullptr.
200 *
201 * The BTGattDesc::Type::CHARACTERISTIC_USER_DESCRIPTION has been indexed while
202 * retrieving the GATT database from the server.
203 */
205 if( 0 > userDescriptionIndex ) {
206 return nullptr;
207 }
208 return descriptorList.at(static_cast<size_t>(userDescriptionIndex)); // abort if out of bounds
209 }
210
211 /**
212 * BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration
213 *
214 * Method enables notification and/or indication for this characteristic at BLE level.
215 *
216 * Implementation masks this Characteristic properties PropertyBitVal::Notify and PropertyBitVal::Indicate
217 * with the respective user request parameters, hence removes unsupported requests.
218 *
219 * Notification and/or indication configuration is only performed per characteristic if changed.
220 *
221 * It is recommended to utilize notification over indication, as its link-layer handshake
222 * and higher potential bandwidth may deliver material higher performance.
223 *
224 * @param enableNotification
225 * @param enableIndication
226 * @param enabledState array of size 2, holding the resulting enabled state for notification and indication.
227 * @return false if this characteristic has no PropertyBitVal::Notify or PropertyBitVal::Indication present,
228 * or there is no BTGattDesc of type ClientCharacteristicConfiguration, or if the operation has failed.
229 * Otherwise returns true.
230 *
231 * @see enableNotificationOrIndication()
232 * @see disableIndicationNotification()
233 */
234 bool configNotificationIndication(const bool enableNotification, const bool enableIndication, bool enabledState[2]) noexcept;
235
236 /**
237 * BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration
238 *
239 * Method will attempt to enable notification on the BLE level, if available,
240 * otherwise indication if available.
241 *
242 * Notification and/or indication configuration is only performed per characteristic if changed.
243 *
244 * It is recommended to utilize notification over indication, as its link-layer handshake
245 * and higher potential bandwidth may deliver material higher performance.
246 *
247 * @param enabledState array of size 2, holding the resulting enabled state for notification and indication.
248 * @return false if this characteristic has no PropertyBitVal::Notify or PropertyBitVal::Indication present,
249 * or there is no BTGattDesc of type ClientCharacteristicConfiguration, or if the operation has failed.
250 * Otherwise returns true.
251 *
252 * @see configNotificationIndication()
253 * @see disableIndicationNotification()
254 */
255 bool enableNotificationOrIndication(bool enabledState[2]) noexcept;
256
257 /**
258 * BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration
259 *
260 * Method will attempt to disable notification and indication on the BLE level.
261 *
262 * Notification and/or indication configuration is only performed per characteristic if changed.
263 *
264 * @return false if this characteristic has no PropertyBitVal::Notify or PropertyBitVal::Indication present,
265 * or there is no BTGattDesc of type ClientCharacteristicConfiguration, or if the operation has failed.
266 * Otherwise returns true.
267 *
268 * @see configNotificationIndication()
269 * @see enableNotificationOrIndication()
270 * @since 2.4.0
271 */
272 bool disableIndicationNotification() noexcept;
273
274 /**
275 * Add the given BTGattCharListener to the listener list if not already present.
276 *
277 * Occurring notifications and indications for this characteristic,
278 * if enabled via configNotificationIndication(bool, bool, bool[]) or enableNotificationOrIndication(bool[]),
279 * will call the respective BTGattCharListener callback method.
280 *
281 * Returns true if the given listener is not element of the list and has been newly added,
282 * otherwise false.
283 *
284 * Convenience delegation call to BTGattHandler via BTDevice
285 *
286 * @see BTGattChar::disableIndicationNotification()
287 * @see BTGattChar::enableNotificationOrIndication()
288 * @see BTGattChar::configNotificationIndication()
289 * @see BTGattChar::addCharListener()
290 * @see BTGattChar::removeCharListener()
291 * @see BTGattChar::removeAllAssociatedCharListener()
292 */
293 bool addCharListener(const BTGattCharListenerRef& l) noexcept;
294
295 /**
296 * Add the given BTGattCharListener to the listener list if not already present
297 * and if enabling the notification <i>or</i> indication for this characteristic at BLE level was successful.<br>
298 * Notification and/or indication configuration is only performed per characteristic if changed.
299 *
300 * Implementation will enable notification if available,
301 * otherwise indication will be enabled if available. <br>
302 * Implementation uses enableNotificationOrIndication(bool[]) to enable either.
303 *
304 * Occurring notifications and indications for this characteristic
305 * will call the respective BTGattCharListener callback method.
306 *
307 * Returns true if enabling the notification and/or indication was successful
308 * and if the given listener is not element of the list and has been newly added,
309 * otherwise false.
310 *
311 * @param enabledState array of size 2, holding the resulting enabled state for notification and indication
312 * using enableNotificationOrIndication(bool[])
313 *
314 * @see BTGattChar::disableIndicationNotification()
315 * @see BTGattChar::enableNotificationOrIndication()
316 * @see BTGattChar::configNotificationIndication()
317 * @see BTGattChar::addCharListener()
318 * @see BTGattChar::removeCharListener()
319 * @see BTGattChar::removeAllAssociatedCharListener()
320 */
321 bool addCharListener(const BTGattCharListenerRef& l, bool enabledState[2]) noexcept;
322
323 /**
324 * Remove the given associated BTGattCharListener from the listener list if present.
325 *
326 * To disables the notification and/or indication for this characteristic at BLE level
327 * use disableIndicationNotification() when desired.
328 *
329 * @param l
330 * @return
331 *
332 * @see BTGattChar::disableIndicationNotification()
333 * @see BTGattChar::enableNotificationOrIndication()
334 * @see BTGattChar::configNotificationIndication()
335 * @see BTGattChar::addCharListener()
336 * @see BTGattChar::removeCharListener()
337 * @see BTGattChar::removeAllAssociatedCharListener()
338 * @since 2.4.0
339 */
340 bool removeCharListener(const BTGattCharListenerRef& l) noexcept;
341
342 /**
343 * Removes all associated BTGattCharListener and and {@link BTGattCharListener} from the listener list.
344 *
345 * Also disables the notification and/or indication for this characteristic at BLE level
346 * if `disableIndicationNotification == true`.
347 *
348 * Returns the number of removed event listener.
349 *
350 * If the BTDevice's BTGattHandler is null, i.e. not connected, `zero` is being returned.
351 *
352 * @param shallDisableIndicationNotification if true, disables the notification and/or indication for this characteristic
353 * using {@link #disableIndicationNotification()
354 * @return
355 * @see BTGattChar::disableIndicationNotification()
356 * @see BTGattChar::configNotificationIndication()
357 * @see BTGattChar::addCharListener()
358 * @see BTGattChar::removeCharListener()
359 * @see BTGattChar::removeAllAssociatedCharListener()
360 */
361 size_type removeAllAssociatedCharListener(bool shallDisableIndicationNotification) noexcept;
362
363 /**
364 * BT Core Spec v5.2: Vol 3, Part G GATT: 4.8.1 Read Characteristic Value
365 * <p>
366 * BT Core Spec v5.2: Vol 3, Part G GATT: 4.8.3 Read Long Characteristic Value
367 * </p>
368 * <p>
369 * If expectedLength = 0, then only one ATT_READ_REQ/RSP will be used.
370 * </p>
371 * <p>
372 * If expectedLength < 0, then long values using multiple ATT_READ_BLOB_REQ/RSP will be used until
373 * the response returns zero. This is the default parameter.
374 * </p>
375 * <p>
376 * If expectedLength > 0, then long values using multiple ATT_READ_BLOB_REQ/RSP will be used
377 * if required until the response returns zero.
378 * </p>
379 * <p>
380 * Convenience delegation call to BTGattHandler via BTDevice
381 * <p>
382 * </p>
383 * If the BTDevice's BTGattHandler is null, i.e. not connected, false is returned.
384 * </p>
385 */
386 bool readValue(jau::POctets & res, int expectedLength=-1) noexcept;
387
388 /**
389 * BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.3 Write Characteristic Value
390 * <p>
391 * Convenience delegation call to BTGattHandler via BTDevice
392 * <p>
393 * </p>
394 * If the BTDevice's BTGattHandler is null, i.e. not connected, false is returned.
395 * </p>
396 */
397 bool writeValue(const jau::TROOctets & value) noexcept;
398
399 /**
400 * BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.1 Write Characteristic Value Without Response
401 * <p>
402 * Convenience delegation call to BTGattHandler via BTDevice
403 * <p>
404 * </p>
405 * If the BTDevice's BTGattHandler is null, i.e. not connected, false is returned.
406 * </p>
407 */
408 bool writeValueNoResp(const jau::TROOctets & value) noexcept;
409 };
410 typedef std::shared_ptr<BTGattChar> BTGattCharRef;
411
412 inline bool operator==(const BTGattChar& lhs, const BTGattChar& rhs) noexcept
413 { return lhs.handle == rhs.handle; /** unique attribute handles */ }
414
415 inline bool operator!=(const BTGattChar& lhs, const BTGattChar& rhs) noexcept
416 { return !(lhs == rhs); }
417
418 constexpr uint8_t number(const BTGattChar::PropertyBitVal rhs) noexcept {
419 return static_cast<uint8_t>(rhs);
420 }
422 return static_cast<BTGattChar::PropertyBitVal> ( number(lhs) | number(rhs) );
423 }
425 return static_cast<BTGattChar::PropertyBitVal> ( number(lhs) & number(rhs) );
426 }
427 constexpr bool operator ==(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
428 return number(lhs) == number(rhs);
429 }
430 constexpr bool operator !=(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept {
431 return !( lhs == rhs );
432 }
433 std::string to_string(const BTGattChar::PropertyBitVal mask) noexcept;
434
435 /**
436 * {@link BTGattChar} event listener for notification and indication events.
437 * <p>
438 * A listener instance may be attached to a BTGattChar instance via
439 * {@link BTGattChar::addCharListener(BTGattCharListenerRef)} to listen to its events.
440 * </p>
441 * <p>
442 * A listener instance may be attached to a BTGattHandler via
443 * {@link BTGattHandler::addCharListener(BTGattCharListenerRef)}
444 * to listen to all events of the device or the matching filtered events.
445 * </p>
446 * <p>
447 * The listener manager maintains a unique set of listener instances without duplicates.
448 * </p>
449 */
451 public:
452 /**
453 * Returns a unique string denominating the type of this instance.
454 *
455 * Simple access and provision of a typename string representation
456 * at compile time like RTTI via jau::type_name_cue.
457 */
458 virtual const char * type_name() const noexcept;
459
460 /**
461 * Called from native BLE stack, initiated by a received notification associated
462 * with the given {@link BTGattChar}.
463 * @param charDecl {@link BTGattChar} related to this notification
464 * @param charValue the notification value
465 * @param timestamp monotonic timestamp at reception, see jau::getCurrentMilliseconds()
466 */
467 virtual void notificationReceived(BTGattCharRef charDecl,
468 const jau::TROOctets& charValue, const uint64_t timestamp) = 0;
469
470 /**
471 * Called from native BLE stack, initiated by a received indication associated
472 * with the given {@link BTGattChar}.
473 * @param charDecl {@link BTGattChar} related to this indication
474 * @param charValue the indication value
475 * @param timestamp monotonic timestamp at reception, see jau::getCurrentMilliseconds()
476 * @param confirmationSent if true, the native stack has sent the confirmation, otherwise user is required to do so.
477 */
478 virtual void indicationReceived(BTGattCharRef charDecl,
479 const jau::TROOctets& charValue, const uint64_t timestamp,
480 const bool confirmationSent) = 0;
481
482 ~BTGattCharListener() noexcept override = default;
483
484 /** Return a simple description about this instance. */
485 std::string toString() const noexcept override {
486 return std::string(type_name())+"["+jau::to_string(this)+"]";
487 }
488
489 std::string get_java_class() const noexcept override {
490 return java_class();
491 }
492 static std::string java_class() noexcept {
493 return std::string(JAVA_MAIN_PACKAGE "BTGattCharListener");
494 }
495
496 /**
497 * Default comparison operator, merely testing for same memory reference.
498 * <p>
499 * Specializations may override.
500 * </p>
501 */
502 virtual bool operator==(const BTGattCharListener& rhs) const noexcept
503 { return this == &rhs; }
504
505 bool operator!=(const BTGattCharListener& rhs) const noexcept
506 { return !(*this == rhs); }
507 };
508 typedef std::shared_ptr<BTGattCharListener> BTGattCharListenerRef;
509
510 /**@}*/
511
512} // namespace direct_bt
513
514#endif /* BT_GATT_CHARACTERISTIC_HPP_ */
#define JAVA_DBT_PACKAGE
Definition: BTTypes0.hpp:43
#define JAVA_MAIN_PACKAGE
Definition: BTTypes0.hpp:44
BTDevice represents one remote Bluetooth device.
Definition: BTDevice.hpp:81
BTGattChar event listener for notification and indication events.
Definition: BTGattChar.hpp:450
virtual void notificationReceived(BTGattCharRef charDecl, const jau::TROOctets &charValue, const uint64_t timestamp)=0
Called from native BLE stack, initiated by a received notification associated with the given BTGattCh...
static std::string java_class() noexcept
Definition: BTGattChar.hpp:492
bool operator!=(const BTGattCharListener &rhs) const noexcept
Definition: BTGattChar.hpp:505
~BTGattCharListener() noexcept override=default
std::string get_java_class() const noexcept override
Definition: BTGattChar.hpp:489
virtual bool operator==(const BTGattCharListener &rhs) const noexcept
Default comparison operator, merely testing for same memory reference.
Definition: BTGattChar.hpp:502
virtual void indicationReceived(BTGattCharRef charDecl, const jau::TROOctets &charValue, const uint64_t timestamp, const bool confirmationSent)=0
Called from native BLE stack, initiated by a received indication associated with the given BTGattChar...
Representing a Gatt Characteristic object from the GATTRole::Client perspective.
Definition: BTGattChar.hpp:94
BTGattServiceRef getServiceUnchecked() const noexcept
Definition: BTGattChar.hpp:163
ssize_type clientCharConfigIndex
Definition: BTGattChar.hpp:146
jau::snsize_t ssize_type
Definition: BTGattChar.hpp:118
std::unique_ptr< const jau::uuid_t > value_type
Definition: BTGattChar.hpp:140
bool disableIndicationNotification() noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration.
Definition: BTGattChar.cpp:254
BTGattHandlerRef getGattHandlerUnchecked() const noexcept
Definition: BTGattChar.cpp:173
bool addCharListener(const BTGattCharListenerRef &l) noexcept
Add the given BTGattCharListener to the listener list if not already present.
Definition: BTGattChar.cpp:259
std::string toString() const noexcept override
Definition: BTGattChar.cpp:114
void clearDescriptors() noexcept
Definition: BTGattChar.hpp:179
BTGattDescRef getClientCharConfig() const noexcept
Return the Client Characteristic Configuration BTGattDescRef if available or nullptr.
Definition: BTGattChar.hpp:191
const uint16_t handle
Characteristic Handle of this instance.
Definition: BTGattChar.hpp:126
std::string get_java_class() const noexcept override
Definition: BTGattChar.hpp:156
BTDeviceRef getDeviceUnchecked() const noexcept
Definition: BTGattChar.cpp:181
BTGattDescRef getUserDescription() const noexcept
Return the User Description BTGattDescRef if available or nullptr.
Definition: BTGattChar.hpp:204
const PropertyBitVal properties
Definition: BTGattChar.hpp:129
const uint16_t value_handle
Characteristics Value Handle.
Definition: BTGattChar.hpp:137
ssize_type userDescriptionIndex
Definition: BTGattChar.hpp:149
bool removeCharListener(const BTGattCharListenerRef &l) noexcept
Remove the given associated BTGattCharListener from the listener list if present.
Definition: BTGattChar.cpp:285
jau::nsize_t size_type
Definition: BTGattChar.hpp:117
BTGattChar(const BTGattServiceRef &service_, const uint16_t handle_, const PropertyBitVal properties_, const uint16_t value_handle_, std::unique_ptr< const jau::uuid_t > &&value_type_) noexcept
Definition: BTGattChar.hpp:151
bool configNotificationIndication(const bool enableNotification, const bool enableIndication, bool enabledState[2]) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration.
Definition: BTGattChar.cpp:189
bool enableNotificationOrIndication(bool enabledState[2]) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration.
Definition: BTGattChar.cpp:244
size_type removeAllAssociatedCharListener(bool shallDisableIndicationNotification) noexcept
Removes all associated BTGattCharListener and and BTGattCharListener from the listener list.
Definition: BTGattChar.cpp:294
PropertyBitVal
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.1.1 Characteristic Properties.
Definition: BTGattChar.hpp:105
bool hasProperties(const PropertyBitVal v) const noexcept
Definition: BTGattChar.hpp:167
std::shared_ptr< BTGattDesc > findGattDesc(const jau::uuid_t &desc_uuid) noexcept
Find a BTGattDesc by its desc_uuid.
Definition: BTGattChar.cpp:103
bool writeValue(const jau::TROOctets &value) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.3 Write Characteristic Value.
Definition: BTGattChar.cpp:322
jau::darray< BTGattDescRef > descriptorList
List of Characteristic Descriptions as shared reference.
Definition: BTGattChar.hpp:143
bool readValue(jau::POctets &res, int expectedLength=-1) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 4.8.1 Read Characteristic Value.
Definition: BTGattChar.cpp:306
bool writeValueNoResp(const jau::TROOctets &value) noexcept
BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.1 Write Characteristic Value Without Response.
Definition: BTGattChar.cpp:339
static std::string java_class() noexcept
Definition: BTGattChar.hpp:159
Representing a Gatt Service object from the GATTRole::Client perspective.
Transient read only and endian aware octet data, i.e.
Definition: octets.hpp:67
const_reference at(size_type i) const
Like std::vector::at(size_type), immutable reference.
Definition: darray.hpp:814
constexpr void clear() noexcept
Like std::vector::clear(), but ending with zero capacity.
Definition: darray.hpp:904
std::string to_string(const endian_t v) noexcept
Return std::string representation of the given endian.
const char * type_name() noexcept
Returns the type name of given type T using template Compile Time Type Information (CTTI) only via RT...
std::shared_ptr< BTGattHandler > BTGattHandlerRef
Definition: BTGattChar.hpp:61
bool operator==(const BTAdapter &lhs, const BTAdapter &rhs) noexcept
Definition: BTAdapter.hpp:1348
std::shared_ptr< BTDevice > BTDeviceRef
Definition: BTDevice.hpp:1347
std::string to_string(const DiscoveryPolicy v) noexcept
Definition: BTAdapter.cpp:58
bool operator!=(const BTAdapter &lhs, const BTAdapter &rhs) noexcept
Definition: BTAdapter.hpp:1351
constexpr uint8_t number(const DiscoveryPolicy rhs) noexcept
Definition: BTAdapter.hpp:100
std::shared_ptr< BTGattCharListener > BTGattCharListenerRef
Definition: BTGattChar.hpp:70
std::shared_ptr< BTGattChar > BTGattCharRef
Definition: BTGattChar.hpp:410
std::shared_ptr< BTGattService > BTGattServiceRef
Definition: BTGattChar.hpp:67
constexpr BTGattChar::PropertyBitVal operator&(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept
Definition: BTGattChar.hpp:424
std::shared_ptr< BTGattDesc > BTGattDescRef
Definition: BTGattDesc.hpp:190
constexpr BTGattChar::PropertyBitVal operator|(const BTGattChar::PropertyBitVal lhs, const BTGattChar::PropertyBitVal rhs) noexcept
Definition: BTGattChar.hpp:421
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:53
int_fast32_t snsize_t
Natural 'ssize_t' alternative using int_fast32_t as its natural sized type.
Definition: int_types.hpp:65
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Definition: backtrace.hpp:32
STL namespace.