23 #include <boost/bind.hpp> 35 if ((fd_ = ::open(device.c_str(), O_WRONLY)) == -1) {
48 for (
unsigned i = 0; i < count; ++i) {
50 ::usleep( 1000 * length);
53 ::usleep( 1000 * delay);
61 params_.action =
false;
64 params_.length = length;
65 params_.count = count;
66 params_.delay = delay;
70 prefix_ void senf::Beeper::timeout()
75 params_.action =
false;
78 if (--params_.count > 0) {
80 params_.action =
true;
#define SENF_THROW_SYSTEM_EXCEPTION(desc)
bool start_beep(float freq)
start playing.
void beep_async(float freq, unsigned length, unsigned count=1, unsigned delay=100)
play beep asynchronous
void stop_beep()
stop playing.
static SENF_CLOCKSERVICE_CONSTEXPR clock_type milliseconds(int64_type const &v)
void timeout(ClockService::clock_type const &timeout, bool initiallyEnabled=true)
Beeper(std::string const &device="/dev/console")
Construct a new Beeper for the given device.
void beep_sync(float freq, unsigned length, unsigned count=1, unsigned delay=100)
play beep synchronous
Helper class to beep the pc speaker.