Made some modifications

This commit is contained in:
CommanderRedYT
2022-12-24 15:29:45 +01:00
parent c85e84e9a1
commit 1b7a523acd
2 changed files with 18 additions and 8 deletions

View File

@ -472,9 +472,9 @@ CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y
# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set
# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set
# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set
CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y
# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set
CONFIG_BT_NIMBLE_LOG_LEVEL=1
# CONFIG_BT_NIMBLE_LOG_LEVEL_INFO is not set
CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG=y
CONFIG_BT_NIMBLE_LOG_LEVEL=0
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3
CONFIG_BT_NIMBLE_MAX_BONDS=3
CONFIG_BT_NIMBLE_MAX_CCCDS=8

View File

@ -55,14 +55,20 @@ void createBle()
{
ESP_LOGI("BOBBY", "called");
BLEDevice::init(configs.bluetoothName.value());
NimBLEDevice::init("foo");//configs.bluetoothName.value());
const auto serviceUuid{"0335e46c-f355-4ce6-8076-017de08cee98"};
pServer = BLEDevice::createServer();
ESP_LOGI(TAG, "Creating BLE server");
pServer = NimBLEDevice::createServer();
ESP_LOGI(TAG, "Creating BLE service");
pService = pServer->createService(serviceUuid);
ESP_LOGI(TAG, "Creating BLE characteristics");
livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
remotecontrolCharacteristic = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
@ -72,19 +78,23 @@ void createBle()
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
getwifilist->setCallbacks(&bleWiFiListCallbacks);
ESP_LOGI(TAG, "Starting BLE service");
pService->start();
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
ESP_LOGI(TAG, "Starting BLE advertising");
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->addServiceUUID(serviceUuid);
pAdvertising->setScanResponse(true);
BLEDevice::startAdvertising();
NimBLEDevice::startAdvertising();
}
void destroyBle()
{
ESP_LOGI("BOBBY", "called");
BLEDevice::deinit(true);
NimBLEDevice::deinit(true);
pServer = {};
pService = {};