mirror of https://github.com/ARMmbed/mbed-os.git
advertising data only contains advertising data
parent
52f54c032a
commit
060d2f5216
|
@ -28,12 +28,6 @@
|
|||
#include "platform/mbed_toolchain.h"
|
||||
#include "platform/NonCopyable.h"
|
||||
|
||||
/* Forward declarations for classes that are only used for pointers or
|
||||
references. */
|
||||
class GapAdvertisingParams;
|
||||
class GapScanningParams;
|
||||
class GapAdvertisingData;
|
||||
|
||||
/**
|
||||
* @addtogroup ble
|
||||
* @{
|
||||
|
@ -88,18 +82,18 @@ class GapAdvertisingData;
|
|||
* Gap& gap;
|
||||
*
|
||||
* // construct the packet to advertise
|
||||
* GapAdvertisingData advertising_data;
|
||||
* AdvertisingData advertising_data;
|
||||
*
|
||||
* // Add advertiser flags
|
||||
* advertising_data.addFlags(
|
||||
* GapAdvertisingData::LE_GENERAL_DISCOVERABLE |
|
||||
* GapAdvertisingData::BREDR_NOT_SUPPORTED
|
||||
* AdvertisingData::LE_GENERAL_DISCOVERABLE |
|
||||
* AdvertisingData::BREDR_NOT_SUPPORTED
|
||||
* );
|
||||
*
|
||||
* // Add the name of the device to the advertising data
|
||||
* static const uint8_t device_name[] = "HRM";
|
||||
* advertising_data.addData(
|
||||
* GapAdvertisingData::COMPLETE_LOCAL_NAME,
|
||||
* AdvertisingData::COMPLETE_LOCAL_NAME,
|
||||
* device_name,
|
||||
* sizeof(device_name)
|
||||
* );
|
||||
|
@ -1182,14 +1176,14 @@ public:
|
|||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
virtual ble_error_t setAdvertisingPayload(AdvHandle_t handle, const GapAdvertisingData* payload) {
|
||||
virtual ble_error_t setAdvertisingPayload(AdvHandle_t handle, const AdvertisingData* payload, bool minimiseFragmentation = false) {
|
||||
(void) handle;
|
||||
(void) payload;
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
return BLE_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
virtual ble_error_t setAdvertisingScanResponse(AdvHandle_t handle, const GapAdvertisingData* response) {
|
||||
virtual ble_error_t setAdvertisingScanResponse(AdvHandle_t handle, const AdvertisingData* response) {
|
||||
(void) handle;
|
||||
(void) response;
|
||||
/* Requesting action from porter(s): override this API if this capability is supported. */
|
||||
|
@ -1885,7 +1879,7 @@ public:
|
|||
*
|
||||
* @return BLE_ERROR_NONE if the new appearance was set correctly.
|
||||
*/
|
||||
virtual ble_error_t setAppearance(GapAdvertisingData::Appearance appearance)
|
||||
virtual ble_error_t setAppearance(AdvertisingData::Appearance appearance)
|
||||
{
|
||||
(void)appearance;
|
||||
|
||||
|
@ -1901,7 +1895,7 @@ public:
|
|||
* @return BLE_ERROR_NONE if the device-appearance was fetched correctly
|
||||
* from the underlying BLE stack.
|
||||
*/
|
||||
virtual ble_error_t getAppearance(GapAdvertisingData::Appearance *appearanceP)
|
||||
virtual ble_error_t getAppearance(AdvertisingData::Appearance *appearanceP)
|
||||
{
|
||||
(void)appearanceP;
|
||||
|
||||
|
|
|
@ -536,24 +536,12 @@ public:
|
|||
|
||||
AdvertisingData(mbed::Span<uint8_t> buffer) :
|
||||
_buffer(buffer),
|
||||
_payloadLen(0),
|
||||
_appearance(GENERIC_TAG),
|
||||
_minimiseFragmentation(false) {
|
||||
_payloadLen(0) {
|
||||
}
|
||||
|
||||
AdvertisingData(uint8_t* buffer, size_t buffer_size) :
|
||||
_buffer(buffer, buffer_size),
|
||||
_payloadLen(0),
|
||||
_appearance(GENERIC_TAG),
|
||||
_minimiseFragmentation(false) {
|
||||
}
|
||||
|
||||
void setMinimiseFragmentation(bool enable = true) {
|
||||
_minimiseFragmentation = enable;
|
||||
}
|
||||
|
||||
bool getMinimiseFragmentation() const {
|
||||
return _minimiseFragmentation;
|
||||
_payloadLen(0) {
|
||||
}
|
||||
|
||||
size_t getBufferSize() const {
|
||||
|
@ -672,7 +660,6 @@ public:
|
|||
*/
|
||||
ble_error_t addAppearance(Appearance appearance = GENERIC_TAG)
|
||||
{
|
||||
_appearance = appearance;
|
||||
return addData(AdvertisingData::APPEARANCE, (uint8_t *)&appearance, 2);
|
||||
}
|
||||
|
||||
|
@ -732,7 +719,12 @@ public:
|
|||
*/
|
||||
uint16_t getAppearance(void) const
|
||||
{
|
||||
return (uint16_t)_appearance;
|
||||
uint16_t appearance = GENERIC_TAG;
|
||||
uint8_t *field = findField(AdvertisingData::APPEARANCE);
|
||||
if (field) {
|
||||
memcpy((uint8_t*)appearance, field, 2);
|
||||
}
|
||||
return appearance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -941,8 +933,6 @@ protected:
|
|||
AdvertisingData(AdvertisingData& other) {
|
||||
_buffer = mbed::make_Span(other.getPayload(), other.getBufferSize());
|
||||
_payloadLen = other.getPayloadLen();
|
||||
_appearance = other.getAppearance();
|
||||
_minimiseFragmentation = other.getMinimiseFragmentation();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -952,13 +942,6 @@ protected:
|
|||
* Length of the data added to the advertising buffer.
|
||||
*/
|
||||
uint8_t _payloadLen;
|
||||
|
||||
/**
|
||||
* Appearance value.
|
||||
*/
|
||||
uint16_t _appearance;
|
||||
|
||||
bool _minimiseFragmentation;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -975,8 +958,6 @@ public:
|
|||
{
|
||||
memcpy(_payload, other.getPayload(), GAP_ADVERTISING_DATA_MAX_PAYLOAD);
|
||||
_payloadLen = other.getPayloadLen();
|
||||
_appearance = other.getAppearance();
|
||||
_minimiseFragmentation = other.getMinimiseFragmentation();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue