SatCat5
satcat5::log::ToBeep Class Reference

Detailed Description

Respond to log messages by playing a few musical notes.

This class implements the log::EventHandler API, so it receives notifications for each Log message. For each such notification, it plays a short sequence of notes based on the message priority. A short cooldown mitigates excessive noise from rapid logging.

Definition at line 102 of file codec_rtttl.h.

#include <codec_rtttl.h>

Inheritance diagram for satcat5::log::ToBeep:
[legend]
Collaboration diagram for satcat5::log::ToBeep:
[legend]

Public Member Functions

 ToBeep (satcat5::io::RtttlDecoder *codec)
 Constructor binds this object to an RTTTL decoder.
 
void log_event (s8 priority, unsigned nbytes, const char *msg) override
 Callback for each formatted Log message.
 
void set_cooldown (unsigned msec)
 Set minimum time between beeps. More...
 

Protected Member Functions

void timer_event () override
 End-of-cooldown callback does nothing.
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 

Static Protected Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Protected Attributes

satcat5::io::RtttlDecoder *const m_codec
 
unsigned m_cooldown
 
bool m_enable
 

Private Member Functions

void query (unsigned elapsed_msec)
 

Private Attributes

satcat5::log::EventHandlerm_next
 
unsigned m_trem
 
unsigned m_tnext
 

Member Function Documentation

◆ set_cooldown()

void satcat5::log::ToBeep::set_cooldown ( unsigned  msec)
inline

Set minimum time between beeps.

Cooldown of zero disables beeps entirely.

Definition at line 114 of file codec_rtttl.h.


The documentation for this class was generated from the following files: