mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 13:10:55 +01:00
Add success/fail return value to disoverAttributes.
This commit is contained in:
parent
c285052f6d
commit
a36655c105
2 changed files with 21 additions and 5 deletions
|
@ -703,13 +703,29 @@ std::vector<NimBLERemoteService*>* NimBLEClient::getServices(bool refresh) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieves the full database of attributes that the peripheral has available.
|
* @brief Retrieves the full database of attributes that the peripheral has available.
|
||||||
|
* @return True if successful.
|
||||||
*/
|
*/
|
||||||
void NimBLEClient::discoverAttributes() {
|
bool NimBLEClient::discoverAttributes() {
|
||||||
for(auto svc: *getServices(true)) {
|
deleteServices();
|
||||||
for(auto chr: *svc->getCharacteristics(true)) {
|
|
||||||
chr->getDescriptors(true);
|
if (!retrieveServices()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(auto svc: m_servicesVector) {
|
||||||
|
if (!svc->retrieveCharacteristics()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto chr: svc->m_characteristicVector) {
|
||||||
|
if (!chr->retrieveDescriptors()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
} // discoverAttributes
|
} // discoverAttributes
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
|
void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
|
||||||
uint16_t latency, uint16_t timeout);
|
uint16_t latency, uint16_t timeout);
|
||||||
void setDataLen(uint16_t tx_octets);
|
void setDataLen(uint16_t tx_octets);
|
||||||
void discoverAttributes();
|
bool discoverAttributes();
|
||||||
NimBLEConnInfo getConnInfo();
|
NimBLEConnInfo getConnInfo();
|
||||||
int getLastError();
|
int getLastError();
|
||||||
#if CONFIG_BT_NIMBLE_EXT_ADV
|
#if CONFIG_BT_NIMBLE_EXT_ADV
|
||||||
|
|
Loading…
Reference in a new issue