Made some modifications
This commit is contained in:
@ -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_NONE is not set
|
||||||
# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR 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_WARNING is not set
|
||||||
CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y
|
# CONFIG_BT_NIMBLE_LOG_LEVEL_INFO is not set
|
||||||
# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set
|
CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG=y
|
||||||
CONFIG_BT_NIMBLE_LOG_LEVEL=1
|
CONFIG_BT_NIMBLE_LOG_LEVEL=0
|
||||||
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3
|
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3
|
||||||
CONFIG_BT_NIMBLE_MAX_BONDS=3
|
CONFIG_BT_NIMBLE_MAX_BONDS=3
|
||||||
CONFIG_BT_NIMBLE_MAX_CCCDS=8
|
CONFIG_BT_NIMBLE_MAX_CCCDS=8
|
||||||
|
@ -55,14 +55,20 @@ void createBle()
|
|||||||
{
|
{
|
||||||
ESP_LOGI("BOBBY", "called");
|
ESP_LOGI("BOBBY", "called");
|
||||||
|
|
||||||
BLEDevice::init(configs.bluetoothName.value());
|
NimBLEDevice::init("foo");//configs.bluetoothName.value());
|
||||||
|
|
||||||
const auto serviceUuid{"0335e46c-f355-4ce6-8076-017de08cee98"};
|
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);
|
pService = pServer->createService(serviceUuid);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Creating BLE characteristics");
|
||||||
|
|
||||||
livestatsCharacteristic = pService->createCharacteristic("a48321ea-329f-4eab-a401-30e247211524", NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY);
|
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 = pService->createCharacteristic("4201def0-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::WRITE);
|
||||||
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
|
remotecontrolCharacteristic->setCallbacks(&bleRemoteCallbacks);
|
||||||
@ -72,19 +78,23 @@ void createBle()
|
|||||||
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
|
getwifilist = pService->createCharacteristic("4201def2-a264-43e6-946b-6b2d9612dfed", NIMBLE_PROPERTY::READ);
|
||||||
getwifilist->setCallbacks(&bleWiFiListCallbacks);
|
getwifilist->setCallbacks(&bleWiFiListCallbacks);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Starting BLE service");
|
||||||
|
|
||||||
pService->start();
|
pService->start();
|
||||||
|
|
||||||
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
|
ESP_LOGI(TAG, "Starting BLE advertising");
|
||||||
|
|
||||||
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
pAdvertising->addServiceUUID(serviceUuid);
|
pAdvertising->addServiceUUID(serviceUuid);
|
||||||
pAdvertising->setScanResponse(true);
|
pAdvertising->setScanResponse(true);
|
||||||
BLEDevice::startAdvertising();
|
NimBLEDevice::startAdvertising();
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyBle()
|
void destroyBle()
|
||||||
{
|
{
|
||||||
ESP_LOGI("BOBBY", "called");
|
ESP_LOGI("BOBBY", "called");
|
||||||
|
|
||||||
BLEDevice::deinit(true);
|
NimBLEDevice::deinit(true);
|
||||||
|
|
||||||
pServer = {};
|
pServer = {};
|
||||||
pService = {};
|
pService = {};
|
||||||
|
Reference in New Issue
Block a user