Arduino examples of the BLE_Server and BLE_Client applications do not connect

rjorgessa
Posts: 1
Joined: Wed Aug 08, 2018 4:43 pm

Arduino examples of the BLE_Server and BLE_Client applications do not connect

Postby rjorgessa » Fri Oct 12, 2018 2:36 pm

Hi All, The examples of the applications BLE_Server and BLE_Client in Arduino, do not connect, even configuring the two applications with the same UUID, I verified that the client application can not determine the UUID of the Server, so it can not conenct, can someone help me?

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: Arduino examples of the BLE_Server and BLE_Client applications do not connect

Postby chegewara » Fri Oct 12, 2018 3:49 pm

Some logs or code would be helpful, especially onResult function.

PeteSN
Posts: 2
Joined: Tue Oct 23, 2018 6:23 am

Re: Arduino examples of the BLE_Server and BLE_Client applications do not connect

Postby PeteSN » Tue Oct 23, 2018 7:41 am

Hi, same problem here.

Code of BLE server is a example from Arduino IDE:

Code: Select all

/*
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp
    Ported to Arduino ESP32 by Evandro Copercini
*/

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

// See the following for generating UUIDs:
// https://www.uuidgenerator.net/

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"

void setup() {
  Serial.begin(115200);
  Serial.println("Starting BLE work!");

  BLEDevice::init("MyESP32");
  BLEServer *pServer = BLEDevice::createServer();
  BLEService *pService = pServer->createService(SERVICE_UUID);
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID,
                                         BLECharacteristic::PROPERTY_READ |
                                         BLECharacteristic::PROPERTY_WRITE
                                       );

  pCharacteristic->setValue("Hello World says Neil");
  pService->start();
  BLEAdvertising *pAdvertising = pServer->getAdvertising();
  pAdvertising->start();
  Serial.println("Characteristic defined! Now you can read it in your phone!");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
}
Code of the client is also frome Arduino IDE example - only the Service und Char UUID were changed and println for the haveServiceUUID function added:

Code: Select all

/**
 * A BLE client example that is rich in capabilities.
 */

#include "BLEDevice.h"
//#include "BLEScan.h"

// The remote service we wish to connect to.
//static BLEUUID serviceUUID("91bad492-b950-4226-aa2b-4ede9fa42f59");
static BLEUUID serviceUUID("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
// The characteristic of the remote service we are interested in.
//static BLEUUID    charUUID("0d563a58-196a-48ce-ace2-dfec78acc814");
static BLEUUID charUUID("beb5483e-36e1-4688-b7f5-ea07361b26a8");


static BLEAddress *pServerAddress;
static boolean doConnect = false;
static boolean connected = false;
static BLERemoteCharacteristic* pRemoteCharacteristic;

static void notifyCallback(
  BLERemoteCharacteristic* pBLERemoteCharacteristic,
  uint8_t* pData,
  size_t length,
  bool isNotify) {
    Serial.print("Notify callback for characteristic ");
    Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str());
    Serial.print(" of data length ");
    Serial.println(length);
}

bool connectToServer(BLEAddress pAddress) {
    Serial.print("Forming a connection to ");
    Serial.println(pAddress.toString().c_str());
    
    BLEClient*  pClient  = BLEDevice::createClient();
    Serial.println(" - Created client");

    // Connect to the remove BLE Server.
    pClient->connect(pAddress);
    Serial.println(" - Connected to server");

    // Obtain a reference to the service we are after in the remote BLE server.
    BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
    if (pRemoteService == nullptr) {
      Serial.print("Failed to find our service UUID: ");
      Serial.println(serviceUUID.toString().c_str());
      return false;
    }
    Serial.println(" - Found our service");


    // Obtain a reference to the characteristic in the service of the remote BLE server.
    pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
    if (pRemoteCharacteristic == nullptr) {
      Serial.print("Failed to find our characteristic UUID: ");
      Serial.println(charUUID.toString().c_str());
      return false;
    }
    Serial.println(" - Found our characteristic");

    // Read the value of the characteristic.
    std::string value = pRemoteCharacteristic->readValue();
    Serial.print("The characteristic value was: ");
    Serial.println(value.c_str());

    pRemoteCharacteristic->registerForNotify(notifyCallback);
}
/**
 * Scan for BLE servers and find the first one that advertises the service we are looking for.
 */
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
 /**
   * Called for each advertising BLE server.
   */
  void onResult(BLEAdvertisedDevice advertisedDevice) {
    Serial.print("BLE Advertised Device found: ");
    Serial.println(advertisedDevice.toString().c_str());

    // We have found a device, let us now see if it contains the service we are looking for.
    Serial.println("haveServiceUUID: ");
    Serial.println(advertisedDevice.haveServiceUUID());
    if (advertisedDevice.haveServiceUUID() && advertisedDevice.getServiceUUID().equals(serviceUUID)) {

      // 
      Serial.print("Found our device!  address: "); 
      advertisedDevice.getScan()->stop();

      pServerAddress = new BLEAddress(advertisedDevice.getAddress());
      doConnect = true;

    } // Found our server
  } // onResult
}; // MyAdvertisedDeviceCallbacks


