|
NimBLE-Arduino 2.3.6
|
A model of a BLE Device from which all the BLE roles are created. More...
#include <NimBLEDevice.h>
Static Public Member Functions | |
| static bool | init (const std::string &deviceName) |
| Initialize the BLE environment. | |
| static bool | deinit (bool clearAll=false) |
| Shutdown the NimBLE stack/controller. | |
| static bool | setDeviceName (const std::string &deviceName) |
| Set the BLEDevice name. | |
| static bool | isInitialized () |
| Check if the initialization is complete. | |
| static NimBLEAddress | getAddress () |
| Get our device address. | |
| static std::string | toString () |
| Return a string representation of the address of this device. | |
| static bool | whiteListAdd (const NimBLEAddress &address) |
| Add a peer address to the whitelist. | |
| static bool | whiteListRemove (const NimBLEAddress &address) |
| Remove a peer address from the whitelist. | |
| static bool | onWhiteList (const NimBLEAddress &address) |
| Checks if a peer device is whitelisted. | |
| static size_t | getWhiteListCount () |
| Gets the count of addresses in the whitelist. | |
| static NimBLEAddress | getWhiteListAddress (size_t index) |
| Gets the address at the vector index. | |
| static bool | setOwnAddrType (uint8_t type) |
| Sets the address type to use. | |
| static bool | setOwnAddr (const NimBLEAddress &addr) |
| Set the device address to use. | |
| static bool | setOwnAddr (const uint8_t *addr) |
| Set the device address to use. | |
| static bool | setCustomGapHandler (gap_event_handler handler) |
| Set a custom callback for gap events. | |
| static void | setSecurityAuth (bool bonding, bool mitm, bool sc) |
| Set the authorization mode for this device. | |
| static void | setSecurityAuth (uint8_t auth) |
| Set the authorization mode for this device. | |
| static void | setSecurityIOCap (uint8_t iocap) |
| Set the Input/Output capabilities of this device. | |
| static void | setSecurityInitKey (uint8_t initKey) |
| If we are the initiator of the security procedure this sets the keys we will distribute. | |
| static void | setSecurityRespKey (uint8_t respKey) |
| Set the keys we are willing to accept during pairing. | |
| static void | setSecurityPasskey (uint32_t passKey) |
| Set the passkey the server will ask for when pairing. | |
| static uint32_t | getSecurityPasskey () |
| Get the current passkey used for pairing. | |
| static bool | startSecurity (uint16_t connHandle, int *rcPtr=nullptr) |
| Start the connection securing and authorization for this connection. | |
| static bool | setMTU (uint16_t mtu) |
| Setup local mtu that will be used to negotiate mtu during request from client peer. | |
| static uint16_t | getMTU () |
| Get local MTU value set. | |
| static void | onReset (int reason) |
| Host reset, we pass the message so we don't make calls until re-synced. | |
| static void | onSync (void) |
| Host synced with controller, all clear to make calls to the stack. | |
| static void | host_task (void *param) |
| The main host task. | |
| static int | getPower (NimBLETxPowerType type=NimBLETxPowerType::All) |
| Get the transmission power. | |
| static bool | setPower (int8_t dbm, NimBLETxPowerType type=NimBLETxPowerType::All) |
| Set the transmission power. | |
| static bool | setDefaultPhy (uint8_t txPhyMask, uint8_t rxPhyMask) |
| Set the preferred default phy to use for connections. | |
| static NimBLEScan * | getScan () |
| Retrieve the Scan object that we use for scanning. | |
| static NimBLEServer * | createServer () |
| Create an instance of a server. | |
| static NimBLEServer * | getServer () |
| Get the instance of the server. | |
| static bool | injectConfirmPasskey (const NimBLEConnInfo &peerInfo, bool accept) |
| Inject the provided numeric comparison response into the Security Manager. | |
| static bool | injectPassKey (const NimBLEConnInfo &peerInfo, uint32_t pin) |
| Inject the provided passkey into the Security Manager. | |
| static NimBLEExtAdvertising * | getAdvertising () |
| Get the instance of the extended advertising object. | |
| static bool | startAdvertising (uint8_t instId, int duration=0, int maxEvents=0) |
| Convenience function to begin advertising. | |
| static bool | stopAdvertising (uint8_t instId) |
| Convenience function to stop advertising a data set. | |
| static bool | stopAdvertising () |
| Convenience function to stop all advertising. | |
| static bool | startAdvertising (uint32_t duration=0) |
| Convenience function to begin advertising. | |
| static NimBLEClient * | createClient () |
| Creates a new client object, each client can connect to 1 peripheral device. | |
| static NimBLEClient * | createClient (const NimBLEAddress &peerAddress) |
| Creates a new client object, each client can connect to 1 peripheral device. | |
| static bool | deleteClient (NimBLEClient *pClient) |
| Delete the client object and remove it from the list. Checks if it is connected or trying to connect and disconnects/stops it first. | |
| static NimBLEClient * | getClientByHandle (uint16_t connHandle) |
| Get a reference to a client by connection handle. | |
| static NimBLEClient * | getClientByPeerAddress (const NimBLEAddress &peerAddress) |
| Get a reference to a client by peer address. | |
| static NimBLEClient * | getDisconnectedClient () |
| Finds the first disconnected client available. | |
| static size_t | getCreatedClientCount () |
| Get the number of created client objects. | |
| static std::vector< NimBLEClient * > | getConnectedClients () |
| Get a list of connected clients. | |
| static bool | deleteBond (const NimBLEAddress &address) |
| Deletes a peer bond. | |
| static int | getNumBonds () |
| Gets the number of bonded peers stored. | |
| static bool | isBonded (const NimBLEAddress &address) |
| Checks if a peer device is bonded. | |
| static bool | deleteAllBonds () |
| Deletes all bonding information. | |
| static NimBLEAddress | getBondedAddress (int index) |
| Get the address of a bonded peer device by index. | |
A model of a BLE Device from which all the BLE roles are created.
|
static |
Creates a new client object, each client can connect to 1 peripheral device.
|
static |
Creates a new client object, each client can connect to 1 peripheral device.
| [in] | peerAddress | A peer address reference that is copied to the new client object, allows for calling NimBLEClient::connect(bool) without a device or address parameter. |
|
static |
Create an instance of a server.
|
static |
Shutdown the NimBLE stack/controller.
| [in] | clearAll | If true, deletes all server/advertising/scan/client objects after de-initializing. |
|
static |
Deletes all bonding information.
|
static |
Deletes a peer bond.
| [in] | address | The address of the peer with which to delete bond info. |
|
static |
Delete the client object and remove it from the list.
Checks if it is connected or trying to connect and disconnects/stops it first.
| [in] | pClient | A pointer to the client object. |
|
static |
Get our device address.
|
static |
Get the instance of the extended advertising object.
Get the instance of the advertising object.
|
static |
Get the address of a bonded peer device by index.
| [in] | index | The index to retrieve the peer address of. |
|
static |
Get a reference to a client by connection handle.
| [in] | connHandle | The client connection handle to search for. |
|
static |
Get a reference to a client by peer address.
| [in] | addr | The address of the peer to search for. |
|
static |
Get a list of connected clients.
|
static |
Get the number of created client objects.
|
static |
Finds the first disconnected client available.
|
static |
Get local MTU value set.
|
static |
Get the transmission power.
|
static |
Retrieve the Scan object that we use for scanning.
|
static |
Get the current passkey used for pairing.
|
static |
Get the instance of the server.
|
static |
Gets the address at the vector index.
| [in] | index | The vector index to retrieve the address from. |
|
static |
Gets the count of addresses in the whitelist.
|
static |
Initialize the BLE environment.
| [in] | deviceName | The device name of the device. |
|
static |
Inject the provided numeric comparison response into the Security Manager.
| [in] | peerInfo | Connection information for the peer. |
| [in] | accept | Whether the user confirmed or declined the comparison. |
|
static |
Inject the provided passkey into the Security Manager.
| [in] | peerInfo | Connection information for the peer. |
| [in] | passkey | The 6-digit passkey to inject. |
|
static |
Checks if a peer device is bonded.
| [in] | address | The address to check for bonding. |
|
static |
Check if the initialization is complete.
|
static |
Host reset, we pass the message so we don't make calls until re-synced.
| [in] | reason | The reason code for the reset. |
|
static |
Checks if a peer device is whitelisted.
| [in] | address | The address to check for in the whitelist. |
|
static |
Set a custom callback for gap events.
| [in] | handler | The function to call when gap events occur. |
|
static |
Set the preferred default phy to use for connections.
| [in] | txPhyMask | TX PHY. Can be mask of following:
|
| [in] | rxPhyMask | RX PHY. Can be mask of following:
|
|
static |
Set the BLEDevice name.
| [in] | deviceName | The name to set. |
|
static |
Setup local mtu that will be used to negotiate mtu during request from client peer.
| [in] | mtu | Value to set local mtu:
|
|
static |
Set the device address to use.
| [in] | addr | The address to set. |
To use the address generated the address type must be set to random with setOwnAddrType.
|
static |
Set the device address to use.
| [in] | addr | The address to set. |
To use the address generated the address type must be set to random with setOwnAddrType.
|
static |
Sets the address type to use.
| [in] | type | Bluetooth Device address type. The available types are defined as:
|
|
static |
Set the transmission power.
| [in] | dbm | The power level to set in dBm. |
|
static |
Set the authorization mode for this device.
| bonding | If true we allow bonding, false no bonding will be performed. |
| mitm | If true we are capable of man in the middle protection, false if not. |
| sc | If true we will perform secure connection pairing, false we will use legacy pairing. |
|
static |
Set the authorization mode for this device.
| auth_req | A bitmap indicating what modes are supported. The available bits are defined as:
|
|
static |
If we are the initiator of the security procedure this sets the keys we will distribute.
| initKey | A bitmap indicating which keys to distribute during pairing. The available bits are defined as:
|
|
static |
Set the Input/Output capabilities of this device.
| iocap | One of the following values:
|
|
static |
Set the passkey the server will ask for when pairing.
| [in] | passkey | The passkey to use. |
|
static |
Set the keys we are willing to accept during pairing.
| respKey | A bitmap indicating which keys to accept during pairing. The available bits are defined as:
|
|
static |
Convenience function to begin advertising.
| [in] | duration | The duration in milliseconds to advertise for, default = forever. |
|
static |
Convenience function to begin advertising.
| [in] | instId | The extended advertisement instance ID to start. |
| [in] | duration | How long to advertise for in milliseconds, 0 = forever (default). |
| [in] | maxEvents | Maximum number of advertisement events to send, 0 = no limit (default). |
|
static |
Start the connection securing and authorization for this connection.
| connHandle | The connection handle of the peer device. |
| rcPtr | Optional pointer to pass the return code to the caller. |
|
static |
Convenience function to stop all advertising.
|
static |
Convenience function to stop advertising a data set.
| [in] | instId | The extended advertisement instance ID to stop advertising. |
|
static |
Return a string representation of the address of this device.
|
static |
Add a peer address to the whitelist.
| [in] | address | The address to add to the whitelist. |
|
static |
Remove a peer address from the whitelist.
| [in] | address | The address to remove from the whitelist. |