Reading characteristic values inside BLE_client notifyCallback

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Reading characteristic values inside BLE_client notifyCallback

Postby ahue32 » Wed Jan 10, 2018 10:15 am

I have two Adafruit Huzzah32 Feather boards with ESP32 modules on them. I want to connect both of them, one as a server sending data via notifications, the other one as a client receiving all changed values.

Code for server (I changed the BLE_uart example a little):

Code: Select all

/*
    Video: https://www.youtube.com/watch?v=oCMOYS71NIU
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleNotify.cpp
    Ported to Arduino ESP32 by Evandro Copercini

   Create a BLE server that, once we receive a connection, will send periodic notifications.
   The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
   Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE" 
   Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with  "NOTIFY"

   The design of creating the BLE server is:
   1. Create a BLE Server
   2. Create a BLE Service
   3. Create a BLE Characteristic on the Service
   4. Create a BLE Descriptor on the characteristic
   5. Start the service.
   6. Start advertising.

   In this example rxValue is the data received (only accessible inside that function).
   And txValue is the data to be sent, in this example just a byte incremented every second. 
*/
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

BLECharacteristic *pCharacteristic;
bool deviceConnected = false;
uint8_t txValue = 50;

// 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"
#define CHARACTERISTIC_UUID_TX "6E400003-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) {
      std::string rxValue = pCharacteristic->getValue();

      if (rxValue.length() > 0) {
        Serial.println("*********");
        Serial.print("Received Value: ");
        for (int i = 0; i < rxValue.length(); i++)
          Serial.print(rxValue[i]);

        Serial.println();
        Serial.println("*********");
      }
    }
};


void setup() {
  Serial.begin(115200);

  // Create the BLE Device
  BLEDevice::init("UART"); // Name must not be longer than 5 chars!!!
  
  // Create the BLE Server
  BLEServer *pServer = BLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());

  // Create the BLE Service
  BLEService *pService = pServer->createService(SERVICE_UUID);
  
  // Create a BLE Characteristic
  pCharacteristic = pService->createCharacteristic(
                      CHARACTERISTIC_UUID_TX,
                      BLECharacteristic::PROPERTY_NOTIFY|BLECharacteristic::PROPERTY_READ|BLECharacteristic::PROPERTY_WRITE
                    );

  BLE2902 *desc = new BLE2902();
  desc->setNotifications(true);
  pCharacteristic->addDescriptor(desc);
  
  BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                         CHARACTERISTIC_UUID_RX,
                                         BLECharacteristic::PROPERTY_WRITE
                                       );
  pCharacteristic->setReadProperty(true);
  pCharacteristic->setCallbacks(new MyCallbacks());

  // Start the service
  pService->start();
  pServer->getAdvertising()->addServiceUUID(SERVICE_UUID);
  // Start advertising
  pServer->getAdvertising()->start();
  Serial.println(pService->getUUID().toString().c_str());
  Serial.println("Waiting a client connection to notify...");
}

void loop() {

  if (deviceConnected) {
    Serial.printf("*** Sent Value: %d ***\n", txValue);
    //pCharacteristic->setValue(&txValue, 1);
    pCharacteristic->setValue("Hi");
    pCharacteristic->notify();
    txValue++;
  }
  delay(1000);
}
Code for client (made some changes to BLE_client example):

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("6E400001-B5A3-F393-E0A9-E50E24DCCA9E");
// The characteristic of the remote service we are interested in.
static BLEUUID    charUUID("6E400003-B5A3-F393-E0A9-E50E24DCCA9E");


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);
    std::string value = pBLERemoteCharacteristic->readValue();
    //Serial.println(pBLERemoteCharacteristic->readValue().c_str());

}

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);
    Serial.println(pRemoteService->toString().c_str());
    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.
   
    Serial.print("The characteristic value was: ");
     //std::string value = pRemoteCharacteristic->readValue(); // Funny thing: with this version the value "hi" is not displayed
    //Serial.println(value.c_str());
    Serial.println(pRemoteCharacteristic->readValue().c_str());    // But with this version it is ?!
    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());
    //Serial.print(advertisedDevice.haveServiceUUID());

    if(advertisedDevice.haveServiceUUID()){
      Serial.println(advertisedDevice.getServiceUUID().toString().c_str());
    }
    
    
    // We have found a device, let us now see if it contains the service we are looking for.
    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) {
    //Serial.println(pRemoteCharacteristic->readUInt8());
    String newValue = "Time since boot: " + String(millis()/1000);
    //Serial.println("Setting new characteristic value to \"" + newValue + "\"");
    //Serial.println(pRemoteCharacteristic->toString().c_str());
    // Set the characteristic's value to be the array of bytes that is actually a string.
    //pRemoteCharacteristic->writeValue(newValue.c_str(), newValue.length()); //did not want to mix up values
  }
  
  delay(1000); // Delay a second between loops.
} // End of loop
I am able to read the characteristic value the first time outside of the callback, but when I try to read it inside nothing happens afterwards.

