summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller
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/Controller
parent67c7349906ce6c9c93cc45f23046853f3ad07fbc (diff)
request EFA occupancy data (works for some VRR trains)
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 8f868a9..169240d 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -557,11 +557,14 @@ sub render_train {
my $wagonorder_req = Mojo::Promise->new;
my $utilization_req = Mojo::Promise->new;
+ my $occupancy_req = Mojo::Promise->new;
my $stationinfo_req = Mojo::Promise->new;
my $route_req = Mojo::Promise->new;
- my @requests
- = ( $wagonorder_req, $utilization_req, $stationinfo_req, $route_req );
+ my @requests = (
+ $wagonorder_req, $utilization_req, $occupancy_req,
+ $stationinfo_req, $route_req
+ );
if ( $departure->{wr_link} ) {
$self->wagonorder->is_available_p( $result, $departure->{wr_link} )
@@ -606,6 +609,26 @@ sub render_train {
$utilization_req->resolve;
}
+ $self->marudor->get_efa_occupancy(
+ eva => $result->station_uic,
+ train_no => $result->train_no
+ )->then(
+ sub {
+ my ($occupancy) = @_;
+ $departure->{occupancy} = $occupancy;
+ return;
+ },
+ sub {
+ $departure->{occupancy} = undef;
+ return;
+ }
+ )->finally(
+ sub {
+ $occupancy_req->resolve;
+ return;
+ }
+ )->wait;
+
$self->wagonorder->get_stationinfo_p( $result->station_uic )->then(
sub {
my ($station_info) = @_;