Skip to content

Commit b3ab64d

Browse files
committed
Add const to NimBLEAdvertisedDevice* in NimBLEClient::connect overload
Fixes an issue where the wrong connect overload is called if the NimBLEAdvertisedDevice* passed is const.
1 parent 56412b9 commit b3ab64d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/NimBLEClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bool NimBLEClient::connect(bool deleteAttributes, bool asyncConnect, bool exchan
147147
* If false, the client will use the default MTU size and the application will need to call exchangeMTU() later.
148148
* @return true on success.
149149
*/
150-
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes, bool asyncConnect, bool exchangeMTU) {
150+
bool NimBLEClient::connect(const NimBLEAdvertisedDevice* device, bool deleteAttributes, bool asyncConnect, bool exchangeMTU) {
151151
NimBLEAddress address(device->getAddress());
152152
return connect(address, deleteAttributes, asyncConnect, exchangeMTU);
153153
}

src/NimBLEClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ struct NimBLETaskData;
4444
*/
4545
class NimBLEClient {
4646
public:
47-
bool connect(NimBLEAdvertisedDevice* device,
48-
bool deleteAttributes = true,
49-
bool asyncConnect = false,
50-
bool exchangeMTU = true);
47+
bool connect(const NimBLEAdvertisedDevice* device,
48+
bool deleteAttributes = true,
49+
bool asyncConnect = false,
50+
bool exchangeMTU = true);
5151
bool connect(const NimBLEAddress& address, bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
5252
bool connect(bool deleteAttributes = true, bool asyncConnect = false, bool exchangeMTU = true);
5353
bool disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);

0 commit comments

Comments
 (0)