Skip to content

BLE client fails to get serviceUUID #144

@s-oshidari

Description

@s-oshidari

First of all, thanks for sharing the library and all the contribution you made at arduino-esp32.

I'm testing BLE_server and BLE_client from your ESP32_BLE_Arduino repo with two of my ESP32 devices, one as a client, another as a server.

I copied the service uuid and characteristic uuid written on the server example and replaced the ones on the client example with them, so that the client can find the server.

On my serial monitor, I could fine a line

BLE Advertised Device found: Name: MyESP32, Address: ...

which would apparently came from
https://github.com/nkolban/ESP32_BLE_Arduino/blob/cb1ab4ea76af17d347cdadcc003d1fe53af12aa7/examples/BLE_client/BLE_client.ino#L74-L75

but doesn't seem to have reached at
https://github.com/nkolban/ESP32_BLE_Arduino/blob/cb1ab4ea76af17d347cdadcc003d1fe53af12aa7/examples/BLE_client/BLE_client.ino#L81

I looks like the if statement right before that returned false.

So I added some lines like these

Serial.print("haveServiceUUID: "); Serial.println(advertisedDevice.haveServiceUUID());
Serial.print("device's UUID: "); Serial.println(advertisedDevice.getServiceUUID().toString().c_str());

to somewhere around
https://github.com/nkolban/ESP32_BLE_Arduino/blob/cb1ab4ea76af17d347cdadcc003d1fe53af12aa7/examples/BLE_client/BLE_client.ino#L76

and this is what I got (I have replaced the <MAC_ADDRESS> part, it was correctly shown on the serial monitor)

BLE Advertised Device found: Name: MyESP32, Address: <MAC_ADDRESS>, txPower: -21
haveServiceUUID: 0
device's UUID: <NULL>

I don't have much experience in BLE environment. Maybe failing to get a service uuid is not a rare thing to happen in the first place.

Could you tell me if those two examples are still working at your environment and if so, is there anything I can try to get this working?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions