17
17
* @return The characteristic.
18
18
*/
19
19
BLEService* BLEServiceMap::getByUUID (const char * uuid) {
20
- return getByUUID (BLEUUID (uuid));
20
+ return getByUUID (BLEUUID (uuid));
21
21
}
22
-
22
+
23
23
/* *
24
24
* @brief Return the service by UUID.
25
25
* @param [in] UUID The UUID to look up the service.
@@ -52,9 +52,8 @@ BLEService* BLEServiceMap::getByHandle(uint16_t handle) {
52
52
* @param [in] characteristic The service to cache.
53
53
* @return N/A.
54
54
*/
55
- void BLEServiceMap::setByUUID (BLEUUID uuid,
56
- BLEService *service) {
57
- m_uuidMap.insert (std::pair<BLEService *, std::string>(service, uuid.toString ()));
55
+ void BLEServiceMap::setByUUID (BLEUUID uuid, BLEService* service) {
56
+ m_uuidMap.insert (std::pair<BLEService*, std::string>(service, uuid.toString ()));
58
57
} // setByUUID
59
58
60
59
@@ -64,9 +63,8 @@ void BLEServiceMap::setByUUID(BLEUUID uuid,
64
63
* @param [in] service The service to cache.
65
64
* @return N/A.
66
65
*/
67
- void BLEServiceMap::setByHandle (uint16_t handle,
68
- BLEService* service) {
69
- m_handleMap.insert (std::pair<uint16_t , BLEService *>(handle, service));
66
+ void BLEServiceMap::setByHandle (uint16_t handle, BLEService* service) {
67
+ m_handleMap.insert (std::pair<uint16_t , BLEService*>(handle, service));
70
68
} // setByHandle
71
69
72
70
@@ -86,7 +84,7 @@ std::string BLEServiceMap::toString() {
86
84
void BLEServiceMap::handleGATTServerEvent (
87
85
esp_gatts_cb_event_t event,
88
86
esp_gatt_if_t gatts_if,
89
- esp_ble_gatts_cb_param_t * param) {
87
+ esp_ble_gatts_cb_param_t * param) {
90
88
// Invoke the handler for every Service we have.
91
89
for (auto &myPair : m_uuidMap) {
92
90
myPair.first ->handleGATTServerEvent (event, gatts_if, param);
@@ -99,9 +97,7 @@ void BLEServiceMap::handleGATTServerEvent(
99
97
*/
100
98
BLEService* BLEServiceMap::getFirst () {
101
99
m_iterator = m_uuidMap.begin ();
102
- if (m_iterator == m_uuidMap.end ()) {
103
- return nullptr ;
104
- }
100
+ if (m_iterator == m_uuidMap.end ()) return nullptr ;
105
101
BLEService* pRet = m_iterator->first ;
106
102
m_iterator++;
107
103
return pRet;
@@ -112,9 +108,7 @@ BLEService* BLEServiceMap::getFirst() {
112
108
* @return The next service in the map.
113
109
*/
114
110
BLEService* BLEServiceMap::getNext () {
115
- if (m_iterator == m_uuidMap.end ()) {
116
- return nullptr ;
117
- }
111
+ if (m_iterator == m_uuidMap.end ()) return nullptr ;
118
112
BLEService* pRet = m_iterator->first ;
119
113
m_iterator++;
120
114
return pRet;
@@ -124,7 +118,7 @@ BLEService* BLEServiceMap::getNext() {
124
118
* @brief Removes service from maps.
125
119
* @return N/A.
126
120
*/
127
- void BLEServiceMap::removeService (BLEService * service){
121
+ void BLEServiceMap::removeService (BLEService* service) {
128
122
m_handleMap.erase (service->getHandle ());
129
123
m_uuidMap.erase (service);
130
124
} // removeService
0 commit comments