mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Just return a pointer for getServices(false) and getCharacteristics(false)
If parameter 'refresh' equals 'false' do not retrieve services or characteristics, just return a pointer to the vector.
This commit is contained in:
parent
c25e48872f
commit
5bc9d59646
2 changed files with 3 additions and 7 deletions
|
@ -412,15 +412,13 @@ NimBLERemoteService* NimBLEClient::getService(const NimBLEUUID &uuid) {
|
||||||
* @param [in] bool value to indicate if the current vector should be cleared and
|
* @param [in] bool value to indicate if the current vector should be cleared and
|
||||||
* subsequently all services retrieved from the peripheral.
|
* subsequently all services retrieved from the peripheral.
|
||||||
* If false the vector will be returned with the currently stored services,
|
* If false the vector will be returned with the currently stored services,
|
||||||
* if vector is empty it will retrieve all services from the peripheral.
|
* If true it will retrieve all services from the peripheral and return the vector with all services
|
||||||
* @return a pointer to the vector of available services.
|
* @return a pointer to the vector of available services.
|
||||||
*/
|
*/
|
||||||
std::vector<NimBLERemoteService*>* NimBLEClient::getServices(bool refresh) {
|
std::vector<NimBLERemoteService*>* NimBLEClient::getServices(bool refresh) {
|
||||||
if(refresh) {
|
if(refresh) {
|
||||||
deleteServices();
|
deleteServices();
|
||||||
}
|
|
||||||
|
|
||||||
if(m_servicesVector.empty()) {
|
|
||||||
if (!retrieveServices()) {
|
if (!retrieveServices()) {
|
||||||
NIMBLE_LOGE(LOG_TAG, "Error: Failed to get services");
|
NIMBLE_LOGE(LOG_TAG, "Error: Failed to get services");
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,17 +118,15 @@ NimBLERemoteCharacteristic* NimBLERemoteService::getCharacteristic(const NimBLEU
|
||||||
* @param [in] bool value to indicate if the current vector should be cleared and
|
* @param [in] bool value to indicate if the current vector should be cleared and
|
||||||
* subsequently all characteristics for this service retrieved from the peripheral.
|
* subsequently all characteristics for this service retrieved from the peripheral.
|
||||||
* If false the vector will be returned with the currently stored characteristics,
|
* If false the vector will be returned with the currently stored characteristics,
|
||||||
* if the vector is empty it will retrieve all characteristics of this service
|
* If true it will retrieve all characteristics of this service from the peripheral
|
||||||
* from the peripheral.
|
* and return the vector with all characteristics for this service.
|
||||||
* @return a pointer to the vector of descriptors for this characteristic.
|
* @return a pointer to the vector of descriptors for this characteristic.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
std::vector<NimBLERemoteCharacteristic*>* NimBLERemoteService::getCharacteristics(bool refresh) {
|
std::vector<NimBLERemoteCharacteristic*>* NimBLERemoteService::getCharacteristics(bool refresh) {
|
||||||
if(refresh) {
|
if(refresh) {
|
||||||
deleteCharacteristics();
|
deleteCharacteristics();
|
||||||
}
|
|
||||||
|
|
||||||
if(m_characteristicVector.empty()) {
|
|
||||||
if (!retrieveCharacteristics()) {
|
if (!retrieveCharacteristics()) {
|
||||||
NIMBLE_LOGE(LOG_TAG, "Error: Failed to get characteristics");
|
NIMBLE_LOGE(LOG_TAG, "Error: Failed to get characteristics");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue