-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Server] Add secondary capability. #59
base: master
Are you sure you want to change the base?
Conversation
8eb8f8e
to
39b752d
Compare
Were you able to get the secondary service to show up in a BLE scanner of some sort? I can't seem to get it to show up in my project. I'll try to throw together something more minimal to either repro my problem or figure out how to do it the right way if you aren't seeing the same. |
I think what's missing here is adding the secondary service to the |
My likely naïve attempt to remedy: if (m_secSvcVec.size() > 0) {
int i = 0;
const ble_gatt_svc_def* incs[m_secSvcVec.size()];
for (auto& it : m_secSvcVec) {
incs[i] = it->m_pSvcDef;
++i;
}
m_pSvcDef->includes = incs;
} triggers an if(svc->m_removed == 0) {
rc = ble_gatts_find_svc(&svc->getUUID().getNative()->u, &svc->m_handle);
if(rc != 0) {
abort();
}
} |
Thanks for testing it, it seemed to be working for me last night but that wasn't a thorough test and I can confirm some scanners don't read it. You were on the right path I think with the "includes", I'll look at this now and see what's up. |
39b752d
to
4c8a13a
Compare
I've added the includes to the primary service. NimBLE reports this:
However, my scanner apps don't report it, maybe you'll have better luck. |
Sorry, I won't have much time to test this today or maybe the rest of the week. My initial attempts didn't work (your rebase from master caused build errors, but I fixed those temporarily). I think what I saw yesterday was that the secondary service was showing up like a primary service in Light Blue. How did you get NimBLE to give you that output? I can at least check if I have things setup correctly before checking what's in a scanner. |
Sorry about the rebase. You can call No hurry, I need to implement the client portion still anyway which does detect this correctly in the test code. |
Was this ever solved? Looking to move from bluedroid to NimBLE and would like to use esp-nimble-cpp but we definitely need multiple services. If this is close and still valid w.r.t. the latest changes (given that these changes were 2 years ago) then I can try to get this finalized and tested with multiple services. |
@finger563 This is for creating secondary service types. If all you need is multiple services then that has been supported since the beginning of this repo. |
Adds
NimBLEService::createService
andNimBLEService::addService
which will create a secondary service under the service caller.