mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-25 06:30: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.
|
||||
* @return True if successful.
|
||||
*/
|
||||
void NimBLEClient::discoverAttributes() {
|
||||
for(auto svc: *getServices(true)) {
|
||||
for(auto chr: *svc->getCharacteristics(true)) {
|
||||
chr->getDescriptors(true);
|
||||
bool NimBLEClient::discoverAttributes() {
|
||||
deleteServices();
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
|
||||
uint16_t latency, uint16_t timeout);
|
||||
void setDataLen(uint16_t tx_octets);
|
||||
void discoverAttributes();
|
||||
bool discoverAttributes();
|
||||
NimBLEConnInfo getConnInfo();
|
||||
int getLastError();
|
||||
#if CONFIG_BT_NIMBLE_EXT_ADV
|
||||
|
|
Loading…
Reference in a new issue