This is the log of the server:

Code: Select all

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:812
load:0x40078000,len:0
load:0x40078000,len:11392
entry 0x40078a9c
[D][BLEDevice.cpp:58] createServer(): >> createServer
[D][BLEServer.cpp:297] registerApp(): >> registerApp - 0
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_REG_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_REG_EVT
[D][BLEUtils.cpp:1755] dumpGattServerEvent(): [status: ESP_GATT_OK, app_id: 0]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_REG_EVT
[D][BLEServer.cpp:301] registerApp(): << registerApp
[D][BLEDevice.cpp:61] createServer(): << createServer
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEServer.cpp:76] createService(): >> createService - 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_CREATE_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_CREATE_EVT
[D][BLEUtils.cpp:1680] dumpGattServerEvent(): [status: ESP_GATT_OK, service_handle: 40 0x28, service_id: [uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, inst_id: 0]]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_CREATE_EVT
[D][BLEService.cpp:160] setHandle(): >> setHandle - Handle=0x28, service UUID=6e400001-b5a3-f393-e0a9-e50e24dcca9e)
[D][BLEService.cpp:166] setHandle(): << setHandle
[D][BLEService.cpp:89] executeCreate(): << executeCreate
[D][BLEServer.cpp:93] createService(): << createService
[D][BLEService.cpp:188] addCharacteristic(): >> addCharacteristic()
[D][BLEService.cpp:191] addCharacteristic(): Adding characteristic: uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e to service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x28
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEService.cpp:203] addCharacteristic(): << addCharacteristic()
[D][BLECharacteristic.cpp:71] addDescriptor(): >> addDescriptor(): Adding UUID: 00002902-0000-1000-8000-00805f9b34fb, handle: 0xffff to UUID: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 0xffff Read Write Notify 
[D][BLECharacteristic.cpp:73] addDescriptor(): << addDescriptor()
[D][BLEService.cpp:188] addCharacteristic(): >> addCharacteristic()
[D][BLEService.cpp:191] addCharacteristic(): Adding characteristic: uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e to service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x28
[D][BLEService.cpp:203] addCharacteristic(): << addCharacteristic()
[D][BLECharacteristic.cpp:557] setCallbacks(): >> setCallbacks: 0x3ffdb0bc
[D][BLECharacteristic.cpp:559] setCallbacks(): << setCallbacks
[D][BLEService.cpp:125] start(): >> start(): Starting service (esp_ble_gatts_start_service): UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x28
[D][BLECharacteristic.cpp:82] executeCreate(): >> executeCreate()
[D][BLECharacteristic.cpp:93] executeCreate(): Registering characteristic (esp_ble_gatts_add_char): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x28
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1633] dumpGattServerEvent(): [status: ESP_GATT_OK, attr_handle: 42 0x2a, service_handle: 40 0x28, char_uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLECharacteristic.cpp:574] setHandle(): >> setHandle: handle=0x2a, characteristic uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e
[D][BLECharacteristic.cpp:576] setHandle(): << setHandle
[D][BLEDescriptor.cpp:63] executeCreate(): >> executeCreate(): UUID: 00002902-0000-1000-8000-00805f9b34fb, handle: 0xffff
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_ADD_CHAR_DESCR_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_ADD_CHAR_DESCR_EVT
[D][BLEUtils.cpp:1621] dumpGattServerEvent(): [status: ESP_GATT_OK, attr_handle: 43 0x2b, service_handle: 40 0x28, char_uuid: 00002902-0000-1000-8000-00805f9b34fb]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_ADD_CHAR_DESCR_EVT
[D][BLEDescriptor.cpp:275] setHandle(): >> setHandle(0x2b): Setting descriptor handle to be 0x2b
[D][BLEDescriptor.cpp:277] setHandle(): << setHandle()
[D][BLEDescriptor.cpp:87] executeCreate(): << executeCreate
[D][BLECharacteristic.cpp:134] executeCreate(): << executeCreate
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLECharacteristic.cpp:82] executeCreate(): >> executeCreate()
[D][BLECharacteristic.cpp:93] executeCreate(): Registering characteristic (esp_ble_gatts_add_char): uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e, service: UUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, handle: 0x28
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLEUtils.cpp:1633] dumpGattServerEvent(): [status: ESP_GATT_OK, attr_handle: 45 0x2d, service_handle: 40 0x28, char_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_ADD_CHAR_EVT
[D][BLECharacteristic.cpp:574] setHandle(): >> setHandle: handle=0x2d, characteristic uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e
[D][BLECharacteristic.cpp:576] setHandle(): << setHandle
[D][BLECharacteristic.cpp:134] executeCreate(): << executeCreate
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_START_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_START_EVT
[D][BLEUtils.cpp:1769] dumpGattServerEvent(): [status: ESP_GATT_OK, service_handle: 0x28]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_START_EVT
[D][BLEService.cpp:151] start(): << start()
[D][BLEAdvertising.cpp:86] start(): >> start
[D][BLEAdvertising.cpp:98] start(): - advertising service: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEAdvertising.cpp:137] start(): << start
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT
6e400001-b5a3-f393-e0a9-e50e24dcca9e[D][BLEUtils.cpp:1075] dumpGapEvent(): [status: 0]

