refuse pair enable requests while session is running
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <chrono>
|
||||
#include <format>
|
||||
#include <ranges>
|
||||
#include <string_view>
|
||||
#include <systemd/sd-bus.h>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -196,6 +197,12 @@ void pair(int duration)
|
||||
if (ret < 0)
|
||||
throw std::system_error(-ret, std::system_category(), "Failed to read PIN");
|
||||
|
||||
if (std::string_view(pin) == "")
|
||||
{
|
||||
std::cout << "Cannot enable pairing while session is active." << pin << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "PIN: " << pin << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user