more dump

This commit is contained in:
James 2024-04-23 20:38:04 +01:00
parent f3157614d3
commit 28f86e8ecc

View File

@ -31,7 +31,16 @@ void setup() {
std::map<std::string, BLERemoteCharacteristic*>* pChars = pRemoteService->getCharacteristics(); std::map<std::string, BLERemoteCharacteristic*>* pChars = pRemoteService->getCharacteristics();
for (auto &myChar : *pChars) { for (auto &myChar : *pChars) {
String properties = getCharacteristicProperties(myChar.second); String properties = getCharacteristicProperties(myChar.second);
Serial.println("\tCharacteristic: " + String(myChar.first.c_str()) + " | Properties: " + properties); Serial.print("\tCharacteristic: " + String(myChar.first.c_str()) + " | Properties: " + properties);
// Read descriptors of the characteristic
std::map<std::string, BLERemoteDescriptor*>* pDescs = myChar.second->getDescriptors();
for (auto &desc : *pDescs) {
std::string descValue = desc.second->readValue();
Serial.print(" | Descriptor: " + String(desc.first.c_str()) + " Value: " + String(descValue.c_str()));
}
Serial.println();
} }
} }
pClient->disconnect(); pClient->disconnect();
@ -48,8 +57,8 @@ String getCharacteristicProperties(BLERemoteCharacteristic* pChar) {
if (pChar->canWriteNoResponse()) propDesc += "write_no_resp "; if (pChar->canWriteNoResponse()) propDesc += "write_no_resp ";
if (pChar->canNotify()) propDesc += "notify "; if (pChar->canNotify()) propDesc += "notify ";
if (pChar->canIndicate()) propDesc += "indicate "; if (pChar->canIndicate()) propDesc += "indicate ";
propDesc.trim(); // This modifies propDesc in place propDesc.trim();
return propDesc; // Return the modified string return propDesc;
} }
void loop() { void loop() {