forked from h2zero/esp-nimble-cpp
Set peer address of client when creating the instance.
* Adds new client connect method that will connect to the address already set. Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
This commit is contained in:
committed by
h2zero
co-authored by
wakwak-koba
parent
f3e0d66853
commit
33d0a732a6
@@ -140,13 +140,16 @@ void NimBLEDevice::stopAdvertising() {
|
||||
* @return A reference to the new client object.
|
||||
*/
|
||||
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
/* STATIC */ NimBLEClient* NimBLEDevice::createClient() {
|
||||
/* STATIC */ NimBLEClient* NimBLEDevice::createClient(NimBLEAddress peerAddress) {
|
||||
if(m_cList.size() >= NIMBLE_MAX_CONNECTIONS) {
|
||||
NIMBLE_LOGW("Number of clients exceeds Max connections. Max=(%d)",
|
||||
NIMBLE_MAX_CONNECTIONS);
|
||||
}
|
||||
|
||||
NimBLEClient* pClient = new NimBLEClient();
|
||||
if(peerAddress != NimBLEAddress("")) {
|
||||
pClient->setPeerAddress(peerAddress);
|
||||
}
|
||||
m_cList.push_back(pClient);
|
||||
|
||||
return pClient;
|
||||
|
||||
Reference in New Issue
Block a user