[D][BLEServer.cpp:134] handleGAPEvent(): BLEServer ... handling GAP event!
Waiting a client connection to notify...
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RSP_DATA_SET_COMPLETE_EVT
[D][BLEUtils.cpp:1261] dumpGapEvent(): [status: 0]
[D][BLEServer.cpp:134] handleGAPEvent(): BLEServer ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_ADV_START_COMPLETE_EVT
[D][BLEUtils.cpp:1099] dumpGapEvent(): [status: 0]
[D][BLEServer.cpp:134] handleGAPEvent(): BLEServer ... handling GAP event!
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_CONNECT_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_CONNECT_EVT
[D][BLEUtils.cpp:1671] dumpGattServerEvent(): [conn_id: 0, remote_bda: 30:ae:a4:24:d0:c6]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_CONNECT_EVT
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
*** Sent Value: 50 ***
[D][BLECharacteristic.cpp:629] setValue(): >> setValue: length=2, data=4869, characteristic UUID=6e400003-b5a3-f393-e0a9-e50e24dcca9e
[D][BLECharacteristic.cpp:636] setValue(): << setValue
[D][BLECharacteristic.cpp:490] notify(): >> notify: length: 2
[D][BLECharacteristic.cpp:531] notify(): << notify
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_CONF_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_CONF_EVT
[D][BLEUtils.cpp:1656] dumpGattServerEvent(): [status: ESP_GATT_OK, conn_id: 0x00]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_CONF_EVT
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_READ_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_READ_EVT
[D][BLEUtils.cpp:1741] dumpGattServerEvent(): [conn_id: 0, trans_id: 1, bda: 30:ae:a4:24:d0:c6, handle: 0x2a, is_long: 0, need_rsp:1]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_READ_EVT
[D][BLECharacteristic.cpp:324] handleGATTServerEvent(): - Testing: 0x2a == 0x2a
[D][BLECharacteristic.cpp:352] handleGATTServerEvent(): Sending a response (esp_ble_gatts_send_response)
[D][BLECharacteristic.cpp:387] handleGATTServerEvent():  - Data: length=2, data=4869, offset=0
[D][BLECharacteristic.cpp:324] handleGATTServerEvent(): - Testing: 0x2a == 0x2d
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_RESPONSE_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_RESPONSE_EVT
[D][BLEUtils.cpp:1748] dumpGattServerEvent(): [status: ESP_GATT_OK, handle: 0x2a]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_RESPONSE_EVT
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_READ_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_READ_EVT
[D][BLEUtils.cpp:1741] dumpGattServerEvent(): [conn_id: 0, trans_id: 2, bda: 30:ae:a4:24:d0:c6, handle: 0x2a, is_long: 0, need_rsp:1]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_READ_EVT
[D][BLECharacteristic.cpp:324] handleGATTServerEvent(): - Testing: 0x2a == 0x2a
[D][BLECharacteristic.cpp:352] handleGATTServerEvent(): Sending a response (esp_ble_gatts_send_response)
[D][BLECharacteristic.cpp:387] handleGATTServerEvent():  - Data: length=2, data=4869, offset=0
[D][BLECharacteristic.cpp:324] handleGATTServerEvent(): - Testing: 0x2a == 0x2d
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_RESPONSE_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_RESPONSE_EVT
[D][BLEUtils.cpp:1748] dumpGattServerEvent(): [status: ESP_GATT_OK, handle: 0x2a]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_RESPONSE_EVT
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
*** Sent Value: 51 ***
[D][BLECharacteristic.cpp:629] setValue(): >> setValue: length=2, data=4869, characteristic UUID=6e400003-b5a3-f393-e0a9-e50e24dcca9e
[D][BLECharacteristic.cpp:636] setValue(): << setValue
[D][BLECharacteristic.cpp:490] notify(): >> notify: length: 2
[D][BLECharacteristic.cpp:531] notify(): << notify
[D][BLEDevice.cpp:80] gattServerEventHandler(): gattServerEventHandler [esp_gatt_if: 3] ... ESP_GATTS_CONF_EVT
[D][BLEUtils.cpp:1611] dumpGattServerEvent(): GATT ServerEvent: ESP_GATTS_CONF_EVT
[D][BLEUtils.cpp:1656] dumpGattServerEvent(): [status: ESP_GATT_OK, conn_id: 0x00]
[D][BLEServer.cpp:175] handleGATTServerEvent(): >> handleGATTServerEvent: ESP_GATTS_CONF_EVT
[D][BLEServer.cpp:287] handleGATTServerEvent(): << handleGATTServerEvent
*** Sent Value: 52 ***
...
As you can see the response value is wrong and after the first send there happens much less. The server continues to send notifications but the log is the same as for value 51.
Last edited by ahue32 on Wed Jan 10, 2018 10:16 am, edited 1 time in total.

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Re: Reading characteristic values inside BLE_client notifyCallback