void setup() {
  Serial.begin(115200);
  Serial.println("Starting Arduino BLE Client application...");
  BLEDevice::init("");

  // Retrieve a Scanner and set the callback we want to use to be informed when we
  // have detected a new device.  Specify that we want active scanning and start the
  // scan to run for 30 seconds.
  BLEScan* pBLEScan = BLEDevice::getScan();
  pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
  pBLEScan->setActiveScan(true);
  pBLEScan->start(30);
} // End of setup.


// This is the Arduino main loop function.
void loop() {

  // If the flag "doConnect" is true then we have scanned for and found the desired
  // BLE Server with which we wish to connect.  Now we connect to it.  Once we are 
  // connected we set the connected flag to be true.
  if (doConnect == true) {
    if (connectToServer(*pServerAddress)) {
      Serial.println("We are now connected to the BLE Server.");
      connected = true;
    } else {
      Serial.println("We have failed to connect to the server; there is nothin more we will do.");
    }
    doConnect = false;
  }

  // If we are connected to a peer BLE Server, update the characteristic each time we are reached
  // with the current time since boot.
  if (connected) {
    String newValue = "Time since boot: " + String(millis()/1000);
    Serial.println("Setting new characteristic value to \"" + newValue + "\"");
    
    // Set the characteristic's value to be the array of bytes that is actually a string.
    pRemoteCharacteristic->writeValue(newValue.c_str(), newValue.length());
  }
  
  delay(1000); // Delay a second between loops.
} // End of loop

BLE-Server Log from serial monitor:

Code: Select all

