Skip to content

Commit

Permalink
Fixed examples, updated changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kdewald committed Jul 4, 2024
1 parent 2392971 commit 171a04c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The format is based on `Keep a Changelog`_, and this project adheres to `Semanti

**Fixed**

-
- (SimpleBluez) Fixed improper handling of non `org.Bluez.Service1` objects within a `org.bluez.Device1` object. *(Thanks Kober Engineering!)*


[0.7.X]
Expand Down
11 changes: 6 additions & 5 deletions examples/simpleble/cpp/connect/connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ int main() {

std::vector<SimpleBLE::Peripheral> peripherals;

adapter.set_callback_on_scan_found([&](SimpleBLE::Peripheral peripheral) { peripherals.push_back(peripheral); });
adapter.set_callback_on_scan_found([&](SimpleBLE::Peripheral peripheral) {
std::cout << "Found device: " << peripheral.identifier() << " [" << peripheral.address() << "]" << std::endl;
if (peripheral.is_connectable()) {
peripherals.push_back(peripheral);
}
});

adapter.set_callback_on_scan_start([]() { std::cout << "Scan started." << std::endl; });
adapter.set_callback_on_scan_stop([]() { std::cout << "Scan stopped." << std::endl; });
Expand All @@ -25,10 +30,6 @@ int main() {

std::cout << "The following connectable devices were found:" << std::endl;
for (size_t i = 0; i < peripherals.size(); i++) {
if (!peripherals[i].is_connectable()) {
continue;
}

std::cout << "[" << i << "] " << peripherals[i].identifier() << " [" << peripherals[i].address() << "]"
<< std::endl;
}
Expand Down
4 changes: 3 additions & 1 deletion examples/simpleble/cpp/notify/notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ int main() {

adapter.set_callback_on_scan_found([&](SimpleBLE::Peripheral peripheral) {
std::cout << "Found device: " << peripheral.identifier() << " [" << peripheral.address() << "]" << std::endl;
peripherals.push_back(peripheral);
if (peripheral.is_connectable()) {
peripherals.push_back(peripheral);
}
});

adapter.set_callback_on_scan_start([]() { std::cout << "Scan started." << std::endl; });
Expand Down
4 changes: 3 additions & 1 deletion examples/simpleble/cpp/read/read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ int main() {

adapter.set_callback_on_scan_found([&](SimpleBLE::Peripheral peripheral) {
std::cout << "Found device: " << peripheral.identifier() << " [" << peripheral.address() << "]" << std::endl;
peripherals.push_back(peripheral);
if (peripheral.is_connectable()) {
peripherals.push_back(peripheral);
}
});

adapter.set_callback_on_scan_start([]() { std::cout << "Scan started." << std::endl; });
Expand Down
4 changes: 3 additions & 1 deletion examples/simpleble/cpp/write/write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ int main() {

adapter.set_callback_on_scan_found([&](SimpleBLE::Peripheral peripheral) {
std::cout << "Found device: " << peripheral.identifier() << " [" << peripheral.address() << "]" << std::endl;
peripherals.push_back(peripheral);
if (peripheral.is_connectable()) {
peripherals.push_back(peripheral);
}
});

adapter.set_callback_on_scan_start([]() { std::cout << "Scan started." << std::endl; });
Expand Down

0 comments on commit 171a04c

Please sign in to comment.