mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-22 11:00:47 +01:00
Set service handle in getHandle function if not set already.
If a service has been created and started but not yet added to the gatt server then the call to getHandle will result in an invalid handle. This adds a call to set the handle value in the getHandle function.
This commit is contained in:
parent
46e7bb9302
commit
d0eaf6c1e0
1 changed files with 3 additions and 0 deletions
|
@ -248,6 +248,9 @@ bool NimBLEService::start() {
|
|||
* @return The handle associated with this service.
|
||||
*/
|
||||
uint16_t NimBLEService::getHandle() {
|
||||
if (m_handle == NULL_HANDLE) {
|
||||
ble_gatts_find_svc(&getUUID().getNative()->u, &m_handle);
|
||||
}
|
||||
return m_handle;
|
||||
} // getHandle
|
||||
|
||||
|
|
Loading…
Reference in a new issue