ets Jun  8 2016 00:22:57
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1496
load:0x40078000,len:8596
load:0x40080400,len:6980
entry 0x400806f4
Starting BLE work!
[D][BLEDevice.cpp:70] createServer(): >> createServer
[D][BLEServer.cpp:305] registerApp(): >> registerApp - 0
[D][BLEDevice.cpp:96] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... ESP_GATTS_REG_EVT
[D][BLEUtils.cpp:1647] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_REG_EVT
[D][BLEUtils.cpp:1791] dumpGattServerEvent(): [status: ESP_GATT_OK, app_id: 0]
[D][BLEServer.cpp:177] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_REG_EVT
[D][BLEServer.cpp:309] registerApp(): << registerApp
[D][BLEServer.cpp:295] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:77] createServer(): << createServer
[D][BLEServer.cpp:76] createService(): >> createService - 4fafc201-1fb5-459e-8fcc-c5c9c331914b
[D][BLEDevice.cpp:96] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... ESP_GATTS_CREATE_EVT
[D][BLEUtils.cpp:1647] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_CREATE_EVT
[D][BLEUtils.cpp:1716] dumpGattServerEvent(): [status: ESP_GATT_OK, service_handle: 40 0x28, service_id: [uuid: 4fafc201-1fb5-459e-8fcc-c5c9c331914b, inst_id: 0]]
[D][BLEServer.cpp:177] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_CREATE_EVT
[D][BLEService.cpp:211] setHandle(): >> setHandle - Handle=0x28, service UUID=4fafc201-1fb5-459e-8fcc-c5c9c331914b)
[D][BLEService.cpp:217] setHandle(): << setHandle
[D][BLEService.cpp:90] executeCreate(): << executeCreate
[D][BLEServer.cpp:295] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEServer.cpp:94] createService(): << createService
[D][BLEService.cpp:239] addCharacteristic(): >> addCharacteristic()
[D][BLEService.cpp:242] addCharacteristic(): Adding characteristic: uuid=beb5483e-36e1-4688-b7f5-ea07361b26a8 to service: UUID: 4fafc201-1fb5-459e-8fcc-c5c9c331914b, handle: 0x28
[D][BLEService.cpp:254] addCharacteristic(): << addCharacteristic()
[D][BLECharacteristic.cpp:664] setValue(): >> setValue: length=21, data=48656c6c6f20576f726c642073617973204e65696c, characteristic UUID=beb5483e-36e1-4688-b7f5-ea07361b26a8
[D][BLECharacteristic.cpp:671] setValue(): << setValue
[D][BLEService.cpp:148] start(): >> start(): Starting service (esp_ble_gatts_start_service): UUID: 4fafc201-1fb5-459e-8fcc-c5c9c331914b, handle: 0x28
[D][BLECharacteristic.cpp:83] executeCreate(): >> executeCreate()
[D][BLECharacteristic.cpp:94] executeCreate(): Registering characteristic (esp_ble_gatts_add_char): uuid: beb5483e-36e1-4688-b7f5-ea07361b26a8, service: UUID: 4fafc201-1fb5-459e-8fcc-c5c9c331914b, handle: 0x28
[D][BLEDevice.cpp:96] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1647] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1669] dumpGattServerEvent(): [status: ESP_GATT_OK, attr_handle: 42 0x2a, service_handle: 40 0x28, char_uuid: beb5483e-36e1-4688-b7f5-ea07361b26a8]
[D][BLEServer.cpp:177] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLECharacteristic.cpp:609] setHandle(): >> setHandle: handle=0x2a, characteristic uuid=beb5483e-36e1-4688-b7f5-ea07361b26a8
[D][BLECharacteristic.cpp:611] setHandle(): << setHandle
[D][BLECharacteristic.cpp:209] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLECharacteristic.cpp:461] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLECharacteristic.cpp:135] executeCreate(): << executeCreate
[D][BLEServer.cpp:295] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:96] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 4] ... ESP_GATTS_START_EVT
[D][BLEUtils.cpp:1647] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_START_EVT
[D][BLEUtils.cpp:1805] dumpGattServerEvent(): [status: ESP_GATT_OK, service_handle: 0x28]
[D][BLEServer.cpp:177] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_START_EVT
[D][BLEService.cpp:174] start(): << start()
[D][BLECharacteristic.cpp:209] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_START_EVT
[D][BLEAdvertising.cpp:174] start(): >> start: customAdvData: 0, customScanResponseData: 0
[D][BLECharacteristic.cpp:461] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEAdvertising.cpp:194] start(): - no services advertised
[D][BLEServer.cpp:295] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEAdvertising.cpp:231] start(): << start
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT
Characteristic defined! Now you can read it in your phone!
[D][BLEUtils.cpp:1099] dumpGapEvent(): [status: 0]
[D][BLEServer.cpp:135] handleGAPEvent(): BLEServer ... handling GAP event!
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT
[D][BLEUtils.cpp:1285] dumpGapEvent(): [status: 0]
[D][BLEServer.cpp:135] handleGAPEvent(): BLEServer ... handling GAP event!
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_START_COMPLETE_EVT
[D][BLEUtils.cpp:1123] dumpGapEvent(): [status: 0]
[D][BLEServer.cpp:135] handleGAPEvent(): BLEServer ... handling GAP event!
Client Log

Code: Select all

POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1496
load:0x40078000,len:8596
load:0x40080400,len:6980
entry 0x400806f4
Starting Arduino BLE Client application...
[D][BLEScan.cpp:196] start(): >> start(duration=30)
[D][BLEScan.cpp:221] start(): << start()
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT
[D][BLEUtils.cpp:1229] dumpGapEvent(): [status: 5]
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_START_COMPLETE_EVT
[D][BLEUtils.cpp:1305] dumpGapEvent(): [status: 0]
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 24:0a:c4:96:4c:26, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -64, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 21, scan_rsp_len: 21
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -64
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x09 (ESP_BLE_AD_TYPE_NAME_CMPL), length: 7, data: 4d794553503332
[D][BLEAdvertisedDevice.cpp:411] setName(): - setName(): name: MyESP32
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x0a (ESP_BLE_AD_TYPE_TX_PWR), length: 1, data: 03
[D][BLEAdvertisedDevice.cpp:482] setTXPower(): - txPower: 3
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x12 (ESP_BLE_AD_TYPE_INT_RANGE), length: 4, data: 20004000
[D][BLEAdvertisedDevice.cpp:347] parseAdvertisement(): Unhandled type: adType: 18 - 0x12
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x09 (ESP_BLE_AD_TYPE_NAME_CMPL), length: 7, data: 4d794553503332
[D][BLEAdvertisedDevice.cpp:411] setName(): - setName(): name: MyESP32
BLE Advertised Device found: Name: MyESP32, Address: 24:0a:c4:96:4c:26, txPower: 3
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:d4:cc:28:f4:e7, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -58, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -58
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 0600010920024784c3a960e3e970ad209a3309241180a22505059669a6
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 0600010920024784c3a960e3e970ad209a3309241180a22505059669a6
BLE Advertised Device found: Name: , Address: 30:d4:cc:28:f4:e7, manufacturer data: 0600010920024784c3a960e3e970ad209a3309241180a22505059669a6
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 06:87:0d:f0:55:58, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -86, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -86
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 0600010920029ef8ff61fe600bc1b4237d06500f7b38750558ed2b0352
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 0600010920029ef8ff61fe600bc1b4237d06500f7b38750558ed2b0352
BLE Advertised Device found: Name: , Address: 06:87:0d:f0:55:58, manufacturer data: 0600010920029ef8ff61fe600bc1b4237d06500f7b38750558ed2b0352
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7e:a0:6e:2d:ce:f5, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -92, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 14, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -92
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 1a
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 9, data: 4c0010050118606ac9
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 4c0010050118606ac9
BLE Advertised Device found: Name: , Address: 7e:a0:6e:2d:ce:f5, manufacturer data: 4c0010050118606ac9
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 5d:b6:14:09:b3:99, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -90, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 14, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -90
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 1a
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 9, data: 4c00100503182937e1
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 4c00100503182937e1
BLE Advertised Device found: Name: , Address: 5d:b6:14:09:b3:99, manufacturer data: 4c00100503182937e1
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 09:e0:21:04:69:ee, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -86, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -86
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 060001092002962d32b4ea394aa7745a8d11c0315522982572ecbb0668
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 060001092002962d32b4ea394aa7745a8d11c0315522982572ecbb0668
BLE Advertised Device found: Name: , Address: 09:e0:21:04:69:ee, manufacturer data: 060001092002962d32b4ea394aa7745a8d11c0315522982572ecbb0668
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 24:0a:c4:96:4c:26, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -60, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 21, scan_rsp_len: 21
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 24:0a:c4:96:4c:26, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:d4:cc:28:f4:e7, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -55, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 30:d4:cc:28:f4:e7, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 24:0a:c4:96:4c:26, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -61, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 21, scan_rsp_len: 21
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 24:0a:c4:96:4c:26, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 06:87:0d:f0:55:58, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -85, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 06:87:0d:f0:55:58, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:d4:cc:28:f4:e7, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -55, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 30:d4:cc:28:f4:e7, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 24:0a:c4:96:4c:26, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -59, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 21, scan_rsp_len: 21
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 24:0a:c4:96:4c:26, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 09:e0:21:04:69:ee, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -81, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 09:e0:21:04:69:ee, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:d4:cc:28:f4:e7, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -55, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 30:d4:cc:28:f4:e7, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7e:a0:6e:2d:ce:f5, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -91, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 14, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 7e:a0:6e:2d:ce:f5, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 5d:b6:14:09:b3:99, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -91, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 14, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 5d:b6:14:09:b3:99, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 24:0a:c4:96:4c:26, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -62, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 21, scan_rsp_len: 21
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 24:0a:c4:96:4c:26, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 09:e0:21:04:69:ee, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -82, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 09:e0:21:04:69:ee, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:d4:cc:28:f4:e7, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -56, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 30:d4:cc:28:f4:e7, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 60:e2:15:d6:f1:70, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -80, ble_adv: ??, flag: 26 ([LE General Discoverable Mode] [Simultaneous LE and BR/EDR to Same Device Capable (Controller)] [Simultaneous LE and BR/EDR to Same Device Capable (Host)] ), num_resps: 1, adv_data_len: 14, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:422] setRSSI(): - setRSSI(): rssi: -80
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 1a
[D][BLEAdvertisedDevice.cpp:251] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 9, data: 4c0010050118e090ed
[D][BLEAdvertisedDevice.cpp:399] setManufacturerData(): - manufacturer data: 4c0010050118e090ed
BLE Advertised Device found: Name: , Address: 60:e2:15:d6:f1:70, manufacturer data: 4c0010050118e090ed
haveServiceUUID: 
0
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1265] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 06:87:0d:f0:55:58, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_NON_CONN_ADV, rssi: -75, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:105] handleGAPEvent(): Ignoring 06:87:0d:f0:55:58, already seen it.
[D][BLEUtils.cpp:1091] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
I use two nodeMCU ESP32S boards. Thank you in advance!


chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: Arduino examples of the BLE_Server and BLE_Client applications do not connect

Postby chegewara » Tue Oct 23, 2018 4:20 pm

Ok, i am suspecting that in both cases the issue is that arduino ble library is not ready for multi-connect usage. You are having problems because BLEClient and BLEServer are both are trying to register app with index 0:
https://github.com/nkolban/ESP32_BLE_Ar ... r.cpp#L307
https://github.com/nkolban/ESP32_BLE_Ar ... nt.cpp#L99

At beginning you can try to change one index.

Who is online

Users browsing this forum: PepeTheGreat and 64 guests