diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-07-11 15:11:28 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-07-11 15:11:28 +1000 |
| commit | a3eb2dd9dc2399ce9c22cd3b07f482f080976440 (patch) | |
| tree | 4a7883755d07b7d9a391d5b6e7858c0ab26e3bdd /src/tangara/app_console/app_console.cpp | |
| parent | a9d2335e1d86b3012789a440e7f0e71033393056 (diff) | |
| download | tangara-fw-a3eb2dd9dc2399ce9c22cd3b07f482f080976440.tar.gz | |
WIP improve bluetooth api and settings screen
Diffstat (limited to 'src/tangara/app_console/app_console.cpp')
| -rw-r--r-- | src/tangara/app_console/app_console.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/tangara/app_console/app_console.cpp b/src/tangara/app_console/app_console.cpp index f3593e1b..af9061fe 100644 --- a/src/tangara/app_console/app_console.cpp +++ b/src/tangara/app_console/app_console.cpp @@ -418,28 +418,21 @@ int CmdBtList(int argc, char** argv) { return 1; } - auto devices = AppConsole::sServices->bluetooth().KnownDevices(); + auto devices = AppConsole::sServices->bluetooth().knownDevices(); if (argc == 2) { int index = std::atoi(argv[1]); if (index < 0 || index >= devices.size()) { std::cout << "index out of range" << std::endl; return -1; } - drivers::bluetooth::MacAndName dev{ - .mac = devices[index].address, - .name = {devices[index].name.data(), devices[index].name.size()}, - }; - AppConsole::sServices->bluetooth().SetPreferredDevice(dev); + AppConsole::sServices->bluetooth().pairedDevice(devices[index]); } else { - std::cout << "mac\t\trssi\tname" << std::endl; + std::cout << "mac\t\tname" << std::endl; for (const auto& device : devices) { - for (size_t i = 0; i < device.address.size(); i++) { + for (size_t i = 0; i < device.mac.size(); i++) { std::cout << std::hex << std::setfill('0') << std::setw(2) - << static_cast<int>(device.address[i]); + << static_cast<int>(device.mac[i]); } - float perc = - (static_cast<double>(device.signal_strength) + 127.0) / 256.0 * 100; - std::cout << "\t" << std::fixed << std::setprecision(0) << perc << "%"; std::cout << "\t" << device.name << std::endl; } } |