Postby ahue32 » Wed Jan 10, 2018 10:16 am

Continuation of question:


Log of client:

Code: Select all

8
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_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:812
load:0x40078000,len:0
load:0x40078000,len:11392
entry 0x40078a9c
Starting Arduino BLE Client application...
[D][BLEScan.cpp:187] start(): >> start(duration=30)
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT
[D][BLEUtils.cpp:1205] dumpGapEvent(): [status: 0]
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_START_COMPLETE_EVT
[D][BLEUtils.cpp:1272] dumpGapEvent(): [status: 0]
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -71, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:353] setRSSI(): - setRSSI(): rssi: -71
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 060001092000e2fd08a6a12da9219ffbd086d33ffdeec5a71d01c1fdeb
[D][BLEAdvertisedDevice.cpp:330] setManufacturerData(): - manufacturer data: 060001092000e2fd08a6a12da9219ffbd086d33ffdeec5a71d01c1fdeb
BLE Advertised Device found: Name: , Address: 37:46:ff:29:c3:2a, manufacturer data: 060001092000e2fd08a6a12da9219ffbd086d33ffdeec5a71d01c1fdeb
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 43:86:a0:4d:99:f1, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -79, 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:353] setRSSI(): - setRSSI(): rssi: -79
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 1a
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 9, data: 4c0010050a10d6b6e4
[D][BLEAdvertisedDevice.cpp:330] setManufacturerData(): - manufacturer data: 4c0010050a10d6b6e4
BLE Advertised Device found: Name: , Address: 43:86:a0:4d:99:f1, manufacturer data: 4c0010050a10d6b6e4
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -82, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:353] setRSSI(): - setRSSI(): rssi: -82
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 06000109200008437818e33a2c179a4a989d582cf3572498ff4c47247d
[D][BLEAdvertisedDevice.cpp:330] setManufacturerData(): - manufacturer data: 06000109200008437818e33a2c179a4a989d582cf3572498ff4c47247d
BLE Advertised Device found: Name: , Address: 2c:83:6c:dd:2f:64, manufacturer data: 06000109200008437818e33a2c179a4a989d582cf3572498ff4c47247d
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -73, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:353] setRSSI(): - setRSSI(): rssi: -73
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 29, data: 0600010920009f4e68ee88576caf9dd0d42967f4fc94605d4c6bfa02ad
[D][BLEAdvertisedDevice.cpp:330] setManufacturerData(): - manufacturer data: 0600010920009f4e68ee88576caf9dd0d42967f4fc94605d4c6bfa02ad
BLE Advertised Device found: Name: , Address: 19:31:4f:5b:4d:b4, manufacturer data: 0600010920009f4e68ee88576caf9dd0d42967f4fc94605d4c6bfa02ad
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEScan.cpp:101] handleGAPEvent(): Ignoring 37:46:ff:29:c3:2a, already seen it.
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7a:0e:79:59:87:9a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -75, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 23, scan_rsp_len: 0
[D][BLEAdvertisedDevice.cpp:353] setRSSI(): - setRSSI(): rssi: -75
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0xff (ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE), length: 18, data: 4c000c0e0070eef867b8254de364aa622185
[D][BLEAdvertisedDevice.cpp:330] setManufacturerData(): - manufacturer data: 4c000c0e0070eef867b8254de364aa622185
BLE Advertised Device found: Name: , Address: 7a:0e:79:59:87:9a, manufacturer data: 4c000c0e0070eef867b8254de364aa622185
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -33, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEAdvertisedDevice.cpp:353] setRSSI(): - setRSSI(): rssi: -33
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x09 (ESP_BLE_AD_TYPE_NAME_CMPL), length: 4, data: 55415254
[D][BLEAdvertisedDevice.cpp:342] setName(): - setName(): name: UART
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x0a (ESP_BLE_AD_TYPE_TX_PWR), length: 1, data: eb
[D][BLEAdvertisedDevice.cpp:393] setTXPower(): - txPower: -21
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x07 (ESP_BLE_AD_TYPE_128SRV_CMPL), length: 16, data: 9ecadc240ee5a9e093f3a3b50100406e
[D][BLEAdvertisedDevice.cpp:382] setServiceUUID(): - addServiceUUID(): serviceUUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[D][BLEAdvertisedDevice.cpp:219] parseAdvertisement(): Type: 0x01 (ESP_BLE_AD_TYPE_FLAG), length: 1, data: 06
BLE Advertised Device found: Name: UART, Address: 30:ae:a4:26:37:82, serviceUUID: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, txPower: -21
6e400001-b5a3-f393-e0a9-e50e24dcca9e
Found our device!  address: [D][BLEScan.cpp:223] stop(): >> stop()
[D][BLEScan.cpp:213] start(): << start()
[D][BLEScan.cpp:236] stop(): << stop()
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -83, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -40, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -76, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -40, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 43:86:a0:4d:99:f1, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -78, 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][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7a:0e:79:59:87:9a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -81, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 23, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -70, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -82, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -76, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -39, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -39, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -73, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -72, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
Forming a connection to [D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
30:ae:a4:26:37:82
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
 - Created client
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:75] connect(): >> connect(30:ae:a4:26:37:82)
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -76, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -38, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 43:86:a0:4d:99:f1, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, 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][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -39, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -79, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -74, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -73, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -82, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -79, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 54:b5:23:a6:1c:88, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, 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][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7a:0e:79:59:87:9a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -75, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 23, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -77, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -38, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -38, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -78, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -38, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -75, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 7a:0e:79:59:87:9a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, rssi: -81, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 23, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -26, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -72, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -81, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -30, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1828] eventTypeToString(): Unknown esp_ble_evt_type_t: 253 (0xfd)
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 43:86:a0:4d:99:f1, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: *** Unknown ***, 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][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -39, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 2c:83:6c:dd:2f:64, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -79, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 19:31:4f:5b:4d:b4, 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: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 30:ae:a4:26:37:82, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_PUBLIC, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -39, ble_adv: ??, flag: 6 ([LE General Discoverable Mode] [BR/EDR Not Supported] ), num_resps: 1, adv_data_len: 30, scan_rsp_len: 30
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_RESULT_EVT
[D][BLEUtils.cpp:1241] dumpGapEvent(): search_evt: ESP_GAP_SEARCH_INQ_RES_EVT, bda: 37:46:ff:29:c3:2a, dev_type: ESP_BT_DEVICE_TYPE_BLE, ble_addr_type: BLE_ADDR_TYPE_RANDOM, ble_evt_type: ESP_BLE_EVT_CONN_ADV, rssi: -73, ble_adv: ??, flag: 0 (), num_resps: 1, adv_data_len: 31, scan_rsp_len: 0
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
[D][BLEUtils.cpp:1067] dumpGapEvent(): Received a GAP event: ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT
[D][BLEUtils.cpp:1284] dumpGapEvent(): [status: 0]
[D][BLEClient.cpp:361] handleGAPEvent(): BLEClient ... handling GAP event!
E (8125) BT: btc_gattc_call_handler()
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_EVT
[D][BLEUtils.cpp:1516] dumpGattClientEvent(): [status: ESP_GATT_OK, app_id: 0x0]
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_CONNECT_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_CONNECT_EVT
[D][BLEUtils.cpp:1374] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82]
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_OPEN_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_OPEN_EVT
[D][BLEUtils.cpp:1469] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, remote_bda: 30:ae:a4:26:37:82, mtu: 23]
[D][BLEClient.cpp:104] connect(): << connect(), rc=1
 - Connected to server
