Skip to content

Commit

Permalink
stick a bit more to the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-de committed Feb 12, 2019
1 parent 9aa89c2 commit e75bb0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/routes/stop_monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fn create_monitored_stop_visit(
stop_point_name: stop.name.clone(),
vehicle_at_stop: None,
destination_display: None,
arrival_status: None,
aimed_arrival_time: Some(model::DateTime(connection.arr_time)),
aimed_departure_time: Some(model::DateTime(connection.dep_time)),
expected_arrival_time: updated_connection
Expand Down
19 changes: 18 additions & 1 deletion src/siri_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ pub struct StopPointsDelivery {
pub annotated_stop_point: Vec<AnnotatedStopPoint>,
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ArrivalStatus {
OnTime,
Early,
Delayed,
Cancelled,
Missed,
Arrived,
NotExpected,
NoReport,
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MonitoredCall {
Expand All @@ -48,7 +61,7 @@ pub struct MonitoredCall {
/// true if the vehicle is at the stop
#[serde(skip_serializing_if = "Option::is_none")]
pub vehicle_at_stop: Option<bool>,
/// headsign of the vehicle
/// Destination on the headsign of the vehicle
#[serde(skip_serializing_if = "Option::is_none")]
pub destination_display: Option<String>,
/// Scheduled arrival time
Expand All @@ -63,6 +76,9 @@ pub struct MonitoredCall {
/// Estimated departure time
#[serde(skip_serializing_if = "Option::is_none")]
pub expected_departure_time: Option<DateTime>,
/// Status on the arrival at the stop
#[serde(skip_serializing_if = "Option::is_none")]
pub arrival_status: Option<ArrivalStatus>,
}

#[derive(Debug, Serialize, Deserialize)]
Expand All @@ -89,6 +105,7 @@ pub struct MonitoredVehicleJourney {
#[serde(skip_serializing_if = "Option::is_none")]
pub journey_pattern_ref: Option<String>,
pub monitored_call: Option<MonitoredCall>,
// pub onward_calls: Option<OnwardCall>,
}

#[derive(Debug, Serialize, Deserialize)]
Expand Down

0 comments on commit e75bb0a

Please sign in to comment.