Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee9bdaf

Browse files
author
Jeroen88
authored
Pass parameters as const reference instead of by value. (#34)
Pass each NimBLEUUID, NimBLEAddress, std::string and uint8_t * parameter as const & instead of by value. This leads to (a bit) smaller code and performance improvement.
1 parent 242e3a3 commit ee9bdaf

39 files changed

+136
-136
lines changed

src/NimBLEAdvertisedDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ NimBLEUUID NimBLEAdvertisedDevice::getServiceUUID() { //TODO Remove it eventual
141141
* @brief Check advertised serviced for existence required UUID
142142
* @return Return true if service is advertised
143143
*/
144-
bool NimBLEAdvertisedDevice::isAdvertisingService(NimBLEUUID uuid){
144+
bool NimBLEAdvertisedDevice::isAdvertisingService(const NimBLEUUID &uuid){
145145
for (int i = 0; i < m_serviceUUIDs.size(); i++) {
146146
NIMBLE_LOGI(LOG_TAG, "Comparing UUIDS: %s %s", m_serviceUUIDs[i].toString().c_str(), uuid.toString().c_str());
147147
if (m_serviceUUIDs[i].equals(uuid)) return true;

src/NimBLEAdvertisedDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class NimBLEAdvertisedDevice {
5454
void setAddressType(uint8_t type);
5555

5656

57-
bool isAdvertisingService(NimBLEUUID uuid);
57+
bool isAdvertisingService(const NimBLEUUID &uuid);
5858
bool haveAppearance();
5959
bool haveManufacturerData();
6060
bool haveName();

src/NimBLEAdvertising.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ NimBLEAdvertising::NimBLEAdvertising() {
5858
* @brief Add a service uuid to exposed list of services.
5959
* @param [in] serviceUUID The UUID of the service to expose.
6060
*/
61-
void NimBLEAdvertising::addServiceUUID(NimBLEUUID serviceUUID) {
61+
void NimBLEAdvertising::addServiceUUID(const NimBLEUUID &serviceUUID) {
6262
m_serviceUUIDs.push_back(serviceUUID);
6363
} // addServiceUUID
6464

@@ -393,7 +393,7 @@ void NimBLEAdvertising::onHostReset() {
393393
* @brief Add data to the payload to be advertised.
394394
* @param [in] data The data to be added to the payload.
395395
*/
396-
void NimBLEAdvertisementData::addData(std::string data) {
396+
void NimBLEAdvertisementData::addData(const std::string &data) {
397397
if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) {
398398
return;
399399
}
@@ -420,7 +420,7 @@ void NimBLEAdvertisementData::setAppearance(uint16_t appearance) {
420420
* @brief Set the complete services.
421421
* @param [in] uuid The single service to advertise.
422422
*/
423-
void NimBLEAdvertisementData::setCompleteServices(NimBLEUUID uuid) {
423+
void NimBLEAdvertisementData::setCompleteServices(const NimBLEUUID &uuid) {
424424
char cdata[2];
425425
switch (uuid.bitSize()) {
426426
case 16: {
@@ -482,7 +482,7 @@ void NimBLEAdvertisementData::setFlags(uint8_t flag) {
482482
* @brief Set manufacturer specific data.
483483
* @param [in] data Manufacturer data.
484484
*/
485-
void NimBLEAdvertisementData::setManufacturerData(std::string data) {
485+
void NimBLEAdvertisementData::setManufacturerData(const std::string &data) {
486486
NIMBLE_LOGD("NimBLEAdvertisementData", ">> setManufacturerData");
487487
char cdata[2];
488488
cdata[0] = data.length() + 1;
@@ -496,7 +496,7 @@ void NimBLEAdvertisementData::setManufacturerData(std::string data) {
496496
* @brief Set the name.
497497
* @param [in] The complete name of the device.
498498
*/
499-
void NimBLEAdvertisementData::setName(std::string name) {
499+
void NimBLEAdvertisementData::setName(const std::string &name) {
500500
NIMBLE_LOGD("NimBLEAdvertisementData", ">> setName: %s", name.c_str());
501501
char cdata[2];
502502
cdata[0] = name.length() + 1;
@@ -510,7 +510,7 @@ void NimBLEAdvertisementData::setName(std::string name) {
510510
* @brief Set the partial services.
511511
* @param [in] uuid The single service to advertise.
512512
*/
513-
void NimBLEAdvertisementData::setPartialServices(NimBLEUUID uuid) {
513+
void NimBLEAdvertisementData::setPartialServices(const NimBLEUUID &uuid) {
514514
char cdata[2];
515515
switch (uuid.bitSize()) {
516516
case 16: {
@@ -548,7 +548,7 @@ void NimBLEAdvertisementData::setPartialServices(NimBLEUUID uuid) {
548548
* @param [in] uuid The UUID to set with the service data. Size of UUID will be used.
549549
* @param [in] data The data to be associated with the service data advert.
550550
*/
551-
void NimBLEAdvertisementData::setServiceData(NimBLEUUID uuid, std::string data) {
551+
void NimBLEAdvertisementData::setServiceData(const NimBLEUUID &uuid, const std::string &data) {
552552
char cdata[2];
553553
switch (uuid.bitSize()) {
554554
case 16: {
@@ -585,7 +585,7 @@ void NimBLEAdvertisementData::setServiceData(NimBLEUUID uuid, std::string data)
585585
* @brief Set the short name.
586586
* @param [in] The short name of the device.
587587
*/
588-
void NimBLEAdvertisementData::setShortName(std::string name) {
588+
void NimBLEAdvertisementData::setShortName(const std::string &name) {
589589
NIMBLE_LOGD("NimBLEAdvertisementData", ">> setShortName: %s", name.c_str());
590590
char cdata[2];
591591
cdata[0] = name.length() + 1;
@@ -603,4 +603,4 @@ std::string NimBLEAdvertisementData::getPayload() {
603603
return m_payload;
604604
} // getPayload
605605

606-
#endif /* CONFIG_BT_ENABLED */
606+
#endif /* CONFIG_BT_ENABLED */

src/NimBLEAdvertising.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ class NimBLEAdvertisementData {
4747
//
4848
public:
4949
void setAppearance(uint16_t appearance);
50-
void setCompleteServices(NimBLEUUID uuid);
50+
void setCompleteServices(const NimBLEUUID &uuid);
5151
void setFlags(uint8_t);
52-
void setManufacturerData(std::string data);
53-
void setName(std::string name);
54-
void setPartialServices(NimBLEUUID uuid);
55-
void setServiceData(NimBLEUUID uuid, std::string data);
56-
void setShortName(std::string name);
57-
void addData(std::string data); // Add data to the payload.
52+
void setManufacturerData(const std::string &data);
53+
void setName(const std::string &name);
54+
void setPartialServices(const NimBLEUUID &uuid);
55+
void setServiceData(const NimBLEUUID &uuid, const std::string &data);
56+
void setShortName(const std::string &name);
57+
void addData(const std::string &data); // Add data to the payload.
5858
std::string getPayload(); // Retrieve the current advert payload.
5959

6060
private:
@@ -71,7 +71,7 @@ class NimBLEAdvertisementData {
7171
class NimBLEAdvertising {
7272
public:
7373
NimBLEAdvertising();
74-
void addServiceUUID(NimBLEUUID serviceUUID);
74+
void addServiceUUID(const NimBLEUUID &serviceUUID);
7575
void addServiceUUID(const char* serviceUUID);
7676
void start();
7777
void stop();
@@ -102,4 +102,4 @@ class NimBLEAdvertising {
102102

103103
};
104104
#endif /* CONFIG_BT_ENABLED */
105-
#endif /* MAIN_BLEADVERTISING_H_ */
105+
#endif /* MAIN_BLEADVERTISING_H_ */

src/NimBLEBeacon.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int8_t NimBLEBeacon::getSignalPower() {
5858
/**
5959
* Set the raw data for the beacon record.
6060
*/
61-
void NimBLEBeacon::setData(std::string data) {
61+
void NimBLEBeacon::setData(const std::string &data) {
6262
if (data.length() != sizeof(m_beaconData)) {
6363
NIMBLE_LOGE(LOG_TAG, "Unable to set the data ... length passed in was %d and expected %d",
6464
data.length(), sizeof(m_beaconData));
@@ -79,9 +79,10 @@ void NimBLEBeacon::setMinor(uint16_t minor) {
7979
m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
8080
} // setMinior
8181

82-
void NimBLEBeacon::setProximityUUID(NimBLEUUID uuid) {
83-
uuid = uuid.to128();
84-
memcpy(m_beaconData.proximityUUID, uuid.getNative()->u128.value, 16);
82+
void NimBLEBeacon::setProximityUUID(const NimBLEUUID &uuid) {
83+
NimBLEUUID temp_uuid = uuid;
84+
temp_uuid.to128();
85+
memcpy(m_beaconData.proximityUUID, temp_uuid.getNative()->u128.value, 16);
8586
} // setProximityUUID
8687

8788
void NimBLEBeacon::setSignalPower(int8_t signalPower) {

src/NimBLEBeacon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class NimBLEBeacon {
3939
uint16_t getManufacturerId();
4040
NimBLEUUID getProximityUUID();
4141
int8_t getSignalPower();
42-
void setData(std::string data);
42+
void setData(const std::string &data);
4343
void setMajor(uint16_t major);
4444
void setMinor(uint16_t minor);
4545
void setManufacturerId(uint16_t manufacturerId);
46-
void setProximityUUID(NimBLEUUID uuid);
46+
void setProximityUUID(const NimBLEUUID &uuid);
4747
void setSignalPower(int8_t signalPower);
4848
}; // NimBLEBeacon
4949

src/NimBLECharacteristic.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ NimBLECharacteristic::NimBLECharacteristic(const char* uuid, uint16_t properties
4141
* @param [in] uuid - UUID for the characteristic.
4242
* @param [in] properties - Properties for the characteristic.
4343
*/
44-
NimBLECharacteristic::NimBLECharacteristic(NimBLEUUID uuid, uint16_t properties, NimBLEService* pService) {
44+
NimBLECharacteristic::NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties, NimBLEService* pService) {
4545
m_uuid = uuid;
4646
m_handle = NULL_HANDLE;
4747
m_properties = properties;
@@ -99,7 +99,7 @@ NimBLEDescriptor* NimBLECharacteristic::createDescriptor(const char* uuid, uint3
9999
* @param [in] properties - The properties of the descriptor.
100100
* @return The new BLE descriptor.
101101
*/
102-
NimBLEDescriptor* NimBLECharacteristic::createDescriptor(NimBLEUUID uuid, uint32_t properties, uint16_t max_len) {
102+
NimBLEDescriptor* NimBLECharacteristic::createDescriptor(const NimBLEUUID &uuid, uint32_t properties, uint16_t max_len) {
103103
NimBLEDescriptor* pDescriptor = nullptr;
104104
if(uuid.equals(NimBLEUUID((uint16_t)0x2902))) {
105105
if(!(m_properties & BLE_GATT_CHR_F_NOTIFY) && !(m_properties & BLE_GATT_CHR_F_INDICATE)) {
@@ -139,7 +139,7 @@ NimBLEDescriptor* NimBLECharacteristic::getDescriptorByUUID(const char* descript
139139
* @param [in] descriptorUUID The UUID of the descriptor that we wish to retrieve.
140140
* @return The BLE Descriptor. If no such descriptor is associated with the characteristic, nullptr is returned.
141141
*/
142-
NimBLEDescriptor* NimBLECharacteristic::getDescriptorByUUID(NimBLEUUID descriptorUUID) {
142+
NimBLEDescriptor* NimBLECharacteristic::getDescriptorByUUID(const NimBLEUUID &descriptorUUID) {
143143
return m_descriptorMap.getByUUID(descriptorUUID);
144144
} // getDescriptorByUUID
145145

@@ -518,7 +518,7 @@ void NimBLECharacteristic::setWriteProperty(bool value) {
518518
* @param [in] data The data to set for the characteristic.
519519
* @param [in] length The length of the data in bytes.
520520
*/
521-
void NimBLECharacteristic::setValue(uint8_t* data, size_t length) {
521+
void NimBLECharacteristic::setValue(const uint8_t* data, size_t length) {
522522
char* pHex = NimBLEUtils::buildHexData(nullptr, data, length);
523523
NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str());
524524
free(pHex);
@@ -546,7 +546,7 @@ void NimBLECharacteristic::setValue(uint8_t* data, size_t length) {
546546
* @param [in] Set the value of the characteristic.
547547
* @return N/A.
548548
*/
549-
void NimBLECharacteristic::setValue(std::string value) {
549+
void NimBLECharacteristic::setValue(const std::string &value) {
550550
setValue((uint8_t*)(value.data()), value.length());
551551
} // setValue
552552

src/NimBLECharacteristic.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class NimBLECharacteristicCallbacks;
5858
class NimBLEDescriptorMap {
5959
public:
6060
void setByUUID(const char* uuid, NimBLEDescriptor* pDescriptor);
61-
void setByUUID(NimBLEUUID uuid, NimBLEDescriptor* pDescriptor);
61+
void setByUUID(const NimBLEUUID &uuid, NimBLEDescriptor* pDescriptor);
6262
// void setByHandle(uint16_t handle, NimBLEDescriptor* pDescriptor);
6363
NimBLEDescriptor* getByUUID(const char* uuid);
64-
NimBLEDescriptor* getByUUID(NimBLEUUID uuid);
64+
NimBLEDescriptor* getByUUID(const NimBLEUUID &uuid);
6565
// NimBLEDescriptor* getByHandle(uint16_t handle);
6666
std::string toString();
6767
NimBLEDescriptor* getFirst();
@@ -87,13 +87,13 @@ class NimBLECharacteristic {
8787
uint32_t properties = NIMBLE_PROPERTY::READ |
8888
NIMBLE_PROPERTY::WRITE,
8989
uint16_t max_len = 100);
90-
NimBLEDescriptor* createDescriptor(NimBLEUUID uuid,
90+
NimBLEDescriptor* createDescriptor(const NimBLEUUID &uuid,
9191
uint32_t properties = NIMBLE_PROPERTY::READ |
9292
NIMBLE_PROPERTY::WRITE,
9393
uint16_t max_len = 100);
9494

9595
NimBLEDescriptor* getDescriptorByUUID(const char* descriptorUUID);
96-
NimBLEDescriptor* getDescriptorByUUID(NimBLEUUID descriptorUUID);
96+
NimBLEDescriptor* getDescriptorByUUID(const NimBLEUUID &descriptorUUID);
9797
NimBLEUUID getUUID();
9898
std::string getValue();
9999
uint8_t* getData();
@@ -110,8 +110,8 @@ class NimBLECharacteristic {
110110
void setWriteProperty(bool value);
111111
void setWriteNoResponseProperty(bool value);
112112
//////////////////////////////////////////////////////
113-
void setValue(uint8_t* data, size_t size);
114-
void setValue(std::string value);
113+
void setValue(const uint8_t* data, size_t size);
114+
void setValue(const std::string &value);
115115
void setValue(uint16_t& data16);
116116
void setValue(uint32_t& data32);
117117
void setValue(int& data32);
@@ -141,7 +141,7 @@ class NimBLECharacteristic {
141141

142142
NimBLECharacteristic(const char* uuid, uint16_t properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE,
143143
NimBLEService* pService = nullptr);
144-
NimBLECharacteristic(NimBLEUUID uuid, uint16_t properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE,
144+
NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties = NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::WRITE,
145145
NimBLEService* pService = nullptr);
146146
virtual ~NimBLECharacteristic();
147147

src/NimBLECharacteristicMap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ NimBLECharacteristic* NimBLECharacteristicMap::getByUUID(const char* uuid) {
4141
* @param [in] UUID The UUID to look up the characteristic.
4242
* @return The characteristic.
4343
*/
44-
NimBLECharacteristic* NimBLECharacteristicMap::getByUUID(NimBLEUUID uuid) {
44+
NimBLECharacteristic* NimBLECharacteristicMap::getByUUID(const NimBLEUUID &uuid) {
4545
for (auto &myPair : m_uuidMap) {
4646
if (myPair.first->getUUID().equals(uuid)) {
4747
return myPair.first;
@@ -100,7 +100,7 @@ void NimBLECharacteristicMap::setByHandle(uint16_t handle, NimBLECharacteristic*
100100
* @param [in] characteristic The characteristic to cache.
101101
* @return N/A.
102102
*/
103-
void NimBLECharacteristicMap::setByUUID(NimBLECharacteristic* pCharacteristic, NimBLEUUID uuid) {
103+
void NimBLECharacteristicMap::setByUUID(NimBLECharacteristic* pCharacteristic, const NimBLEUUID &uuid) {
104104
m_uuidMap.insert(std::pair<NimBLECharacteristic*, std::string>(pCharacteristic, uuid.toString()));
105105
} // setByUUID
106106

@@ -125,4 +125,4 @@ std::string NimBLECharacteristicMap::toString() {
125125
} // toString
126126

127127

128-
#endif /* CONFIG_BT_ENABLED */
128+
#endif /* CONFIG_BT_ENABLED */

src/NimBLEClient.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool refreshServices)
120120
* @param [in] address The address of the partner.
121121
* @return True on success.
122122
*/
123-
bool NimBLEClient::connect(NimBLEAddress address, uint8_t type, bool refreshServices) {
123+
bool NimBLEClient::connect(const NimBLEAddress &address, uint8_t type, bool refreshServices) {
124124
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());
125125

126126
if(!NimBLEDevice::m_synced) {
@@ -359,7 +359,7 @@ NimBLERemoteService* NimBLEClient::getService(const char* uuid) {
359359
* @param [in] uuid The UUID of the service being sought.
360360
* @return A reference to the Service or nullptr if don't know about it.
361361
*/
362-
NimBLERemoteService* NimBLEClient::getService(NimBLEUUID uuid) {
362+
NimBLERemoteService* NimBLEClient::getService(const NimBLEUUID &uuid) {
363363
NIMBLE_LOGD(LOG_TAG, ">> getService: uuid: %s", uuid.toString().c_str());
364364

365365
if (!m_haveServices) {
@@ -494,7 +494,7 @@ int NimBLEClient::serviceDiscoveredCB(
494494
* @param [in] characteristicUUID The characteristic whose value we wish to read.
495495
* @returns characteristic value or an empty string if not found
496496
*/
497-
std::string NimBLEClient::getValue(NimBLEUUID serviceUUID, NimBLEUUID characteristicUUID) {
497+
std::string NimBLEClient::getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID) {
498498
NIMBLE_LOGD(LOG_TAG, ">> getValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str());
499499

500500
std::string ret = "";
@@ -518,7 +518,7 @@ std::string NimBLEClient::getValue(NimBLEUUID serviceUUID, NimBLEUUID characteri
518518
* @param [in] characteristicUUID The characteristic whose value we wish to write.
519519
* @returns true if successful otherwise false
520520
*/
521-
bool NimBLEClient::setValue(NimBLEUUID serviceUUID, NimBLEUUID characteristicUUID, std::string value) {
521+
bool NimBLEClient::setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const std::string &value) {
522522
NIMBLE_LOGD(LOG_TAG, ">> setValue: serviceUUID: %s, characteristicUUID: %s", serviceUUID.toString().c_str(), characteristicUUID.toString().c_str());
523523

524524
bool ret = false;

src/NimBLEClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ class NimBLEAdvertisedDevice;
3434
class NimBLEClient {
3535
public:
3636
bool connect(NimBLEAdvertisedDevice* device, bool refreshServices = true);
37-
bool connect(NimBLEAddress address, uint8_t type = BLE_ADDR_PUBLIC, bool refreshServices = true); // Connect to the remote BLE Server
37+
bool connect(const NimBLEAddress &address, uint8_t type = BLE_ADDR_PUBLIC, bool refreshServices = true); // Connect to the remote BLE Server
3838
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM); // Disconnect from the remote BLE Server
3939
NimBLEAddress getPeerAddress(); // Get the address of the remote BLE Server
4040
int getRssi(); // Get the RSSI of the remote BLE Server
4141
std::map<std::string, NimBLERemoteService*>* getServices(); // Get a map of the services offered by the remote BLE Server
4242
NimBLERemoteService* getService(const char* uuid); // Get a reference to a specified service offered by the remote BLE server.
43-
NimBLERemoteService* getService(NimBLEUUID uuid); // Get a reference to a specified service offered by the remote BLE server.
44-
std::string getValue(NimBLEUUID serviceUUID, NimBLEUUID characteristicUUID); // Get the value of a given characteristic at a given service.
45-
bool setValue(NimBLEUUID serviceUUID, NimBLEUUID characteristicUUID, std::string value); // Set the value of a given characteristic at a given service.
43+
NimBLERemoteService* getService(const NimBLEUUID &uuid); // Get a reference to a specified service offered by the remote BLE server.
44+
std::string getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID); // Get the value of a given characteristic at a given service.
45+
bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID, const std::string &value); // Set the value of a given characteristic at a given service.
4646
bool isConnected(); // Return true if we are connected.
4747
void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks, bool deleteCallbacks = true);
4848
std::string toString(); // Return a string representation of this client.

src/NimBLEDescriptor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void NimBLEDescriptor::setHandle(uint16_t handle) {
187187
* @param [in] data The data to set for the descriptor.
188188
* @param [in] length The length of the data in bytes.
189189
*/
190-
void NimBLEDescriptor::setValue(uint8_t* data, size_t length) {
190+
void NimBLEDescriptor::setValue(const uint8_t* data, size_t length) {
191191
if (length > BLE_ATT_ATTR_MAX_LEN) {
192192
NIMBLE_LOGE(LOG_TAG, "Size %d too large, must be no bigger than %d", length, BLE_ATT_ATTR_MAX_LEN);
193193
return;
@@ -201,7 +201,7 @@ void NimBLEDescriptor::setValue(uint8_t* data, size_t length) {
201201
* @brief Set the value of the descriptor.
202202
* @param [in] value The value of the descriptor in string form.
203203
*/
204-
void NimBLEDescriptor::setValue(std::string value) {
204+
void NimBLEDescriptor::setValue(const std::string &value) {
205205
setValue((uint8_t*) value.data(), value.length());
206206
} // setValue
207207

@@ -245,4 +245,4 @@ void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor) {
245245
} // onWrite
246246

247247

248-
#endif /* CONFIG_BT_ENABLED */
248+
#endif /* CONFIG_BT_ENABLED */

0 commit comments

Comments
 (0)