esp32-snippets
esp32-snippets copied to clipboard
How to set the entire advertising payload
Hi,
I want to set the entire advertising payload and I have tested it writting a custom ADType = 0x88 with data = 0x54.
The problem is that appear 3 ADType more, 0x09 0x0a and 0x12. How to fix this ?.
Thanks and regards.
// "ESP32 Dev Module" version 1.0.6
#include <BLEDevice.h> #include <BLEUtils.h> #include <BLEServer.h> #include <Arduino.h> #include <stdlib.h>
BLEAdvertising *pAdvertising;
void setup() { Serial.begin(115200);
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); std::string strServiceData = "\x02\x88\x54"; oAdvertisementData.addData(strServiceData);
BLEDevice::init(""); BLEDevice::setPower(ESP_PWR_LVL_P6); // + 6dBm
pAdvertising = BLEDevice::getAdvertising();
pAdvertising->setScanResponse(true);
pAdvertising->setMinInterval(320); // 200 mS
pAdvertising->setMaxInterval(320); // 200 mS
pAdvertising->setAdvertisementData(oAdvertisementData);
}
void loop() { pAdvertising->start(); delay(100); pAdvertising->stop(); delay(60000); }