Инициализация
По таймеру (раз в секунду) посылаю
Но BLE beacon scanner на телефоне не видит этих биконов. Другие видит а эти нет.
В чём может быть проблема?
C++:
BLEAdvertising *pAdvertising;
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
char beacon_data[25];
uint16_t beconUUID = 0xFEAA;
void BLE_SetBeacon(uint16_t min_interval, uint16_t max_interval)
{
BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
BLEAdvertisementData oScanResponseData = BLEAdvertisementData();
oScanResponseData.setFlags(0x06); //GENERAL_DISC_MODE 0x02 | BR_EDR_NOT_SUPPORTED 0x04
oScanResponseData.setCompleteServices(BLEUUID(beconUUID));
beacon_data[0] = 0x20;
beacon_data[1] = 0x00;
beacon_data[2] = 0xAA;
beacon_data[3] = 0xBB;
beacon_data[4] = 0xCC;
beacon_data[5] = 0xDD;
beacon_data[6] = 0x01;
beacon_data[7] = 0x02;
beacon_data[8] = 0x03;
beacon_data[9] = 0x04;
beacon_data[10] = 0x05;
beacon_data[11] = 0x06;
beacon_data[12] = 0x07;
beacon_data[13] = 0x08;
oScanResponseData.setServiceData(BLEUUID(beconUUID), std::string(beacon_data, 14));
oAdvertisementData.setName("BLE_Test");
pAdvertising->setAdvertisementData(oAdvertisementData);
pAdvertising->setScanResponseData(oScanResponseData);
pAdvertising->setMaxInterval(max_interval);
pAdvertising->setMinInterval(min_interval);
}
void BLE_Init()
{
// Create the BLE Device
BLEDevice::init("BLE_Test"); //AgroSens
//BLEDevice::setPower(ESP_PWR_LVL_N12);
pAdvertising = BLEDevice::getAdvertising();
BLE_SetBeacon(100, 10000);
// Start advertising
pAdvertising->start();
Serial.println("Advertizing started...");
delay(100);
pAdvertising->stop();
}
C++:
void BLE_Send()
{
count++;
//first - update data
beacon_data[2] = (count >> 8);
beacon_data[3] = (count & 0xFF);
pAdvertising->setAdvertisementData(oAdvertisementData);
pAdvertising->start();
delay(100);
pAdvertising->stop();
}
В чём может быть проблема?