summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-03-27 13:27:15 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-03-27 13:27:15 +0100
commitaa9e55128f287b2e264df22997ec282b13f16fbe (patch)
treec7900bae91466f01fc280bf4f577460f8e281df9 /lib/DBInfoscreen.pm
parent67c7349906ce6c9c93cc45f23046853f3ad07fbc (diff)
request EFA occupancy data (works for some VRR trains)
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r--lib/DBInfoscreen.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index 4445d7f..70b4b5e 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -295,6 +295,28 @@ sub startup {
);
$self->helper(
+ 'occupancy_icon' => sub {
+ my ( $self, $occupancy ) = @_;
+
+ my @symbols
+ = (qw(help_outline person_outline people priority_high));
+ my $text = 'Auslastung unbekannt';
+
+ if ( $occupancy > 2 ) {
+ $text = 'Sehr hohe Auslastung';
+ }
+ elsif ( $occupancy > 1 ) {
+ $text = 'Hohe Auslastung';
+ }
+ elsif ( $occupancy > 0 ) {
+ $text = 'Geringe Auslastung';
+ }
+
+ return ( $text, $symbols[$occupancy] );
+ }
+ );
+
+ $self->helper(
'utilization_icon' => sub {
my ( $self, $utilization ) = @_;
my ( $first, $second ) = @{ $utilization // [ 0, 0 ] };