#include <stdio.h>
#include <stdlib.h>
#include <Arduino.h>
#include "BLE2902.h"
#include <BLEUtils.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include "BleConnectionStatus.h"
bool deviceConnected = false;
bool oldDeviceConnected = false;
bool isBluetoothConnected = false;
BLEServer *pServer ;
BLECharacteristic *pRxCharacteristic;
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" // UART service UUID
#define CHARACTERISTIC_UUID_RX "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
class MyServerCallbacks: public BLEServerCallbacks
{
void onConnect(BLEServer* pServer)
{
deviceConnected = true;
}
void onDisconnect(BLEServer* pServer)
{
deviceConnected = false;
}
};
class MyCallbacks: public BLECharacteristicCallbacks
{
void onWrite(BLECharacteristic pCharacteristic)
{
const std::string& constValue = pCharacteristic->getValue();
std::string value(const_cast<char>(constValue.data()), constValue.size());
int a = isDigit(value[0]);
}
void setup()
{
Serial.begin(115200);
// Create the BLE Device
BLEDevice::init("LED ANIMATION");
// Create the BLE Server
pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks());
// Create the BLE Service
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic * pRxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID_RX,BLECharacteristic::PROPERTY_WRITE);
pRxCharacteristic->setCallbacks(new MyCallbacks());
// Start the service
pService->start();
// Start advertising
pServer->getAdvertising()->start();
Serial.println("Waiting a client connection to notify...");
//Print the wakeup reason for ESP32
Serial.println("Bluetooth Not connected");
} In this code I am getting Name in the iOS NRF connect app but I am not getting Name in the IOS Bluetooth setting. means direct Bluetooth name list. But in Android, I am getting both the NRF app and the Android Bluetooth setting. please give me a solution of this.