From 6c25964c0165530e7db6650eea79cbac99031353 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 2 Jul 2022 00:16:02 +0200 Subject: gtfs realtime proof of concept this adds a package for protobuf stuff, generated via hprotoc. Seems to work kinda fine? (the generated API is horrible though, will have to write some wrappers for that) --- README.md | 12 + default.nix | 22 +- gtfs-realtime.proto | 995 +++++++++++++++++++++ gtfs/GTFS/Realtime.hs | 25 + gtfs/GTFS/Realtime/Alert.hs | 204 +++++ gtfs/GTFS/Realtime/Alert/Cause.hs | 118 +++ gtfs/GTFS/Realtime/Alert/Effect.hs | 114 +++ gtfs/GTFS/Realtime/Alert/SeverityLevel.hs | 76 ++ gtfs/GTFS/Realtime/EntitySelector.hs | 125 +++ gtfs/GTFS/Realtime/FeedEntity.hs | 132 +++ gtfs/GTFS/Realtime/FeedHeader.hs | 104 +++ gtfs/GTFS/Realtime/FeedHeader/Incrementality.hs | 67 ++ gtfs/GTFS/Realtime/FeedMessage.hs | 97 ++ gtfs/GTFS/Realtime/Position.hs | 112 +++ gtfs/GTFS/Realtime/Shape.hs | 94 ++ gtfs/GTFS/Realtime/TimeRange.hs | 94 ++ gtfs/GTFS/Realtime/TranslatedImage.hs | 93 ++ .../Realtime/TranslatedImage/LocalizedImage.hs | 101 +++ gtfs/GTFS/Realtime/TranslatedString.hs | 92 ++ gtfs/GTFS/Realtime/TranslatedString/Translation.hs | 94 ++ gtfs/GTFS/Realtime/TripDescriptor.hs | 128 +++ .../TripDescriptor/ScheduleRelationship.hs | 91 ++ gtfs/GTFS/Realtime/TripUpdate.hs | 133 +++ gtfs/GTFS/Realtime/TripUpdate/StopTimeEvent.hs | 101 +++ gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate.hs | 149 +++ .../StopTimeUpdate/ScheduleRelationship.hs | 83 ++ .../StopTimeUpdate/StopTimeProperties.hs | 89 ++ gtfs/GTFS/Realtime/TripUpdate/TripProperties.hs | 108 +++ gtfs/GTFS/Realtime/VehicleDescriptor.hs | 101 +++ gtfs/GTFS/Realtime/VehiclePosition.hs | 183 ++++ .../Realtime/VehiclePosition/CarriageDetails.hs | 120 +++ .../Realtime/VehiclePosition/CongestionLevel.hs | 85 ++ .../Realtime/VehiclePosition/OccupancyStatus.hs | 109 +++ .../Realtime/VehiclePosition/VehicleStopStatus.hs | 73 ++ gtfs/Servant/GTFS/Realtime.hs | 38 + hie.yaml | 3 + lib/API.hs | 13 +- lib/Server.hs | 64 +- tracktrain.cabal | 48 + 39 files changed, 4479 insertions(+), 11 deletions(-) create mode 100644 gtfs-realtime.proto create mode 100644 gtfs/GTFS/Realtime.hs create mode 100644 gtfs/GTFS/Realtime/Alert.hs create mode 100644 gtfs/GTFS/Realtime/Alert/Cause.hs create mode 100644 gtfs/GTFS/Realtime/Alert/Effect.hs create mode 100644 gtfs/GTFS/Realtime/Alert/SeverityLevel.hs create mode 100644 gtfs/GTFS/Realtime/EntitySelector.hs create mode 100644 gtfs/GTFS/Realtime/FeedEntity.hs create mode 100644 gtfs/GTFS/Realtime/FeedHeader.hs create mode 100644 gtfs/GTFS/Realtime/FeedHeader/Incrementality.hs create mode 100644 gtfs/GTFS/Realtime/FeedMessage.hs create mode 100644 gtfs/GTFS/Realtime/Position.hs create mode 100644 gtfs/GTFS/Realtime/Shape.hs create mode 100644 gtfs/GTFS/Realtime/TimeRange.hs create mode 100644 gtfs/GTFS/Realtime/TranslatedImage.hs create mode 100644 gtfs/GTFS/Realtime/TranslatedImage/LocalizedImage.hs create mode 100644 gtfs/GTFS/Realtime/TranslatedString.hs create mode 100644 gtfs/GTFS/Realtime/TranslatedString/Translation.hs create mode 100644 gtfs/GTFS/Realtime/TripDescriptor.hs create mode 100644 gtfs/GTFS/Realtime/TripDescriptor/ScheduleRelationship.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate/StopTimeEvent.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.hs create mode 100644 gtfs/GTFS/Realtime/TripUpdate/TripProperties.hs create mode 100644 gtfs/GTFS/Realtime/VehicleDescriptor.hs create mode 100644 gtfs/GTFS/Realtime/VehiclePosition.hs create mode 100644 gtfs/GTFS/Realtime/VehiclePosition/CarriageDetails.hs create mode 100644 gtfs/GTFS/Realtime/VehiclePosition/CongestionLevel.hs create mode 100644 gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs create mode 100644 gtfs/GTFS/Realtime/VehiclePosition/VehicleStopStatus.hs create mode 100644 gtfs/Servant/GTFS/Realtime.hs diff --git a/README.md b/README.md index 18b4471..ef4764d 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,15 @@ I run a test-deployment of this at (tracktrain.stuebinm.eu)[https://tracktrain.s It self-generates an OpenAPI description of the currently implemented routes at (`/api`)[https://tracktrain.stuebinm.eu/debug/openapi]. + + + +## Packages & Modules + +This project is split into a few haskell packages: + - the tracktrain executable in `app/`, handling startup & config + - the tracktrain library implementing the business logic in `lib/` + - the gtfs realtime library (generated with `hprotoc` from the gtfs realtime + proto file, along with a very little glue code in `Servant.GTFS.Realtime`) + in `gtfs/` + - that's it for now, but there'll probably be more diff --git a/default.nix b/default.nix index 4261fe5..c32059c 100644 --- a/default.nix +++ b/default.nix @@ -5,12 +5,13 @@ let inherit (nixpkgs) pkgs; f = { mkDerivation, aeson, base, bytestring, cassava, conduit - , containers, data-default-class, either, extra, fmt, lens, lib - , monad-logger, mtl, path-pieces, persistent, persistent-postgresql - , regex-tdfa, resource-pool, servant, servant-docs - , servant-server, servant-swagger, stm, swagger2, text, time - , transformers, universum, unliftio-core, uuid, vector, wai-extra - , warp, zip-archive + , containers, data-default-class, either, extra, fmt, http-media + , lens, lib, monad-logger, mtl, path-pieces, persistent + , persistent-postgresql, protocol-buffers + , protocol-buffers-descriptor, regex-tdfa, resource-pool, servant + , servant-docs, servant-server, servant-swagger, stm, swagger2 + , text, time, transformers, unliftio-core, uuid, vector + , vector-algorithms, wai-extra, warp, zip-archive }: mkDerivation { pname = "tracktrain"; @@ -20,15 +21,18 @@ let isExecutable = true; libraryHaskellDepends = [ aeson base bytestring cassava conduit containers either extra fmt - lens monad-logger mtl path-pieces persistent persistent-postgresql + http-media lens monad-logger mtl path-pieces persistent + persistent-postgresql protocol-buffers protocol-buffers-descriptor regex-tdfa resource-pool servant servant-docs servant-server servant-swagger stm swagger2 text time transformers unliftio-core - uuid vector warp zip-archive + uuid vector vector-algorithms warp zip-archive ]; executableHaskellDepends = [ aeson base bytestring data-default-class fmt monad-logger - persistent-postgresql time universum wai-extra warp + persistent-postgresql protocol-buffers time wai-extra warp ]; + doHaddock = false; + description = "tracktrain tracks trains on their traintracks"; license = "unknown"; hydraPlatforms = lib.platforms.none; }; diff --git a/gtfs-realtime.proto b/gtfs-realtime.proto new file mode 100644 index 0000000..6f243d2 --- /dev/null +++ b/gtfs-realtime.proto @@ -0,0 +1,995 @@ +// Copyright 2015 The GTFS Specifications Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Protocol definition file for GTFS Realtime. +// +// GTFS Realtime lets transit agencies provide consumers with realtime +// information about disruptions to their service (stations closed, lines not +// operating, important delays etc), location of their vehicles and expected +// arrival times. +// +// This protocol is published at: +// https://github.com/google/transit/tree/master/gtfs-realtime + +syntax = "proto2"; +option java_package = "GTFS.realtime"; +package transit_realtime; + +// The contents of a feed message. +// A feed is a continuous stream of feed messages. Each message in the stream is +// obtained as a response to an appropriate HTTP GET request. +// A realtime feed is always defined with relation to an existing GTFS feed. +// All the entity ids are resolved with respect to the GTFS feed. +// Note that "required" and "optional" as stated in this file refer to Protocol +// Buffer cardinality, not semantic cardinality. See reference.md at +// https://github.com/google/transit/tree/master/gtfs-realtime for field +// semantic cardinality. +message FeedMessage { + // Metadata about this feed and feed message. + required FeedHeader header = 1; + + // Contents of the feed. + repeated FeedEntity entity = 2; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// Metadata about a feed, included in feed messages. +message FeedHeader { + // Version of the feed specification. + // The current version is 2.0. Valid versions are "2.0", "1.0". + required string gtfs_realtime_version = 1; + + // Determines whether the current fetch is incremental. Currently, + // DIFFERENTIAL mode is unsupported and behavior is unspecified for feeds + // that use this mode. There are discussions on the GTFS Realtime mailing + // list around fully specifying the behavior of DIFFERENTIAL mode and the + // documentation will be updated when those discussions are finalized. + enum Incrementality { + FULL_DATASET = 0; + DIFFERENTIAL = 1; + } + optional Incrementality incrementality = 2 [default = FULL_DATASET]; + + // This timestamp identifies the moment when the content of this feed has been + // created (in server time). In POSIX time (i.e., number of seconds since + // January 1st 1970 00:00:00 UTC). + optional uint64 timestamp = 3; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// A definition (or update) of an entity in the transit feed. +message FeedEntity { + // The ids are used only to provide incrementality support. The id should be + // unique within a FeedMessage. Consequent FeedMessages may contain + // FeedEntities with the same id. In case of a DIFFERENTIAL update the new + // FeedEntity with some id will replace the old FeedEntity with the same id + // (or delete it - see is_deleted below). + // The actual GTFS entities (e.g. stations, routes, trips) referenced by the + // feed must be specified by explicit selectors (see EntitySelector below for + // more info). + required string id = 1; + + // Whether this entity is to be deleted. Relevant only for incremental + // fetches. + optional bool is_deleted = 2 [default = false]; + + // Data about the entity itself. Exactly one of the following fields must be + // present (unless the entity is being deleted). + optional TripUpdate trip_update = 3; + optional VehiclePosition vehicle = 4; + optional Alert alert = 5; + + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional Shape shape = 6; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// +// Entities used in the feed. +// + +// Realtime update of the progress of a vehicle along a trip. +// Depending on the value of ScheduleRelationship, a TripUpdate can specify: +// - A trip that proceeds along the schedule. +// - A trip that proceeds along a route but has no fixed schedule. +// - A trip that have been added or removed with regard to schedule. +// +// The updates can be for future, predicted arrival/departure events, or for +// past events that already occurred. +// Normally, updates should get more precise and more certain (see +// uncertainty below) as the events gets closer to current time. +// Even if that is not possible, the information for past events should be +// precise and certain. In particular, if an update points to time in the past +// but its update's uncertainty is not 0, the client should conclude that the +// update is a (wrong) prediction and that the trip has not completed yet. +// +// Note that the update can describe a trip that is already completed. +// To this end, it is enough to provide an update for the last stop of the trip. +// If the time of that is in the past, the client will conclude from that that +// the whole trip is in the past (it is possible, although inconsequential, to +// also provide updates for preceding stops). +// This option is most relevant for a trip that has completed ahead of schedule, +// but according to the schedule, the trip is still proceeding at the current +// time. Removing the updates for this trip could make the client assume +// that the trip is still proceeding. +// Note that the feed provider is allowed, but not required, to purge past +// updates - this is one case where this would be practically useful. +message TripUpdate { + // The Trip that this message applies to. There can be at most one + // TripUpdate entity for each actual trip instance. + // If there is none, that means there is no prediction information available. + // It does *not* mean that the trip is progressing according to schedule. + required TripDescriptor trip = 1; + + // Additional information on the vehicle that is serving this trip. + optional VehicleDescriptor vehicle = 3; + + // Timing information for a single predicted event (either arrival or + // departure). + // Timing consists of delay and/or estimated time, and uncertainty. + // - delay should be used when the prediction is given relative to some + // existing schedule in GTFS. + // - time should be given whether there is a predicted schedule or not. If + // both time and delay are specified, time will take precedence + // (although normally, time, if given for a scheduled trip, should be + // equal to scheduled time in GTFS + delay). + // + // Uncertainty applies equally to both time and delay. + // The uncertainty roughly specifies the expected error in true delay (but + // note, we don't yet define its precise statistical meaning). It's possible + // for the uncertainty to be 0, for example for trains that are driven under + // computer timing control. + message StopTimeEvent { + // Delay (in seconds) can be positive (meaning that the vehicle is late) or + // negative (meaning that the vehicle is ahead of schedule). Delay of 0 + // means that the vehicle is exactly on time. + optional int32 delay = 1; + + // Event as absolute time. + // In Unix time (i.e., number of seconds since January 1st 1970 00:00:00 + // UTC). + optional int64 time = 2; + + // If uncertainty is omitted, it is interpreted as unknown. + // If the prediction is unknown or too uncertain, the delay (or time) field + // should be empty. In such case, the uncertainty field is ignored. + // To specify a completely certain prediction, set its uncertainty to 0. + optional int32 uncertainty = 3; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features + // and modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + + // Realtime update for arrival and/or departure events for a given stop on a + // trip. Updates can be supplied for both past and future events. + // The producer is allowed, although not required, to drop past events. + message StopTimeUpdate { + // The update is linked to a specific stop either through stop_sequence or + // stop_id, so one of the fields below must necessarily be set. + // See the documentation in TripDescriptor for more information. + + // Must be the same as in stop_times.txt in the corresponding GTFS feed. + optional uint32 stop_sequence = 1; + // Must be the same as in stops.txt in the corresponding GTFS feed. + optional string stop_id = 4; + + optional StopTimeEvent arrival = 2; + optional StopTimeEvent departure = 3; + + // Expected occupancy after departure from the given stop. + // Should be provided only for future stops. + // In order to provide departure_occupancy_status without either arrival or + // departure StopTimeEvents, ScheduleRelationship should be set to NO_DATA. + optional VehiclePosition.OccupancyStatus departure_occupancy_status = 7; + + // The relation between the StopTimeEvents and the static schedule. + enum ScheduleRelationship { + // The vehicle is proceeding in accordance with its static schedule of + // stops, although not necessarily according to the times of the schedule. + // At least one of arrival and departure must be provided. If the schedule + // for this stop contains both arrival and departure times then so must + // this update. Frequency-based trips (GTFS frequencies.txt with exact_times = 0) + // should not have a SCHEDULED value and should use UNSCHEDULED instead. + SCHEDULED = 0; + + // The stop is skipped, i.e., the vehicle will not stop at this stop. + // Arrival and departure are optional. + SKIPPED = 1; + + // No StopTimeEvents are given for this stop. + // The main intention for this value is to give time predictions only for + // part of a trip, i.e., if the last update for a trip has a NO_DATA + // specifier, then StopTimeEvents for the rest of the stops in the trip + // are considered to be unspecified as well. + // Neither arrival nor departure should be supplied. + NO_DATA = 2; + + // The vehicle is operating a trip defined in GTFS frequencies.txt with exact_times = 0. + // This value should not be used for trips that are not defined in GTFS frequencies.txt, + // or trips in GTFS frequencies.txt with exact_times = 1. Trips containing StopTimeUpdates + // with ScheduleRelationship=UNSCHEDULED must also set TripDescriptor.ScheduleRelationship=UNSCHEDULED. + // NOTE: This field is still experimental, and subject to change. It may be + // formally adopted in the future. + UNSCHEDULED = 3; + } + optional ScheduleRelationship schedule_relationship = 5 + [default = SCHEDULED]; + + // Provides the updated values for the stop time. + // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. + message StopTimeProperties { + // Supports real-time stop assignments. Refers to a stop_id defined in the GTFS stops.txt. + // The new assigned_stop_id should not result in a significantly different trip experience for the end user than + // the stop_id defined in GTFS stop_times.txt. In other words, the end user should not view this new stop_id as an + // "unusual change" if the new stop was presented within an app without any additional context. + // For example, this field is intended to be used for platform assignments by using a stop_id that belongs to the + // same station as the stop originally defined in GTFS stop_times.txt. + // To assign a stop without providing any real-time arrival or departure predictions, populate this field and set + // StopTimeUpdate.schedule_relationship = NO_DATA. + // If this field is populated, it is preferred to omit `StopTimeUpdate.stop_id` and use only `StopTimeUpdate.stop_sequence`. If + // `StopTimeProperties.assigned_stop_id` and `StopTimeUpdate.stop_id` are populated, `StopTimeUpdate.stop_id` must match `assigned_stop_id`. + // Platform assignments should be reflected in other GTFS-realtime fields as well + // (e.g., `VehiclePosition.stop_id`). + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string assigned_stop_id = 1; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features + // and modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + + // Realtime updates for certain properties defined within GTFS stop_times.txt + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional StopTimeProperties stop_time_properties = 6; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features + // and modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + + // Updates to StopTimes for the trip (both future, i.e., predictions, and in + // some cases, past ones, i.e., those that already happened). + // The updates must be sorted by stop_sequence, and apply for all the + // following stops of the trip up to the next specified one. + // + // Example 1: + // For a trip with 20 stops, a StopTimeUpdate with arrival delay and departure + // delay of 0 for stop_sequence of the current stop means that the trip is + // exactly on time. + // + // Example 2: + // For the same trip instance, 3 StopTimeUpdates are provided: + // - delay of 5 min for stop_sequence 3 + // - delay of 1 min for stop_sequence 8 + // - delay of unspecified duration for stop_sequence 10 + // This will be interpreted as: + // - stop_sequences 3,4,5,6,7 have delay of 5 min. + // - stop_sequences 8,9 have delay of 1 min. + // - stop_sequences 10,... have unknown delay. + repeated StopTimeUpdate stop_time_update = 2; + + // The most recent moment at which the vehicle's real-time progress was measured + // to estimate StopTimes in the future. When StopTimes in the past are provided, + // arrival/departure times may be earlier than this value. In POSIX + // time (i.e., the number of seconds since January 1st 1970 00:00:00 UTC). + optional uint64 timestamp = 4; + + // The current schedule deviation for the trip. Delay should only be + // specified when the prediction is given relative to some existing schedule + // in GTFS. + // + // Delay (in seconds) can be positive (meaning that the vehicle is late) or + // negative (meaning that the vehicle is ahead of schedule). Delay of 0 + // means that the vehicle is exactly on time. + // + // Delay information in StopTimeUpdates take precedent of trip-level delay + // information, such that trip-level delay is only propagated until the next + // stop along the trip with a StopTimeUpdate delay value specified. + // + // Feed providers are strongly encouraged to provide a TripUpdate.timestamp + // value indicating when the delay value was last updated, in order to + // evaluate the freshness of the data. + // + // NOTE: This field is still experimental, and subject to change. It may be + // formally adopted in the future. + optional int32 delay = 5; + + // Defines updated properties of the trip, such as a new shape_id when there is a detour. Or defines the + // trip_id, start_date, and start_time of a DUPLICATED trip. + // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. + message TripProperties { + // Defines the identifier of a new trip that is a duplicate of an existing trip defined in (CSV) GTFS trips.txt + // but will start at a different service date and/or time (defined using the TripProperties.start_date and + // TripProperties.start_time fields). See definition of trips.trip_id in (CSV) GTFS. Its value must be different + // than the ones used in the (CSV) GTFS. Required if schedule_relationship=DUPLICATED, otherwise this field must not + // be populated and will be ignored by consumers. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string trip_id = 1; + // Service date on which the DUPLICATED trip will be run, in YYYYMMDD format. Required if + // schedule_relationship=DUPLICATED, otherwise this field must not be populated and will be ignored by consumers. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string start_date = 2; + // Defines the departure start time of the trip when it’s duplicated. See definition of stop_times.departure_time + // in (CSV) GTFS. Scheduled arrival and departure times for the duplicated trip are calculated based on the offset + // between the original trip departure_time and this field. For example, if a GTFS trip has stop A with a + // departure_time of 10:00:00 and stop B with departure_time of 10:01:00, and this field is populated with the value + // of 10:30:00, stop B on the duplicated trip will have a scheduled departure_time of 10:31:00. Real-time prediction + // delay values are applied to this calculated schedule time to determine the predicted time. For example, if a + // departure delay of 30 is provided for stop B, then the predicted departure time is 10:31:30. Real-time + // prediction time values do not have any offset applied to them and indicate the predicted time as provided. + // For example, if a departure time representing 10:31:30 is provided for stop B, then the predicted departure time + // is 10:31:30. This field is required if schedule_relationship is DUPLICATED, otherwise this field must not be + // populated and will be ignored by consumers. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string start_time = 3; + // Specifies the shape of the vehicle travel path when the trip shape differs from the shape specified in + // (CSV) GTFS or to specify it in real-time when it's not provided by (CSV) GTFS, such as a vehicle that takes differing + // paths based on rider demand. See definition of trips.shape_id in (CSV) GTFS. If a shape is neither defined in (CSV) GTFS + // nor in real-time, the shape is considered unknown. This field can refer to a shape defined in the (CSV) GTFS in shapes.txt + // or a Shape in the (protobuf) real-time feed. The order of stops (stop sequences) for this trip must remain the same as + // (CSV) GTFS. Stops that are a part of the original trip but will no longer be made, such as when a detour occurs, should + // be marked as schedule_relationship=SKIPPED. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string shape_id = 4; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features + // and modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + optional TripProperties trip_properties = 6; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// Realtime positioning information for a given vehicle. +message VehiclePosition { + // The Trip that this vehicle is serving. + // Can be empty or partial if the vehicle can not be identified with a given + // trip instance. + optional TripDescriptor trip = 1; + + // Additional information on the vehicle that is serving this trip. + optional VehicleDescriptor vehicle = 8; + + // Current position of this vehicle. + optional Position position = 2; + + // The stop sequence index of the current stop. The meaning of + // current_stop_sequence (i.e., the stop that it refers to) is determined by + // current_status. + // If current_status is missing IN_TRANSIT_TO is assumed. + optional uint32 current_stop_sequence = 3; + // Identifies the current stop. The value must be the same as in stops.txt in + // the corresponding GTFS feed. + optional string stop_id = 7; + + enum VehicleStopStatus { + // The vehicle is just about to arrive at the stop (on a stop + // display, the vehicle symbol typically flashes). + INCOMING_AT = 0; + + // The vehicle is standing at the stop. + STOPPED_AT = 1; + + // The vehicle has departed and is in transit to the next stop. + IN_TRANSIT_TO = 2; + } + // The exact status of the vehicle with respect to the current stop. + // Ignored if current_stop_sequence is missing. + optional VehicleStopStatus current_status = 4 [default = IN_TRANSIT_TO]; + + // Moment at which the vehicle's position was measured. In POSIX time + // (i.e., number of seconds since January 1st 1970 00:00:00 UTC). + optional uint64 timestamp = 5; + + // Congestion level that is affecting this vehicle. + enum CongestionLevel { + UNKNOWN_CONGESTION_LEVEL = 0; + RUNNING_SMOOTHLY = 1; + STOP_AND_GO = 2; + CONGESTION = 3; + SEVERE_CONGESTION = 4; // People leaving their cars. + } + optional CongestionLevel congestion_level = 6; + + // The state of passenger occupancy for the vehicle or carriage. + // Individual producers may not publish all OccupancyStatus values. Therefore, consumers + // must not assume that the OccupancyStatus values follow a linear scale. + // Consumers should represent OccupancyStatus values as the state indicated + // and intended by the producer. Likewise, producers must use OccupancyStatus values that + // correspond to actual vehicle occupancy states. + // For describing passenger occupancy levels on a linear scale, see `occupancy_percentage`. + // This field is still experimental, and subject to change. It may be formally adopted in the future. + enum OccupancyStatus { + // The vehicle or carriage is considered empty by most measures, and has few or no + // passengers onboard, but is still accepting passengers. + EMPTY = 0; + + // The vehicle or carriage has a large number of seats available. + // The amount of free seats out of the total seats available to be + // considered large enough to fall into this category is determined at the + // discretion of the producer. + MANY_SEATS_AVAILABLE = 1; + + // The vehicle or carriage has a relatively small number of seats available. + // The amount of free seats out of the total seats available to be + // considered small enough to fall into this category is determined at the + // discretion of the feed producer. + FEW_SEATS_AVAILABLE = 2; + + // The vehicle or carriage can currently accommodate only standing passengers. + STANDING_ROOM_ONLY = 3; + + // The vehicle or carriage can currently accommodate only standing passengers + // and has limited space for them. + CRUSHED_STANDING_ROOM_ONLY = 4; + + // The vehicle or carriage is considered full by most measures, but may still be + // allowing passengers to board. + FULL = 5; + + // The vehicle or carriage is not accepting passengers, but usually accepts passengers for boarding. + NOT_ACCEPTING_PASSENGERS = 6; + + // The vehicle or carriage doesn't have any occupancy data available at that time. + NO_DATA_AVAILABLE = 7; + + // The vehicle or carriage is not boardable and never accepts passengers. + // Useful for special vehicles or carriages (engine, maintenance carriage, etc…). + NOT_BOARDABLE = 8; + + } + // If multi_carriage_status is populated with per-carriage OccupancyStatus, + // then this field should describe the entire vehicle with all carriages accepting passengers considered. + optional OccupancyStatus occupancy_status = 9; + + // A percentage value indicating the degree of passenger occupancy in the vehicle. + // The values are represented as an integer without decimals. 0 means 0% and 100 means 100%. + // The value 100 should represent the total maximum occupancy the vehicle was designed for, + // including both seated and standing capacity, and current operating regulations allow. + // The value may exceed 100 if there are more passengers than the maximum designed capacity. + // The precision of occupancy_percentage should be low enough that individual passengers cannot be tracked boarding or alighting the vehicle. + // If multi_carriage_status is populated with per-carriage occupancy_percentage, + // then this field should describe the entire vehicle with all carriages accepting passengers considered. + // This field is still experimental, and subject to change. It may be formally adopted in the future. + optional uint32 occupancy_percentage = 10; + + // Carriage specific details, used for vehicles composed of several carriages + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + message CarriageDetails { + + // Identification of the carriage. Should be unique per vehicle. + optional string id = 1; + + // User visible label that may be shown to the passenger to help identify + // the carriage. Example: "7712", "Car ABC-32", etc... + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + optional string label = 2; + + // Occupancy status for this given carriage, in this vehicle + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + optional OccupancyStatus occupancy_status = 3 [default = NO_DATA_AVAILABLE]; + + // Occupancy percentage for this given carriage, in this vehicle. + // Follows the same rules as "VehiclePosition.occupancy_percentage" + // -1 in case data is not available for this given carriage (as protobuf defaults to 0 otherwise) + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + optional int32 occupancy_percentage = 4 [default = -1]; + + // Identifies the order of this carriage with respect to the other + // carriages in the vehicle's list of CarriageDetails. + // The first carriage in the direction of travel must have a value of 1. + // The second value corresponds to the second carriage in the direction + // of travel and must have a value of 2, and so forth. + // For example, the first carriage in the direction of travel has a value of 1. + // If the second carriage in the direction of travel has a value of 3, + // consumers will discard data for all carriages (i.e., the multi_carriage_details field). + // Carriages without data must be represented with a valid carriage_sequence number and the fields + // without data should be omitted (alternately, those fields could also be included and set to the "no data" values). + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + optional uint32 carriage_sequence = 5; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + + // Details of the multiple carriages of this given vehicle. + // The first occurrence represents the first carriage of the vehicle, + // given the current direction of travel. + // The number of occurrences of the multi_carriage_details + // field represents the number of carriages of the vehicle. + // It also includes non boardable carriages, + // like engines, maintenance carriages, etc… as they provide valuable + // information to passengers about where to stand on a platform. + // This message/field is still experimental, and subject to change. It may be formally adopted in the future. + repeated CarriageDetails multi_carriage_details = 11; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// An alert, indicating some sort of incident in the public transit network. +message Alert { + // Time when the alert should be shown to the user. If missing, the + // alert will be shown as long as it appears in the feed. + // If multiple ranges are given, the alert will be shown during all of them. + repeated TimeRange active_period = 1; + + // Entities whose users we should notify of this alert. + repeated EntitySelector informed_entity = 5; + + // Cause of this alert. + enum Cause { + UNKNOWN_CAUSE = 1; + OTHER_CAUSE = 2; // Not machine-representable. + TECHNICAL_PROBLEM = 3; + STRIKE = 4; // Public transit agency employees stopped working. + DEMONSTRATION = 5; // People are blocking the streets. + ACCIDENT = 6; + HOLIDAY = 7; + WEATHER = 8; + MAINTENANCE = 9; + CONSTRUCTION = 10; + POLICE_ACTIVITY = 11; + MEDICAL_EMERGENCY = 12; + } + optional Cause cause = 6 [default = UNKNOWN_CAUSE]; + + // What is the effect of this problem on the affected entity. + enum Effect { + NO_SERVICE = 1; + REDUCED_SERVICE = 2; + + // We don't care about INsignificant delays: they are hard to detect, have + // little impact on the user, and would clutter the results as they are too + // frequent. + SIGNIFICANT_DELAYS = 3; + + DETOUR = 4; + ADDITIONAL_SERVICE = 5; + MODIFIED_SERVICE = 6; + OTHER_EFFECT = 7; + UNKNOWN_EFFECT = 8; + STOP_MOVED = 9; + NO_EFFECT = 10; + ACCESSIBILITY_ISSUE = 11; + } + optional Effect effect = 7 [default = UNKNOWN_EFFECT]; + + // The URL which provides additional information about the alert. + optional TranslatedString url = 8; + + // Alert header. Contains a short summary of the alert text as plain-text. + optional TranslatedString header_text = 10; + + // Full description for the alert as plain-text. The information in the + // description should add to the information of the header. + optional TranslatedString description_text = 11; + + // Text for alert header to be used in text-to-speech implementations. This field is the text-to-speech version of header_text. + optional TranslatedString tts_header_text = 12; + + // Text for full description for the alert to be used in text-to-speech implementations. This field is the text-to-speech version of description_text. + optional TranslatedString tts_description_text = 13; + + // Severity of this alert. + enum SeverityLevel { + UNKNOWN_SEVERITY = 1; + INFO = 2; + WARNING = 3; + SEVERE = 4; + } + + optional SeverityLevel severity_level = 14 [default = UNKNOWN_SEVERITY]; + + // TranslatedImage to be displayed along the alert text. Used to explain visually the alert effect of a detour, station closure, etc. The image must enhance the understanding of the alert. Any essential information communicated within the image must also be contained in the alert text. + // The following types of images are discouraged : image containing mainly text, marketing or branded images that add no additional information. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional TranslatedImage image = 15; + + // Text describing the appearance of the linked image in the `image` field (e.g., in case the image can't be displayed + // or the user can't see the image for accessibility reasons). See the HTML spec for alt image text - https://html.spec.whatwg.org/#alt. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional TranslatedString image_alternative_text = 16; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features + // and modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// +// Low level data structures used above. +// + +// A time interval. The interval is considered active at time 't' if 't' is +// greater than or equal to the start time and less than the end time. +message TimeRange { + // Start time, in POSIX time (i.e., number of seconds since January 1st 1970 + // 00:00:00 UTC). + // If missing, the interval starts at minus infinity. + optional uint64 start = 1; + + // End time, in POSIX time (i.e., number of seconds since January 1st 1970 + // 00:00:00 UTC). + // If missing, the interval ends at plus infinity. + optional uint64 end = 2; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// A position. +message Position { + // Degrees North, in the WGS-84 coordinate system. + required float latitude = 1; + + // Degrees East, in the WGS-84 coordinate system. + required float longitude = 2; + + // Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East. + // This can be the compass bearing, or the direction towards the next stop + // or intermediate location. + // This should not be direction deduced from the sequence of previous + // positions, which can be computed from previous data. + optional float bearing = 3; + + // Odometer value, in meters. + optional double odometer = 4; + // Momentary speed measured by the vehicle, in meters per second. + optional float speed = 5; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// A descriptor that identifies an instance of a GTFS trip, or all instances of +// a trip along a route. +// - To specify a single trip instance, the trip_id (and if necessary, +// start_time) is set. If route_id is also set, then it should be same as one +// that the given trip corresponds to. +// - To specify all the trips along a given route, only the route_id should be +// set. Note that if the trip_id is not known, then stop sequence ids in +// TripUpdate are not sufficient, and stop_ids must be provided as well. In +// addition, absolute arrival/departure times must be provided. +message TripDescriptor { + // The trip_id from the GTFS feed that this selector refers to. + // For non frequency-based trips, this field is enough to uniquely identify + // the trip. For frequency-based trip, start_time and start_date might also be + // necessary. When schedule_relationship is DUPLICATED within a TripUpdate, the trip_id identifies the trip from + // static GTFS to be duplicated. When schedule_relationship is DUPLICATED within a VehiclePosition, the trip_id + // identifies the new duplicate trip and must contain the value for the corresponding TripUpdate.TripProperties.trip_id. + optional string trip_id = 1; + + // The route_id from the GTFS that this selector refers to. + optional string route_id = 5; + + // The direction_id from the GTFS feed trips.txt file, indicating the + // direction of travel for trips this selector refers to. + optional uint32 direction_id = 6; + + // The initially scheduled start time of this trip instance. + // When the trip_id corresponds to a non-frequency-based trip, this field + // should either be omitted or be equal to the value in the GTFS feed. When + // the trip_id correponds to a frequency-based trip, the start_time must be + // specified for trip updates and vehicle positions. If the trip corresponds + // to exact_times=1 GTFS record, then start_time must be some multiple + // (including zero) of headway_secs later than frequencies.txt start_time for + // the corresponding time period. If the trip corresponds to exact_times=0, + // then its start_time may be arbitrary, and is initially expected to be the + // first departure of the trip. Once established, the start_time of this + // frequency-based trip should be considered immutable, even if the first + // departure time changes -- that time change may instead be reflected in a + // StopTimeUpdate. + // Format and semantics of the field is same as that of + // GTFS/frequencies.txt/start_time, e.g., 11:15:35 or 25:15:35. + optional string start_time = 2; + // The scheduled start date of this trip instance. + // Must be provided to disambiguate trips that are so late as to collide with + // a scheduled trip on a next day. For example, for a train that departs 8:00 + // and 20:00 every day, and is 12 hours late, there would be two distinct + // trips on the same time. + // This field can be provided but is not mandatory for schedules in which such + // collisions are impossible - for example, a service running on hourly + // schedule where a vehicle that is one hour late is not considered to be + // related to schedule anymore. + // In YYYYMMDD format. + optional string start_date = 3; + + // The relation between this trip and the static schedule. If a trip is done + // in accordance with temporary schedule, not reflected in GTFS, then it + // shouldn't be marked as SCHEDULED, but likely as ADDED. + enum ScheduleRelationship { + // Trip that is running in accordance with its GTFS schedule, or is close + // enough to the scheduled trip to be associated with it. + SCHEDULED = 0; + + // An extra trip that was added in addition to a running schedule, for + // example, to replace a broken vehicle or to respond to sudden passenger + // load. + // NOTE: Currently, behavior is unspecified for feeds that use this mode. There are discussions on the GTFS GitHub + // [(1)](https://github.com/google/transit/issues/106) [(2)](https://github.com/google/transit/pull/221) + // [(3)](https://github.com/google/transit/pull/219) around fully specifying or deprecating ADDED trips and the + // documentation will be updated when those discussions are finalized. + ADDED = 1; + + // A trip that is running with no schedule associated to it (GTFS frequencies.txt exact_times=0). + // Trips with ScheduleRelationship=UNSCHEDULED must also set all StopTimeUpdates.ScheduleRelationship=UNSCHEDULED. + UNSCHEDULED = 2; + + // A trip that existed in the schedule but was removed. + CANCELED = 3; + + // Should not be used - for backwards-compatibility only. + REPLACEMENT = 5; // [deprecated=true]; + + // An extra trip that was added in addition to a running schedule, for example, to replace a broken vehicle or to + // respond to sudden passenger load. Used with TripUpdate.TripProperties.trip_id, TripUpdate.TripProperties.start_date, + // and TripUpdate.TripProperties.start_time to copy an existing trip from static GTFS but start at a different service + // date and/or time. Duplicating a trip is allowed if the service related to the original trip in (CSV) GTFS + // (in calendar.txt or calendar_dates.txt) is operating within the next 30 days. The trip to be duplicated is + // identified via TripUpdate.TripDescriptor.trip_id. This enumeration does not modify the existing trip referenced by + // TripUpdate.TripDescriptor.trip_id - if a producer wants to cancel the original trip, it must publish a separate + // TripUpdate with the value of CANCELED. Trips defined in GTFS frequencies.txt with exact_times that is empty or + // equal to 0 cannot be duplicated. The VehiclePosition.TripDescriptor.trip_id for the new trip must contain + // the matching value from TripUpdate.TripProperties.trip_id and VehiclePosition.TripDescriptor.ScheduleRelationship + // must also be set to DUPLICATED. + // Existing producers and consumers that were using the ADDED enumeration to represent duplicated trips must follow + // the migration guide (https://github.com/google/transit/tree/master/gtfs-realtime/spec/en/examples/migration-duplicated.md) + // to transition to the DUPLICATED enumeration. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + DUPLICATED = 6; + } + optional ScheduleRelationship schedule_relationship = 4; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// Identification information for the vehicle performing the trip. +message VehicleDescriptor { + // Internal system identification of the vehicle. Should be unique per + // vehicle, and can be used for tracking the vehicle as it proceeds through + // the system. + optional string id = 1; + + // User visible label, i.e., something that must be shown to the passenger to + // help identify the correct vehicle. + optional string label = 2; + + // The license plate of the vehicle. + optional string license_plate = 3; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// A selector for an entity in a GTFS feed. +message EntitySelector { + // The values of the fields should correspond to the appropriate fields in the + // GTFS feed. + // At least one specifier must be given. If several are given, then the + // matching has to apply to all the given specifiers. + optional string agency_id = 1; + optional string route_id = 2; + // corresponds to route_type in GTFS. + optional int32 route_type = 3; + optional TripDescriptor trip = 4; + optional string stop_id = 5; + // Corresponds to trip direction_id in GTFS trips.txt. If provided the + // route_id must also be provided. + optional uint32 direction_id = 6; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// An internationalized message containing per-language versions of a snippet of +// text or a URL. +// One of the strings from a message will be picked up. The resolution proceeds +// as follows: +// 1. If the UI language matches the language code of a translation, +// the first matching translation is picked. +// 2. If a default UI language (e.g., English) matches the language code of a +// translation, the first matching translation is picked. +// 3. If some translation has an unspecified language code, that translation is +// picked. +message TranslatedString { + message Translation { + // A UTF-8 string containing the message. + required string text = 1; + // BCP-47 language code. Can be omitted if the language is unknown or if + // no i18n is done at all for the feed. At most one translation is + // allowed to have an unspecified language tag. + optional string language = 2; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + // At least one translation must be provided. + repeated Translation translation = 1; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// An internationalized image containing per-language versions of a URL linking to an image +// along with meta information +// Only one of the images from a message will be retained by consumers. The resolution proceeds +// as follows: +// 1. If the UI language matches the language code of a translation, +// the first matching translation is picked. +// 2. If a default UI language (e.g., English) matches the language code of a +// translation, the first matching translation is picked. +// 3. If some translation has an unspecified language code, that translation is +// picked. +// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. +message TranslatedImage { + message LocalizedImage { + // String containing an URL linking to an image + // The image linked must be less than 2MB. + // If an image changes in a significant enough way that an update is required on the consumer side, the producer must update the URL to a new one. + // The URL should be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See the following https://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values. + required string url = 1; + + // IANA media type as to specify the type of image to be displayed. + // The type must start with "image/" + required string media_type = 2; + + // BCP-47 language code. Can be omitted if the language is unknown or if + // no i18n is done at all for the feed. At most one translation is + // allowed to have an unspecified language tag. + optional string language = 3; + + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; + } + // At least one localized image must be provided. + repeated LocalizedImage localized_image = 1; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} + +// Describes the physical path that a vehicle takes when it's not part of the (CSV) GTFS, +// such as for a detour. Shapes belong to Trips, and consist of a sequence of shape points. +// Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept +// the location of Stops exactly, but all Stops on a trip should lie within a small distance of +// the shape for that trip, i.e. close to straight line segments connecting the shape points +// NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future. +message Shape { + // Identifier of the shape. Must be different than any shape_id defined in the (CSV) GTFS. + // This field is required as per reference.md, but needs to be specified here optional because "Required is Forever" + // See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string shape_id = 1; + + // Encoded polyline representation of the shape. This polyline must contain at least two points. + // For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm + // This field is required as per reference.md, but needs to be specified here optional because "Required is Forever" + // See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional string encoded_polyline = 2; + + // The extensions namespace allows 3rd-party developers to extend the + // GTFS Realtime Specification in order to add and evaluate new features and + // modifications to the spec. + extensions 1000 to 1999; + + // The following extension IDs are reserved for private use by any organization. + extensions 9000 to 9999; +} diff --git a/gtfs/GTFS/Realtime.hs b/gtfs/GTFS/Realtime.hs new file mode 100644 index 0000000..9c72aaa --- /dev/null +++ b/gtfs/GTFS/Realtime.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime (protoInfo, fileDescriptorProto) where +import Prelude ((+), (/), (++), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import Text.DescriptorProtos.FileDescriptorProto (FileDescriptorProto) +import Text.ProtocolBuffers.Reflections (ProtoInfo) +import qualified Text.ProtocolBuffers.WireMessage as P' (wireGet,getFromBS) + +protoInfo :: ProtoInfo +protoInfo + = Prelude'.read + "ProtoInfo {protoMod = ProtoName {protobufName = FIName \".transit_realtime\", haskellPrefix = [], parentModule = [MName \"GTFS\"], baseName = MName \"Realtime\"}, protoFilePath = [\"GTFS\",\"Realtime.hs\"], protoSource = \"gtfs-realtime.proto\", extensionKeys = fromList [], messages = [DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedMessage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedMessage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedMessage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedMessage.header\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedMessage\"], baseName' = FName \"header\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedHeader\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedHeader\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedMessage.entity\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedMessage\"], baseName' = FName \"entity\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedEntity\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedEntity\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedHeader\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedHeader\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedHeader.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.gtfs_realtime_version\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"gtfs_realtime_version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.incrementality\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"incrementality\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedHeader.Incrementality\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName = MName \"Incrementality\"}), hsRawDefault = Just \"FULL_DATASET\", hsDefault = Just (HsDef'Enum \"FULL_DATASET\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedEntity\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedEntity\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedEntity.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.is_deleted\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"is_deleted\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Just \"false\", hsDefault = Just (HsDef'Bool False), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.trip_update\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"trip_update\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripUpdate\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehiclePosition\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.alert\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"alert\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Alert\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.shape\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"shape\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Shape\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Shape\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripUpdate\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.stop_time_update\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"stop_time_update\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeUpdate\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.delay\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"delay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.trip_properties\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"trip_properties\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.TripProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"TripProperties\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeEvent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.delay\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"delay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.uncertainty\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"uncertainty\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeUpdate\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeUpdate.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.arrival\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"arrival\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.departure\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"departure\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.departure_occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"departure_occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.schedule_relationship\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"schedule_relationship\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"ScheduleRelationship\"}), hsRawDefault = Just \"SCHEDULED\", hsDefault = Just (HsDef'Enum \"SCHEDULED\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_time_properties\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_time_properties\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"StopTimeProperties\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"StopTimeProperties\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeUpdate\",\"StopTimeProperties.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.assigned_stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\",MName \"StopTimeProperties\"], baseName' = FName \"assigned_stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.TripProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"TripProperties\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"TripProperties.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.trip_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"trip_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.start_date\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"start_date\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.start_time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"start_time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.shape_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"shape_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehiclePosition\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.position\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"position\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Position\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Position\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.current_stop_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"current_stop_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.current_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"current_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.VehicleStopStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"VehicleStopStatus\"}), hsRawDefault = Just \"IN_TRANSIT_TO\", hsDefault = Just (HsDef'Enum \"IN_TRANSIT_TO\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.congestion_level\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"congestion_level\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CongestionLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CongestionLevel\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 72}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.occupancy_percentage\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"occupancy_percentage\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 80}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.multi_carriage_details\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"multi_carriage_details\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 90}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CarriageDetails\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CarriageDetails\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CarriageDetails\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CarriageDetails\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition\",\"CarriageDetails.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.label\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"label\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Just \"NO_DATA_AVAILABLE\", hsDefault = Just (HsDef'Enum \"NO_DATA_AVAILABLE\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.occupancy_percentage\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"occupancy_percentage\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Just \"-1\", hsDefault = Just (HsDef'Integer (-1)), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.carriage_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"carriage_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Alert\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Alert\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Alert.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.active_period\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"active_period\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TimeRange\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TimeRange\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.informed_entity\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"informed_entity\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.EntitySelector\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"EntitySelector\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.cause\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"cause\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.Cause\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Cause\"}), hsRawDefault = Just \"UNKNOWN_CAUSE\", hsDefault = Just (HsDef'Enum \"UNKNOWN_CAUSE\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.effect\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"effect\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.Effect\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Effect\"}), hsRawDefault = Just \"UNKNOWN_EFFECT\", hsDefault = Just (HsDef'Enum \"UNKNOWN_EFFECT\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.url\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"url\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.header_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"header_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.description_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"description_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 90}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.tts_header_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"tts_header_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 12}, wireTag = WireTag {getWireTag = 98}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.tts_description_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"tts_description_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 13}, wireTag = WireTag {getWireTag = 106}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.severity_level\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"severity_level\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 14}, wireTag = WireTag {getWireTag = 112}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.SeverityLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"SeverityLevel\"}), hsRawDefault = Just \"UNKNOWN_SEVERITY\", hsDefault = Just (HsDef'Enum \"UNKNOWN_SEVERITY\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.image\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"image\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 15}, wireTag = WireTag {getWireTag = 122}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedImage\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.image_alternative_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"image_alternative_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 16}, wireTag = WireTag {getWireTag = 130}, packedTag = Nothing, wireTagLength = 2, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TimeRange\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TimeRange\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TimeRange.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TimeRange.start\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TimeRange\"], baseName' = FName \"start\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TimeRange.end\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TimeRange\"], baseName' = FName \"end\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Position\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Position\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Position.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.latitude\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"latitude\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 13}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.longitude\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"longitude\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 21}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.bearing\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"bearing\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 29}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.odometer\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"odometer\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 33}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.speed\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"speed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 45}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripDescriptor.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.trip_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"trip_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.route_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"route_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.direction_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"direction_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.start_time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"start_time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.start_date\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"start_date\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.schedule_relationship\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"schedule_relationship\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName = MName \"ScheduleRelationship\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehicleDescriptor.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.label\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"label\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.license_plate\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"license_plate\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.EntitySelector\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"EntitySelector\"}, descFilePath = [\"GTFS\",\"Realtime\",\"EntitySelector.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.agency_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"agency_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.route_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"route_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.route_type\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"route_type\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.direction_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"direction_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedString.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.translation\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName' = FName \"translation\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString.Translation\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName = MName \"Translation\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedString.Translation\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName = MName \"Translation\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedString\",\"Translation.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.Translation.text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\",MName \"Translation\"], baseName' = FName \"text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.Translation.language\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\",MName \"Translation\"], baseName' = FName \"language\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedImage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedImage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.localized_image\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName' = FName \"localized_image\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage.LocalizedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName = MName \"LocalizedImage\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage.LocalizedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName = MName \"LocalizedImage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedImage\",\"LocalizedImage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.url\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"url\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.media_type\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"media_type\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.language\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"language\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Shape\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Shape\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Shape.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Shape.shape_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Shape\"], baseName' = FName \"shape_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Shape.encoded_polyline\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Shape\"], baseName' = FName \"encoded_polyline\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}], enums = [EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.FeedHeader.Incrementality\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName = MName \"Incrementality\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"FeedHeader\",\"Incrementality.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"FULL_DATASET\"),(EnumCode {getEnumCode = 1},\"DIFFERENTIAL\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"ScheduleRelationship\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeUpdate\",\"ScheduleRelationship.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"SCHEDULED\"),(EnumCode {getEnumCode = 1},\"SKIPPED\"),(EnumCode {getEnumCode = 2},\"NO_DATA\"),(EnumCode {getEnumCode = 3},\"UNSCHEDULED\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.VehicleStopStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"VehicleStopStatus\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition\",\"VehicleStopStatus.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"INCOMING_AT\"),(EnumCode {getEnumCode = 1},\"STOPPED_AT\"),(EnumCode {getEnumCode = 2},\"IN_TRANSIT_TO\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CongestionLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CongestionLevel\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition\",\"CongestionLevel.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"UNKNOWN_CONGESTION_LEVEL\"),(EnumCode {getEnumCode = 1},\"RUNNING_SMOOTHLY\"),(EnumCode {getEnumCode = 2},\"STOP_AND_GO\"),(EnumCode {getEnumCode = 3},\"CONGESTION\"),(EnumCode {getEnumCode = 4},\"SEVERE_CONGESTION\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition\",\"OccupancyStatus.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"EMPTY\"),(EnumCode {getEnumCode = 1},\"MANY_SEATS_AVAILABLE\"),(EnumCode {getEnumCode = 2},\"FEW_SEATS_AVAILABLE\"),(EnumCode {getEnumCode = 3},\"STANDING_ROOM_ONLY\"),(EnumCode {getEnumCode = 4},\"CRUSHED_STANDING_ROOM_ONLY\"),(EnumCode {getEnumCode = 5},\"FULL\"),(EnumCode {getEnumCode = 6},\"NOT_ACCEPTING_PASSENGERS\"),(EnumCode {getEnumCode = 7},\"NO_DATA_AVAILABLE\"),(EnumCode {getEnumCode = 8},\"NOT_BOARDABLE\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.Alert.Cause\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Cause\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"Alert\",\"Cause.hs\"], enumValues = [(EnumCode {getEnumCode = 1},\"UNKNOWN_CAUSE\"),(EnumCode {getEnumCode = 2},\"OTHER_CAUSE\"),(EnumCode {getEnumCode = 3},\"TECHNICAL_PROBLEM\"),(EnumCode {getEnumCode = 4},\"STRIKE\"),(EnumCode {getEnumCode = 5},\"DEMONSTRATION\"),(EnumCode {getEnumCode = 6},\"ACCIDENT\"),(EnumCode {getEnumCode = 7},\"HOLIDAY\"),(EnumCode {getEnumCode = 8},\"WEATHER\"),(EnumCode {getEnumCode = 9},\"MAINTENANCE\"),(EnumCode {getEnumCode = 10},\"CONSTRUCTION\"),(EnumCode {getEnumCode = 11},\"POLICE_ACTIVITY\"),(EnumCode {getEnumCode = 12},\"MEDICAL_EMERGENCY\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.Alert.Effect\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Effect\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"Alert\",\"Effect.hs\"], enumValues = [(EnumCode {getEnumCode = 1},\"NO_SERVICE\"),(EnumCode {getEnumCode = 2},\"REDUCED_SERVICE\"),(EnumCode {getEnumCode = 3},\"SIGNIFICANT_DELAYS\"),(EnumCode {getEnumCode = 4},\"DETOUR\"),(EnumCode {getEnumCode = 5},\"ADDITIONAL_SERVICE\"),(EnumCode {getEnumCode = 6},\"MODIFIED_SERVICE\"),(EnumCode {getEnumCode = 7},\"OTHER_EFFECT\"),(EnumCode {getEnumCode = 8},\"UNKNOWN_EFFECT\"),(EnumCode {getEnumCode = 9},\"STOP_MOVED\"),(EnumCode {getEnumCode = 10},\"NO_EFFECT\"),(EnumCode {getEnumCode = 11},\"ACCESSIBILITY_ISSUE\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.Alert.SeverityLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"SeverityLevel\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"Alert\",\"SeverityLevel.hs\"], enumValues = [(EnumCode {getEnumCode = 1},\"UNKNOWN_SEVERITY\"),(EnumCode {getEnumCode = 2},\"INFO\"),(EnumCode {getEnumCode = 3},\"WARNING\"),(EnumCode {getEnumCode = 4},\"SEVERE\")], enumJsonInstances = False},EnumInfo {enumName = ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName = MName \"ScheduleRelationship\"}, enumFilePath = [\"GTFS\",\"Realtime\",\"TripDescriptor\",\"ScheduleRelationship.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"SCHEDULED\"),(EnumCode {getEnumCode = 1},\"ADDED\"),(EnumCode {getEnumCode = 2},\"UNSCHEDULED\"),(EnumCode {getEnumCode = 3},\"CANCELED\"),(EnumCode {getEnumCode = 5},\"REPLACEMENT\"),(EnumCode {getEnumCode = 6},\"DUPLICATED\")], enumJsonInstances = False}], oneofs = [], services = [], knownKeyMap = fromList []}" + +fileDescriptorProto :: FileDescriptorProto +fileDescriptorProto + = P'.getFromBS (P'.wireGet 11) + (P'.pack + "\168+\n\DC3gtfs-realtime.proto\DC2\DLEtransit_realtime\"y\n\vFeedMessage\DC2,\n\ACKheader\CAN\SOH \STX(\v2\FS.transit_realtime.FeedHeader\DC2,\n\ACKentity\CAN\STX \ETX(\v2\FS.transit_realtime.FeedEntity*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\215\SOH\n\nFeedHeader\DC2\GS\n\NAKgtfs_realtime_version\CAN\SOH \STX(\t\DC2Q\n\SOincrementality\CAN\STX \SOH(\SO2+.transit_realtime.FeedHeader.Incrementality:\fFULL_DATASET\DC2\DC1\n\ttimestamp\CAN\ETX \SOH(\EOT\"4\n\SOIncrementality\DC2\DLE\n\fFULL_DATASET\DLE\NUL\DC2\DLE\n\fDIFFERENTIAL\DLE\SOH*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\250\SOH\n\nFeedEntity\DC2\n\n\STXid\CAN\SOH \STX(\t\DC2\EM\n\nis_deleted\CAN\STX \SOH(\b:\ENQfalse\DC21\n\vtrip_update\CAN\ETX \SOH(\v2\FS.transit_realtime.TripUpdate\DC22\n\avehicle\CAN\EOT \SOH(\v2!.transit_realtime.VehiclePosition\DC2&\n\ENQalert\CAN\ENQ \SOH(\v2\ETB.transit_realtime.Alert\DC2&\n\ENQshape\CAN\ACK \SOH(\v2\ETB.transit_realtime.Shape*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\235\b\n\nTripUpdate\DC2.\n\EOTtrip\CAN\SOH \STX(\v2 .transit_realtime.TripDescriptor\DC24\n\avehicle\CAN\ETX \SOH(\v2#.transit_realtime.VehicleDescriptor\DC2E\n\DLEstop_time_update\CAN\STX \ETX(\v2+.transit_realtime.TripUpdate.StopTimeUpdate\DC2\DC1\n\ttimestamp\CAN\EOT \SOH(\EOT\DC2\r\n\ENQdelay\CAN\ENQ \SOH(\ENQ\DC2D\n\SItrip_properties\CAN\ACK \SOH(\v2+.transit_realtime.TripUpdate.TripProperties\SUBQ\n\rStopTimeEvent\DC2\r\n\ENQdelay\CAN\SOH \SOH(\ENQ\DC2\f\n\EOTtime\CAN\STX \SOH(\ETX\DC2\DC3\n\vuncertainty\CAN\ETX \SOH(\ENQ*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\SUB\247\EOT\n\SOStopTimeUpdate\DC2\NAK\n\rstop_sequence\CAN\SOH \SOH(\r\DC2\SI\n\astop_id\CAN\EOT \SOH(\t\DC2;\n\aarrival\CAN\STX \SOH(\v2*.transit_realtime.TripUpdate.StopTimeEvent\DC2=\n\tdeparture\CAN\ETX \SOH(\v2*.transit_realtime.TripUpdate.StopTimeEvent\DC2U\n\SUBdeparture_occupancy_status\CAN\a \SOH(\SO21.transit_realtime.VehiclePosition.OccupancyStatus\DC2j\n\NAKschedule_relationship\CAN\ENQ \SOH(\SO2@.transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship:\tSCHEDULED\DC2\\\n\DC4stop_time_properties\CAN\ACK \SOH(\v2>.transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties\SUB>\n\DC2StopTimeProperties\DC2\CAN\n\DLEassigned_stop_id\CAN\SOH \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"P\n\DC4ScheduleRelationship\DC2\r\n\tSCHEDULED\DLE\NUL\DC2\v\n\aSKIPPED\DLE\SOH\DC2\v\n\aNO_DATA\DLE\STX\DC2\SI\n\vUNSCHEDULED\DLE\ETX*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\SUBk\n\SOTripProperties\DC2\SI\n\atrip_id\CAN\SOH \SOH(\t\DC2\DC2\n\nstart_date\CAN\STX \SOH(\t\DC2\DC2\n\nstart_time\CAN\ETX \SOH(\t\DC2\DLE\n\bshape_id\CAN\EOT \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\223\t\n\SIVehiclePosition\DC2.\n\EOTtrip\CAN\SOH \SOH(\v2 .transit_realtime.TripDescriptor\DC24\n\avehicle\CAN\b \SOH(\v2#.transit_realtime.VehicleDescriptor\DC2,\n\bposition\CAN\STX \SOH(\v2\SUB.transit_realtime.Position\DC2\GS\n\NAKcurrent_stop_sequence\CAN\ETX \SOH(\r\DC2\SI\n\astop_id\CAN\a \SOH(\t\DC2Z\n\SOcurrent_status\CAN\EOT \SOH(\SO23.transit_realtime.VehiclePosition.VehicleStopStatus:\rIN_TRANSIT_TO\DC2\DC1\n\ttimestamp\CAN\ENQ \SOH(\EOT\DC2K\n\DLEcongestion_level\CAN\ACK \SOH(\SO21.transit_realtime.VehiclePosition.CongestionLevel\DC2K\n\DLEoccupancy_status\CAN\t \SOH(\SO21.transit_realtime.VehiclePosition.OccupancyStatus\DC2\FS\n\DC4occupancy_percentage\CAN\n \SOH(\r\DC2Q\n\SYNmulti_carriage_details\CAN\v \ETX(\v21.transit_realtime.VehiclePosition.CarriageDetails\SUB\217\SOH\n\SICarriageDetails\DC2\n\n\STXid\CAN\SOH \SOH(\t\DC2\r\n\ENQlabel\CAN\STX \SOH(\t\DC2^\n\DLEoccupancy_status\CAN\ETX \SOH(\SO21.transit_realtime.VehiclePosition.OccupancyStatus:\DC1NO_DATA_AVAILABLE\DC2 \n\DC4occupancy_percentage\CAN\EOT \SOH(\ENQ:\STX-1\DC2\EM\n\DC1carriage_sequence\CAN\ENQ \SOH(\r*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"G\n\DC1VehicleStopStatus\DC2\SI\n\vINCOMING_AT\DLE\NUL\DC2\SO\n\nSTOPPED_AT\DLE\SOH\DC2\DC1\n\rIN_TRANSIT_TO\DLE\STX\"}\n\SICongestionLevel\DC2\FS\n\CANUNKNOWN_CONGESTION_LEVEL\DLE\NUL\DC2\DC4\n\DLERUNNING_SMOOTHLY\DLE\SOH\DC2\SI\n\vSTOP_AND_GO\DLE\STX\DC2\SO\n\nCONGESTION\DLE\ETX\DC2\NAK\n\DC1SEVERE_CONGESTION\DLE\EOT\"\217\SOH\n\SIOccupancyStatus\DC2\t\n\ENQEMPTY\DLE\NUL\DC2\CAN\n\DC4MANY_SEATS_AVAILABLE\DLE\SOH\DC2\ETB\n\DC3FEW_SEATS_AVAILABLE\DLE\STX\DC2\SYN\n\DC2STANDING_ROOM_ONLY\DLE\ETX\DC2\RS\n\SUBCRUSHED_STANDING_ROOM_ONLY\DLE\EOT\DC2\b\n\EOTFULL\DLE\ENQ\DC2\FS\n\CANNOT_ACCEPTING_PASSENGERS\DLE\ACK\DC2\NAK\n\DC1NO_DATA_AVAILABLE\DLE\a\DC2\DC1\n\rNOT_BOARDABLE\DLE\b*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\246\t\n\ENQAlert\DC22\n\ractive_period\CAN\SOH \ETX(\v2\ESC.transit_realtime.TimeRange\DC29\n\SIinformed_entity\CAN\ENQ \ETX(\v2 .transit_realtime.EntitySelector\DC2;\n\ENQcause\CAN\ACK \SOH(\SO2\GS.transit_realtime.Alert.Cause:\rUNKNOWN_CAUSE\DC2>\n\ACKeffect\CAN\a \SOH(\SO2\RS.transit_realtime.Alert.Effect:\SOUNKNOWN_EFFECT\DC2/\n\ETXurl\CAN\b \SOH(\v2\".transit_realtime.TranslatedString\DC27\n\vheader_text\CAN\n \SOH(\v2\".transit_realtime.TranslatedString\DC2<\n\DLEdescription_text\CAN\v \SOH(\v2\".transit_realtime.TranslatedString\DC2;\n\SItts_header_text\CAN\f \SOH(\v2\".transit_realtime.TranslatedString\DC2@\n\DC4tts_description_text\CAN\r \SOH(\v2\".transit_realtime.TranslatedString\DC2O\n\SOseverity_level\CAN\SO \SOH(\SO2%.transit_realtime.Alert.SeverityLevel:\DLEUNKNOWN_SEVERITY\DC20\n\ENQimage\CAN\SI \SOH(\v2!.transit_realtime.TranslatedImage\DC2B\n\SYNimage_alternative_text\CAN\DLE \SOH(\v2\".transit_realtime.TranslatedString\"\216\SOH\n\ENQCause\DC2\DC1\n\rUNKNOWN_CAUSE\DLE\SOH\DC2\SI\n\vOTHER_CAUSE\DLE\STX\DC2\NAK\n\DC1TECHNICAL_PROBLEM\DLE\ETX\DC2\n\n\ACKSTRIKE\DLE\EOT\DC2\DC1\n\rDEMONSTRATION\DLE\ENQ\DC2\f\n\bACCIDENT\DLE\ACK\DC2\v\n\aHOLIDAY\DLE\a\DC2\v\n\aWEATHER\DLE\b\DC2\SI\n\vMAINTENANCE\DLE\t\DC2\DLE\n\fCONSTRUCTION\DLE\n\DC2\DC3\n\SIPOLICE_ACTIVITY\DLE\v\DC2\NAK\n\DC1MEDICAL_EMERGENCY\DLE\f\"\221\SOH\n\ACKEffect\DC2\SO\n\nNO_SERVICE\DLE\SOH\DC2\DC3\n\SIREDUCED_SERVICE\DLE\STX\DC2\SYN\n\DC2SIGNIFICANT_DELAYS\DLE\ETX\DC2\n\n\ACKDETOUR\DLE\EOT\DC2\SYN\n\DC2ADDITIONAL_SERVICE\DLE\ENQ\DC2\DC4\n\DLEMODIFIED_SERVICE\DLE\ACK\DC2\DLE\n\fOTHER_EFFECT\DLE\a\DC2\DC2\n\SOUNKNOWN_EFFECT\DLE\b\DC2\SO\n\nSTOP_MOVED\DLE\t\DC2\r\n\tNO_EFFECT\DLE\n\DC2\ETB\n\DC3ACCESSIBILITY_ISSUE\DLE\v\"H\n\rSeverityLevel\DC2\DC4\n\DLEUNKNOWN_SEVERITY\DLE\SOH\DC2\b\n\EOTINFO\DLE\STX\DC2\v\n\aWARNING\DLE\ETX\DC2\n\n\ACKSEVERE\DLE\EOT*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"7\n\tTimeRange\DC2\r\n\ENQstart\CAN\SOH \SOH(\EOT\DC2\v\n\ETXend\CAN\STX \SOH(\EOT*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"q\n\bPosition\DC2\DLE\n\blatitude\CAN\SOH \STX(\STX\DC2\DC1\n\tlongitude\CAN\STX \STX(\STX\DC2\SI\n\abearing\CAN\ETX \SOH(\STX\DC2\DLE\n\bodometer\CAN\EOT \SOH(\SOH\DC2\r\n\ENQspeed\CAN\ENQ \SOH(\STX*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\201\STX\n\SOTripDescriptor\DC2\SI\n\atrip_id\CAN\SOH \SOH(\t\DC2\DLE\n\broute_id\CAN\ENQ \SOH(\t\DC2\DC4\n\fdirection_id\CAN\ACK \SOH(\r\DC2\DC2\n\nstart_time\CAN\STX \SOH(\t\DC2\DC2\n\nstart_date\CAN\ETX \SOH(\t\DC2T\n\NAKschedule_relationship\CAN\EOT \SOH(\SO25.transit_realtime.TripDescriptor.ScheduleRelationship\"p\n\DC4ScheduleRelationship\DC2\r\n\tSCHEDULED\DLE\NUL\DC2\t\n\ENQADDED\DLE\SOH\DC2\SI\n\vUNSCHEDULED\DLE\STX\DC2\f\n\bCANCELED\DLE\ETX\DC2\SI\n\vREPLACEMENT\DLE\ENQ\DC2\SO\n\nDUPLICATED\DLE\ACK*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"U\n\DC1VehicleDescriptor\DC2\n\n\STXid\CAN\SOH \SOH(\t\DC2\r\n\ENQlabel\CAN\STX \SOH(\t\DC2\NAK\n\rlicense_plate\CAN\ETX \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\176\SOH\n\SOEntitySelector\DC2\DC1\n\tagency_id\CAN\SOH \SOH(\t\DC2\DLE\n\broute_id\CAN\STX \SOH(\t\DC2\DC2\n\nroute_type\CAN\ETX \SOH(\ENQ\DC2.\n\EOTtrip\CAN\EOT \SOH(\v2 .transit_realtime.TripDescriptor\DC2\SI\n\astop_id\CAN\ENQ \SOH(\t\DC2\DC4\n\fdirection_id\CAN\ACK \SOH(\r*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\166\SOH\n\DLETranslatedString\DC2C\n\vtranslation\CAN\SOH \ETX(\v2..transit_realtime.TranslatedString.Translation\SUB=\n\vTranslation\DC2\f\n\EOTtext\CAN\SOH \STX(\t\DC2\DLE\n\blanguage\CAN\STX \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"\193\SOH\n\SITranslatedImage\DC2I\n\SIlocalized_image\CAN\SOH \ETX(\v20.transit_realtime.TranslatedImage.LocalizedImage\SUBS\n\SOLocalizedImage\DC2\v\n\ETXurl\CAN\SOH \STX(\t\DC2\DC2\n\nmedia_type\CAN\STX \STX(\t\DC2\DLE\n\blanguage\CAN\ETX \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144N\"C\n\ENQShape\DC2\DLE\n\bshape_id\CAN\SOH \SOH(\t\DC2\CAN\n\DLEencoded_polyline\CAN\STX \SOH(\t*\ACK\b\232\a\DLE\208\SI*\ACK\b\168F\DLE\144NB(\n\rGTFS.realtimeH\SOHP\NUL\128\SOH\NUL\136\SOH\NUL\144\SOH\NUL\160\SOH\NUL\184\SOH\NUL\216\SOH\NUL\248\SOH\NULb\ACKproto2") \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Alert.hs b/gtfs/GTFS/Realtime/Alert.hs new file mode 100644 index 0000000..bca6530 --- /dev/null +++ b/gtfs/GTFS/Realtime/Alert.hs @@ -0,0 +1,204 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Alert (Alert(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.Alert.Cause as GTFS.Realtime.Alert +import qualified GTFS.Realtime.Alert.Effect as GTFS.Realtime.Alert +import qualified GTFS.Realtime.Alert.SeverityLevel as GTFS.Realtime.Alert +import qualified GTFS.Realtime.EntitySelector as GTFS.Realtime +import qualified GTFS.Realtime.TimeRange as GTFS.Realtime +import qualified GTFS.Realtime.TranslatedImage as GTFS.Realtime +import qualified GTFS.Realtime.TranslatedString as GTFS.Realtime + +data Alert = Alert{active_period :: !(P'.Seq GTFS.Realtime.TimeRange), informed_entity :: !(P'.Seq GTFS.Realtime.EntitySelector), + cause :: !(P'.Maybe GTFS.Realtime.Alert.Cause), effect :: !(P'.Maybe GTFS.Realtime.Alert.Effect), + url :: !(P'.Maybe GTFS.Realtime.TranslatedString), header_text :: !(P'.Maybe GTFS.Realtime.TranslatedString), + description_text :: !(P'.Maybe GTFS.Realtime.TranslatedString), + tts_header_text :: !(P'.Maybe GTFS.Realtime.TranslatedString), + tts_description_text :: !(P'.Maybe GTFS.Realtime.TranslatedString), + severity_level :: !(P'.Maybe GTFS.Realtime.Alert.SeverityLevel), + image :: !(P'.Maybe GTFS.Realtime.TranslatedImage), + image_alternative_text :: !(P'.Maybe GTFS.Realtime.TranslatedString), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage Alert where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable Alert where + mergeAppend (Alert x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13) + (Alert y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9 y'10 y'11 y'12 y'13) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + !z'8 = P'.mergeAppend x'8 y'8 + !z'9 = P'.mergeAppend x'9 y'9 + !z'10 = P'.mergeAppend x'10 y'10 + !z'11 = P'.mergeAppend x'11 y'11 + !z'12 = P'.mergeAppend x'12 y'12 + !z'13 = P'.mergeAppend x'13 y'13 + in Alert z'1 z'2 z'3 z'4 z'5 z'6 z'7 z'8 z'9 z'10 z'11 z'12 z'13 + +instance P'.Default Alert where + defaultValue + = Alert P'.defaultValue P'.defaultValue (Prelude'.Just (Prelude'.read "UNKNOWN_CAUSE")) + (Prelude'.Just (Prelude'.read "UNKNOWN_EFFECT")) + P'.defaultValue + P'.defaultValue + P'.defaultValue + P'.defaultValue + P'.defaultValue + (Prelude'.Just (Prelude'.read "UNKNOWN_SEVERITY")) + P'.defaultValue + P'.defaultValue + P'.defaultValue + +instance P'.Wire Alert where + wireSize ft' self'@(Alert x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeRep 1 11 x'1 + P'.wireSizeRep 1 11 x'2 + P'.wireSizeOpt 1 14 x'3 + P'.wireSizeOpt 1 14 x'4 + + P'.wireSizeOpt 1 11 x'5 + + P'.wireSizeOpt 1 11 x'6 + + P'.wireSizeOpt 1 11 x'7 + + P'.wireSizeOpt 1 11 x'8 + + P'.wireSizeOpt 1 11 x'9 + + P'.wireSizeOpt 1 14 x'10 + + P'.wireSizeOpt 1 11 x'11 + + P'.wireSizeOpt 2 11 x'12 + + P'.wireSizeExtField x'13) + wirePutWithSize ft' self'@(Alert x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutRepWithSize 10 11 x'1, P'.wirePutRepWithSize 42 11 x'2, P'.wirePutOptWithSize 48 14 x'3, + P'.wirePutOptWithSize 56 14 x'4, P'.wirePutOptWithSize 66 11 x'5, P'.wirePutOptWithSize 82 11 x'6, + P'.wirePutOptWithSize 90 11 x'7, P'.wirePutOptWithSize 98 11 x'8, P'.wirePutOptWithSize 106 11 x'9, + P'.wirePutOptWithSize 112 14 x'10, P'.wirePutOptWithSize 122 11 x'11, P'.wirePutOptWithSize 130 11 x'12, + P'.wirePutExtFieldWithSize x'13] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{active_period = P'.append (active_period old'Self) new'Field}) + (P'.wireGet 11) + 42 -> Prelude'.fmap (\ !new'Field -> old'Self{informed_entity = P'.append (informed_entity old'Self) new'Field}) + (P'.wireGet 11) + 48 -> Prelude'.fmap (\ !new'Field -> old'Self{cause = Prelude'.Just new'Field}) (P'.wireGet 14) + 56 -> Prelude'.fmap (\ !new'Field -> old'Self{effect = Prelude'.Just new'Field}) (P'.wireGet 14) + 66 -> Prelude'.fmap (\ !new'Field -> old'Self{url = P'.mergeAppend (url old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 82 -> Prelude'.fmap + (\ !new'Field -> old'Self{header_text = P'.mergeAppend (header_text old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 90 -> Prelude'.fmap + (\ !new'Field -> + old'Self{description_text = P'.mergeAppend (description_text old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 98 -> Prelude'.fmap + (\ !new'Field -> + old'Self{tts_header_text = P'.mergeAppend (tts_header_text old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 106 -> Prelude'.fmap + (\ !new'Field -> + old'Self{tts_description_text = P'.mergeAppend (tts_description_text old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 112 -> Prelude'.fmap (\ !new'Field -> old'Self{severity_level = Prelude'.Just new'Field}) (P'.wireGet 14) + 122 -> Prelude'.fmap (\ !new'Field -> old'Self{image = P'.mergeAppend (image old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 130 -> Prelude'.fmap + (\ !new'Field -> + old'Self{image_alternative_text = + P'.mergeAppend (image_alternative_text old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> Alert) Alert where + getVal m' f' = f' m' + +instance P'.GPB Alert + +instance P'.ReflectDescriptor Alert where + getMessageInfo _ + = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 42, 48, 56, 66, 82, 90, 98, 106, 112, 122, 130]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Alert\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Alert\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Alert.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.active_period\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"active_period\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TimeRange\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TimeRange\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.informed_entity\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"informed_entity\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.EntitySelector\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"EntitySelector\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.cause\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"cause\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.Cause\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Cause\"}), hsRawDefault = Just \"UNKNOWN_CAUSE\", hsDefault = Just (HsDef'Enum \"UNKNOWN_CAUSE\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.effect\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"effect\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.Effect\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"Effect\"}), hsRawDefault = Just \"UNKNOWN_EFFECT\", hsDefault = Just (HsDef'Enum \"UNKNOWN_EFFECT\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.url\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"url\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.header_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"header_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.description_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"description_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 90}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.tts_header_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"tts_header_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 12}, wireTag = WireTag {getWireTag = 98}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.tts_description_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"tts_description_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 13}, wireTag = WireTag {getWireTag = 106}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.severity_level\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"severity_level\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 14}, wireTag = WireTag {getWireTag = 112}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert.SeverityLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName = MName \"SeverityLevel\"}), hsRawDefault = Just \"UNKNOWN_SEVERITY\", hsDefault = Just (HsDef'Enum \"UNKNOWN_SEVERITY\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.image\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"image\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 15}, wireTag = WireTag {getWireTag = 122}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedImage\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Alert.image_alternative_text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Alert\"], baseName' = FName \"image_alternative_text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 16}, wireTag = WireTag {getWireTag = 130}, packedTag = Nothing, wireTagLength = 2, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType Alert where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg Alert where + textPut msg + = do + P'.tellT "active_period" (active_period msg) + P'.tellT "informed_entity" (informed_entity msg) + P'.tellT "cause" (cause msg) + P'.tellT "effect" (effect msg) + P'.tellT "url" (url msg) + P'.tellT "header_text" (header_text msg) + P'.tellT "description_text" (description_text msg) + P'.tellT "tts_header_text" (tts_header_text msg) + P'.tellT "tts_description_text" (tts_description_text msg) + P'.tellT "severity_level" (severity_level msg) + P'.tellT "image" (image msg) + P'.tellT "image_alternative_text" (image_alternative_text msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice + [parse'active_period, parse'informed_entity, parse'cause, parse'effect, parse'url, parse'header_text, + parse'description_text, parse'tts_header_text, parse'tts_description_text, parse'severity_level, parse'image, + parse'image_alternative_text]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'active_period + = Prelude'.fmap (\ v o -> o{active_period = P'.append (active_period o) v}) (P'.try (P'.getT "active_period")) + parse'informed_entity + = Prelude'.fmap (\ v o -> o{informed_entity = P'.append (informed_entity o) v}) (P'.try (P'.getT "informed_entity")) + parse'cause = Prelude'.fmap (\ v o -> o{cause = v}) (P'.try (P'.getT "cause")) + parse'effect = Prelude'.fmap (\ v o -> o{effect = v}) (P'.try (P'.getT "effect")) + parse'url = Prelude'.fmap (\ v o -> o{url = v}) (P'.try (P'.getT "url")) + parse'header_text = Prelude'.fmap (\ v o -> o{header_text = v}) (P'.try (P'.getT "header_text")) + parse'description_text = Prelude'.fmap (\ v o -> o{description_text = v}) (P'.try (P'.getT "description_text")) + parse'tts_header_text = Prelude'.fmap (\ v o -> o{tts_header_text = v}) (P'.try (P'.getT "tts_header_text")) + parse'tts_description_text = Prelude'.fmap (\ v o -> o{tts_description_text = v}) (P'.try (P'.getT "tts_description_text")) + parse'severity_level = Prelude'.fmap (\ v o -> o{severity_level = v}) (P'.try (P'.getT "severity_level")) + parse'image = Prelude'.fmap (\ v o -> o{image = v}) (P'.try (P'.getT "image")) + parse'image_alternative_text + = Prelude'.fmap (\ v o -> o{image_alternative_text = v}) (P'.try (P'.getT "image_alternative_text")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Alert/Cause.hs b/gtfs/GTFS/Realtime/Alert/Cause.hs new file mode 100644 index 0000000..9f71db7 --- /dev/null +++ b/gtfs/GTFS/Realtime/Alert/Cause.hs @@ -0,0 +1,118 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Alert.Cause (Cause(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Cause = UNKNOWN_CAUSE + | OTHER_CAUSE + | TECHNICAL_PROBLEM + | STRIKE + | DEMONSTRATION + | ACCIDENT + | HOLIDAY + | WEATHER + | MAINTENANCE + | CONSTRUCTION + | POLICE_ACTIVITY + | MEDICAL_EMERGENCY + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.Mergeable Cause + +instance Prelude'.Bounded Cause where + minBound = UNKNOWN_CAUSE + maxBound = MEDICAL_EMERGENCY + +instance P'.Default Cause where + defaultValue = UNKNOWN_CAUSE + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe Cause +toMaybe'Enum 1 = Prelude'.Just UNKNOWN_CAUSE +toMaybe'Enum 2 = Prelude'.Just OTHER_CAUSE +toMaybe'Enum 3 = Prelude'.Just TECHNICAL_PROBLEM +toMaybe'Enum 4 = Prelude'.Just STRIKE +toMaybe'Enum 5 = Prelude'.Just DEMONSTRATION +toMaybe'Enum 6 = Prelude'.Just ACCIDENT +toMaybe'Enum 7 = Prelude'.Just HOLIDAY +toMaybe'Enum 8 = Prelude'.Just WEATHER +toMaybe'Enum 9 = Prelude'.Just MAINTENANCE +toMaybe'Enum 10 = Prelude'.Just CONSTRUCTION +toMaybe'Enum 11 = Prelude'.Just POLICE_ACTIVITY +toMaybe'Enum 12 = Prelude'.Just MEDICAL_EMERGENCY +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum Cause where + fromEnum UNKNOWN_CAUSE = 1 + fromEnum OTHER_CAUSE = 2 + fromEnum TECHNICAL_PROBLEM = 3 + fromEnum STRIKE = 4 + fromEnum DEMONSTRATION = 5 + fromEnum ACCIDENT = 6 + fromEnum HOLIDAY = 7 + fromEnum WEATHER = 8 + fromEnum MAINTENANCE = 9 + fromEnum CONSTRUCTION = 10 + fromEnum POLICE_ACTIVITY = 11 + fromEnum MEDICAL_EMERGENCY = 12 + toEnum = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.Alert.Cause") . toMaybe'Enum + succ UNKNOWN_CAUSE = OTHER_CAUSE + succ OTHER_CAUSE = TECHNICAL_PROBLEM + succ TECHNICAL_PROBLEM = STRIKE + succ STRIKE = DEMONSTRATION + succ DEMONSTRATION = ACCIDENT + succ ACCIDENT = HOLIDAY + succ HOLIDAY = WEATHER + succ WEATHER = MAINTENANCE + succ MAINTENANCE = CONSTRUCTION + succ CONSTRUCTION = POLICE_ACTIVITY + succ POLICE_ACTIVITY = MEDICAL_EMERGENCY + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.Alert.Cause" + pred OTHER_CAUSE = UNKNOWN_CAUSE + pred TECHNICAL_PROBLEM = OTHER_CAUSE + pred STRIKE = TECHNICAL_PROBLEM + pred DEMONSTRATION = STRIKE + pred ACCIDENT = DEMONSTRATION + pred HOLIDAY = ACCIDENT + pred WEATHER = HOLIDAY + pred MAINTENANCE = WEATHER + pred CONSTRUCTION = MAINTENANCE + pred POLICE_ACTIVITY = CONSTRUCTION + pred MEDICAL_EMERGENCY = POLICE_ACTIVITY + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.Alert.Cause" + +instance P'.Wire Cause where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB Cause + +instance P'.MessageAPI msg' (msg' -> Cause) Cause where + getVal m' f' = f' m' + +instance P'.ReflectEnum Cause where + reflectEnum + = [(1, "UNKNOWN_CAUSE", UNKNOWN_CAUSE), (2, "OTHER_CAUSE", OTHER_CAUSE), (3, "TECHNICAL_PROBLEM", TECHNICAL_PROBLEM), + (4, "STRIKE", STRIKE), (5, "DEMONSTRATION", DEMONSTRATION), (6, "ACCIDENT", ACCIDENT), (7, "HOLIDAY", HOLIDAY), + (8, "WEATHER", WEATHER), (9, "MAINTENANCE", MAINTENANCE), (10, "CONSTRUCTION", CONSTRUCTION), + (11, "POLICE_ACTIVITY", POLICE_ACTIVITY), (12, "MEDICAL_EMERGENCY", MEDICAL_EMERGENCY)] + reflectEnumInfo _ + = P'.EnumInfo (P'.makePNF (P'.pack ".transit_realtime.Alert.Cause") [] ["GTFS", "Realtime", "Alert"] "Cause") + ["GTFS", "Realtime", "Alert", "Cause.hs"] + [(1, "UNKNOWN_CAUSE"), (2, "OTHER_CAUSE"), (3, "TECHNICAL_PROBLEM"), (4, "STRIKE"), (5, "DEMONSTRATION"), (6, "ACCIDENT"), + (7, "HOLIDAY"), (8, "WEATHER"), (9, "MAINTENANCE"), (10, "CONSTRUCTION"), (11, "POLICE_ACTIVITY"), (12, "MEDICAL_EMERGENCY")] + Prelude'.False + +instance P'.TextType Cause where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Alert/Effect.hs b/gtfs/GTFS/Realtime/Alert/Effect.hs new file mode 100644 index 0000000..dcaa77d --- /dev/null +++ b/gtfs/GTFS/Realtime/Alert/Effect.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Alert.Effect (Effect(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Effect = NO_SERVICE + | REDUCED_SERVICE + | SIGNIFICANT_DELAYS + | DETOUR + | ADDITIONAL_SERVICE + | MODIFIED_SERVICE + | OTHER_EFFECT + | UNKNOWN_EFFECT + | STOP_MOVED + | NO_EFFECT + | ACCESSIBILITY_ISSUE + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.Mergeable Effect + +instance Prelude'.Bounded Effect where + minBound = NO_SERVICE + maxBound = ACCESSIBILITY_ISSUE + +instance P'.Default Effect where + defaultValue = NO_SERVICE + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe Effect +toMaybe'Enum 1 = Prelude'.Just NO_SERVICE +toMaybe'Enum 2 = Prelude'.Just REDUCED_SERVICE +toMaybe'Enum 3 = Prelude'.Just SIGNIFICANT_DELAYS +toMaybe'Enum 4 = Prelude'.Just DETOUR +toMaybe'Enum 5 = Prelude'.Just ADDITIONAL_SERVICE +toMaybe'Enum 6 = Prelude'.Just MODIFIED_SERVICE +toMaybe'Enum 7 = Prelude'.Just OTHER_EFFECT +toMaybe'Enum 8 = Prelude'.Just UNKNOWN_EFFECT +toMaybe'Enum 9 = Prelude'.Just STOP_MOVED +toMaybe'Enum 10 = Prelude'.Just NO_EFFECT +toMaybe'Enum 11 = Prelude'.Just ACCESSIBILITY_ISSUE +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum Effect where + fromEnum NO_SERVICE = 1 + fromEnum REDUCED_SERVICE = 2 + fromEnum SIGNIFICANT_DELAYS = 3 + fromEnum DETOUR = 4 + fromEnum ADDITIONAL_SERVICE = 5 + fromEnum MODIFIED_SERVICE = 6 + fromEnum OTHER_EFFECT = 7 + fromEnum UNKNOWN_EFFECT = 8 + fromEnum STOP_MOVED = 9 + fromEnum NO_EFFECT = 10 + fromEnum ACCESSIBILITY_ISSUE = 11 + toEnum = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.Alert.Effect") . toMaybe'Enum + succ NO_SERVICE = REDUCED_SERVICE + succ REDUCED_SERVICE = SIGNIFICANT_DELAYS + succ SIGNIFICANT_DELAYS = DETOUR + succ DETOUR = ADDITIONAL_SERVICE + succ ADDITIONAL_SERVICE = MODIFIED_SERVICE + succ MODIFIED_SERVICE = OTHER_EFFECT + succ OTHER_EFFECT = UNKNOWN_EFFECT + succ UNKNOWN_EFFECT = STOP_MOVED + succ STOP_MOVED = NO_EFFECT + succ NO_EFFECT = ACCESSIBILITY_ISSUE + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.Alert.Effect" + pred REDUCED_SERVICE = NO_SERVICE + pred SIGNIFICANT_DELAYS = REDUCED_SERVICE + pred DETOUR = SIGNIFICANT_DELAYS + pred ADDITIONAL_SERVICE = DETOUR + pred MODIFIED_SERVICE = ADDITIONAL_SERVICE + pred OTHER_EFFECT = MODIFIED_SERVICE + pred UNKNOWN_EFFECT = OTHER_EFFECT + pred STOP_MOVED = UNKNOWN_EFFECT + pred NO_EFFECT = STOP_MOVED + pred ACCESSIBILITY_ISSUE = NO_EFFECT + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.Alert.Effect" + +instance P'.Wire Effect where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB Effect + +instance P'.MessageAPI msg' (msg' -> Effect) Effect where + getVal m' f' = f' m' + +instance P'.ReflectEnum Effect where + reflectEnum + = [(1, "NO_SERVICE", NO_SERVICE), (2, "REDUCED_SERVICE", REDUCED_SERVICE), (3, "SIGNIFICANT_DELAYS", SIGNIFICANT_DELAYS), + (4, "DETOUR", DETOUR), (5, "ADDITIONAL_SERVICE", ADDITIONAL_SERVICE), (6, "MODIFIED_SERVICE", MODIFIED_SERVICE), + (7, "OTHER_EFFECT", OTHER_EFFECT), (8, "UNKNOWN_EFFECT", UNKNOWN_EFFECT), (9, "STOP_MOVED", STOP_MOVED), + (10, "NO_EFFECT", NO_EFFECT), (11, "ACCESSIBILITY_ISSUE", ACCESSIBILITY_ISSUE)] + reflectEnumInfo _ + = P'.EnumInfo (P'.makePNF (P'.pack ".transit_realtime.Alert.Effect") [] ["GTFS", "Realtime", "Alert"] "Effect") + ["GTFS", "Realtime", "Alert", "Effect.hs"] + [(1, "NO_SERVICE"), (2, "REDUCED_SERVICE"), (3, "SIGNIFICANT_DELAYS"), (4, "DETOUR"), (5, "ADDITIONAL_SERVICE"), + (6, "MODIFIED_SERVICE"), (7, "OTHER_EFFECT"), (8, "UNKNOWN_EFFECT"), (9, "STOP_MOVED"), (10, "NO_EFFECT"), + (11, "ACCESSIBILITY_ISSUE")] + Prelude'.False + +instance P'.TextType Effect where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Alert/SeverityLevel.hs b/gtfs/GTFS/Realtime/Alert/SeverityLevel.hs new file mode 100644 index 0000000..bb50ff3 --- /dev/null +++ b/gtfs/GTFS/Realtime/Alert/SeverityLevel.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Alert.SeverityLevel (SeverityLevel(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data SeverityLevel = UNKNOWN_SEVERITY + | INFO + | WARNING + | SEVERE + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable SeverityLevel + +instance Prelude'.Bounded SeverityLevel where + minBound = UNKNOWN_SEVERITY + maxBound = SEVERE + +instance P'.Default SeverityLevel where + defaultValue = UNKNOWN_SEVERITY + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe SeverityLevel +toMaybe'Enum 1 = Prelude'.Just UNKNOWN_SEVERITY +toMaybe'Enum 2 = Prelude'.Just INFO +toMaybe'Enum 3 = Prelude'.Just WARNING +toMaybe'Enum 4 = Prelude'.Just SEVERE +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum SeverityLevel where + fromEnum UNKNOWN_SEVERITY = 1 + fromEnum INFO = 2 + fromEnum WARNING = 3 + fromEnum SEVERE = 4 + toEnum + = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.Alert.SeverityLevel") . + toMaybe'Enum + succ UNKNOWN_SEVERITY = INFO + succ INFO = WARNING + succ WARNING = SEVERE + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.Alert.SeverityLevel" + pred INFO = UNKNOWN_SEVERITY + pred WARNING = INFO + pred SEVERE = WARNING + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.Alert.SeverityLevel" + +instance P'.Wire SeverityLevel where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB SeverityLevel + +instance P'.MessageAPI msg' (msg' -> SeverityLevel) SeverityLevel where + getVal m' f' = f' m' + +instance P'.ReflectEnum SeverityLevel where + reflectEnum = [(1, "UNKNOWN_SEVERITY", UNKNOWN_SEVERITY), (2, "INFO", INFO), (3, "WARNING", WARNING), (4, "SEVERE", SEVERE)] + reflectEnumInfo _ + = P'.EnumInfo (P'.makePNF (P'.pack ".transit_realtime.Alert.SeverityLevel") [] ["GTFS", "Realtime", "Alert"] "SeverityLevel") + ["GTFS", "Realtime", "Alert", "SeverityLevel.hs"] + [(1, "UNKNOWN_SEVERITY"), (2, "INFO"), (3, "WARNING"), (4, "SEVERE")] + Prelude'.False + +instance P'.TextType SeverityLevel where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/EntitySelector.hs b/gtfs/GTFS/Realtime/EntitySelector.hs new file mode 100644 index 0000000..c4441ae --- /dev/null +++ b/gtfs/GTFS/Realtime/EntitySelector.hs @@ -0,0 +1,125 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.EntitySelector (EntitySelector(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TripDescriptor as GTFS.Realtime + +data EntitySelector = EntitySelector{agency_id :: !(P'.Maybe P'.Utf8), route_id :: !(P'.Maybe P'.Utf8), + route_type :: !(P'.Maybe P'.Int32), trip :: !(P'.Maybe GTFS.Realtime.TripDescriptor), + stop_id :: !(P'.Maybe P'.Utf8), direction_id :: !(P'.Maybe P'.Word32), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage EntitySelector where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable EntitySelector where + mergeAppend (EntitySelector x'1 x'2 x'3 x'4 x'5 x'6 x'7) (EntitySelector y'1 y'2 y'3 y'4 y'5 y'6 y'7) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + in EntitySelector z'1 z'2 z'3 z'4 z'5 z'6 z'7 + +instance P'.Default EntitySelector where + defaultValue + = EntitySelector P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire EntitySelector where + wireSize ft' self'@(EntitySelector x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 5 x'3 + P'.wireSizeOpt 1 11 x'4 + + P'.wireSizeOpt 1 9 x'5 + + P'.wireSizeOpt 1 13 x'6 + + P'.wireSizeExtField x'7) + wirePutWithSize ft' self'@(EntitySelector x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutOptWithSize 24 5 x'3, + P'.wirePutOptWithSize 34 11 x'4, P'.wirePutOptWithSize 42 9 x'5, P'.wirePutOptWithSize 48 13 x'6, + P'.wirePutExtFieldWithSize x'7] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{agency_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{route_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 24 -> Prelude'.fmap (\ !new'Field -> old'Self{route_type = Prelude'.Just new'Field}) (P'.wireGet 5) + 34 -> Prelude'.fmap (\ !new'Field -> old'Self{trip = P'.mergeAppend (trip old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 42 -> Prelude'.fmap (\ !new'Field -> old'Self{stop_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 48 -> Prelude'.fmap (\ !new'Field -> old'Self{direction_id = Prelude'.Just new'Field}) (P'.wireGet 13) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> EntitySelector) EntitySelector where + getVal m' f' = f' m' + +instance P'.GPB EntitySelector + +instance P'.ReflectDescriptor EntitySelector where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 24, 34, 42, 48]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.EntitySelector\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"EntitySelector\"}, descFilePath = [\"GTFS\",\"Realtime\",\"EntitySelector.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.agency_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"agency_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.route_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"route_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.route_type\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"route_type\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.EntitySelector.direction_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"EntitySelector\"], baseName' = FName \"direction_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType EntitySelector where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg EntitySelector where + textPut msg + = do + P'.tellT "agency_id" (agency_id msg) + P'.tellT "route_id" (route_id msg) + P'.tellT "route_type" (route_type msg) + P'.tellT "trip" (trip msg) + P'.tellT "stop_id" (stop_id msg) + P'.tellT "direction_id" (direction_id msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice [parse'agency_id, parse'route_id, parse'route_type, parse'trip, parse'stop_id, parse'direction_id]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'agency_id = Prelude'.fmap (\ v o -> o{agency_id = v}) (P'.try (P'.getT "agency_id")) + parse'route_id = Prelude'.fmap (\ v o -> o{route_id = v}) (P'.try (P'.getT "route_id")) + parse'route_type = Prelude'.fmap (\ v o -> o{route_type = v}) (P'.try (P'.getT "route_type")) + parse'trip = Prelude'.fmap (\ v o -> o{trip = v}) (P'.try (P'.getT "trip")) + parse'stop_id = Prelude'.fmap (\ v o -> o{stop_id = v}) (P'.try (P'.getT "stop_id")) + parse'direction_id = Prelude'.fmap (\ v o -> o{direction_id = v}) (P'.try (P'.getT "direction_id")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/FeedEntity.hs b/gtfs/GTFS/Realtime/FeedEntity.hs new file mode 100644 index 0000000..4ac137a --- /dev/null +++ b/gtfs/GTFS/Realtime/FeedEntity.hs @@ -0,0 +1,132 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.FeedEntity (FeedEntity(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.Alert as GTFS.Realtime +import qualified GTFS.Realtime.Shape as GTFS.Realtime +import qualified GTFS.Realtime.TripUpdate as GTFS.Realtime +import qualified GTFS.Realtime.VehiclePosition as GTFS.Realtime + +data FeedEntity = FeedEntity{id :: !(P'.Utf8), is_deleted :: !(P'.Maybe P'.Bool), + trip_update :: !(P'.Maybe GTFS.Realtime.TripUpdate), + vehicle :: !(P'.Maybe GTFS.Realtime.VehiclePosition), alert :: !(P'.Maybe GTFS.Realtime.Alert), + shape :: !(P'.Maybe GTFS.Realtime.Shape), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage FeedEntity where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable FeedEntity where + mergeAppend (FeedEntity x'1 x'2 x'3 x'4 x'5 x'6 x'7) (FeedEntity y'1 y'2 y'3 y'4 y'5 y'6 y'7) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + in FeedEntity z'1 z'2 z'3 z'4 z'5 z'6 z'7 + +instance P'.Default FeedEntity where + defaultValue + = FeedEntity P'.defaultValue (Prelude'.Just Prelude'.False) P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + P'.defaultValue + +instance P'.Wire FeedEntity where + wireSize ft' self'@(FeedEntity x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeOpt 1 8 x'2 + P'.wireSizeOpt 1 11 x'3 + P'.wireSizeOpt 1 11 x'4 + + P'.wireSizeOpt 1 11 x'5 + + P'.wireSizeOpt 1 11 x'6 + + P'.wireSizeExtField x'7) + wirePutWithSize ft' self'@(FeedEntity x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutReqWithSize 10 9 x'1, P'.wirePutOptWithSize 16 8 x'2, P'.wirePutOptWithSize 26 11 x'3, + P'.wirePutOptWithSize 34 11 x'4, P'.wirePutOptWithSize 42 11 x'5, P'.wirePutOptWithSize 50 11 x'6, + P'.wirePutExtFieldWithSize x'7] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{id = new'Field}) (P'.wireGet 9) + 16 -> Prelude'.fmap (\ !new'Field -> old'Self{is_deleted = Prelude'.Just new'Field}) (P'.wireGet 8) + 26 -> Prelude'.fmap + (\ !new'Field -> old'Self{trip_update = P'.mergeAppend (trip_update old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 34 -> Prelude'.fmap (\ !new'Field -> old'Self{vehicle = P'.mergeAppend (vehicle old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 42 -> Prelude'.fmap (\ !new'Field -> old'Self{alert = P'.mergeAppend (alert old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 50 -> Prelude'.fmap (\ !new'Field -> old'Self{shape = P'.mergeAppend (shape old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> FeedEntity) FeedEntity where + getVal m' f' = f' m' + +instance P'.GPB FeedEntity + +instance P'.ReflectDescriptor FeedEntity where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [10, 16, 26, 34, 42, 50]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedEntity\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedEntity\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedEntity.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.is_deleted\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"is_deleted\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Just \"false\", hsDefault = Just (HsDef'Bool False), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.trip_update\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"trip_update\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripUpdate\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehiclePosition\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.alert\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"alert\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Alert\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Alert\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedEntity.shape\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedEntity\"], baseName' = FName \"shape\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Shape\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Shape\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType FeedEntity where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg FeedEntity where + textPut msg + = do + P'.tellT "id" (id msg) + P'.tellT "is_deleted" (is_deleted msg) + P'.tellT "trip_update" (trip_update msg) + P'.tellT "vehicle" (vehicle msg) + P'.tellT "alert" (alert msg) + P'.tellT "shape" (shape msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'id, parse'is_deleted, parse'trip_update, parse'vehicle, parse'alert, parse'shape]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'id = Prelude'.fmap (\ v o -> o{id = v}) (P'.try (P'.getT "id")) + parse'is_deleted = Prelude'.fmap (\ v o -> o{is_deleted = v}) (P'.try (P'.getT "is_deleted")) + parse'trip_update = Prelude'.fmap (\ v o -> o{trip_update = v}) (P'.try (P'.getT "trip_update")) + parse'vehicle = Prelude'.fmap (\ v o -> o{vehicle = v}) (P'.try (P'.getT "vehicle")) + parse'alert = Prelude'.fmap (\ v o -> o{alert = v}) (P'.try (P'.getT "alert")) + parse'shape = Prelude'.fmap (\ v o -> o{shape = v}) (P'.try (P'.getT "shape")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/FeedHeader.hs b/gtfs/GTFS/Realtime/FeedHeader.hs new file mode 100644 index 0000000..f4b8667 --- /dev/null +++ b/gtfs/GTFS/Realtime/FeedHeader.hs @@ -0,0 +1,104 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.FeedHeader (FeedHeader(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.FeedHeader.Incrementality as GTFS.Realtime.FeedHeader + +data FeedHeader = FeedHeader{gtfs_realtime_version :: !(P'.Utf8), + incrementality :: !(P'.Maybe GTFS.Realtime.FeedHeader.Incrementality), + timestamp :: !(P'.Maybe P'.Word64), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage FeedHeader where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable FeedHeader where + mergeAppend (FeedHeader x'1 x'2 x'3 x'4) (FeedHeader y'1 y'2 y'3 y'4) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + in FeedHeader z'1 z'2 z'3 z'4 + +instance P'.Default FeedHeader where + defaultValue = FeedHeader P'.defaultValue (Prelude'.Just (Prelude'.read "FULL_DATASET")) P'.defaultValue P'.defaultValue + +instance P'.Wire FeedHeader where + wireSize ft' self'@(FeedHeader x'1 x'2 x'3 x'4) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeOpt 1 14 x'2 + P'.wireSizeOpt 1 4 x'3 + P'.wireSizeExtField x'4) + wirePutWithSize ft' self'@(FeedHeader x'1 x'2 x'3 x'4) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutReqWithSize 10 9 x'1, P'.wirePutOptWithSize 16 14 x'2, P'.wirePutOptWithSize 24 4 x'3, + P'.wirePutExtFieldWithSize x'4] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{gtfs_realtime_version = new'Field}) (P'.wireGet 9) + 16 -> Prelude'.fmap (\ !new'Field -> old'Self{incrementality = Prelude'.Just new'Field}) (P'.wireGet 14) + 24 -> Prelude'.fmap (\ !new'Field -> old'Self{timestamp = Prelude'.Just new'Field}) (P'.wireGet 4) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> FeedHeader) FeedHeader where + getVal m' f' = f' m' + +instance P'.GPB FeedHeader + +instance P'.ReflectDescriptor FeedHeader where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [10, 16, 24]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedHeader\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedHeader\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedHeader.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.gtfs_realtime_version\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"gtfs_realtime_version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.incrementality\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"incrementality\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedHeader.Incrementality\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName = MName \"Incrementality\"}), hsRawDefault = Just \"FULL_DATASET\", hsDefault = Just (HsDef'Enum \"FULL_DATASET\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedHeader.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedHeader\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType FeedHeader where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg FeedHeader where + textPut msg + = do + P'.tellT "gtfs_realtime_version" (gtfs_realtime_version msg) + P'.tellT "incrementality" (incrementality msg) + P'.tellT "timestamp" (timestamp msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'gtfs_realtime_version, parse'incrementality, parse'timestamp]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'gtfs_realtime_version + = Prelude'.fmap (\ v o -> o{gtfs_realtime_version = v}) (P'.try (P'.getT "gtfs_realtime_version")) + parse'incrementality = Prelude'.fmap (\ v o -> o{incrementality = v}) (P'.try (P'.getT "incrementality")) + parse'timestamp = Prelude'.fmap (\ v o -> o{timestamp = v}) (P'.try (P'.getT "timestamp")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/FeedHeader/Incrementality.hs b/gtfs/GTFS/Realtime/FeedHeader/Incrementality.hs new file mode 100644 index 0000000..ad6e194 --- /dev/null +++ b/gtfs/GTFS/Realtime/FeedHeader/Incrementality.hs @@ -0,0 +1,67 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.FeedHeader.Incrementality (Incrementality(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Incrementality = FULL_DATASET + | DIFFERENTIAL + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable Incrementality + +instance Prelude'.Bounded Incrementality where + minBound = FULL_DATASET + maxBound = DIFFERENTIAL + +instance P'.Default Incrementality where + defaultValue = FULL_DATASET + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe Incrementality +toMaybe'Enum 0 = Prelude'.Just FULL_DATASET +toMaybe'Enum 1 = Prelude'.Just DIFFERENTIAL +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum Incrementality where + fromEnum FULL_DATASET = 0 + fromEnum DIFFERENTIAL = 1 + toEnum + = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.FeedHeader.Incrementality") . + toMaybe'Enum + succ FULL_DATASET = DIFFERENTIAL + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.FeedHeader.Incrementality" + pred DIFFERENTIAL = FULL_DATASET + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.FeedHeader.Incrementality" + +instance P'.Wire Incrementality where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB Incrementality + +instance P'.MessageAPI msg' (msg' -> Incrementality) Incrementality where + getVal m' f' = f' m' + +instance P'.ReflectEnum Incrementality where + reflectEnum = [(0, "FULL_DATASET", FULL_DATASET), (1, "DIFFERENTIAL", DIFFERENTIAL)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.FeedHeader.Incrementality") [] ["GTFS", "Realtime", "FeedHeader"] "Incrementality") + ["GTFS", "Realtime", "FeedHeader", "Incrementality.hs"] + [(0, "FULL_DATASET"), (1, "DIFFERENTIAL")] + Prelude'.False + +instance P'.TextType Incrementality where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/FeedMessage.hs b/gtfs/GTFS/Realtime/FeedMessage.hs new file mode 100644 index 0000000..f3c25d2 --- /dev/null +++ b/gtfs/GTFS/Realtime/FeedMessage.hs @@ -0,0 +1,97 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.FeedMessage (FeedMessage(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.FeedEntity as GTFS.Realtime +import qualified GTFS.Realtime.FeedHeader as GTFS.Realtime + +data FeedMessage = FeedMessage{header :: !(GTFS.Realtime.FeedHeader), entity :: !(P'.Seq GTFS.Realtime.FeedEntity), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage FeedMessage where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable FeedMessage where + mergeAppend (FeedMessage x'1 x'2 x'3) (FeedMessage y'1 y'2 y'3) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + in FeedMessage z'1 z'2 z'3 + +instance P'.Default FeedMessage where + defaultValue = FeedMessage P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire FeedMessage where + wireSize ft' self'@(FeedMessage x'1 x'2 x'3) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeRep 1 11 x'2 + P'.wireSizeExtField x'3) + wirePutWithSize ft' self'@(FeedMessage x'1 x'2 x'3) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize [P'.wirePutReqWithSize 10 11 x'1, P'.wirePutRepWithSize 18 11 x'2, P'.wirePutExtFieldWithSize x'3] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{header = P'.mergeAppend (header old'Self) (new'Field)}) (P'.wireGet 11) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{entity = P'.append (entity old'Self) new'Field}) (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> FeedMessage) FeedMessage where + getVal m' f' = f' m' + +instance P'.GPB FeedMessage + +instance P'.ReflectDescriptor FeedMessage where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [10, 18]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.FeedMessage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedMessage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"FeedMessage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedMessage.header\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedMessage\"], baseName' = FName \"header\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedHeader\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedHeader\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.FeedMessage.entity\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"FeedMessage\"], baseName' = FName \"entity\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.FeedEntity\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"FeedEntity\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType FeedMessage where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg FeedMessage where + textPut msg + = do + P'.tellT "header" (header msg) + P'.tellT "entity" (entity msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'header, parse'entity]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'header = Prelude'.fmap (\ v o -> o{header = v}) (P'.try (P'.getT "header")) + parse'entity = Prelude'.fmap (\ v o -> o{entity = P'.append (entity o) v}) (P'.try (P'.getT "entity")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Position.hs b/gtfs/GTFS/Realtime/Position.hs new file mode 100644 index 0000000..7cea83b --- /dev/null +++ b/gtfs/GTFS/Realtime/Position.hs @@ -0,0 +1,112 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Position (Position(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Position = Position{latitude :: !(P'.Float), longitude :: !(P'.Float), bearing :: !(P'.Maybe P'.Float), + odometer :: !(P'.Maybe P'.Double), speed :: !(P'.Maybe P'.Float), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage Position where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable Position where + mergeAppend (Position x'1 x'2 x'3 x'4 x'5 x'6) (Position y'1 y'2 y'3 y'4 y'5 y'6) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + in Position z'1 z'2 z'3 z'4 z'5 z'6 + +instance P'.Default Position where + defaultValue = Position P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire Position where + wireSize ft' self'@(Position x'1 x'2 x'3 x'4 x'5 x'6) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeReq 1 2 x'1 + P'.wireSizeReq 1 2 x'2 + P'.wireSizeOpt 1 2 x'3 + P'.wireSizeOpt 1 1 x'4 + + P'.wireSizeOpt 1 2 x'5 + + P'.wireSizeExtField x'6) + wirePutWithSize ft' self'@(Position x'1 x'2 x'3 x'4 x'5 x'6) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutReqWithSize 13 2 x'1, P'.wirePutReqWithSize 21 2 x'2, P'.wirePutOptWithSize 29 2 x'3, + P'.wirePutOptWithSize 33 1 x'4, P'.wirePutOptWithSize 45 2 x'5, P'.wirePutExtFieldWithSize x'6] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 13 -> Prelude'.fmap (\ !new'Field -> old'Self{latitude = new'Field}) (P'.wireGet 2) + 21 -> Prelude'.fmap (\ !new'Field -> old'Self{longitude = new'Field}) (P'.wireGet 2) + 29 -> Prelude'.fmap (\ !new'Field -> old'Self{bearing = Prelude'.Just new'Field}) (P'.wireGet 2) + 33 -> Prelude'.fmap (\ !new'Field -> old'Self{odometer = Prelude'.Just new'Field}) (P'.wireGet 1) + 45 -> Prelude'.fmap (\ !new'Field -> old'Self{speed = Prelude'.Just new'Field}) (P'.wireGet 2) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> Position) Position where + getVal m' f' = f' m' + +instance P'.GPB Position + +instance P'.ReflectDescriptor Position where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [13, 21]) (P'.fromDistinctAscList [13, 21, 29, 33, 45]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Position\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Position\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Position.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.latitude\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"latitude\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 13}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.longitude\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"longitude\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 21}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.bearing\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"bearing\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 29}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.odometer\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"odometer\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 33}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Position.speed\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Position\"], baseName' = FName \"speed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 45}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 2}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType Position where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg Position where + textPut msg + = do + P'.tellT "latitude" (latitude msg) + P'.tellT "longitude" (longitude msg) + P'.tellT "bearing" (bearing msg) + P'.tellT "odometer" (odometer msg) + P'.tellT "speed" (speed msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'latitude, parse'longitude, parse'bearing, parse'odometer, parse'speed]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'latitude = Prelude'.fmap (\ v o -> o{latitude = v}) (P'.try (P'.getT "latitude")) + parse'longitude = Prelude'.fmap (\ v o -> o{longitude = v}) (P'.try (P'.getT "longitude")) + parse'bearing = Prelude'.fmap (\ v o -> o{bearing = v}) (P'.try (P'.getT "bearing")) + parse'odometer = Prelude'.fmap (\ v o -> o{odometer = v}) (P'.try (P'.getT "odometer")) + parse'speed = Prelude'.fmap (\ v o -> o{speed = v}) (P'.try (P'.getT "speed")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/Shape.hs b/gtfs/GTFS/Realtime/Shape.hs new file mode 100644 index 0000000..a19cd49 --- /dev/null +++ b/gtfs/GTFS/Realtime/Shape.hs @@ -0,0 +1,94 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.Shape (Shape(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Shape = Shape{shape_id :: !(P'.Maybe P'.Utf8), encoded_polyline :: !(P'.Maybe P'.Utf8), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage Shape where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable Shape where + mergeAppend (Shape x'1 x'2 x'3) (Shape y'1 y'2 y'3) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + in Shape z'1 z'2 z'3 + +instance P'.Default Shape where + defaultValue = Shape P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire Shape where + wireSize ft' self'@(Shape x'1 x'2 x'3) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeExtField x'3) + wirePutWithSize ft' self'@(Shape x'1 x'2 x'3) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutExtFieldWithSize x'3] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{shape_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{encoded_polyline = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> Shape) Shape where + getVal m' f' = f' m' + +instance P'.GPB Shape + +instance P'.ReflectDescriptor Shape where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.Shape\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Shape\"}, descFilePath = [\"GTFS\",\"Realtime\",\"Shape.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Shape.shape_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Shape\"], baseName' = FName \"shape_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.Shape.encoded_polyline\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"Shape\"], baseName' = FName \"encoded_polyline\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType Shape where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg Shape where + textPut msg + = do + P'.tellT "shape_id" (shape_id msg) + P'.tellT "encoded_polyline" (encoded_polyline msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'shape_id, parse'encoded_polyline]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'shape_id = Prelude'.fmap (\ v o -> o{shape_id = v}) (P'.try (P'.getT "shape_id")) + parse'encoded_polyline = Prelude'.fmap (\ v o -> o{encoded_polyline = v}) (P'.try (P'.getT "encoded_polyline")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TimeRange.hs b/gtfs/GTFS/Realtime/TimeRange.hs new file mode 100644 index 0000000..1384a08 --- /dev/null +++ b/gtfs/GTFS/Realtime/TimeRange.hs @@ -0,0 +1,94 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TimeRange (TimeRange(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data TimeRange = TimeRange{start :: !(P'.Maybe P'.Word64), end :: !(P'.Maybe P'.Word64), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TimeRange where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TimeRange where + mergeAppend (TimeRange x'1 x'2 x'3) (TimeRange y'1 y'2 y'3) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + in TimeRange z'1 z'2 z'3 + +instance P'.Default TimeRange where + defaultValue = TimeRange P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire TimeRange where + wireSize ft' self'@(TimeRange x'1 x'2 x'3) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeOpt 1 4 x'1 + P'.wireSizeOpt 1 4 x'2 + P'.wireSizeExtField x'3) + wirePutWithSize ft' self'@(TimeRange x'1 x'2 x'3) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize [P'.wirePutOptWithSize 8 4 x'1, P'.wirePutOptWithSize 16 4 x'2, P'.wirePutExtFieldWithSize x'3] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 8 -> Prelude'.fmap (\ !new'Field -> old'Self{start = Prelude'.Just new'Field}) (P'.wireGet 4) + 16 -> Prelude'.fmap (\ !new'Field -> old'Self{end = Prelude'.Just new'Field}) (P'.wireGet 4) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TimeRange) TimeRange where + getVal m' f' = f' m' + +instance P'.GPB TimeRange + +instance P'.ReflectDescriptor TimeRange where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [8, 16]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TimeRange\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TimeRange\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TimeRange.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TimeRange.start\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TimeRange\"], baseName' = FName \"start\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TimeRange.end\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TimeRange\"], baseName' = FName \"end\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TimeRange where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TimeRange where + textPut msg + = do + P'.tellT "start" (start msg) + P'.tellT "end" (end msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'start, parse'end]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'start = Prelude'.fmap (\ v o -> o{start = v}) (P'.try (P'.getT "start")) + parse'end = Prelude'.fmap (\ v o -> o{end = v}) (P'.try (P'.getT "end")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TranslatedImage.hs b/gtfs/GTFS/Realtime/TranslatedImage.hs new file mode 100644 index 0000000..c6e4b1f --- /dev/null +++ b/gtfs/GTFS/Realtime/TranslatedImage.hs @@ -0,0 +1,93 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TranslatedImage (TranslatedImage(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TranslatedImage.LocalizedImage as GTFS.Realtime.TranslatedImage + +data TranslatedImage = TranslatedImage{localized_image :: !(P'.Seq GTFS.Realtime.TranslatedImage.LocalizedImage), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TranslatedImage where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TranslatedImage where + mergeAppend (TranslatedImage x'1 x'2) (TranslatedImage y'1 y'2) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + in TranslatedImage z'1 z'2 + +instance P'.Default TranslatedImage where + defaultValue = TranslatedImage P'.defaultValue P'.defaultValue + +instance P'.Wire TranslatedImage where + wireSize ft' self'@(TranslatedImage x'1 x'2) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeRep 1 11 x'1 + P'.wireSizeExtField x'2) + wirePutWithSize ft' self'@(TranslatedImage x'1 x'2) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 10 11 x'1, P'.wirePutExtFieldWithSize x'2] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{localized_image = P'.append (localized_image old'Self) new'Field}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TranslatedImage) TranslatedImage where + getVal m' f' = f' m' + +instance P'.GPB TranslatedImage + +instance P'.ReflectDescriptor TranslatedImage where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedImage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedImage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.localized_image\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName' = FName \"localized_image\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage.LocalizedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName = MName \"LocalizedImage\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TranslatedImage where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TranslatedImage where + textPut msg + = do + P'.tellT "localized_image" (localized_image msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'localized_image]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'localized_image + = Prelude'.fmap (\ v o -> o{localized_image = P'.append (localized_image o) v}) (P'.try (P'.getT "localized_image")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TranslatedImage/LocalizedImage.hs b/gtfs/GTFS/Realtime/TranslatedImage/LocalizedImage.hs new file mode 100644 index 0000000..d1bc9ab --- /dev/null +++ b/gtfs/GTFS/Realtime/TranslatedImage/LocalizedImage.hs @@ -0,0 +1,101 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TranslatedImage.LocalizedImage (LocalizedImage(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data LocalizedImage = LocalizedImage{url :: !(P'.Utf8), media_type :: !(P'.Utf8), language :: !(P'.Maybe P'.Utf8), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage LocalizedImage where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable LocalizedImage where + mergeAppend (LocalizedImage x'1 x'2 x'3 x'4) (LocalizedImage y'1 y'2 y'3 y'4) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + in LocalizedImage z'1 z'2 z'3 z'4 + +instance P'.Default LocalizedImage where + defaultValue = LocalizedImage P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire LocalizedImage where + wireSize ft' self'@(LocalizedImage x'1 x'2 x'3 x'4) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeReq 1 9 x'2 + P'.wireSizeOpt 1 9 x'3 + P'.wireSizeExtField x'4) + wirePutWithSize ft' self'@(LocalizedImage x'1 x'2 x'3 x'4) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutReqWithSize 10 9 x'1, P'.wirePutReqWithSize 18 9 x'2, P'.wirePutOptWithSize 26 9 x'3, + P'.wirePutExtFieldWithSize x'4] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{url = new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{media_type = new'Field}) (P'.wireGet 9) + 26 -> Prelude'.fmap (\ !new'Field -> old'Self{language = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> LocalizedImage) LocalizedImage where + getVal m' f' = f' m' + +instance P'.GPB LocalizedImage + +instance P'.ReflectDescriptor LocalizedImage where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10, 18]) (P'.fromDistinctAscList [10, 18, 26]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedImage.LocalizedImage\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\"], baseName = MName \"LocalizedImage\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedImage\",\"LocalizedImage.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.url\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"url\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.media_type\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"media_type\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedImage.LocalizedImage.language\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedImage\",MName \"LocalizedImage\"], baseName' = FName \"language\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType LocalizedImage where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg LocalizedImage where + textPut msg + = do + P'.tellT "url" (url msg) + P'.tellT "media_type" (media_type msg) + P'.tellT "language" (language msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'url, parse'media_type, parse'language]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'url = Prelude'.fmap (\ v o -> o{url = v}) (P'.try (P'.getT "url")) + parse'media_type = Prelude'.fmap (\ v o -> o{media_type = v}) (P'.try (P'.getT "media_type")) + parse'language = Prelude'.fmap (\ v o -> o{language = v}) (P'.try (P'.getT "language")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TranslatedString.hs b/gtfs/GTFS/Realtime/TranslatedString.hs new file mode 100644 index 0000000..3d270ce --- /dev/null +++ b/gtfs/GTFS/Realtime/TranslatedString.hs @@ -0,0 +1,92 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TranslatedString (TranslatedString(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TranslatedString.Translation as GTFS.Realtime.TranslatedString + +data TranslatedString = TranslatedString{translation :: !(P'.Seq GTFS.Realtime.TranslatedString.Translation), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TranslatedString where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TranslatedString where + mergeAppend (TranslatedString x'1 x'2) (TranslatedString y'1 y'2) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + in TranslatedString z'1 z'2 + +instance P'.Default TranslatedString where + defaultValue = TranslatedString P'.defaultValue P'.defaultValue + +instance P'.Wire TranslatedString where + wireSize ft' self'@(TranslatedString x'1 x'2) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeRep 1 11 x'1 + P'.wireSizeExtField x'2) + wirePutWithSize ft' self'@(TranslatedString x'1 x'2) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 10 11 x'1, P'.wirePutExtFieldWithSize x'2] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{translation = P'.append (translation old'Self) new'Field}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TranslatedString) TranslatedString where + getVal m' f' = f' m' + +instance P'.GPB TranslatedString + +instance P'.ReflectDescriptor TranslatedString where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedString\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TranslatedString\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedString.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.translation\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName' = FName \"translation\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TranslatedString.Translation\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName = MName \"Translation\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TranslatedString where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TranslatedString where + textPut msg + = do + P'.tellT "translation" (translation msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'translation]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'translation = Prelude'.fmap (\ v o -> o{translation = P'.append (translation o) v}) (P'.try (P'.getT "translation")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TranslatedString/Translation.hs b/gtfs/GTFS/Realtime/TranslatedString/Translation.hs new file mode 100644 index 0000000..8ff7e1c --- /dev/null +++ b/gtfs/GTFS/Realtime/TranslatedString/Translation.hs @@ -0,0 +1,94 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TranslatedString.Translation (Translation(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data Translation = Translation{text :: !(P'.Utf8), language :: !(P'.Maybe P'.Utf8), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage Translation where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable Translation where + mergeAppend (Translation x'1 x'2 x'3) (Translation y'1 y'2 y'3) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + in Translation z'1 z'2 z'3 + +instance P'.Default Translation where + defaultValue = Translation P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire Translation where + wireSize ft' self'@(Translation x'1 x'2 x'3) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeExtField x'3) + wirePutWithSize ft' self'@(Translation x'1 x'2 x'3) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize [P'.wirePutReqWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutExtFieldWithSize x'3] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{text = new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{language = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> Translation) Translation where + getVal m' f' = f' m' + +instance P'.GPB Translation + +instance P'.ReflectDescriptor Translation where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [10, 18]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TranslatedString.Translation\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\"], baseName = MName \"Translation\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TranslatedString\",\"Translation.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.Translation.text\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\",MName \"Translation\"], baseName' = FName \"text\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TranslatedString.Translation.language\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TranslatedString\",MName \"Translation\"], baseName' = FName \"language\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType Translation where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg Translation where + textPut msg + = do + P'.tellT "text" (text msg) + P'.tellT "language" (language msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'text, parse'language]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'text = Prelude'.fmap (\ v o -> o{text = v}) (P'.try (P'.getT "text")) + parse'language = Prelude'.fmap (\ v o -> o{language = v}) (P'.try (P'.getT "language")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripDescriptor.hs b/gtfs/GTFS/Realtime/TripDescriptor.hs new file mode 100644 index 0000000..501f196 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripDescriptor.hs @@ -0,0 +1,128 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripDescriptor (TripDescriptor(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TripDescriptor.ScheduleRelationship as GTFS.Realtime.TripDescriptor + +data TripDescriptor = TripDescriptor{trip_id :: !(P'.Maybe P'.Utf8), route_id :: !(P'.Maybe P'.Utf8), + direction_id :: !(P'.Maybe P'.Word32), start_time :: !(P'.Maybe P'.Utf8), + start_date :: !(P'.Maybe P'.Utf8), + schedule_relationship :: !(P'.Maybe GTFS.Realtime.TripDescriptor.ScheduleRelationship), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TripDescriptor where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TripDescriptor where + mergeAppend (TripDescriptor x'1 x'2 x'3 x'4 x'5 x'6 x'7) (TripDescriptor y'1 y'2 y'3 y'4 y'5 y'6 y'7) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + in TripDescriptor z'1 z'2 z'3 z'4 z'5 z'6 z'7 + +instance P'.Default TripDescriptor where + defaultValue + = TripDescriptor P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire TripDescriptor where + wireSize ft' self'@(TripDescriptor x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 13 x'3 + P'.wireSizeOpt 1 9 x'4 + + P'.wireSizeOpt 1 9 x'5 + + P'.wireSizeOpt 1 14 x'6 + + P'.wireSizeExtField x'7) + wirePutWithSize ft' self'@(TripDescriptor x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'4, P'.wirePutOptWithSize 26 9 x'5, + P'.wirePutOptWithSize 32 14 x'6, P'.wirePutOptWithSize 42 9 x'2, P'.wirePutOptWithSize 48 13 x'3, + P'.wirePutExtFieldWithSize x'7] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{trip_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 42 -> Prelude'.fmap (\ !new'Field -> old'Self{route_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 48 -> Prelude'.fmap (\ !new'Field -> old'Self{direction_id = Prelude'.Just new'Field}) (P'.wireGet 13) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{start_time = Prelude'.Just new'Field}) (P'.wireGet 9) + 26 -> Prelude'.fmap (\ !new'Field -> old'Self{start_date = Prelude'.Just new'Field}) (P'.wireGet 9) + 32 -> Prelude'.fmap (\ !new'Field -> old'Self{schedule_relationship = Prelude'.Just new'Field}) (P'.wireGet 14) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TripDescriptor) TripDescriptor where + getVal m' f' = f' m' + +instance P'.GPB TripDescriptor + +instance P'.ReflectDescriptor TripDescriptor where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 26, 32, 42, 48]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripDescriptor.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.trip_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"trip_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.route_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"route_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.direction_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"direction_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.start_time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"start_time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.start_date\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"start_date\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripDescriptor.schedule_relationship\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName' = FName \"schedule_relationship\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripDescriptor\"], baseName = MName \"ScheduleRelationship\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TripDescriptor where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TripDescriptor where + textPut msg + = do + P'.tellT "trip_id" (trip_id msg) + P'.tellT "route_id" (route_id msg) + P'.tellT "direction_id" (direction_id msg) + P'.tellT "start_time" (start_time msg) + P'.tellT "start_date" (start_date msg) + P'.tellT "schedule_relationship" (schedule_relationship msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice + [parse'trip_id, parse'route_id, parse'direction_id, parse'start_time, parse'start_date, + parse'schedule_relationship]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'trip_id = Prelude'.fmap (\ v o -> o{trip_id = v}) (P'.try (P'.getT "trip_id")) + parse'route_id = Prelude'.fmap (\ v o -> o{route_id = v}) (P'.try (P'.getT "route_id")) + parse'direction_id = Prelude'.fmap (\ v o -> o{direction_id = v}) (P'.try (P'.getT "direction_id")) + parse'start_time = Prelude'.fmap (\ v o -> o{start_time = v}) (P'.try (P'.getT "start_time")) + parse'start_date = Prelude'.fmap (\ v o -> o{start_date = v}) (P'.try (P'.getT "start_date")) + parse'schedule_relationship + = Prelude'.fmap (\ v o -> o{schedule_relationship = v}) (P'.try (P'.getT "schedule_relationship")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripDescriptor/ScheduleRelationship.hs b/gtfs/GTFS/Realtime/TripDescriptor/ScheduleRelationship.hs new file mode 100644 index 0000000..2a4c150 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripDescriptor/ScheduleRelationship.hs @@ -0,0 +1,91 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripDescriptor.ScheduleRelationship (ScheduleRelationship(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data ScheduleRelationship = SCHEDULED + | ADDED + | UNSCHEDULED + | CANCELED + | REPLACEMENT + | DUPLICATED + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable ScheduleRelationship + +instance Prelude'.Bounded ScheduleRelationship where + minBound = SCHEDULED + maxBound = DUPLICATED + +instance P'.Default ScheduleRelationship where + defaultValue = SCHEDULED + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe ScheduleRelationship +toMaybe'Enum 0 = Prelude'.Just SCHEDULED +toMaybe'Enum 1 = Prelude'.Just ADDED +toMaybe'Enum 2 = Prelude'.Just UNSCHEDULED +toMaybe'Enum 3 = Prelude'.Just CANCELED +toMaybe'Enum 5 = Prelude'.Just REPLACEMENT +toMaybe'Enum 6 = Prelude'.Just DUPLICATED +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum ScheduleRelationship where + fromEnum SCHEDULED = 0 + fromEnum ADDED = 1 + fromEnum UNSCHEDULED = 2 + fromEnum CANCELED = 3 + fromEnum REPLACEMENT = 5 + fromEnum DUPLICATED = 6 + toEnum + = P'.fromMaybe + (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.TripDescriptor.ScheduleRelationship") + . toMaybe'Enum + succ SCHEDULED = ADDED + succ ADDED = UNSCHEDULED + succ UNSCHEDULED = CANCELED + succ CANCELED = REPLACEMENT + succ REPLACEMENT = DUPLICATED + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.TripDescriptor.ScheduleRelationship" + pred ADDED = SCHEDULED + pred UNSCHEDULED = ADDED + pred CANCELED = UNSCHEDULED + pred REPLACEMENT = CANCELED + pred DUPLICATED = REPLACEMENT + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.TripDescriptor.ScheduleRelationship" + +instance P'.Wire ScheduleRelationship where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB ScheduleRelationship + +instance P'.MessageAPI msg' (msg' -> ScheduleRelationship) ScheduleRelationship where + getVal m' f' = f' m' + +instance P'.ReflectEnum ScheduleRelationship where + reflectEnum + = [(0, "SCHEDULED", SCHEDULED), (1, "ADDED", ADDED), (2, "UNSCHEDULED", UNSCHEDULED), (3, "CANCELED", CANCELED), + (5, "REPLACEMENT", REPLACEMENT), (6, "DUPLICATED", DUPLICATED)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.TripDescriptor.ScheduleRelationship") [] ["GTFS", "Realtime", "TripDescriptor"] + "ScheduleRelationship") + ["GTFS", "Realtime", "TripDescriptor", "ScheduleRelationship.hs"] + [(0, "SCHEDULED"), (1, "ADDED"), (2, "UNSCHEDULED"), (3, "CANCELED"), (5, "REPLACEMENT"), (6, "DUPLICATED")] + Prelude'.False + +instance P'.TextType ScheduleRelationship where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate.hs b/gtfs/GTFS/Realtime/TripUpdate.hs new file mode 100644 index 0000000..24ef425 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate.hs @@ -0,0 +1,133 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate (TripUpdate(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TripDescriptor as GTFS.Realtime +import qualified GTFS.Realtime.TripUpdate.StopTimeUpdate as GTFS.Realtime.TripUpdate +import qualified GTFS.Realtime.TripUpdate.TripProperties as GTFS.Realtime.TripUpdate +import qualified GTFS.Realtime.VehicleDescriptor as GTFS.Realtime + +data TripUpdate = TripUpdate{trip :: !(GTFS.Realtime.TripDescriptor), vehicle :: !(P'.Maybe GTFS.Realtime.VehicleDescriptor), + stop_time_update :: !(P'.Seq GTFS.Realtime.TripUpdate.StopTimeUpdate), + timestamp :: !(P'.Maybe P'.Word64), delay :: !(P'.Maybe P'.Int32), + trip_properties :: !(P'.Maybe GTFS.Realtime.TripUpdate.TripProperties), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TripUpdate where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TripUpdate where + mergeAppend (TripUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7) (TripUpdate y'1 y'2 y'3 y'4 y'5 y'6 y'7) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + in TripUpdate z'1 z'2 z'3 z'4 z'5 z'6 z'7 + +instance P'.Default TripUpdate where + defaultValue + = TripUpdate P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire TripUpdate where + wireSize ft' self'@(TripUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeOpt 1 11 x'2 + P'.wireSizeRep 1 11 x'3 + P'.wireSizeOpt 1 4 x'4 + + P'.wireSizeOpt 1 5 x'5 + + P'.wireSizeOpt 1 11 x'6 + + P'.wireSizeExtField x'7) + wirePutWithSize ft' self'@(TripUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutReqWithSize 10 11 x'1, P'.wirePutRepWithSize 18 11 x'3, P'.wirePutOptWithSize 26 11 x'2, + P'.wirePutOptWithSize 32 4 x'4, P'.wirePutOptWithSize 40 5 x'5, P'.wirePutOptWithSize 50 11 x'6, + P'.wirePutExtFieldWithSize x'7] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{trip = P'.mergeAppend (trip old'Self) (new'Field)}) (P'.wireGet 11) + 26 -> Prelude'.fmap (\ !new'Field -> old'Self{vehicle = P'.mergeAppend (vehicle old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{stop_time_update = P'.append (stop_time_update old'Self) new'Field}) + (P'.wireGet 11) + 32 -> Prelude'.fmap (\ !new'Field -> old'Self{timestamp = Prelude'.Just new'Field}) (P'.wireGet 4) + 40 -> Prelude'.fmap (\ !new'Field -> old'Self{delay = Prelude'.Just new'Field}) (P'.wireGet 5) + 50 -> Prelude'.fmap + (\ !new'Field -> + old'Self{trip_properties = P'.mergeAppend (trip_properties old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TripUpdate) TripUpdate where + getVal m' f' = f' m' + +instance P'.GPB TripUpdate + +instance P'.ReflectDescriptor TripUpdate where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [10, 18, 26, 32, 40, 50]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripUpdate\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.stop_time_update\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"stop_time_update\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeUpdate\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.delay\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"delay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.trip_properties\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName' = FName \"trip_properties\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.TripProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"TripProperties\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TripUpdate where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TripUpdate where + textPut msg + = do + P'.tellT "trip" (trip msg) + P'.tellT "vehicle" (vehicle msg) + P'.tellT "stop_time_update" (stop_time_update msg) + P'.tellT "timestamp" (timestamp msg) + P'.tellT "delay" (delay msg) + P'.tellT "trip_properties" (trip_properties msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice [parse'trip, parse'vehicle, parse'stop_time_update, parse'timestamp, parse'delay, parse'trip_properties]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'trip = Prelude'.fmap (\ v o -> o{trip = v}) (P'.try (P'.getT "trip")) + parse'vehicle = Prelude'.fmap (\ v o -> o{vehicle = v}) (P'.try (P'.getT "vehicle")) + parse'stop_time_update + = Prelude'.fmap (\ v o -> o{stop_time_update = P'.append (stop_time_update o) v}) (P'.try (P'.getT "stop_time_update")) + parse'timestamp = Prelude'.fmap (\ v o -> o{timestamp = v}) (P'.try (P'.getT "timestamp")) + parse'delay = Prelude'.fmap (\ v o -> o{delay = v}) (P'.try (P'.getT "delay")) + parse'trip_properties = Prelude'.fmap (\ v o -> o{trip_properties = v}) (P'.try (P'.getT "trip_properties")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate/StopTimeEvent.hs b/gtfs/GTFS/Realtime/TripUpdate/StopTimeEvent.hs new file mode 100644 index 0000000..0005e4c --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate/StopTimeEvent.hs @@ -0,0 +1,101 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate.StopTimeEvent (StopTimeEvent(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data StopTimeEvent = StopTimeEvent{delay :: !(P'.Maybe P'.Int32), time :: !(P'.Maybe P'.Int64), uncertainty :: !(P'.Maybe P'.Int32), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage StopTimeEvent where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable StopTimeEvent where + mergeAppend (StopTimeEvent x'1 x'2 x'3 x'4) (StopTimeEvent y'1 y'2 y'3 y'4) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + in StopTimeEvent z'1 z'2 z'3 z'4 + +instance P'.Default StopTimeEvent where + defaultValue = StopTimeEvent P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire StopTimeEvent where + wireSize ft' self'@(StopTimeEvent x'1 x'2 x'3 x'4) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeOpt 1 5 x'1 + P'.wireSizeOpt 1 3 x'2 + P'.wireSizeOpt 1 5 x'3 + P'.wireSizeExtField x'4) + wirePutWithSize ft' self'@(StopTimeEvent x'1 x'2 x'3 x'4) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 8 5 x'1, P'.wirePutOptWithSize 16 3 x'2, P'.wirePutOptWithSize 24 5 x'3, + P'.wirePutExtFieldWithSize x'4] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 8 -> Prelude'.fmap (\ !new'Field -> old'Self{delay = Prelude'.Just new'Field}) (P'.wireGet 5) + 16 -> Prelude'.fmap (\ !new'Field -> old'Self{time = Prelude'.Just new'Field}) (P'.wireGet 3) + 24 -> Prelude'.fmap (\ !new'Field -> old'Self{uncertainty = Prelude'.Just new'Field}) (P'.wireGet 5) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> StopTimeEvent) StopTimeEvent where + getVal m' f' = f' m' + +instance P'.GPB StopTimeEvent + +instance P'.ReflectDescriptor StopTimeEvent where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [8, 16, 24]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeEvent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.delay\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"delay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeEvent.uncertainty\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeEvent\"], baseName' = FName \"uncertainty\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType StopTimeEvent where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg StopTimeEvent where + textPut msg + = do + P'.tellT "delay" (delay msg) + P'.tellT "time" (time msg) + P'.tellT "uncertainty" (uncertainty msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'delay, parse'time, parse'uncertainty]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'delay = Prelude'.fmap (\ v o -> o{delay = v}) (P'.try (P'.getT "delay")) + parse'time = Prelude'.fmap (\ v o -> o{time = v}) (P'.try (P'.getT "time")) + parse'uncertainty = Prelude'.fmap (\ v o -> o{uncertainty = v}) (P'.try (P'.getT "uncertainty")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate.hs b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate.hs new file mode 100644 index 0000000..e2553e3 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate.hs @@ -0,0 +1,149 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate.StopTimeUpdate (StopTimeUpdate(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.TripUpdate.StopTimeEvent as GTFS.Realtime.TripUpdate +import qualified GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship as GTFS.Realtime.TripUpdate.StopTimeUpdate +import qualified GTFS.Realtime.TripUpdate.StopTimeUpdate.StopTimeProperties as GTFS.Realtime.TripUpdate.StopTimeUpdate +import qualified GTFS.Realtime.VehiclePosition.OccupancyStatus as GTFS.Realtime.VehiclePosition + +data StopTimeUpdate = StopTimeUpdate{stop_sequence :: !(P'.Maybe P'.Word32), stop_id :: !(P'.Maybe P'.Utf8), + arrival :: !(P'.Maybe GTFS.Realtime.TripUpdate.StopTimeEvent), + departure :: !(P'.Maybe GTFS.Realtime.TripUpdate.StopTimeEvent), + departure_occupancy_status :: !(P'.Maybe GTFS.Realtime.VehiclePosition.OccupancyStatus), + schedule_relationship :: + !(P'.Maybe GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship), + stop_time_properties :: !(P'.Maybe GTFS.Realtime.TripUpdate.StopTimeUpdate.StopTimeProperties), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage StopTimeUpdate where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable StopTimeUpdate where + mergeAppend (StopTimeUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8) (StopTimeUpdate y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + !z'8 = P'.mergeAppend x'8 y'8 + in StopTimeUpdate z'1 z'2 z'3 z'4 z'5 z'6 z'7 z'8 + +instance P'.Default StopTimeUpdate where + defaultValue + = StopTimeUpdate P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + (Prelude'.Just (Prelude'.read "SCHEDULED")) + P'.defaultValue + P'.defaultValue + +instance P'.Wire StopTimeUpdate where + wireSize ft' self'@(StopTimeUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 13 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 11 x'3 + P'.wireSizeOpt 1 11 x'4 + + P'.wireSizeOpt 1 14 x'5 + + P'.wireSizeOpt 1 14 x'6 + + P'.wireSizeOpt 1 11 x'7 + + P'.wireSizeExtField x'8) + wirePutWithSize ft' self'@(StopTimeUpdate x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 8 13 x'1, P'.wirePutOptWithSize 18 11 x'3, P'.wirePutOptWithSize 26 11 x'4, + P'.wirePutOptWithSize 34 9 x'2, P'.wirePutOptWithSize 40 14 x'6, P'.wirePutOptWithSize 50 11 x'7, + P'.wirePutOptWithSize 56 14 x'5, P'.wirePutExtFieldWithSize x'8] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 8 -> Prelude'.fmap (\ !new'Field -> old'Self{stop_sequence = Prelude'.Just new'Field}) (P'.wireGet 13) + 34 -> Prelude'.fmap (\ !new'Field -> old'Self{stop_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{arrival = P'.mergeAppend (arrival old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 26 -> Prelude'.fmap + (\ !new'Field -> old'Self{departure = P'.mergeAppend (departure old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 56 -> Prelude'.fmap (\ !new'Field -> old'Self{departure_occupancy_status = Prelude'.Just new'Field}) (P'.wireGet 14) + 40 -> Prelude'.fmap (\ !new'Field -> old'Self{schedule_relationship = Prelude'.Just new'Field}) (P'.wireGet 14) + 50 -> Prelude'.fmap + (\ !new'Field -> + old'Self{stop_time_properties = P'.mergeAppend (stop_time_properties old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> StopTimeUpdate) StopTimeUpdate where + getVal m' f' = f' m' + +instance P'.GPB StopTimeUpdate + +instance P'.ReflectDescriptor StopTimeUpdate where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [8, 18, 26, 34, 40, 50, 56]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeUpdate\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeUpdate.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.arrival\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"arrival\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.departure\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"departure\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeEvent\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"StopTimeEvent\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.departure_occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"departure_occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.schedule_relationship\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"schedule_relationship\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"ScheduleRelationship\"}), hsRawDefault = Just \"SCHEDULED\", hsDefault = Just (HsDef'Enum \"SCHEDULED\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.stop_time_properties\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName' = FName \"stop_time_properties\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"StopTimeProperties\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType StopTimeUpdate where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg StopTimeUpdate where + textPut msg + = do + P'.tellT "stop_sequence" (stop_sequence msg) + P'.tellT "stop_id" (stop_id msg) + P'.tellT "arrival" (arrival msg) + P'.tellT "departure" (departure msg) + P'.tellT "departure_occupancy_status" (departure_occupancy_status msg) + P'.tellT "schedule_relationship" (schedule_relationship msg) + P'.tellT "stop_time_properties" (stop_time_properties msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice + [parse'stop_sequence, parse'stop_id, parse'arrival, parse'departure, parse'departure_occupancy_status, + parse'schedule_relationship, parse'stop_time_properties]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'stop_sequence = Prelude'.fmap (\ v o -> o{stop_sequence = v}) (P'.try (P'.getT "stop_sequence")) + parse'stop_id = Prelude'.fmap (\ v o -> o{stop_id = v}) (P'.try (P'.getT "stop_id")) + parse'arrival = Prelude'.fmap (\ v o -> o{arrival = v}) (P'.try (P'.getT "arrival")) + parse'departure = Prelude'.fmap (\ v o -> o{departure = v}) (P'.try (P'.getT "departure")) + parse'departure_occupancy_status + = Prelude'.fmap (\ v o -> o{departure_occupancy_status = v}) (P'.try (P'.getT "departure_occupancy_status")) + parse'schedule_relationship + = Prelude'.fmap (\ v o -> o{schedule_relationship = v}) (P'.try (P'.getT "schedule_relationship")) + parse'stop_time_properties = Prelude'.fmap (\ v o -> o{stop_time_properties = v}) (P'.try (P'.getT "stop_time_properties")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.hs b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.hs new file mode 100644 index 0000000..050ac88 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/ScheduleRelationship.hs @@ -0,0 +1,83 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship (ScheduleRelationship(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data ScheduleRelationship = SCHEDULED + | SKIPPED + | NO_DATA + | UNSCHEDULED + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable ScheduleRelationship + +instance Prelude'.Bounded ScheduleRelationship where + minBound = SCHEDULED + maxBound = UNSCHEDULED + +instance P'.Default ScheduleRelationship where + defaultValue = SCHEDULED + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe ScheduleRelationship +toMaybe'Enum 0 = Prelude'.Just SCHEDULED +toMaybe'Enum 1 = Prelude'.Just SKIPPED +toMaybe'Enum 2 = Prelude'.Just NO_DATA +toMaybe'Enum 3 = Prelude'.Just UNSCHEDULED +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum ScheduleRelationship where + fromEnum SCHEDULED = 0 + fromEnum SKIPPED = 1 + fromEnum NO_DATA = 2 + fromEnum UNSCHEDULED = 3 + toEnum + = P'.fromMaybe + (Prelude'.error + "hprotoc generated code: toEnum failure for type GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship") + . toMaybe'Enum + succ SCHEDULED = SKIPPED + succ SKIPPED = NO_DATA + succ NO_DATA = UNSCHEDULED + succ _ + = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship" + pred SKIPPED = SCHEDULED + pred NO_DATA = SKIPPED + pred UNSCHEDULED = NO_DATA + pred _ + = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship" + +instance P'.Wire ScheduleRelationship where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB ScheduleRelationship + +instance P'.MessageAPI msg' (msg' -> ScheduleRelationship) ScheduleRelationship where + getVal m' f' = f' m' + +instance P'.ReflectEnum ScheduleRelationship where + reflectEnum = [(0, "SCHEDULED", SCHEDULED), (1, "SKIPPED", SKIPPED), (2, "NO_DATA", NO_DATA), (3, "UNSCHEDULED", UNSCHEDULED)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship") [] + ["GTFS", "Realtime", "TripUpdate", "StopTimeUpdate"] + "ScheduleRelationship") + ["GTFS", "Realtime", "TripUpdate", "StopTimeUpdate", "ScheduleRelationship.hs"] + [(0, "SCHEDULED"), (1, "SKIPPED"), (2, "NO_DATA"), (3, "UNSCHEDULED")] + Prelude'.False + +instance P'.TextType ScheduleRelationship where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.hs b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.hs new file mode 100644 index 0000000..8784522 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate/StopTimeUpdate/StopTimeProperties.hs @@ -0,0 +1,89 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate.StopTimeUpdate.StopTimeProperties (StopTimeProperties(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data StopTimeProperties = StopTimeProperties{assigned_stop_id :: !(P'.Maybe P'.Utf8), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage StopTimeProperties where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable StopTimeProperties where + mergeAppend (StopTimeProperties x'1 x'2) (StopTimeProperties y'1 y'2) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + in StopTimeProperties z'1 z'2 + +instance P'.Default StopTimeProperties where + defaultValue = StopTimeProperties P'.defaultValue P'.defaultValue + +instance P'.Wire StopTimeProperties where + wireSize ft' self'@(StopTimeProperties x'1 x'2) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeExtField x'2) + wirePutWithSize ft' self'@(StopTimeProperties x'1 x'2) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields = P'.sequencePutWithSize [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutExtFieldWithSize x'2] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{assigned_stop_id = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> StopTimeProperties) StopTimeProperties where + getVal m' f' = f' m' + +instance P'.GPB StopTimeProperties + +instance P'.ReflectDescriptor StopTimeProperties where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\"], baseName = MName \"StopTimeProperties\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"StopTimeUpdate\",\"StopTimeProperties.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.StopTimeUpdate.StopTimeProperties.assigned_stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"StopTimeUpdate\",MName \"StopTimeProperties\"], baseName' = FName \"assigned_stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType StopTimeProperties where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg StopTimeProperties where + textPut msg + = do + P'.tellT "assigned_stop_id" (assigned_stop_id msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'assigned_stop_id]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'assigned_stop_id = Prelude'.fmap (\ v o -> o{assigned_stop_id = v}) (P'.try (P'.getT "assigned_stop_id")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/TripUpdate/TripProperties.hs b/gtfs/GTFS/Realtime/TripUpdate/TripProperties.hs new file mode 100644 index 0000000..ad66022 --- /dev/null +++ b/gtfs/GTFS/Realtime/TripUpdate/TripProperties.hs @@ -0,0 +1,108 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.TripUpdate.TripProperties (TripProperties(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data TripProperties = TripProperties{trip_id :: !(P'.Maybe P'.Utf8), start_date :: !(P'.Maybe P'.Utf8), + start_time :: !(P'.Maybe P'.Utf8), shape_id :: !(P'.Maybe P'.Utf8), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage TripProperties where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable TripProperties where + mergeAppend (TripProperties x'1 x'2 x'3 x'4 x'5) (TripProperties y'1 y'2 y'3 y'4 y'5) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + in TripProperties z'1 z'2 z'3 z'4 z'5 + +instance P'.Default TripProperties where + defaultValue = TripProperties P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire TripProperties where + wireSize ft' self'@(TripProperties x'1 x'2 x'3 x'4 x'5) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 9 x'3 + P'.wireSizeOpt 1 9 x'4 + + P'.wireSizeExtField x'5) + wirePutWithSize ft' self'@(TripProperties x'1 x'2 x'3 x'4 x'5) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutOptWithSize 26 9 x'3, + P'.wirePutOptWithSize 34 9 x'4, P'.wirePutExtFieldWithSize x'5] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{trip_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{start_date = Prelude'.Just new'Field}) (P'.wireGet 9) + 26 -> Prelude'.fmap (\ !new'Field -> old'Self{start_time = Prelude'.Just new'Field}) (P'.wireGet 9) + 34 -> Prelude'.fmap (\ !new'Field -> old'Self{shape_id = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> TripProperties) TripProperties where + getVal m' f' = f' m' + +instance P'.GPB TripProperties + +instance P'.ReflectDescriptor TripProperties where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 26, 34]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.TripUpdate.TripProperties\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\"], baseName = MName \"TripProperties\"}, descFilePath = [\"GTFS\",\"Realtime\",\"TripUpdate\",\"TripProperties.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.trip_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"trip_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.start_date\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"start_date\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.start_time\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"start_time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.TripUpdate.TripProperties.shape_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"TripUpdate\",MName \"TripProperties\"], baseName' = FName \"shape_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType TripProperties where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg TripProperties where + textPut msg + = do + P'.tellT "trip_id" (trip_id msg) + P'.tellT "start_date" (start_date msg) + P'.tellT "start_time" (start_time msg) + P'.tellT "shape_id" (shape_id msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'trip_id, parse'start_date, parse'start_time, parse'shape_id]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'trip_id = Prelude'.fmap (\ v o -> o{trip_id = v}) (P'.try (P'.getT "trip_id")) + parse'start_date = Prelude'.fmap (\ v o -> o{start_date = v}) (P'.try (P'.getT "start_date")) + parse'start_time = Prelude'.fmap (\ v o -> o{start_time = v}) (P'.try (P'.getT "start_time")) + parse'shape_id = Prelude'.fmap (\ v o -> o{shape_id = v}) (P'.try (P'.getT "shape_id")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehicleDescriptor.hs b/gtfs/GTFS/Realtime/VehicleDescriptor.hs new file mode 100644 index 0000000..41bd0fa --- /dev/null +++ b/gtfs/GTFS/Realtime/VehicleDescriptor.hs @@ -0,0 +1,101 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehicleDescriptor (VehicleDescriptor(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data VehicleDescriptor = VehicleDescriptor{id :: !(P'.Maybe P'.Utf8), label :: !(P'.Maybe P'.Utf8), + license_plate :: !(P'.Maybe P'.Utf8), ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage VehicleDescriptor where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable VehicleDescriptor where + mergeAppend (VehicleDescriptor x'1 x'2 x'3 x'4) (VehicleDescriptor y'1 y'2 y'3 y'4) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + in VehicleDescriptor z'1 z'2 z'3 z'4 + +instance P'.Default VehicleDescriptor where + defaultValue = VehicleDescriptor P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + +instance P'.Wire VehicleDescriptor where + wireSize ft' self'@(VehicleDescriptor x'1 x'2 x'3 x'4) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 9 x'3 + P'.wireSizeExtField x'4) + wirePutWithSize ft' self'@(VehicleDescriptor x'1 x'2 x'3 x'4) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutOptWithSize 26 9 x'3, + P'.wirePutExtFieldWithSize x'4] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{label = Prelude'.Just new'Field}) (P'.wireGet 9) + 26 -> Prelude'.fmap (\ !new'Field -> old'Self{license_plate = Prelude'.Just new'Field}) (P'.wireGet 9) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> VehicleDescriptor) VehicleDescriptor where + getVal m' f' = f' m' + +instance P'.GPB VehicleDescriptor + +instance P'.ReflectDescriptor VehicleDescriptor where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 26]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehicleDescriptor.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.label\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"label\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehicleDescriptor.license_plate\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehicleDescriptor\"], baseName' = FName \"license_plate\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType VehicleDescriptor where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg VehicleDescriptor where + textPut msg + = do + P'.tellT "id" (id msg) + P'.tellT "label" (label msg) + P'.tellT "license_plate" (license_plate msg) + textGet + = do + mods <- P'.sepEndBy (P'.choice [parse'id, parse'label, parse'license_plate]) P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'id = Prelude'.fmap (\ v o -> o{id = v}) (P'.try (P'.getT "id")) + parse'label = Prelude'.fmap (\ v o -> o{label = v}) (P'.try (P'.getT "label")) + parse'license_plate = Prelude'.fmap (\ v o -> o{license_plate = v}) (P'.try (P'.getT "license_plate")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehiclePosition.hs b/gtfs/GTFS/Realtime/VehiclePosition.hs new file mode 100644 index 0000000..da2cb12 --- /dev/null +++ b/gtfs/GTFS/Realtime/VehiclePosition.hs @@ -0,0 +1,183 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehiclePosition (VehiclePosition(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.Position as GTFS.Realtime +import qualified GTFS.Realtime.TripDescriptor as GTFS.Realtime +import qualified GTFS.Realtime.VehicleDescriptor as GTFS.Realtime +import qualified GTFS.Realtime.VehiclePosition.CarriageDetails as GTFS.Realtime.VehiclePosition +import qualified GTFS.Realtime.VehiclePosition.CongestionLevel as GTFS.Realtime.VehiclePosition +import qualified GTFS.Realtime.VehiclePosition.OccupancyStatus as GTFS.Realtime.VehiclePosition +import qualified GTFS.Realtime.VehiclePosition.VehicleStopStatus as GTFS.Realtime.VehiclePosition + +data VehiclePosition = VehiclePosition{trip :: !(P'.Maybe GTFS.Realtime.TripDescriptor), + vehicle :: !(P'.Maybe GTFS.Realtime.VehicleDescriptor), + position :: !(P'.Maybe GTFS.Realtime.Position), + current_stop_sequence :: !(P'.Maybe P'.Word32), stop_id :: !(P'.Maybe P'.Utf8), + current_status :: !(P'.Maybe GTFS.Realtime.VehiclePosition.VehicleStopStatus), + timestamp :: !(P'.Maybe P'.Word64), + congestion_level :: !(P'.Maybe GTFS.Realtime.VehiclePosition.CongestionLevel), + occupancy_status :: !(P'.Maybe GTFS.Realtime.VehiclePosition.OccupancyStatus), + occupancy_percentage :: !(P'.Maybe P'.Word32), + multi_carriage_details :: !(P'.Seq GTFS.Realtime.VehiclePosition.CarriageDetails), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage VehiclePosition where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable VehiclePosition where + mergeAppend (VehiclePosition x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12) + (VehiclePosition y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9 y'10 y'11 y'12) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + !z'7 = P'.mergeAppend x'7 y'7 + !z'8 = P'.mergeAppend x'8 y'8 + !z'9 = P'.mergeAppend x'9 y'9 + !z'10 = P'.mergeAppend x'10 y'10 + !z'11 = P'.mergeAppend x'11 y'11 + !z'12 = P'.mergeAppend x'12 y'12 + in VehiclePosition z'1 z'2 z'3 z'4 z'5 z'6 z'7 z'8 z'9 z'10 z'11 z'12 + +instance P'.Default VehiclePosition where + defaultValue + = VehiclePosition P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue + (Prelude'.Just (Prelude'.read "IN_TRANSIT_TO")) + P'.defaultValue + P'.defaultValue + P'.defaultValue + P'.defaultValue + P'.defaultValue + P'.defaultValue + +instance P'.Wire VehiclePosition where + wireSize ft' self'@(VehiclePosition x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 11 x'1 + P'.wireSizeOpt 1 11 x'2 + P'.wireSizeOpt 1 11 x'3 + P'.wireSizeOpt 1 13 x'4 + + P'.wireSizeOpt 1 9 x'5 + + P'.wireSizeOpt 1 14 x'6 + + P'.wireSizeOpt 1 4 x'7 + + P'.wireSizeOpt 1 14 x'8 + + P'.wireSizeOpt 1 14 x'9 + + P'.wireSizeOpt 1 13 x'10 + + P'.wireSizeRep 1 11 x'11 + + P'.wireSizeExtField x'12) + wirePutWithSize ft' self'@(VehiclePosition x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 11 x'1, P'.wirePutOptWithSize 18 11 x'3, P'.wirePutOptWithSize 24 13 x'4, + P'.wirePutOptWithSize 32 14 x'6, P'.wirePutOptWithSize 40 4 x'7, P'.wirePutOptWithSize 48 14 x'8, + P'.wirePutOptWithSize 58 9 x'5, P'.wirePutOptWithSize 66 11 x'2, P'.wirePutOptWithSize 72 14 x'9, + P'.wirePutOptWithSize 80 13 x'10, P'.wirePutRepWithSize 90 11 x'11, P'.wirePutExtFieldWithSize x'12] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{trip = P'.mergeAppend (trip old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 66 -> Prelude'.fmap (\ !new'Field -> old'Self{vehicle = P'.mergeAppend (vehicle old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{position = P'.mergeAppend (position old'Self) (Prelude'.Just new'Field)}) + (P'.wireGet 11) + 24 -> Prelude'.fmap (\ !new'Field -> old'Self{current_stop_sequence = Prelude'.Just new'Field}) (P'.wireGet 13) + 58 -> Prelude'.fmap (\ !new'Field -> old'Self{stop_id = Prelude'.Just new'Field}) (P'.wireGet 9) + 32 -> Prelude'.fmap (\ !new'Field -> old'Self{current_status = Prelude'.Just new'Field}) (P'.wireGet 14) + 40 -> Prelude'.fmap (\ !new'Field -> old'Self{timestamp = Prelude'.Just new'Field}) (P'.wireGet 4) + 48 -> Prelude'.fmap (\ !new'Field -> old'Self{congestion_level = Prelude'.Just new'Field}) (P'.wireGet 14) + 72 -> Prelude'.fmap (\ !new'Field -> old'Self{occupancy_status = Prelude'.Just new'Field}) (P'.wireGet 14) + 80 -> Prelude'.fmap (\ !new'Field -> old'Self{occupancy_percentage = Prelude'.Just new'Field}) (P'.wireGet 13) + 90 -> Prelude'.fmap + (\ !new'Field -> old'Self{multi_carriage_details = P'.append (multi_carriage_details old'Self) new'Field}) + (P'.wireGet 11) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> VehiclePosition) VehiclePosition where + getVal m' f' = f' m' + +instance P'.GPB VehiclePosition + +instance P'.ReflectDescriptor VehiclePosition where + getMessageInfo _ + = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 24, 32, 40, 48, 58, 66, 72, 80, 90]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehiclePosition\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.trip\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"trip\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.TripDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"TripDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.vehicle\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"vehicle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehicleDescriptor\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"VehicleDescriptor\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.position\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"position\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.Position\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\"], baseName = MName \"Position\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.current_stop_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"current_stop_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.stop_id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"stop_id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.current_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"current_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.VehicleStopStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"VehicleStopStatus\"}), hsRawDefault = Just \"IN_TRANSIT_TO\", hsDefault = Just (HsDef'Enum \"IN_TRANSIT_TO\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.timestamp\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"timestamp\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.congestion_level\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"congestion_level\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CongestionLevel\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CongestionLevel\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 72}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.occupancy_percentage\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"occupancy_percentage\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 80}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.multi_carriage_details\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName' = FName \"multi_carriage_details\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 90}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CarriageDetails\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CarriageDetails\"}), hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType VehiclePosition where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg VehiclePosition where + textPut msg + = do + P'.tellT "trip" (trip msg) + P'.tellT "vehicle" (vehicle msg) + P'.tellT "position" (position msg) + P'.tellT "current_stop_sequence" (current_stop_sequence msg) + P'.tellT "stop_id" (stop_id msg) + P'.tellT "current_status" (current_status msg) + P'.tellT "timestamp" (timestamp msg) + P'.tellT "congestion_level" (congestion_level msg) + P'.tellT "occupancy_status" (occupancy_status msg) + P'.tellT "occupancy_percentage" (occupancy_percentage msg) + P'.tellT "multi_carriage_details" (multi_carriage_details msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice + [parse'trip, parse'vehicle, parse'position, parse'current_stop_sequence, parse'stop_id, parse'current_status, + parse'timestamp, parse'congestion_level, parse'occupancy_status, parse'occupancy_percentage, + parse'multi_carriage_details]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'trip = Prelude'.fmap (\ v o -> o{trip = v}) (P'.try (P'.getT "trip")) + parse'vehicle = Prelude'.fmap (\ v o -> o{vehicle = v}) (P'.try (P'.getT "vehicle")) + parse'position = Prelude'.fmap (\ v o -> o{position = v}) (P'.try (P'.getT "position")) + parse'current_stop_sequence + = Prelude'.fmap (\ v o -> o{current_stop_sequence = v}) (P'.try (P'.getT "current_stop_sequence")) + parse'stop_id = Prelude'.fmap (\ v o -> o{stop_id = v}) (P'.try (P'.getT "stop_id")) + parse'current_status = Prelude'.fmap (\ v o -> o{current_status = v}) (P'.try (P'.getT "current_status")) + parse'timestamp = Prelude'.fmap (\ v o -> o{timestamp = v}) (P'.try (P'.getT "timestamp")) + parse'congestion_level = Prelude'.fmap (\ v o -> o{congestion_level = v}) (P'.try (P'.getT "congestion_level")) + parse'occupancy_status = Prelude'.fmap (\ v o -> o{occupancy_status = v}) (P'.try (P'.getT "occupancy_status")) + parse'occupancy_percentage = Prelude'.fmap (\ v o -> o{occupancy_percentage = v}) (P'.try (P'.getT "occupancy_percentage")) + parse'multi_carriage_details + = Prelude'.fmap (\ v o -> o{multi_carriage_details = P'.append (multi_carriage_details o) v}) + (P'.try (P'.getT "multi_carriage_details")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehiclePosition/CarriageDetails.hs b/gtfs/GTFS/Realtime/VehiclePosition/CarriageDetails.hs new file mode 100644 index 0000000..1afba89 --- /dev/null +++ b/gtfs/GTFS/Realtime/VehiclePosition/CarriageDetails.hs @@ -0,0 +1,120 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehiclePosition.CarriageDetails (CarriageDetails(..)) where +import Prelude ((+), (/), (++), (.), (==), (<=), (&&)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' +import qualified GTFS.Realtime.VehiclePosition.OccupancyStatus as GTFS.Realtime.VehiclePosition + +data CarriageDetails = CarriageDetails{id :: !(P'.Maybe P'.Utf8), label :: !(P'.Maybe P'.Utf8), + occupancy_status :: !(P'.Maybe GTFS.Realtime.VehiclePosition.OccupancyStatus), + occupancy_percentage :: !(P'.Maybe P'.Int32), carriage_sequence :: !(P'.Maybe P'.Word32), + ext'field :: !(P'.ExtField)} + deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic) + +instance P'.ExtendMessage CarriageDetails where + getExtField = ext'field + putExtField e'f msg = msg{ext'field = e'f} + validExtRanges msg = P'.extRanges (P'.reflectDescriptorInfo msg) + +instance P'.Mergeable CarriageDetails where + mergeAppend (CarriageDetails x'1 x'2 x'3 x'4 x'5 x'6) (CarriageDetails y'1 y'2 y'3 y'4 y'5 y'6) + = let !z'1 = P'.mergeAppend x'1 y'1 + !z'2 = P'.mergeAppend x'2 y'2 + !z'3 = P'.mergeAppend x'3 y'3 + !z'4 = P'.mergeAppend x'4 y'4 + !z'5 = P'.mergeAppend x'5 y'5 + !z'6 = P'.mergeAppend x'6 y'6 + in CarriageDetails z'1 z'2 z'3 z'4 z'5 z'6 + +instance P'.Default CarriageDetails where + defaultValue + = CarriageDetails P'.defaultValue P'.defaultValue (Prelude'.Just (Prelude'.read "NO_DATA_AVAILABLE")) (Prelude'.Just (-1)) + P'.defaultValue + P'.defaultValue + +instance P'.Wire CarriageDetails where + wireSize ft' self'@(CarriageDetails x'1 x'2 x'3 x'4 x'5 x'6) + = case ft' of + 10 -> calc'Size + 11 -> P'.prependMessageSize calc'Size + _ -> P'.wireSizeErr ft' self' + where + calc'Size + = (P'.wireSizeOpt 1 9 x'1 + P'.wireSizeOpt 1 9 x'2 + P'.wireSizeOpt 1 14 x'3 + P'.wireSizeOpt 1 5 x'4 + + P'.wireSizeOpt 1 13 x'5 + + P'.wireSizeExtField x'6) + wirePutWithSize ft' self'@(CarriageDetails x'1 x'2 x'3 x'4 x'5 x'6) + = case ft' of + 10 -> put'Fields + 11 -> put'FieldsSized + _ -> P'.wirePutErr ft' self' + where + put'Fields + = P'.sequencePutWithSize + [P'.wirePutOptWithSize 10 9 x'1, P'.wirePutOptWithSize 18 9 x'2, P'.wirePutOptWithSize 24 14 x'3, + P'.wirePutOptWithSize 32 5 x'4, P'.wirePutOptWithSize 40 13 x'5, P'.wirePutExtFieldWithSize x'6] + put'FieldsSized + = let size' = Prelude'.fst (P'.runPutM put'Fields) + put'Size + = do + P'.putSize size' + Prelude'.return (P'.size'WireSize size') + in P'.sequencePutWithSize [put'Size, put'Fields] + wireGet ft' + = case ft' of + 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self) + _ -> P'.wireGetErr ft' + where + update'Self wire'Tag old'Self + = case wire'Tag of + 10 -> Prelude'.fmap (\ !new'Field -> old'Self{id = Prelude'.Just new'Field}) (P'.wireGet 9) + 18 -> Prelude'.fmap (\ !new'Field -> old'Self{label = Prelude'.Just new'Field}) (P'.wireGet 9) + 24 -> Prelude'.fmap (\ !new'Field -> old'Self{occupancy_status = Prelude'.Just new'Field}) (P'.wireGet 14) + 32 -> Prelude'.fmap (\ !new'Field -> old'Self{occupancy_percentage = Prelude'.Just new'Field}) (P'.wireGet 5) + 40 -> Prelude'.fmap (\ !new'Field -> old'Self{carriage_sequence = Prelude'.Just new'Field}) (P'.wireGet 13) + _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in + if Prelude'.or [1000 <= field'Number && field'Number <= 1999, 9000 <= field'Number && field'Number <= 9999] then + P'.loadExtension field'Number wire'Type old'Self else P'.unknown field'Number wire'Type old'Self + +instance P'.MessageAPI msg' (msg' -> CarriageDetails) CarriageDetails where + getVal m' f' = f' m' + +instance P'.GPB CarriageDetails + +instance P'.ReflectDescriptor CarriageDetails where + getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [10, 18, 24, 32, 40]) + reflectDescriptorInfo _ + = Prelude'.read + "DescriptorInfo {descName = ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.CarriageDetails\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"CarriageDetails\"}, descFilePath = [\"GTFS\",\"Realtime\",\"VehiclePosition\",\"CarriageDetails.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.id\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.label\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"label\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.occupancy_status\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"occupancy_status\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".transit_realtime.VehiclePosition.OccupancyStatus\", haskellPrefix = [], parentModule = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\"], baseName = MName \"OccupancyStatus\"}), hsRawDefault = Just \"NO_DATA_AVAILABLE\", hsDefault = Just (HsDef'Enum \"NO_DATA_AVAILABLE\"), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.occupancy_percentage\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"occupancy_percentage\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Just \"-1\", hsDefault = Just (HsDef'Integer (-1)), isMapField = False, mapKeyVal = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".transit_realtime.VehiclePosition.CarriageDetails.carriage_sequence\", haskellPrefix' = [], parentModule' = [MName \"GTFS\",MName \"Realtime\",MName \"VehiclePosition\",MName \"CarriageDetails\"], baseName' = FName \"carriage_sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing, isMapField = False, mapKeyVal = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [(FieldId {getFieldId = 1000},FieldId {getFieldId = 1999}),(FieldId {getFieldId = 9000},FieldId {getFieldId = 9999})], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False, mapEntry = False}" + +instance P'.TextType CarriageDetails where + tellT = P'.tellSubMessage + getT = P'.getSubMessage + +instance P'.TextMsg CarriageDetails where + textPut msg + = do + P'.tellT "id" (id msg) + P'.tellT "label" (label msg) + P'.tellT "occupancy_status" (occupancy_status msg) + P'.tellT "occupancy_percentage" (occupancy_percentage msg) + P'.tellT "carriage_sequence" (carriage_sequence msg) + textGet + = do + mods <- P'.sepEndBy + (P'.choice [parse'id, parse'label, parse'occupancy_status, parse'occupancy_percentage, parse'carriage_sequence]) + P'.spaces + Prelude'.return (Prelude'.foldl' (\ v f -> f v) P'.defaultValue mods) + where + parse'id = Prelude'.fmap (\ v o -> o{id = v}) (P'.try (P'.getT "id")) + parse'label = Prelude'.fmap (\ v o -> o{label = v}) (P'.try (P'.getT "label")) + parse'occupancy_status = Prelude'.fmap (\ v o -> o{occupancy_status = v}) (P'.try (P'.getT "occupancy_status")) + parse'occupancy_percentage = Prelude'.fmap (\ v o -> o{occupancy_percentage = v}) (P'.try (P'.getT "occupancy_percentage")) + parse'carriage_sequence = Prelude'.fmap (\ v o -> o{carriage_sequence = v}) (P'.try (P'.getT "carriage_sequence")) \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehiclePosition/CongestionLevel.hs b/gtfs/GTFS/Realtime/VehiclePosition/CongestionLevel.hs new file mode 100644 index 0000000..4f84eac --- /dev/null +++ b/gtfs/GTFS/Realtime/VehiclePosition/CongestionLevel.hs @@ -0,0 +1,85 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehiclePosition.CongestionLevel (CongestionLevel(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data CongestionLevel = UNKNOWN_CONGESTION_LEVEL + | RUNNING_SMOOTHLY + | STOP_AND_GO + | CONGESTION + | SEVERE_CONGESTION + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable CongestionLevel + +instance Prelude'.Bounded CongestionLevel where + minBound = UNKNOWN_CONGESTION_LEVEL + maxBound = SEVERE_CONGESTION + +instance P'.Default CongestionLevel where + defaultValue = UNKNOWN_CONGESTION_LEVEL + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe CongestionLevel +toMaybe'Enum 0 = Prelude'.Just UNKNOWN_CONGESTION_LEVEL +toMaybe'Enum 1 = Prelude'.Just RUNNING_SMOOTHLY +toMaybe'Enum 2 = Prelude'.Just STOP_AND_GO +toMaybe'Enum 3 = Prelude'.Just CONGESTION +toMaybe'Enum 4 = Prelude'.Just SEVERE_CONGESTION +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum CongestionLevel where + fromEnum UNKNOWN_CONGESTION_LEVEL = 0 + fromEnum RUNNING_SMOOTHLY = 1 + fromEnum STOP_AND_GO = 2 + fromEnum CONGESTION = 3 + fromEnum SEVERE_CONGESTION = 4 + toEnum + = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.VehiclePosition.CongestionLevel") . + toMaybe'Enum + succ UNKNOWN_CONGESTION_LEVEL = RUNNING_SMOOTHLY + succ RUNNING_SMOOTHLY = STOP_AND_GO + succ STOP_AND_GO = CONGESTION + succ CONGESTION = SEVERE_CONGESTION + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.VehiclePosition.CongestionLevel" + pred RUNNING_SMOOTHLY = UNKNOWN_CONGESTION_LEVEL + pred STOP_AND_GO = RUNNING_SMOOTHLY + pred CONGESTION = STOP_AND_GO + pred SEVERE_CONGESTION = CONGESTION + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.VehiclePosition.CongestionLevel" + +instance P'.Wire CongestionLevel where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB CongestionLevel + +instance P'.MessageAPI msg' (msg' -> CongestionLevel) CongestionLevel where + getVal m' f' = f' m' + +instance P'.ReflectEnum CongestionLevel where + reflectEnum + = [(0, "UNKNOWN_CONGESTION_LEVEL", UNKNOWN_CONGESTION_LEVEL), (1, "RUNNING_SMOOTHLY", RUNNING_SMOOTHLY), + (2, "STOP_AND_GO", STOP_AND_GO), (3, "CONGESTION", CONGESTION), (4, "SEVERE_CONGESTION", SEVERE_CONGESTION)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.VehiclePosition.CongestionLevel") [] ["GTFS", "Realtime", "VehiclePosition"] + "CongestionLevel") + ["GTFS", "Realtime", "VehiclePosition", "CongestionLevel.hs"] + [(0, "UNKNOWN_CONGESTION_LEVEL"), (1, "RUNNING_SMOOTHLY"), (2, "STOP_AND_GO"), (3, "CONGESTION"), (4, "SEVERE_CONGESTION")] + Prelude'.False + +instance P'.TextType CongestionLevel where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs b/gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs new file mode 100644 index 0000000..92d4064 --- /dev/null +++ b/gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs @@ -0,0 +1,109 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehiclePosition.OccupancyStatus (OccupancyStatus(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data OccupancyStatus = EMPTY + | MANY_SEATS_AVAILABLE + | FEW_SEATS_AVAILABLE + | STANDING_ROOM_ONLY + | CRUSHED_STANDING_ROOM_ONLY + | FULL + | NOT_ACCEPTING_PASSENGERS + | NO_DATA_AVAILABLE + | NOT_BOARDABLE + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable OccupancyStatus + +instance Prelude'.Bounded OccupancyStatus where + minBound = EMPTY + maxBound = NOT_BOARDABLE + +instance P'.Default OccupancyStatus where + defaultValue = EMPTY + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe OccupancyStatus +toMaybe'Enum 0 = Prelude'.Just EMPTY +toMaybe'Enum 1 = Prelude'.Just MANY_SEATS_AVAILABLE +toMaybe'Enum 2 = Prelude'.Just FEW_SEATS_AVAILABLE +toMaybe'Enum 3 = Prelude'.Just STANDING_ROOM_ONLY +toMaybe'Enum 4 = Prelude'.Just CRUSHED_STANDING_ROOM_ONLY +toMaybe'Enum 5 = Prelude'.Just FULL +toMaybe'Enum 6 = Prelude'.Just NOT_ACCEPTING_PASSENGERS +toMaybe'Enum 7 = Prelude'.Just NO_DATA_AVAILABLE +toMaybe'Enum 8 = Prelude'.Just NOT_BOARDABLE +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum OccupancyStatus where + fromEnum EMPTY = 0 + fromEnum MANY_SEATS_AVAILABLE = 1 + fromEnum FEW_SEATS_AVAILABLE = 2 + fromEnum STANDING_ROOM_ONLY = 3 + fromEnum CRUSHED_STANDING_ROOM_ONLY = 4 + fromEnum FULL = 5 + fromEnum NOT_ACCEPTING_PASSENGERS = 6 + fromEnum NO_DATA_AVAILABLE = 7 + fromEnum NOT_BOARDABLE = 8 + toEnum + = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus") . + toMaybe'Enum + succ EMPTY = MANY_SEATS_AVAILABLE + succ MANY_SEATS_AVAILABLE = FEW_SEATS_AVAILABLE + succ FEW_SEATS_AVAILABLE = STANDING_ROOM_ONLY + succ STANDING_ROOM_ONLY = CRUSHED_STANDING_ROOM_ONLY + succ CRUSHED_STANDING_ROOM_ONLY = FULL + succ FULL = NOT_ACCEPTING_PASSENGERS + succ NOT_ACCEPTING_PASSENGERS = NO_DATA_AVAILABLE + succ NO_DATA_AVAILABLE = NOT_BOARDABLE + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus" + pred MANY_SEATS_AVAILABLE = EMPTY + pred FEW_SEATS_AVAILABLE = MANY_SEATS_AVAILABLE + pred STANDING_ROOM_ONLY = FEW_SEATS_AVAILABLE + pred CRUSHED_STANDING_ROOM_ONLY = STANDING_ROOM_ONLY + pred FULL = CRUSHED_STANDING_ROOM_ONLY + pred NOT_ACCEPTING_PASSENGERS = FULL + pred NO_DATA_AVAILABLE = NOT_ACCEPTING_PASSENGERS + pred NOT_BOARDABLE = NO_DATA_AVAILABLE + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.VehiclePosition.OccupancyStatus" + +instance P'.Wire OccupancyStatus where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB OccupancyStatus + +instance P'.MessageAPI msg' (msg' -> OccupancyStatus) OccupancyStatus where + getVal m' f' = f' m' + +instance P'.ReflectEnum OccupancyStatus where + reflectEnum + = [(0, "EMPTY", EMPTY), (1, "MANY_SEATS_AVAILABLE", MANY_SEATS_AVAILABLE), (2, "FEW_SEATS_AVAILABLE", FEW_SEATS_AVAILABLE), + (3, "STANDING_ROOM_ONLY", STANDING_ROOM_ONLY), (4, "CRUSHED_STANDING_ROOM_ONLY", CRUSHED_STANDING_ROOM_ONLY), + (5, "FULL", FULL), (6, "NOT_ACCEPTING_PASSENGERS", NOT_ACCEPTING_PASSENGERS), (7, "NO_DATA_AVAILABLE", NO_DATA_AVAILABLE), + (8, "NOT_BOARDABLE", NOT_BOARDABLE)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.VehiclePosition.OccupancyStatus") [] ["GTFS", "Realtime", "VehiclePosition"] + "OccupancyStatus") + ["GTFS", "Realtime", "VehiclePosition", "OccupancyStatus.hs"] + [(0, "EMPTY"), (1, "MANY_SEATS_AVAILABLE"), (2, "FEW_SEATS_AVAILABLE"), (3, "STANDING_ROOM_ONLY"), + (4, "CRUSHED_STANDING_ROOM_ONLY"), (5, "FULL"), (6, "NOT_ACCEPTING_PASSENGERS"), (7, "NO_DATA_AVAILABLE"), + (8, "NOT_BOARDABLE")] + Prelude'.False + +instance P'.TextType OccupancyStatus where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/GTFS/Realtime/VehiclePosition/VehicleStopStatus.hs b/gtfs/GTFS/Realtime/VehiclePosition/VehicleStopStatus.hs new file mode 100644 index 0000000..3bc70e5 --- /dev/null +++ b/gtfs/GTFS/Realtime/VehiclePosition/VehicleStopStatus.hs @@ -0,0 +1,73 @@ +{-# LANGUAGE BangPatterns, DataKinds, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings + #-} +{-# OPTIONS_GHC -w #-} +module GTFS.Realtime.VehiclePosition.VehicleStopStatus (VehicleStopStatus(..)) where +import Prelude ((+), (/), (.)) +import qualified Prelude as Prelude' +import qualified Data.List as Prelude' +import qualified Data.Typeable as Prelude' +import qualified GHC.Generics as Prelude' +import qualified Data.Data as Prelude' +import qualified Text.ProtocolBuffers.Header as P' + +data VehicleStopStatus = INCOMING_AT + | STOPPED_AT + | IN_TRANSIT_TO + deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, + Prelude'.Generic) + +instance P'.Mergeable VehicleStopStatus + +instance Prelude'.Bounded VehicleStopStatus where + minBound = INCOMING_AT + maxBound = IN_TRANSIT_TO + +instance P'.Default VehicleStopStatus where + defaultValue = INCOMING_AT + +toMaybe'Enum :: Prelude'.Int -> P'.Maybe VehicleStopStatus +toMaybe'Enum 0 = Prelude'.Just INCOMING_AT +toMaybe'Enum 1 = Prelude'.Just STOPPED_AT +toMaybe'Enum 2 = Prelude'.Just IN_TRANSIT_TO +toMaybe'Enum _ = Prelude'.Nothing + +instance Prelude'.Enum VehicleStopStatus where + fromEnum INCOMING_AT = 0 + fromEnum STOPPED_AT = 1 + fromEnum IN_TRANSIT_TO = 2 + toEnum + = P'.fromMaybe (Prelude'.error "hprotoc generated code: toEnum failure for type GTFS.Realtime.VehiclePosition.VehicleStopStatus") + . toMaybe'Enum + succ INCOMING_AT = STOPPED_AT + succ STOPPED_AT = IN_TRANSIT_TO + succ _ = Prelude'.error "hprotoc generated code: succ failure for type GTFS.Realtime.VehiclePosition.VehicleStopStatus" + pred STOPPED_AT = INCOMING_AT + pred IN_TRANSIT_TO = STOPPED_AT + pred _ = Prelude'.error "hprotoc generated code: pred failure for type GTFS.Realtime.VehiclePosition.VehicleStopStatus" + +instance P'.Wire VehicleStopStatus where + wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum) + wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum) + wireGet 14 = P'.wireGetEnum toMaybe'Enum + wireGet ft' = P'.wireGetErr ft' + wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum + wireGetPacked ft' = P'.wireGetErr ft' + +instance P'.GPB VehicleStopStatus + +instance P'.MessageAPI msg' (msg' -> VehicleStopStatus) VehicleStopStatus where + getVal m' f' = f' m' + +instance P'.ReflectEnum VehicleStopStatus where + reflectEnum = [(0, "INCOMING_AT", INCOMING_AT), (1, "STOPPED_AT", STOPPED_AT), (2, "IN_TRANSIT_TO", IN_TRANSIT_TO)] + reflectEnumInfo _ + = P'.EnumInfo + (P'.makePNF (P'.pack ".transit_realtime.VehiclePosition.VehicleStopStatus") [] ["GTFS", "Realtime", "VehiclePosition"] + "VehicleStopStatus") + ["GTFS", "Realtime", "VehiclePosition", "VehicleStopStatus.hs"] + [(0, "INCOMING_AT"), (1, "STOPPED_AT"), (2, "IN_TRANSIT_TO")] + Prelude'.False + +instance P'.TextType VehicleStopStatus where + tellT = P'.tellShow + getT = P'.getRead \ No newline at end of file diff --git a/gtfs/Servant/GTFS/Realtime.hs b/gtfs/Servant/GTFS/Realtime.hs new file mode 100644 index 0000000..8923b92 --- /dev/null +++ b/gtfs/Servant/GTFS/Realtime.hs @@ -0,0 +1,38 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE UndecidableInstances #-} + + +module Servant.GTFS.Realtime (Proto) where + +import Servant + ( MimeRender(..), + MimeUnrender(mimeUnrender), + Accept(contentType), + Proxy(Proxy) ) +import Text.ProtocolBuffers + ( Wire, ReflectDescriptor, messagePut, messageGet ) +import Network.HTTP.Media ((//)) +import Data.Either.Combinators (mapRight) +import Data.Swagger (ToSchema(..)) + + +-- | A servant encoding for protobuf-encoded messages +data Proto + +instance Accept Proto where + contentType _ = "application" // "octet-stream" + +instance (Wire msg, ReflectDescriptor msg) => MimeUnrender Proto msg where + mimeUnrender _ = mapRight fst . messageGet @msg + +instance (Wire msg, ReflectDescriptor msg) => MimeRender Proto msg where + mimeRender _ = messagePut + +-- TODO: this instance is horrible; ideally it should at least include +-- the name of the message type (if at all possible) +instance {-# OVERLAPPABLE #-} Wire msg => ToSchema msg where + declareNamedSchema _ = declareNamedSchema (Proxy @String) diff --git a/hie.yaml b/hie.yaml index 2b25c1f..4bc07c5 100644 --- a/hie.yaml +++ b/hie.yaml @@ -5,3 +5,6 @@ cradle: - path: "lib" component: "lib:tracktrain" + + - path: "gtfs" + component: "tracktrain:lib:gtfs" diff --git a/lib/API.hs b/lib/API.hs index 51c3690..34b127a 100644 --- a/lib/API.hs +++ b/lib/API.hs @@ -5,7 +5,7 @@ -- | The sole authorative definition of this server's API, given as a Servant-style -- Haskell type. All other descriptions of the API are generated from this one. -module API (API, CompleteAPI) where +module API (API, CompleteAPI, GtfsRealtimeAPI) where import Data.Map (Map) import Data.Proxy (Proxy (..)) @@ -21,6 +21,10 @@ import Servant (Application, import Servant.API (Capture, FromHttpApiData, Get, JSON, Post, QueryParam, ReqBody, type (:<|>) ((:<|>))) +import Servant.GTFS.Realtime (Proto) +import GTFS.Realtime.FeedEntity +import GTFS.Realtime.FeedMessage (FeedMessage) + -- | The server's API (as it is actually intended). type API = "stations" :> Get '[JSON] (Map StationID Station) @@ -33,6 +37,13 @@ type API = "stations" :> Get '[JSON] (Map StationID Station) :<|> "train" :> "ping" :> ReqBody '[JSON] TripPing :> Post '[JSON] () -- debug things :<|> "debug" :> "state" :> Get '[JSON] (Map Token [TripPing]) + :<|> "gtfs" :> GtfsRealtimeAPI + +-- | The API used for publishing gtfs realtime updates +type GtfsRealtimeAPI = "servicealerts" :> Get '[Proto] FeedMessage + :<|> "tripupdates" :> Get '[Proto] FeedEntity + :<|> "vehiclepositions" :> Get '[Proto] FeedEntity + -- | The server's API with an additional debug route for accessing the specification -- itself. Split from API to prevent the API documenting the format in which it is diff --git a/lib/Server.hs b/lib/Server.hs index 2375d2b..1aaf630 100644 --- a/lib/Server.hs +++ b/lib/Server.hs @@ -5,6 +5,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeApplications #-} +{-# LANGUAGE OverloadedLists #-} -- Implementation of the API. This module is the main point of the program. @@ -57,9 +58,27 @@ import Servant.Docs (DocCapture (..), import Servant.Server (Handler) import Servant.Swagger (toSwagger) import Web.PathPieces (PathPiece) +import Text.ProtocolBuffers (defaultValue) +import qualified Data.Sequence as Seq +import Data.Time.Clock.POSIX (getPOSIXTime) +import Data.Time.Clock.System (SystemTime(systemSeconds), getSystemTime) +import Text.ProtocolBuffers.WireMessage (zzEncode64) + +import GTFS.Realtime.FeedMessage (FeedMessage(..)) +import GTFS.Realtime.FeedEntity ( FeedEntity(FeedEntity) ) +import GTFS.Realtime.FeedHeader (FeedHeader(FeedHeader)) +import GTFS.Realtime.FeedHeader.Incrementality (Incrementality(FULL_DATASET)) import API import Persist +import GTFS.Realtime.Alert (Alert(Alert)) +import GTFS.Realtime.Alert.SeverityLevel (SeverityLevel(WARNING)) +import GTFS.Realtime.Alert.Cause (Cause(CONSTRUCTION)) +import GTFS.Realtime.Alert.Effect (Effect(DETOUR)) +import GTFS.Realtime.TranslatedString (TranslatedString(TranslatedString)) +import GTFS.Realtime.TranslatedString.Translation (Translation(Translation)) +import GTFS.Realtime.TimeRange (TimeRange(TimeRange)) +import GTFS.Realtime.EntitySelector (EntitySelector(EntitySelector)) application :: GTFS -> Pool SqlBackend -> IO Application application gtfs dbpool = do @@ -75,7 +94,7 @@ doMigration pool = runSql pool $ server :: GTFS -> Pool SqlBackend -> Server CompleteAPI server gtfs@GTFS{..} dbpool = handleDebugAPI :<|> handleStations :<|> handleTimetable :<|> handleTrip - :<|> handleRegister :<|> handleTripPing :<|> handleDebugState + :<|> handleRegister :<|> handleTripPing :<|> handleDebugState :<|> gtfsRealtimeServer where handleStations = pure stations handleTimetable station maybeDay = do -- TODO: resolve "overlay" trips (perhaps just additional CalendarDates?) @@ -106,6 +125,49 @@ server gtfs@GTFS{..} dbpool = handleDebugAPI :<|> handleStations :<|> handleTime pure (M.fromList pairs) handleDebugAPI = pure $ toSwagger (Proxy @API) +gtfsRealtimeServer :: Server GtfsRealtimeAPI +gtfsRealtimeServer = handleServiceAlerts :<|> handleDummy :<|> handleDummy + where handleDummy = do + pure $ FeedEntity + "1234" + Nothing + Nothing + Nothing + Nothing + Nothing + defaultValue + handleServiceAlerts = do + now <- liftIO getSystemTime <&> systemSeconds + pure $ FeedMessage + (FeedHeader "2.0" (Just FULL_DATASET) (Just $ fromIntegral now) defaultValue) + (Seq.fromList + [FeedEntity + "0" + Nothing + Nothing + Nothing + (Just $ Alert + [TimeRange (Just $ fromIntegral (now - 1000)) Nothing defaultValue] + [EntitySelector Nothing (Just "Passau - Freyung") Nothing Nothing Nothing Nothing defaultValue] + (Just CONSTRUCTION) + (Just DETOUR) + (lang "de" "https://ilztalbahn.eu") + (lang "de" "Da liegt ein Baum auf der Strecke") + (lang "de" "Leider liegt ein Baum auf der Strecke. Solange fährt hier nix.") + Nothing + Nothing + (Just WARNING) + Nothing + Nothing + defaultValue + ) + Nothing + defaultValue + ]) + defaultValue + lang code msg = Just $ TranslatedString [Translation msg (Just code) defaultValue] defaultValue + + -- TODO: proper debug logging for expired tokens checkTokenValid :: Pool SqlBackend -> Token -> Handler () checkTokenValid dbpool token = do diff --git a/tracktrain.cabal b/tracktrain.cabal index 80aa773..7c20efe 100644 --- a/tracktrain.cabal +++ b/tracktrain.cabal @@ -34,6 +34,8 @@ executable tracktrain , data-default-class >= 0.1.2 , persistent-postgresql , monad-logger + , gtfs + , protocol-buffers hs-source-dirs: app default-language: Haskell2010 default-extensions: OverloadedStrings @@ -54,6 +56,8 @@ executable tracktrain library build-depends: base ^>=4.14.3.0 + , gtfs + , protocol-buffers , zip-archive , cassava >= 0.5.2.0 , bytestring >= 0.10.10.0 @@ -94,3 +98,47 @@ library default-language: Haskell2010 default-extensions: OverloadedStrings , ScopedTypeVariables + +library gtfs + build-depends: base ^>=4.14.3.0 + , protocol-buffers + , protocol-buffers-descriptor + , servant + , servant-server + , http-media + , either + , swagger2 + default-language: Haskell2010 + hs-source-dirs: gtfs + exposed-modules: GTFS.Realtime + , GTFS.Realtime.Alert + , GTFS.Realtime.Alert.Cause + , GTFS.Realtime.Alert.Effect + , GTFS.Realtime.Alert.SeverityLevel + , GTFS.Realtime.EntitySelector + , GTFS.Realtime.FeedEntity + , GTFS.Realtime.FeedHeader + , GTFS.Realtime.FeedHeader.Incrementality + , GTFS.Realtime.FeedMessage + , GTFS.Realtime.Position + , GTFS.Realtime.Shape + , GTFS.Realtime.TimeRange + , GTFS.Realtime.TranslatedImage + , GTFS.Realtime.TranslatedImage.LocalizedImage + , GTFS.Realtime.TranslatedString + , GTFS.Realtime.TranslatedString.Translation + , GTFS.Realtime.TripDescriptor + , GTFS.Realtime.TripDescriptor.ScheduleRelationship + , GTFS.Realtime.TripUpdate + , GTFS.Realtime.TripUpdate.StopTimeEvent + , GTFS.Realtime.TripUpdate.StopTimeUpdate + , GTFS.Realtime.TripUpdate.StopTimeUpdate.ScheduleRelationship + , GTFS.Realtime.TripUpdate.StopTimeUpdate.StopTimeProperties + , GTFS.Realtime.TripUpdate.TripProperties + , GTFS.Realtime.VehicleDescriptor + , GTFS.Realtime.VehiclePosition + , GTFS.Realtime.VehiclePosition.CarriageDetails + , GTFS.Realtime.VehiclePosition.CongestionLevel + , GTFS.Realtime.VehiclePosition.OccupancyStatus + , GTFS.Realtime.VehiclePosition.VehicleStopStatus + , Servant.GTFS.Realtime -- cgit v1.2.3