diff options
author | Sven Gothel <[email protected]> | 2022-05-15 01:23:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-15 01:23:18 +0200 |
commit | 82ecfd8e19c88e3e4d0ddb04796874834292a05e (patch) | |
tree | a18d4972d9600521e2e830b0e541196d562e5066 /api/direct_bt/BTGattHandler.hpp | |
parent | 919cf46dd36e7c97a5784d86b5313f024212a756 (diff) |
noexcept: BTGattHandler::send*(): Fix BTDevice::getGattService(): Return zero sized array of BTGattServices on error
BTGattHandler::discoverCompletePrimaryServices():
- just discover the services and its characteristics and descriptors
- return bool, success of failor as returned by discovery methods (incl. their send*() command)
BTGattHandler::initClientGatt():
- clear services before retrieval and on error
- error response on
- BTGattHandler::discoverCompletePrimaryServices() failure
- no services
- no GenericAccess services
- only return true and leave services if no error
BTDevice::getGattService():
- perform BTGattHandler::initClientGatt() error checks as well
- update method API doc, describing failure included no GenericAccess service
Diffstat (limited to 'api/direct_bt/BTGattHandler.hpp')
-rw-r--r-- | api/direct_bt/BTGattHandler.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/api/direct_bt/BTGattHandler.hpp b/api/direct_bt/BTGattHandler.hpp index 4dc08c9e..5f20d56c 100644 --- a/api/direct_bt/BTGattHandler.hpp +++ b/api/direct_bt/BTGattHandler.hpp @@ -555,17 +555,17 @@ namespace direct_bt { * <p> * BT Core Spec v5.2: Vol 3, Part G GATT: 4.4.1 Discover All Primary Services * </p> - * Method returns reference to BTGattHandler's internal BTGattService vector of discovered services + * Populates the internal internal BTGattService vector of discovered services. * * Service discovery may consume 500ms - 2000ms, depending on bandwidth. * - * Method usually called via initClientGatt() and is only exposed special applications. + * Method called from initClientGatt(). * * @param shared_this shared pointer of this instance, used to forward a weak_ptr to BTGattService for back-reference. Reference is validated. - * @return BTGattHandler's internal BTGattService vector of discovered services + * @return true if successful, otherwise false * @see initClientGatt() */ - jau::darray<BTGattServiceRef> & discoverCompletePrimaryServices(std::shared_ptr<BTGattHandler> shared_this) noexcept; + bool discoverCompletePrimaryServices(std::shared_ptr<BTGattHandler> shared_this) noexcept; public: /** @@ -635,12 +635,13 @@ namespace direct_bt { * Initialize the connection and internal data set for GATT client operations: * - Exchange MTU * - Discover all primary services, its characteristics and its descriptors + * - Extracts the GattGenericAccessSvc from the services, see getGenericAccess() * * Service discovery may consume 500ms - 2000ms, depending on bandwidth. * * @param shared_this the shared BTGattHandler reference * @param already_init if already initialized true, will hold true, otherwise false - * @return true if already initialized or newly initialized, otherwise false + * @return true if already initialized or successfully newly initialized with at least GattGenericAccessSvc available, otherwise false * @see clientMTUExchange() * @see discoverCompletePrimaryServices() */ |