mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-23 03:20:46 +01:00
Initialize peerAddress in client constructor.
Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
This commit is contained in:
parent
73cec7a92a
commit
97832d4d95
3 changed files with 4 additions and 8 deletions
|
@ -53,8 +53,7 @@ static NimBLEClientCallbacks defaultCallbacks;
|
||||||
* @brief Constructor, private - only callable by NimBLEDevice::createClient
|
* @brief Constructor, private - only callable by NimBLEDevice::createClient
|
||||||
* to ensure proper handling of the list of client objects.
|
* to ensure proper handling of the list of client objects.
|
||||||
*/
|
*/
|
||||||
NimBLEClient::NimBLEClient()
|
NimBLEClient::NimBLEClient(const NimBLEAddress &peerAddress) : m_peerAddress(peerAddress) {
|
||||||
{
|
|
||||||
m_pClientCallbacks = &defaultCallbacks;
|
m_pClientCallbacks = &defaultCallbacks;
|
||||||
m_conn_id = BLE_HS_CONN_HANDLE_NONE;
|
m_conn_id = BLE_HS_CONN_HANDLE_NONE;
|
||||||
m_isConnected = false;
|
m_isConnected = false;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
void discoverAttributes();
|
void discoverAttributes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NimBLEClient();
|
NimBLEClient(const NimBLEAddress &peerAddress);
|
||||||
~NimBLEClient();
|
~NimBLEClient();
|
||||||
|
|
||||||
friend class NimBLEDevice;
|
friend class NimBLEDevice;
|
||||||
|
@ -84,7 +84,7 @@ private:
|
||||||
void *arg);
|
void *arg);
|
||||||
bool retrieveServices(const NimBLEUUID *uuid_filter = nullptr);
|
bool retrieveServices(const NimBLEUUID *uuid_filter = nullptr);
|
||||||
|
|
||||||
NimBLEAddress m_peerAddress = NimBLEAddress("");
|
NimBLEAddress m_peerAddress;
|
||||||
uint16_t m_conn_id;
|
uint16_t m_conn_id;
|
||||||
bool m_isConnected;
|
bool m_isConnected;
|
||||||
bool m_waitingToConnect;
|
bool m_waitingToConnect;
|
||||||
|
|
|
@ -148,10 +148,7 @@ void NimBLEDevice::stopAdvertising() {
|
||||||
NIMBLE_MAX_CONNECTIONS);
|
NIMBLE_MAX_CONNECTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NimBLEClient* pClient = new NimBLEClient();
|
NimBLEClient* pClient = new NimBLEClient(peerAddress);
|
||||||
if(peerAddress != NimBLEAddress("")) {
|
|
||||||
pClient->setPeerAddress(peerAddress);
|
|
||||||
}
|
|
||||||
m_cList.push_back(pClient);
|
m_cList.push_back(pClient);
|
||||||
|
|
||||||
return pClient;
|
return pClient;
|
||||||
|
|
Loading…
Reference in a new issue