mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-23 13:40:55 +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
bf956b9cdf
commit
e93f943cc4
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