Skip to content

Payload used as string, thus "prints" adds garbage #7637

Closed
@Franck78

Description

@Franck78

Board

ESP32-S3

Device Description

homemade

Hardware Configuration

homemade

Version

latest master (checkout manually)

IDE Name

ARduino IDE

Operating System

linux

Flash frequency

40

PSRAM enabled

no

Upload speed

115200

Description

Hello
v2.0.6

this is the output of the demo program using BLE_client

https://github.com/espressif/arduino-esp32/blob/master/libraries/BLE/examples/BLE_client/BLE_client.ino

We are now connected to the BLE Server.
Notify callback for characteristic 0000ffe1-0000-1000-8000-00805f9b34fb of data length 2
data: AT⸮⸮⸮?�⸮$

The data length is correct, I recognize just an 'AT' command from the HC06.
Line 32 of the demo program uses the payload directly as a string (serial.print) .

Maybe just add a warning for readers: this is a payload interpreted wrongly as a string for simplicity of the demo.

Sketch

bool isNotify) {
    Serial.print("Notify callback for characteristic ");
    Serial.print(pBLERemoteCharacteristic->getUUID().toString().c_str());
    Serial.print(" of data length ");
    Serial.println(length);
    Serial.print("data: ");
    Serial.println((char*)pData);

Debug Message

x

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Area: BT&WifiBT & Wifi related issuesType: ExampleIssue is related to specific example.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions