Add const to NimBLEAdvertisedDevice* in NimBLEClient::connect overload

Fixes an issue where the wrong connect overload is called if the NimBLEAdvertisedDevice* passed is const.
This commit is contained in:
h2zero 2024-11-24 16:17:01 -07:00
parent 1b0abd273f
commit 41a7aa8eb5
2 changed files with 5 additions and 5 deletions

View file

@ -147,7 +147,7 @@ bool NimBLEClient::connect(bool deleteAttributes, bool asyncConnect, bool exchan
* If false, the client will use the default MTU size and the application will need to call exchangeMTU() later. * If false, the client will use the default MTU size and the application will need to call exchangeMTU() later.
* @return true on success. * @return true on success.
*/ */
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes, bool asyncConnect, bool exchangeMTU) { bool NimBLEClient::connect(const NimBLEAdvertisedDevice* device, bool deleteAttributes, bool asyncConnect, bool exchangeMTU) {
NimBLEAddress address(device->getAddress()); NimBLEAddress address(device->getAddress());
return connect(address, deleteAttributes, asyncConnect, exchangeMTU); return connect(address, deleteAttributes, asyncConnect, exchangeMTU);
} }

View file

@ -44,7 +44,7 @@ struct NimBLETaskData;
*/ */
class NimBLEClient { class NimBLEClient {
public: public:
bool connect(NimBLEAdvertisedDevice* device, bool connect(const NimBLEAdvertisedDevice* device,
bool deleteAttributes = true, bool deleteAttributes = true,
bool asyncConnect = false, bool asyncConnect = false,
bool exchangeMTU = true); bool exchangeMTU = true);