Skip to content

Can't access to Service Data in the GATT #846

Open
@JpEncausse

Description

@JpEncausse

Operating System

Windows 11

IDE version

PlatformIO

Board

seeed-xiao-afruitnrf52-nrf52840-sense

BSP version

adafruit/Adafruit BluefruitLE nRF51@^1.10.0

Sketch

This code was suggested by ChatGPT in loop ...

Option 1

BLEClientService pixelService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
BLEClientCharacteristic pixelCharacteristic("6e400003-b5a3-f393-e0a9-e50e24dcca9e");

void PixelDiceManager::connectCallback(uint16_t conn_handle) {
  BLEConnection* connection = Bluefruit.Connection(conn_handle);
  char central_name[32] = { 0 };
  connection->getPeerName(central_name, sizeof(central_name));
  Serial.print("Connecté à ");
  Serial.println(central_name);

  delay(100);
  if (pixelService.discover(conn_handle)) {
    if (pixelCharacteristic.discover()) {
      pixelCharacteristic.setNotifyCallback(notif_callback_wrapper);
      pixelCharacteristic.enableNotify();
      Serial.println("Abonné aux notifications du dé Pixel.");
    } else {
      Serial.println("Caractéristique non trouvée.");
      Bluefruit.disconnect(conn_handle);
    }
  } else {
    Serial.println("Service non trouvé.");
    Bluefruit.disconnect(conn_handle);
  }
}

Option 2

BLEClientUart clientUart;
void bleuart_rx_callback(BLEClientUart& uart_svc) {
  Serial.print("Données reçues : ");
  while (uart_svc.available()) {
    Serial.print((char)uart_svc.read());
  }
  Serial.println();
}

void PixelDiceManager::connectCallback(uint16_t conn_handle) {
  Serial.println("Connecté");

  if (clientUart.discover(conn_handle)) {
    Serial.println("Service BLE UART trouvé");
    clientUart.enableTXD();
    clientUart.setRxCallback(bleuart_rx_callback);
    clientUart.enableTXD();
    Serial.println("Prêt à recevoir des données");
  } else {
    Serial.println("Service BLE UART non trouvé");
    Bluefruit.disconnect(conn_handle);
  }
}

What happened ?

I try to read data from a BLE device using Bluefruit

  • I correctly have access to Advertiser Data
  • I can connect to the device
  • I can't discover the Service Data
  • It works with ESP-32 BLE library

The protocol is described here

According to ChatGPT

  • the Service Data can't be find and should require GATT level access or something similar
  • the nRF lib see the service and ESP-32 BLE library also works
  • the weird things? is that ServiceUUID is same as notifUUID 6e400001-b5a3-f393-e0a9-e50e24dcca9e

I don't know how to do to perform list services or go deeper to get that service or notification to validate if it's a bug, a limitation of the library or if a workaround is possible ?

How to reproduce ?

It requires the PixelDice to test

Debug Log

No response

Screenshots

Here is the nRF screenshot
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions