8000 added getServiceByUUID() to BLEServer · jbkim/esp32-snippets@8dbdaa5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8dbdaa5

Browse files
committed
added getServiceByUUID() to BLEServer
1 parent 4743dfc commit 8dbdaa5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

cpp_utils/BLEServer.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ BLEService* BLEServer::createService(BLEUUID uuid, uint32_t numHandles, uint8_t
9696
} // createService
9797

9898

99+
/**
100+
* @brief Get a %BLE Service by its UUID
101+
* @param [in] uuid The UUID of the new service.
102+
* @return A reference to the service object.
103+
*/
104+
BLEService* BLEServer::getServiceByUUID(const char* uuid) {
105+
return m_serviceMap.getByUUID(uuid);
106+
}
107+
108+
/**
109+
* @brief Get a %BLE Service by its UUID
110+
* @param [in] uuid The UUID of the new service.
111+
* @return A reference to the service object.
112+
*/
113+
BLEService* BLEServer::getServiceByUUID(BLEUUID uuid) {
114+
return m_serviceMap.getByUUID(uuid);
115+
}
116+
99117
/**
100118
* @brief Retrieve the advertising object that can be used to advertise the existence of the server.
101119
*

cpp_utils/BLEServer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class BLEServer {
6363
void setCallbacks(BLEServerCallbacks* pCallbacks);
6464
void startAdvertising();
6565
void removeService(BLEService *service);
66-
66+
BLEService* getServiceByUUID(const char* uuid);
67+
BLEService* getServiceByUUID(BLEUUID uuid);
6768

6869
private:
6970
BLEServer();

0 commit comments

Comments
 (0)
0