Add support for creating a NimBLEClient from a NimBLEServer peer.

This allows the NimBLEServer instance to create a NimBLEClient instance to read/write form/to a connected peer.
Only one instance is supported subsequent calls will overwrite the previous client connection information and data.
This commit is contained in:
h2zero
2024-12-05 16:03:33 -07:00
committed by h2zero
parent a55489fee2
commit ac3d3575cc
4 changed files with 79 additions and 63 deletions
+2 -4
View File
@@ -60,9 +60,6 @@ class NimBLEClient {
void setClientCallbacks(NimBLEClientCallbacks* pClientCallbacks, bool deleteCallbacks = true);
std::string toString() const;
uint16_t getConnHandle() const;
void clearConnection();
bool setConnection(const NimBLEConnInfo& connInfo);
bool setConnection(uint16_t connHandle);
uint16_t getMTU() const;
bool exchangeMTU();
bool secureConnection(bool async = false) const;
@@ -140,6 +137,7 @@ class NimBLEClient {
ble_gap_conn_params m_connParams;
friend class NimBLEDevice;
friend class NimBLEServer;
}; // class NimBLEClient
/**
@@ -155,7 +153,7 @@ class NimBLEClientCallbacks {
*/
virtual void onConnect(NimBLEClient* pClient);
/**
/**
* @brief Called when a connection attempt fails.
* @param [in] pClient A pointer to the connecting client object.
* @param [in] reason Contains the reason code for the connection failure.