[D][BLEClient.cpp:298] getService(): >> getService: uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[D][BLEClient.cpp:334] getServices(): >> getServices
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1568] dumpGattClientEvent(): [conn_id: 0, start_handle: 1 0x01, end_handle: 5 0x05, srvc_id: uuid: 00001801-0000-1000-8000-00805f9b34fb, inst_id: 1
[D][BLERemoteService.cpp:29] BLERemoteService(): >> BLERemoteService()
[D][BLERemoteService.cpp:37] BLERemoteService(): << BLERemoteService()
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1568] dumpGattClientEvent(): [conn_id: 0, start_handle: 20 0x14, end_handle: 28 0x1c, srvc_id: uuid: 00001800-0000-1000-8000-00805f9b34fb, inst_id: 1
[D][BLERemoteService.cpp:29] BLERemoteService(): >> BLERemoteService()
[D][BLERemoteService.cpp:37] BLERemoteService(): << BLERemoteService()
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_SEARCH_RES_EVT
[D][BLEUtils.cpp:1568] dumpGattClientEvent(): [conn_id: 0, start_handle: 40 0x28, end_handle: 65535 0xffff, srvc_id: uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, inst_id: 1
[D][BLERemoteService.cpp:29] BLERemoteService(): >> BLERemoteService()
[D][BLERemoteService.cpp:37] BLERemoteService(): << BLERemoteService()
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_SEARCH_CMPL_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_SEARCH_CMPL_EVT
[D][BLEUtils.cpp:1547] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0]
[D][BLEClient.cpp:348] getServices(): << getServices
[D][BLEClient.cpp:311] getService(): << getService: found the service with uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
Service: uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e, start_handle: 40 0x28, end_handle: 65535 0xffff
 - Found our service
[D][BLERemoteService.cpp:165] retrieveCharacteristics(): >> getCharacteristics() for service: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
[D][BLERemoteService.cpp:250] retrieveCharacteristics(): Found a characteristic: Handle: 42, UUID: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
[D][BLERemoteCharacteristic.cpp:40] BLERemoteCharacteristic(): >> BLERemoteCharacteristic: handle: 42 0x42, uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
[D][BLERemoteCharacteristic.cpp:283] retrieveDescriptors(): >> retrieveDescriptors() for characteristic: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
[E][BLERemoteCharacteristic.cpp:314] retrieveDescriptors():
[D][BLERemoteCharacteristic.cpp:315] retrieveDescriptors(): Found a descriptor: Handle: 43, UUID: 00002902-0000-1000-8000-00805f9b34fb
[D][BLERemoteCharacteristic.cpp:329] retrieveDescriptors(): << retrieveDescriptors(): Found 1 descriptors.
[D][BLERemoteCharacteristic.cpp:48] BLERemoteCharacteristic(): << BLERemoteCharacteristic
[D][BLERemoteService.cpp:250] retrieveCharacteristics(): Found a characteristic: Handle: 45, UUID: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[D][BLERemoteCharacteristic.cpp:40] BLERemoteCharacteristic(): >> BLERemoteCharacteristic: handle: 45 0x45, uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[D][BLERemoteCharacteristic.cpp:283] retrieveDescriptors(): >> retrieveDescriptors() for characteristic: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
[E][BLERemoteCharacteristic.cpp:307] retrieveDescriptors(): esp_ble_gattc_get_all_descr: ESP_GATT_NOT_FOUND
[D][BLERemoteCharacteristic.cpp:329] retrieveDescriptors(): << retrieveDescriptors(): Found 0 descriptors.
[D][BLERemoteCharacteristic.cpp:48] BLERemoteCharacteristic(): << BLERemoteCharacteristic
[D][BLERemoteService.cpp:266] retrieveCharacteristics(): << getCharacteristics()
 - Found our characteristic
[D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1493] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, handle: 42 0x2a, value_len: 2]
[D][BLERemoteCharacteristic.cpp:455] readValue(): << readValue(): length: 2
The characteristic value was: [D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1493] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, handle: 42 0x2a, value_len: 2]
[D][BLERemoteCharacteristic.cpp:455] readValue(): << readValue(): length: 2
Hi
[D][BLERemoteCharacteristic.cpp:472] registerForNotify(): >> registerForNotify(): Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_FOR_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_FOR_NOTIFY_EVT
[D][BLEUtils.cpp:1532] dumpGattClientEvent(): [status: ESP_GATT_OK, handle: 42 0x2a]
[D][BLERemoteCharacteristic.cpp:503] registerForNotify(): << registerForNotify()
We are now connected to the BLE Server.
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1451] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82, handle: 42 0x2a, value_len: 2, is_notify: 1]
[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
[D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a

Is it possible at all to read characteristic values inside of notification callbacks? I am able to read every characteristic value if I do it in loop() but that does not make sense to me. What do I need to do to make it work?

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

Re: Reading characteristic values inside BLE_client notifyCallback

Postby chegewara » Wed Jan 10, 2018 10:57 am

This is what you are sending all the time in loop from server thru notifications:

Code: Select all

    pCharacteristic->setValue("Hi");
    pCharacteristic->notify();
    
As you can see your value is constant and its confirmed by this log:

Code: Select all

[D][BLECharacteristic.cpp:629] setValue(): >> setValue: length=2, data=4869, characteristic UUID=6e400003-b5a3-f393-e0a9-e50e24dcca9e
Capital 'H' is 0x48 and 'i' is 0x69 in ASCII table.

Now what client is reading is here:

Code: Select all

[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1493] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, handle: 42 0x2a, value_len: 2]
[D][BLERemoteCharacteristic.cpp:455] readValue(): << readValue(): length: 2
Hi
Here you should receive and print notification value:

Code: Select all

[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
[D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a
and you are receiving it but you have commented out this line:

Code: Select all

  //Serial.println(pBLERemoteCharacteristic->readValue().c_str());

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Re: Reading characteristic values inside BLE_client notifyCallback

Postby ahue32 » Wed Jan 10, 2018 11:45 am

chegewara wrote: and you are receiving it but you have commented out this line:

Code: Select all

  //Serial.println(pBLERemoteCharacteristic->readValue().c_str());
When I comment in this line the log looks the same and nothing happens afterwards. The point is, if

Code: Select all

std::string value = pBLERemoteCharacteristic->readValue();
is commented out, the log from the client looks like this:

Code: Select all

...
 - Found our characteristic
[D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1493] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, handle: 42 0x2a, value_len: 2]
[D][BLERemoteCharacteristic.cpp:455] readValue(): << readValue(): length: 2
The characteristic value was: [D][BLERemoteCharacteristic.cpp:433] readValue(): >> readValue(): uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_READ_CHAR_EVT
[D][BLEUtils.cpp:1493] dumpGattClientEvent(): [status: ESP_GATT_OK, conn_id: 0, handle: 42 0x2a, value_len: 2]
[D][BLERemoteCharacteristic.cpp:455] readValue(): << readValue(): length: 2
Hi
[D][BLERemoteCharacteristic.cpp:472] registerForNotify(): >> registerForNotify(): Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_REG_FOR_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_REG_FOR_NOTIFY_EVT
[D][BLEUtils.cpp:1532] dumpGattClientEvent(): [status: ESP_GATT_OK, handle: 42 0x2a]
[D][BLERemoteCharacteristic.cpp:503] registerForNotify(): << registerForNotify()
We are now connected to the BLE Server.
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1451] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82, handle: 42 0x2a, value_len: 2, is_notify: 1]
[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1451] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82, handle: 42 0x2a, value_len: 2, is_notify: 1]
[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1451] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82, handle: 42 0x2a, value_len: 2, is_notify: 1]
[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
[D][BLEDevice.cpp:105] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 3] ... ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1344] dumpGattClientEvent(): GATT Event: ESP_GATTC_NOTIFY_EVT
[D][BLEUtils.cpp:1451] dumpGattClientEvent(): [conn_id: 0, remote_bda: 30:ae:a4:26:37:82, handle: 42 0x2a, value_len: 2, is_notify: 1]
[D][BLERemoteCharacteristic.cpp:173] gattClientEventHandler(): Invoking callback for notification on characteristic Characteristic: uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e, handle: 42 0x2a, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
...
There is a notification once every second, but if I read the value there is just one received notification and nothing afterwards.

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

