mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-23 22:39:22 -05:00
Beep-on-packet support in POCSAG app (#2061)
This commit is contained in:
parent
fe2fbb847f
commit
0db65ccb6b
@ -136,6 +136,10 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav)
|
||||
};
|
||||
|
||||
refresh_ui();
|
||||
|
||||
if (pmem::beep_on_packets())
|
||||
audio::set_rate(audio::Rate::Hz_24000);
|
||||
|
||||
audio::output::start();
|
||||
receiver_model.enable();
|
||||
baseband::set_pocsag();
|
||||
@ -304,6 +308,10 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {
|
||||
|
||||
// Set status icon color to indicate state machine state.
|
||||
image_status.set_foreground(get_status_color(pocsag_state));
|
||||
|
||||
if (pmem::beep_on_packets()) {
|
||||
baseband::request_audio_beep(1000, 24000, 60);
|
||||
}
|
||||
}
|
||||
|
||||
void POCSAGAppView::on_stats(const POCSAGStatsMessage* stats) {
|
||||
|
@ -361,6 +361,10 @@ void POCSAGProcessor::on_message(const Message* const message) {
|
||||
break;
|
||||
}
|
||||
|
||||
case Message::ID::AudioBeep:
|
||||
on_beep_message(*reinterpret_cast<const AudioBeepMessage*>(message));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -414,6 +418,10 @@ void POCSAGProcessor::send_packet() {
|
||||
shared_memory.application_queue.push(message);
|
||||
}
|
||||
|
||||
void POCSAGProcessor::on_beep_message(const AudioBeepMessage& message) {
|
||||
audio::dma::beep_start(message.freq, message.sample_rate, message.duration_ms);
|
||||
}
|
||||
|
||||
/* main **************************************************/
|
||||
|
||||
int main() {
|
||||
|
@ -212,6 +212,7 @@ class POCSAGProcessor : public BasebandProcessor {
|
||||
void reset();
|
||||
void send_stats() const;
|
||||
void send_packet();
|
||||
void on_beep_message(const AudioBeepMessage& message);
|
||||
|
||||
/* Set once app is ready to receive messages. */
|
||||
bool configured = false;
|
||||
|
Loading…
Reference in New Issue
Block a user