Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/NimBLEServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,33 @@ bool NimBLEServer::start() {
}
# endif

// Populate Aggregate Format (0x2905) descriptors with the handle of each active 0x2904 descriptor.
for (const auto& svc : m_svcVec) {
if (svc->getHandle() == 0) { // Skip services that have no handle (not registered)
continue;
}

for (const auto& chr : svc->getCharacteristics()) {
if (chr->getHandle() == 0) { // Skip characteristics that have no handle (not registered)
continue;
}

auto dsc2905 = chr->getDescriptorByUUID(NimBLEUUID(static_cast<uint16_t>(0x2905)));
Comment thread
h2zero marked this conversation as resolved.
Resolved
if (dsc2905 == nullptr) {
continue;
}

static const NimBLEUUID uuid2904(static_cast<uint16_t>(0x2904));
dsc2905->m_value = NimBLEAttValue();
for (const auto& dsc : chr->m_vDescriptors) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
auto handle = dsc->getHandle();
if (handle != 0 && dsc->getUUID() == uuid2904) {
dsc2905->m_value.append(reinterpret_cast<const uint8_t*>(&handle), sizeof(handle));
}
}
}
}

// If the services have changed indicate it now
if (m_svcChanged) {
m_svcChanged = false;
Expand Down
Loading