diff --git a/src/frontend/assets/index.html b/src/frontend/assets/index.html index 4e368cb..63862ab 100644 --- a/src/frontend/assets/index.html +++ b/src/frontend/assets/index.html @@ -217,6 +217,9 @@

Status

Connected
+
+ Queue: {{status.queue}} +
diff --git a/src/frontend/assets/style.css b/src/frontend/assets/style.css index cf48f78..556076c 100644 --- a/src/frontend/assets/style.css +++ b/src/frontend/assets/style.css @@ -159,18 +159,30 @@ button.red:active { background-color: ##B71C1C; } padding: 3px 5px; } -.on-air { +.status.on-air { border-color: #F44336; background-color: #F44336; color: #fff; } -.connected { +.status.connected { border-color: #4CAF50; background-color: #4CAF50; color: #fff; } +.status.active { + border-color: #2196F3; + background-color: #2196F3; + color: #fff; +} + +.status.critical { + border-color: #FFC107; + background-color: #FFC107; + color: #fff; +} + @keyframes active_timeslot { 0% {opacity: 1.0;} 50% {opacity: 0.5;} diff --git a/src/pocsag/scheduler.rs b/src/pocsag/scheduler.rs index cc7e1dc..6ef176c 100644 --- a/src/pocsag/scheduler.rs +++ b/src/pocsag/scheduler.rs @@ -93,12 +93,14 @@ impl SchedulerCore { } } + status!(queue: self.queue.len() + 1); + if self.slots.is_current_allowed() { /* transmit immediately */ } else if let Some(next_slot) = self.slots.next_allowed() { let mut duration = next_slot.duration_until(); - info!("Waiting {} seconds until {:?}...", - duration.as_secs(), next_slot); + debug!("Waiting {} seconds until {:?}...", + duration.as_secs(), next_slot); // Process other commands while waiting for the time slot 'waiting: while !next_slot.active() { @@ -107,6 +109,7 @@ impl SchedulerCore { match self.rx.recv_timeout(duration) { Ok(Command::Message(msg)) => { self.queue.push_back(msg); + status!(queue: self.queue.len() + 1); }, Ok(Command::SetTimeSlots(slots)) => { self.slots = slots; @@ -121,6 +124,7 @@ impl SchedulerCore { warn!("No allowed time slots! Sending anyway..."); } + status!(queue: self.queue.len()); status!(transmitting: true); transmitter.send(&mut Generator::new(self, message.unwrap())); status!(transmitting: false); @@ -160,6 +164,8 @@ impl MessageProvider for SchedulerCore { }; } - self.queue.pop_front() + let message = self.queue.pop_front(); + status!(queue: self.queue.len()); + message } } diff --git a/src/status.rs b/src/status.rs index 164449d..ad4bdde 100644 --- a/src/status.rs +++ b/src/status.rs @@ -12,7 +12,8 @@ pub struct Status { pub connected: bool, pub transmitting: bool, pub timeslots: TimeSlots, - pub timeslot: TimeSlot + pub timeslot: TimeSlot, + pub queue: usize } impl Status { @@ -21,7 +22,8 @@ impl Status { connected: false, transmitting: false, timeslots: TimeSlots::new(), - timeslot: TimeSlot::current() + timeslot: TimeSlot::current(), + queue: 0 } } }