esp-nimble-cpp / NimBLE-Arduino
1.3.1
|
A model of a BLE Device from which all the BLE roles are created. More...
Static Public Member Functions | |
static void | init (const std::string &deviceName) |
Initialize the BLE environment. More... | |
static void | deinit (bool clearAll=false) |
Shutdown the NimBLE stack/controller. More... | |
static bool | getInitialized () |
Check if the initialization is complete. More... | |
static NimBLEAddress | getAddress () |
Get our device address. More... | |
static std::string | toString () |
Return a string representation of the address of this device. More... | |
static bool | whiteListAdd (const NimBLEAddress &address) |
Add a peer address to the whitelist. More... | |
static bool | whiteListRemove (const NimBLEAddress &address) |
Remove a peer address from the whitelist. More... | |
static bool | onWhiteList (const NimBLEAddress &address) |
Checks if a peer device is whitelisted. More... | |
static size_t | getWhiteListCount () |
Gets the count of addresses in the whitelist. More... | |
static NimBLEAddress | getWhiteListAddress (size_t index) |
Gets the address at the vector index. More... | |
static NimBLEScan * | getScan () |
Retrieve the Scan object that we use for scanning. More... | |
static NimBLEServer * | createServer () |
Create a new instance of a server. More... | |
static NimBLEServer * | getServer () |
Get the instance of the server. More... | |
static void | setPower (esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT) |
Set the transmission power. More... | |
static int | getPower (esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT) |
Get the transmission power. More... | |
static void | setCustomGapHandler (gap_event_handler handler) |
Set a custom callback for gap events. More... | |
static void | setSecurityAuth (bool bonding, bool mitm, bool sc) |
Set the authorization mode for this device. More... | |
static void | setSecurityAuth (uint8_t auth_req) |
Set the authorization mode for this device. More... | |
static void | setSecurityIOCap (uint8_t iocap) |
Set the Input/Output capabilities of this device. More... | |
static void | setSecurityInitKey (uint8_t init_key) |
If we are the initiator of the security procedure this sets the keys we will distribute. More... | |
static void | setSecurityRespKey (uint8_t init_key) |
Set the keys we are willing to accept during pairing. More... | |
static void | setSecurityPasskey (uint32_t pin) |
Set the passkey the server will ask for when pairing. More... | |
static uint32_t | getSecurityPasskey () |
Get the current passkey used for pairing. More... | |
static void | setSecurityCallbacks (NimBLESecurityCallbacks *pCallbacks) |
Set callbacks that will be used to handle encryption negotiation events and authentication events. More... | |
static void | setOwnAddrType (uint8_t own_addr_type, bool useNRPA=false) |
Set the own address type. More... | |
static int | startSecurity (uint16_t conn_id) |
Start the connection securing and authorization for this connection. More... | |
static int | setMTU (uint16_t mtu) |
Setup local mtu that will be used to negotiate mtu during request from client peer. More... | |
static uint16_t | getMTU () |
Get local MTU value set. More... | |
static bool | isIgnored (const NimBLEAddress &address) |
Check if the device address is on our ignore list. More... | |
static void | addIgnored (const NimBLEAddress &address) |
Add a device to the ignore list. More... | |
static void | removeIgnored (const NimBLEAddress &address) |
Remove a device from the ignore list. More... | |
static void | setScanDuplicateCacheSize (uint16_t cacheSize) |
Set the duplicate filter cache size for filtering scanned devices. More... | |
static void | setScanFilterMode (uint8_t type) |
Set the duplicate filter mode for filtering scanned devices. More... | |
static NimBLEAdvertising * | getAdvertising () |
Get the instance of the advertising object. More... | |
static void | startAdvertising () |
Convenience function to begin advertising. | |
static void | stopAdvertising () |
Convenience function to stop advertising. | |
static NimBLEClient * | createClient (NimBLEAddress peerAddress=NimBLEAddress("")) |
Creates a new client object and maintains a list of all client objects each client can connect to 1 peripheral device. More... | |
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. More... | |
static NimBLEClient * | getClientByID (uint16_t conn_id) |
Get a reference to a client by connection ID. More... | |
static NimBLEClient * | getClientByPeerAddress (const NimBLEAddress &peer_addr) |
Get a reference to a client by peer address. More... | |
static NimBLEClient * | getDisconnectedClient () |
Finds the first disconnected client in the list. More... | |
static size_t | getClientListSize () |
Get the number of created client objects. More... | |
static std::list< NimBLEClient * > * | getClientList () |
Get the list of created client objects. More... | |
static bool | deleteBond (const NimBLEAddress &address) |
Deletes a peer bond. More... | |
static int | getNumBonds () |
Gets the number of bonded peers stored. | |
static bool | isBonded (const NimBLEAddress &address) |
Checks if a peer device is bonded. More... | |
static void | deleteAllBonds () |
Deletes all bonding information. | |
static NimBLEAddress | getBondedAddress (int index) |
Get the address of a bonded peer device by index. More... | |
A model of a BLE Device from which all the BLE roles are created.
|
static |
Add a device to the ignore list.
[in] | address | The address of the device we want to ignore. |
|
static |
Creates a new client object and maintains a list of all client objects each client can connect to 1 peripheral device.
[in] | peerAddress | An optional peer address that is copied to the new client object, allows for calling NimBLEClient::connect(bool) without a device or address parameter. |
|
static |
Create a new instance of a server.
|
static |
Shutdown the NimBLE stack/controller.
[in] | clearAll | If true, deletes all server/advertising/scan/client objects after deinitializing. |
|
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 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 ID.
[in] | conn_id | The client connection ID to search for. |
|
static |
Get a reference to a client by peer address.
[in] | peer_addr | The address of the peer to search for. |
|
static |
Get the list of created client objects.
|
static |
Get the number of created client objects.
|
static |
Finds the first disconnected client in the list.
|
static |
Check if the initialization is complete.
|
static |
Get local MTU value set.
|
static |
Get the transmission power.
[in] | powerType | The power level to set, can be one of:
|
|
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 |
Checks if a peer device is bonded.
[in] | address | The address to check for bonding. |
|
static |
Check if the device address is on our ignore list.
[in] | address | The address to look for. |
|
static |
Checks if a peer device is whitelisted.
[in] | address | The address to check for in the whitelist. |
|
static |
Remove a device from the ignore list.
[in] | address | The address of the device we want to remove from the list. |
|
static |
Set a custom callback for gap events.
[in] | handler | The function to call when gap events occur. |
|
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 own address type.
[in] | own_addr_type | Own Bluetooth Device address type. The available bits are defined as:
|
[in] | useNRPA | If true, and address type is random, uses a non-resolvable random address. |
|
static |
Set the transmission power.
[in] | powerLevel | The power level to set, can be one of:
|
[in] | powerType | The BLE function to set the power level for, can be one of:
|
|
static |
Set the duplicate filter cache size for filtering scanned devices.
[in] | cacheSize | The number of advertisements filtered before the cache is reset. Range is 10-1000, a larger value will reduce how often the same devices are reported. |
Must only be called before calling NimBLEDevice::init.
|
static |
Set the duplicate filter mode for filtering scanned devices.
[in] | mode | One of three possible options:
|
|
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 |
Set callbacks that will be used to handle encryption negotiation events and authentication events.
[in] | callbacks | Pointer to NimBLESecurityCallbacks class |
|
static |
If we are the initiator of the security procedure this sets the keys we will distribute.
init_key | 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] | pin | The passkey to use. |
|
static |
Set the keys we are willing to accept during pairing.
resp_key | A bitmap indicating which keys to accept during pairing. The available bits are defined as:
|
|
static |
Start the connection securing and authorization for this connection.
conn_id | The connection id of the peer device. |
|
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. |