MCPcopy Create free account
hub / github.com/BruceDevices/firmware / executeCustomSpam

Function executeCustomSpam

src/modules/ble/ble_spam.cpp:274–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void executeCustomSpam(String spamName) {
275 uint8_t macAddr[6];
276 for (int i = 0; i < 6; i++) { macAddr[i] = esp_random() & 0xFF; }
277 macAddr[0] = (macAddr[0] | 0xF0) & 0xFE;
278 esp_iface_mac_addr_set(macAddr, ESP_MAC_BT);
279
280 BLEDevice::init("sh4rk");
281 vTaskDelay(5 / portTICK_PERIOD_MS);
282 esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, MAX_TX_POWER);
283 pAdvertising = BLEDevice::getAdvertising();
284 BLEAdvertisementData advertisementData = BLEAdvertisementData();
285
286 advertisementData.setFlags(0x06);
287 advertisementData.setName(spamName.c_str());
288 pAdvertising->addServiceUUID(BLEUUID("1812"));
289 pAdvertising->setAdvertisementData(advertisementData);
290 pAdvertising->start();
291 vTaskDelay(20 / portTICK_PERIOD_MS);
292 pAdvertising->stop();
293 vTaskDelay(5 / portTICK_PERIOD_MS);
294#if defined(CONFIG_IDF_TARGET_ESP32C5)
295 esp_bt_controller_deinit();
296#else
297 BLEDevice::deinit();
298#endif
299}
300
301void ibeacon(const char *DeviceName, const char *BEACON_UUID, int ManufacturerId) {
302 uint8_t macAddr[6];

Callers 1

aj_advFunction · 0.85

Calls 4

initFunction · 0.85
setNameMethod · 0.80
startMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected