Skip to content

Commit 7b4d468

Browse files
authored
Fix BTAdvertisedDeviceSet::toString() method output (#8691)
1 parent 2d6d285 commit 7b4d468

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ bool BTAdvertisedDeviceSet::haveRSSI() const { return m_haveRSSI; }
4141
std::string BTAdvertisedDeviceSet::toString() {
4242
std::string res = "Name: " + getName() + ", Address: " + std::string(getAddress().toString().c_str(), getAddress().toString().length());
4343
if (haveCOD()) {
44-
char val[6];
45-
snprintf(val, sizeof(val), "%d", getCOD());
46-
res += ", cod: ";
44+
char val[7]; //6 hex digits + null
45+
snprintf(val, sizeof(val), "%06x", getCOD() & 0xFFFFFF);
46+
res += ", cod: 0x";
4747
res += val;
4848
}
4949
if (haveRSSI()) {

0 commit comments

Comments
 (0)