2022-04-10 10:21:45 -06:00
|
|
|
/*
|
|
|
|
* NimBLEExtAdvertising.h
|
|
|
|
*
|
|
|
|
* Created: on February 6, 2022
|
|
|
|
* Author H2zero
|
|
|
|
*/
|
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
#ifndef NIMBLE_CPP_EXTADVERTISING_H_
|
|
|
|
#define NIMBLE_CPP_EXTADVERTISING_H_
|
|
|
|
|
2022-04-10 10:21:45 -06:00
|
|
|
#include "nimconfig.h"
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && CONFIG_BT_NIMBLE_EXT_ADV
|
2022-04-10 10:21:45 -06:00
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
# if defined(CONFIG_NIMBLE_CPP_IDF)
|
|
|
|
# include "host/ble_gap.h"
|
|
|
|
# else
|
|
|
|
# include "nimble/nimble/host/include/host/ble_gap.h"
|
|
|
|
# endif
|
2022-04-10 10:21:45 -06:00
|
|
|
|
|
|
|
/**** FIX COMPILATION ****/
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
# undef min
|
|
|
|
# undef max
|
2022-04-10 10:21:45 -06:00
|
|
|
/**************************/
|
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
# include "NimBLEAddress.h"
|
2022-04-10 10:21:45 -06:00
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
# include <string>
|
|
|
|
# include <vector>
|
2022-04-10 10:21:45 -06:00
|
|
|
|
|
|
|
class NimBLEExtAdvertisingCallbacks;
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
class NimBLEUUID;
|
2022-04-10 10:21:45 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Extended advertisement data
|
|
|
|
*/
|
|
|
|
class NimBLEExtAdvertisement {
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
public:
|
|
|
|
NimBLEExtAdvertisement(uint8_t priPhy = BLE_HCI_LE_PHY_1M, uint8_t secPhy = BLE_HCI_LE_PHY_1M);
|
|
|
|
bool setAppearance(uint16_t appearance);
|
|
|
|
bool addServiceUUID(const NimBLEUUID& serviceUUID);
|
|
|
|
bool addServiceUUID(const char* serviceUUID);
|
|
|
|
bool removeServiceUUID(const NimBLEUUID& serviceUUID);
|
|
|
|
bool removeServiceUUID(const char* serviceUUID);
|
|
|
|
bool removeServices();
|
|
|
|
bool setCompleteServices(const NimBLEUUID& uuid);
|
|
|
|
bool setCompleteServices16(const std::vector<NimBLEUUID>& uuids);
|
|
|
|
bool setCompleteServices32(const std::vector<NimBLEUUID>& uuids);
|
|
|
|
bool setFlags(uint8_t flag);
|
|
|
|
bool setManufacturerData(const uint8_t* data, size_t length);
|
|
|
|
bool setManufacturerData(const std::string& data);
|
|
|
|
bool setManufacturerData(const std::vector<uint8_t>& data);
|
|
|
|
bool setURI(const std::string& uri);
|
|
|
|
bool setName(const std::string& name, bool isComplete = true);
|
|
|
|
bool setPartialServices(const NimBLEUUID& uuid);
|
|
|
|
bool setPartialServices16(const std::vector<NimBLEUUID>& uuids);
|
|
|
|
bool setPartialServices32(const std::vector<NimBLEUUID>& uuids);
|
|
|
|
bool setServiceData(const NimBLEUUID& uuid, const uint8_t* data, size_t length);
|
|
|
|
bool setServiceData(const NimBLEUUID& uuid, const std::string& data);
|
|
|
|
bool setServiceData(const NimBLEUUID& uuid, const std::vector<uint8_t>& data);
|
|
|
|
bool setShortName(const std::string& name);
|
|
|
|
bool setData(const uint8_t* data, size_t length);
|
|
|
|
bool addData(const uint8_t* data, size_t length);
|
|
|
|
bool addData(const std::string& data);
|
|
|
|
bool setPreferredParams(uint16_t min, uint16_t max);
|
|
|
|
|
|
|
|
void addTxPower();
|
|
|
|
void setLegacyAdvertising(bool enable);
|
|
|
|
void setConnectable(bool enable);
|
|
|
|
void setScannable(bool enable);
|
|
|
|
void setMinInterval(uint32_t mininterval);
|
|
|
|
void setMaxInterval(uint32_t maxinterval);
|
|
|
|
void setPrimaryPhy(uint8_t phy);
|
|
|
|
void setSecondaryPhy(uint8_t phy);
|
|
|
|
void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
|
|
|
|
void setDirectedPeer(const NimBLEAddress& addr);
|
|
|
|
void setDirected(bool enable, bool high_duty = true);
|
|
|
|
void setAnonymous(bool enable);
|
|
|
|
void setPrimaryChannels(bool ch37, bool ch38, bool ch39);
|
|
|
|
void setTxPower(int8_t dbm);
|
|
|
|
void setAddress(const NimBLEAddress& addr);
|
|
|
|
void enableScanRequestCallback(bool enable);
|
|
|
|
void clearData();
|
|
|
|
int getDataLocation(uint8_t type) const;
|
|
|
|
bool removeData(uint8_t type);
|
|
|
|
size_t getDataSize() const;
|
|
|
|
std::string toString() const;
|
|
|
|
|
|
|
|
private:
|
2022-04-10 10:21:45 -06:00
|
|
|
friend class NimBLEExtAdvertising;
|
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
bool setServices(bool complete, uint8_t size, const std::vector<NimBLEUUID>& uuids);
|
2022-04-10 10:21:45 -06:00
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
std::vector<uint8_t> m_payload{};
|
|
|
|
ble_gap_ext_adv_params m_params{};
|
|
|
|
NimBLEAddress m_advAddress{};
|
|
|
|
}; // NimBLEExtAdvertisement
|
2022-04-10 10:21:45 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Extended advertising class.
|
|
|
|
*/
|
|
|
|
class NimBLEExtAdvertising {
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
public:
|
|
|
|
NimBLEExtAdvertising();
|
2022-04-10 10:21:45 -06:00
|
|
|
~NimBLEExtAdvertising();
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
bool start(uint8_t instId, int duration = 0, int maxEvents = 0);
|
|
|
|
bool setInstanceData(uint8_t instId, NimBLEExtAdvertisement& adv);
|
|
|
|
bool setScanResponseData(uint8_t instId, NimBLEExtAdvertisement& data);
|
|
|
|
bool removeInstance(uint8_t instId);
|
2022-04-10 10:21:45 -06:00
|
|
|
bool removeAll();
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
bool stop(uint8_t instId);
|
2022-04-10 10:21:45 -06:00
|
|
|
bool stop();
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
bool isActive(uint8_t instId);
|
2022-04-10 10:21:45 -06:00
|
|
|
bool isAdvertising();
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
void setCallbacks(NimBLEExtAdvertisingCallbacks* callbacks, bool deleteCallbacks = true);
|
2022-04-10 10:21:45 -06:00
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
private:
|
2022-04-10 10:21:45 -06:00
|
|
|
friend class NimBLEDevice;
|
|
|
|
friend class NimBLEServer;
|
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
void onHostSync();
|
|
|
|
static int handleGapEvent(struct ble_gap_event* event, void* arg);
|
2022-04-10 10:21:45 -06:00
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
bool m_deleteCallbacks;
|
|
|
|
NimBLEExtAdvertisingCallbacks* m_pCallbacks;
|
|
|
|
std::vector<bool> m_advStatus;
|
2022-04-10 10:21:45 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Callbacks associated with NimBLEExtAdvertising class.
|
|
|
|
*/
|
|
|
|
class NimBLEExtAdvertisingCallbacks {
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
public:
|
2022-04-10 10:21:45 -06:00
|
|
|
virtual ~NimBLEExtAdvertisingCallbacks() {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Handle an advertising stop event.
|
|
|
|
* @param [in] pAdv A convenience pointer to the extended advertising interface.
|
|
|
|
* @param [in] reason The reason code for stopping the advertising.
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
* @param [in] instId The instance ID of the advertisement that was stopped.
|
2022-04-10 10:21:45 -06:00
|
|
|
*/
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
virtual void onStopped(NimBLEExtAdvertising* pAdv, int reason, uint8_t instId);
|
2022-04-10 10:21:45 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Handle a scan response request.
|
|
|
|
* This is called when a scanning device requests a scan response.
|
|
|
|
* @param [in] pAdv A convenience pointer to the extended advertising interface.
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
* @param [in] instId The instance ID of the advertisement that the scan response request was made.
|
2022-04-10 10:21:45 -06:00
|
|
|
* @param [in] addr The address of the device making the request.
|
|
|
|
*/
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
virtual void onScanRequest(NimBLEExtAdvertising* pAdv, uint8_t instId, NimBLEAddress addr);
|
2022-04-10 10:21:45 -06:00
|
|
|
}; // NimBLEExtAdvertisingCallbacks
|
|
|
|
|
Refactor NimBLEExtAdvertising
* General code cleanup
* `NimBLEExtAdvertisement` : All functions that set data now return `bool`, true = success.
* Added new method, `NimBLEExtAdvertisement::removeData`, which will remove the data of the specified type from the advertisement.
* Added new method, `NimBLEExtAdvertisement::addServiceUUID`, which will append to the service uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServiceUUID`, which will remove the service from the uuids advertised.
* Added new method, `NimBLEExtAdvertisement::removeServices`, which will remove all service uuids advertised.
* Added overloads for `NimBLEExtAdvertisement::setServiceData` with the parameters `const NimBLEUUID& uuid, const uint8_t* data, size_t length` and
`const NimBLEUUID& uuid, const std::vector<uint8_t>& data`.
* Added new method, `NimBLEExtAdvertisement::getDataLocation`, which returns the location in the advertisment data of the type requested in parameter `uint8_t type`.
* Added new method, `toString` which returns a Hex string representation of the advertisement data.
2024-11-24 11:33:42 -07:00
|
|
|
#endif // CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV
|
|
|
|
#endif // NIMBLE_CPP_EXTADVERTISING_H_
|