Re: Reading characteristic values inside BLE_client notifyCallback

Postby chegewara » Wed Jan 10, 2018 12:21 pm

This log looks like different. As you can see in first client log there was this log line:
Notify callback for characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e of data length 2
and it comes from this part of code:

Code: Select all

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);
Which means notification works and is handled. Now you just uncommented one line and notifyCallback seems its not to be called. That odd. Im running just now very similar code. My code is compilation BLE_notify with BLE_client into one application and everything is working. Only difference can be in ESP32BLE library version, because im using library cloned from here https://github.com/nkolban/esp32-snippets and prepared to work with arduino and im can guess you are using library gathered with library manager in arduino-ide. I will try to make test with that library little bit later today.

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Re: Reading characteristic values inside BLE_client notifyCallback

Postby ahue32 » Mon Jan 15, 2018 8:56 am

I'm using a workaround now where I set a flag inside the callback and check the value of the characteristic in loop. As I use core 0 only for Bluetooth the response time is ok.

ahue32
Posts: 16
Joined: Mon Nov 06, 2017 10:09 am

Re: Reading characteristic values inside BLE_client notifyCallback

Postby ahue32 » Mon Sep 17, 2018 7:57 am

I had a look inside BLERemoteCharacteristic.cpp and found the following problem:

