Please ignore this one- Class has no such member

“BLE Advertising” is on line 42. Then we start ‘void setBeacon()’, and the error is raised several lines later. I can’t see how they’re connected.

   Based on Neil Kolban example for IDF:
   Ported to Arduino ESP32 by pcbreflux

   Create a BLE server that will send periodic iBeacon frames.
   The design of creating the BLE server is:
   1. Create a BLE Server
   2. Create advertising data
   3. Start advertising.
   4. wait
   5. Stop advertising.
   6. deep sleep
#include <Arduino.h>
#include "sys/time.h"
#include "BLEDevice.h"
#include "BLEUtils.h"
#include "BLEBeacon.h"
#include "esp_sleep.h"

#define GPIO_DEEP_SLEEP_DURATION 10      // sleep x seconds and then wake up
RTC_DATA_ATTR static time_t last;        // remember last boot in RTC Memory
RTC_DATA_ATTR static uint32_t bootcount; // remember number of boots in RTC Memory

#ifdef __cplusplus
extern "C"

  uint8_t temprature_sens_read();
  //uint8_t g_phyFuns;

#ifdef __cplusplus

// See the following for generating UUIDs:
BLEAdvertising *pAdvertising;
struct timeval now;

#define BEACON_UUID "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via

void setBeacon()

  BLEBeacon oBeacon = BLEBeacon();
  oBeacon.setManufacturerId(0x4C00); // fake Apple 0x004C LSB (ENDIAN_CHANGE_U16!)
  oBeacon.setMajor((bootcount & 0xFFFF0000) >> 16);
  oBeacon.setMinor(bootcount & 0xFFFF);
  BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
  BLEAdvertisementData oScanResponseData = BLEAdvertisementData();

  oAdvertisementData.setFlags(0x04); // BR_EDR_NOT_SUPPORTED 0x04

  std::string strServiceData = "";

  strServiceData += (char)26;   // Len
  strServiceData += (char)0xFF; // Type
  strServiceData += oBeacon.getData();


void setup()

  gettimeofday(&now, NULL);

  Serial.printf("start ESP32 %d\n", bootcount++);

  Serial.printf("deep sleep (%lds since last reset, %lds since last boot)\n", now.tv_sec, now.tv_sec - last);

  last = now.tv_sec;

  // Create the BLE Device

  // Create the BLE Server
  // BLEServer *pServer = BLEDevice::createServer(); // <-- no longer required to instantiate BLEServer, less flash and ram usage

  pAdvertising = BLEDevice::getAdvertising();

  // Start advertising
  Serial.println("Advertizing started...");
  Serial.printf("enter deep sleep\n");
  esp_deep_sleep(1000000LL * GPIO_DEEP_SLEEP_DURATION);
  Serial.printf("in deep sleep\n");

void loop()

The error:

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)

Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 1.12.4 > WeMos D1 MINI ESP32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
 - framework-arduinoespressif32 3.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 46 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP32 BLE Arduino> 1.0.1
Building in release mode
Compiling .pio\build\wemos_d1_mini32\src\main.cpp.o
Compiling .pio\build\wemos_d1_mini32\liba2e\BLE\BLEBeacon.cpp.o
Compiling .pio\build\wemos_d1_mini32\liba2e\BLE\BLECharacteristic.cpp.o
Compiling .pio\build\wemos_d1_mini32\liba2e\BLE\BLECharacteristicMap.cpp.o
Compiling .pio\build\wemos_d1_mini32\liba2e\BLE\BLEClient.cpp.o
src\main.cpp: In function 'void setBeacon()':
src\main.cpp:69:17: error: 'class BLEAdvertising' has no member named 'setAdvertisementType'
*** [.pio\build\wemos_d1_mini32\src\main.cpp.o] Error 1

I’m sorry for posting essentially the same thing i just posted.

I can’t see a way to delete it.

Click the … button under the post, the’s a delete option which looks like a dustbin.

I checked ESP32_BLE_Arduino/BLEAdvertising.h at master · nkolban/ESP32_BLE_Arduino · GitHub which defines classes BLEAdvertisementData and BLEAdvertising.

The latter has no member named setAdvertisementType, it does have setAdvertisementData.


Thanks Norm, but I can’t delete what you typed,

I’m working on another script now. I went into the library and added some members to the class, and those errors went away. So I guess the trick is finding the class in the library.

What data type could setAdvertisementType take?
A new one came though.

Has no class ‘begin’.

And I have a variable I can’t use, apparently.

It looks like setAdvertisementType is provided by the BLEAdvertising.h included as part of the arduino-esp32 board support package

It appears that the type should be one of the following


but I have no idea what they mean. According this, more study of BLE abstraction will make it all fall into place… Let me know if it does! :laughing:

I have several different DHT library folders. DHT.h was specified in this example sketch. I was looking at sensor libraryemphasized text**.

Now I have several of these threads open as tabs on my PC. I hope to emerge from the weekend with a grasp of ‘class’.

I have created a BLE peripheral beacon with a single “Hello World” service, and I was able to read that in nRF. I don’t think I know how to write back, because it’s in HEX. It says read/write, but there’s no connection so it shouldn’t work.

Now I’m looking to generate data with the DHT11 and serve that. Really, I want the BME 680 (Temp, Hum, Press, VOC), but I haven’t gotten that one to wok yet. Something in a library divides by zero.

Next, I’ll make a central and display the DHT11 data on OLED. And then I’ll switch from beacon to direct-connect BLE.

And then I will dance a little jig, because I’m two months behind due to the Arduino-PIO migration.
When I have my paired devices, I’ll publish a how-to with:
Make a beacon
Make a beacon reader
Make a dedicated pair.

Mesh is too far down on my list. Not going to start that for a while. What I want is a set of sensor pods and a central reader to collect data and publish a web page.

1 Like