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 @@ -646,13 +646,29 @@ std::vector<NimBLERemoteService*>* NimBLEClient::getServices(bool refresh) {
646646
647647/* *
648648 * @brief Retrieves the full database of attributes that the peripheral has available.
649+ * @return True if successful.
649650 */
650- void NimBLEClient::discoverAttributes () {
651- for (auto svc: *getServices (true )) {
652- for (auto chr: *svc->getCharacteristics (true )) {
653- chr->getDescriptors (true );
651+ bool NimBLEClient::discoverAttributes () {
652+ deleteServices ();
653+
654+ if (!retrieveServices ()){
655+ return false ;
656+ }
657+
658+
659+ for (auto svc: m_servicesVector) {
660+ if (!svc->retrieveCharacteristics ()) {
661+ return false ;
662+ }
663+
664+ for (auto chr: svc->m_characteristicVector ) {
665+ if (!chr->retrieveDescriptors ()) {
666+ return false ;
667+ }
654668 }
655669 }
670+
671+ return true ;
656672} // discoverAttributes
657673
658674
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ class NimBLEClient {
7171 uint16_t scanInterval=16 , uint16_t scanWindow=16 );
7272 void updateConnParams (uint16_t minInterval, uint16_t maxInterval,
7373 uint16_t latency, uint16_t timeout);
74- void discoverAttributes ();
74+ bool discoverAttributes ();
7575 NimBLEConnInfo getConnInfo ();
7676 int getLastError ();
7777
You can’t perform that action at this time.
0 commit comments