In the 'readValue()' method, there is a call to take the semaphore and afterwards one to wait. It seems that the wait is never called. As far as I understand semaphores, it is because in 'm_semaphoreReadCharEvt.take("readValue");' there is an infinite blocking of the semaphore and it never gets released. If I add 'm_semaphoreReadCharEvt.give();' before 'm_semaphoreReadCharEvt.wait("readValue");' then it works.

Code: Select all

/**
 * @brief Read the value of the remote characteristic.
 * @return The value of the remote characteristic.
 */
std::string BLERemoteCharacteristic::readValue() {
	ESP_LOGD(LOG_TAG, ">> readValue(): uuid: %s, handle: %d 0x%.2x", getUUID().toString().c_str(), getHandle(), getHandle());

	// Check to see that we are connected.
	if (!getRemoteService()->getClient()->isConnected()) {
		ESP_LOGE(LOG_TAG, "Disconnected");
		throw BLEDisconnectedException();
	}
	
	m_semaphoreReadCharEvt.take("readValue");
	ESP_LOGD(LOG_TAG, "next1"); \\ Messages to find out when exactly the program stops. 
	// Ask the BLE subsystem to retrieve the value for the remote hosted characteristic.
	// This is an asynchronous request which means that we must block waiting for the response
	// to become available.
	esp_err_t errRc = ::esp_ble_gattc_read_char(
		m_pRemoteService->getClient()->getGattcIf(),
		m_pRemoteService->getClient()->getConnId(),    // The connection ID to the BLE server
		getHandle(),                                   // The handle of this characteristic
		ESP_GATT_AUTH_REQ_NONE);                       // Security
	ESP_LOGD(LOG_TAG, "next2"); \\ Messages to find out when exactly the program stops.
	if (errRc != ESP_OK) {
		ESP_LOGE(LOG_TAG, "esp_ble_gattc_read_char: rc=%d %s", errRc, GeneralUtils::errorToString(errRc));
		return "";
	}
	ESP_LOGD(LOG_TAG, "next3"); \\ Messages to find out when exactly the program stops. 
	m_semaphoreReadCharEvt.give(); \\ I put that in and now it works
	// Block waiting for the event that indicates that the read has completed.  When it has, the std::string found
	// in m_value will contain our data.
	m_semaphoreReadCharEvt.wait("readValue");
	ESP_LOGD(LOG_TAG, "next4"); \\ Messages to find out when exactly the program stops. 
	ESP_LOGD(LOG_TAG, "<< readValue(): length: %d", m_value.length());
	
	return m_value;
} // readValue

I don't know if this 'm_semaphoreReadCharEvt.give();' may lead to any other bad behaviour. If you encounter anything that is strange or know a reason why this is not an adequate solution please let me know.

mkarpicki
Posts: 1
Joined: Thu Feb 18, 2021 12:48 am

Re: Reading characteristic values inside BLE_client notifyCallback

Postby mkarpicki » Thu Feb 18, 2021 12:50 am

Solution worked for me. Thnx!

Who is online

Users browsing this forum: mgsecord62 and 27 guests