Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppressing some serial output from the scan whitelist example #640

Open
linxcow opened this issue Feb 15, 2024 · 3 comments
Open

suppressing some serial output from the scan whitelist example #640

linxcow opened this issue Feb 15, 2024 · 3 comments

Comments

@linxcow
Copy link

linxcow commented Feb 15, 2024

How can i suppress following output to my serial monitor ?
20:50:32.829 -> Service Data:
20:50:32.829 -> UUID: 0xfe2c, Data:

I just want to see the advertised lines.:
20:50:25.525 -> Advertised Device: Name: < snipped >

      class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {
        void onResult(BLEAdvertisedDevice* advertisedDevice) {
          if (!advertisedDevice->getName().empty()) {
             Serial.printf("Advertised Device: %s \n", advertisedDevice->toString().c_str());
          }
        }
      };

I've noticed only a few specific devices adds those extra lines , maybe something to do with the toString().c_str() conversion

      20:51:21.565 -> Advertised Device: Name: LE-SRS-XB13, Address: 70:0b:1f:d6:xx:xx, txPower: -10
      20:51:21.565 -> Service Data:
      20:51:21.565 -> UUID: 0xfe2c, Data:  
@h2zero
Copy link
Owner

h2zero commented Feb 18, 2024

You could just call getName and print the value. The toString method dumps more data.

@linxcow
Copy link
Author

linxcow commented Feb 18, 2024

Yes , but this was not my question.
I want to see all data on 1 line when name is not empty , some devices print on several lines.

@h2zero
Copy link
Owner

h2zero commented Feb 19, 2024

You'll need to implement your own version of toString to accomplish this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants