Skip to content

Custom ble advertisement [Not iBeacon standard/Data spec] #110

Closed
@mm108

Description

@mm108

I want to send out some custom ble advertisement. Is something like this possible with NimBLE-Arduino library at the moment? I got the below code working (with ESP32 BLE for Arduino) after getting some help from chegewara. I am yet to try anything with NimBLE-Arduino along the same lines but I thought I'd get a word from you. I am referring to this example. Anything similar with NimBLE-Arduino? Thanks.

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

uint8_t Adv_DATA[] = {0x4c, 0x00, 0x02, 0x15, 0xe9, 0xd5, 0xad, 0x15};
BLEAdvertisementData oAdvertisementCustom = BLEAdvertisementData();
oAdvertisementCustom.setManufacturerData(std::string((char *)&Adv_DATA[0], 8)); // 8 is length of Adv_DATA
pAdvertising->setAdvertisementData(oAdvertisementCustom);
pAdvertising->setScanResponse(false);
//  oAdvertisementCustom.setFlags(0x04);
oAdvertisementCustom.setFlags(0x06);

// Start advertising
pAdvertising->start();
Serial.println("Advertising started...");
delay(100);
pAdvertising->stop();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions