Function AddDescriptor

Synopsis

#include <bta/gatt/database_builder.h>

void AddDescriptor(uint16_t handle, const bluetooth::Uuid &uuid)

Description

No description yet.

Source

Lines 101-123 in bta/gatt/database_builder.cc. Line 39 in bta/gatt/database_builder.h.

void DatabaseBuilder::AddDescriptor(uint16_t handle, const Uuid& uuid) {
  Service* service = FindService(database.services, handle);
  if (!service) {
    LOG(ERROR) << "Illegal action to add to non-existing service!";
    return;
  }

  if (service->characteristics.empty()) {
    LOG(ERROR) << __func__
               << ": Illegal action to add to non-existing characteristic!";
    return;
  }

  Characteristic* char_node = &service->characteristics.front();
  for (auto it = service->characteristics.begin();
       it != service->characteristics.end(); it++) {
    if (it->declaration_handle > handle) break;
    char_node = &(*it);
  }

  char_node->descriptors.emplace_back(
      gatt::Descriptor{.handle = handle, .uuid = uuid});
}





Add Discussion as Guest

Log in to DocsForge