File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -703,13 +703,29 @@ std::vector<NimBLERemoteService*>* NimBLEClient::getServices(bool refresh) {
703703
704704/* *
705705 * @brief Retrieves the full database of attributes that the peripheral has available.
706+ * @return True if successful.
706707 */
707- void NimBLEClient::discoverAttributes () {
708- for (auto svc: *getServices (true )) {
709- for (auto chr: *svc->getCharacteristics (true )) {
710- chr->getDescriptors (true );
708+ bool NimBLEClient::discoverAttributes () {
709+ deleteServices ();
710+
711+ if (!retrieveServices ()){
712+ return false ;
713+ }
714+
715+
716+ for (auto svc: m_servicesVector) {
717+ if (!svc->retrieveCharacteristics ()) {
718+ return false ;
719+ }
720+
721+ for (auto chr: svc->m_characteristicVector ) {
722+ if (!chr->retrieveDescriptors ()) {
723+ return false ;
724+ }
711725 }
712726 }
727+
728+ return true ;
713729} // discoverAttributes
714730
715731
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ class NimBLEClient {
7070 void updateConnParams (uint16_t minInterval, uint16_t maxInterval,
7171 uint16_t latency, uint16_t timeout);
7272 void setDataLen (uint16_t tx_octets);
73- void discoverAttributes ();
73+ bool discoverAttributes ();
7474 NimBLEConnInfo getConnInfo ();
7575 int getLastError ();
7676#if CONFIG_BT_NIMBLE_EXT_ADV
You can’t perform that action at this time.
0 commit comments