and the PB included as well

2b031fb · gmorell · 2022-10-14 19:20

5 files +955 -0

Files changed

added apps/room_gtfs/gtfs-realtime.proto
+640 −0
@@ -0,0 +1,640 @@
1 +// https://developers.google.com/static/transit/gtfs-realtime/gtfs-realtime.proto
2 +
3 +// Copyright 2015 The GTFS Specifications Authors.
4 +//
5 +// Licensed under the Apache License, Version 2.0 (the "License");
6 +// you may not use this file except in compliance with the License.
7 +// You may obtain a copy of the License at
8 +//
9 +// http://www.apache.org/licenses/LICENSE-2.0
10 +//
11 +// Unless required by applicable law or agreed to in writing, software
12 +// distributed under the License is distributed on an "AS IS" BASIS,
13 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 +// See the License for the specific language governing permissions and
15 +// limitations under the License.
16 +
17 +// Protocol definition file for GTFS Realtime.
18 +//
19 +// GTFS Realtime lets transit agencies provide consumers with realtime
20 +// information about disruptions to their service (stations closed, lines not
21 +// operating, important delays etc), location of their vehicles and expected
22 +// arrival times.
23 +//
24 +// This protocol is published at:
25 +// https://github.com/google/transit/tree/master/gtfs-realtime
26 +
27 +syntax = "proto2";
28 +
29 +package transit_realtime;
30 +
31 +option java_package = "com.google.transit.realtime";
32 +
33 +// The contents of a feed message.
34 +// A feed is a continuous stream of feed messages. Each message in the stream is
35 +// obtained as a response to an appropriate HTTP GET request.
36 +// A realtime feed is always defined with relation to an existing GTFS feed.
37 +// All the entity ids are resolved with respect to the GTFS feed.
38 +// Note that "required" and "optional" as stated in this file refer to Protocol
39 +// Buffer cardinality, not semantic cardinality. See reference.md at
40 +// https://github.com/google/transit/tree/master/gtfs-realtime for field
41 +// semantic cardinality.
42 +message FeedMessage {
43 + // Metadata about this feed and feed message.
44 + required FeedHeader header = 1;
45 +
46 + // Contents of the feed.
47 + repeated FeedEntity entity = 2;
48 +
49 + // The extensions namespace allows 3rd-party developers to extend the
50 + // GTFS Realtime specification in order to add and evaluate new features and
51 + // modifications to the spec.
52 + extensions 1000 to 1999;
53 +}
54 +
55 +// Metadata about a feed, included in feed messages.
56 +message FeedHeader {
57 + // Version of the feed specification.
58 + // The current version is 2.0.
59 + required string gtfs_realtime_version = 1;
60 +
61 + // Determines whether the current fetch is incremental. Currently,
62 + // DIFFERENTIAL mode is unsupported and behavior is unspecified for feeds
63 + // that use this mode. There are discussions on the GTFS Realtime mailing
64 + // list around fully specifying the behavior of DIFFERENTIAL mode and the
65 + // documentation will be updated when those discussions are finalized.
66 + enum Incrementality {
67 + FULL_DATASET = 0;
68 + DIFFERENTIAL = 1;
69 + }
70 + optional Incrementality incrementality = 2 [default = FULL_DATASET];
71 +
72 + // This timestamp identifies the moment when the content of this feed has been
73 + // created (in server time). In POSIX time (i.e., number of seconds since
74 + // January 1st 1970 00:00:00 UTC).
75 + optional uint64 timestamp = 3;
76 +
77 + // The extensions namespace allows 3rd-party developers to extend the
78 + // GTFS Realtime specification in order to add and evaluate new features and
79 + // modifications to the spec.
80 + extensions 1000 to 1999;
81 +}
82 +
83 +// A definition (or update) of an entity in the transit feed.
84 +message FeedEntity {
85 + // The ids are used only to provide incrementality support. The id should be
86 + // unique within a FeedMessage. Consequent FeedMessages may contain
87 + // FeedEntities with the same id. In case of a DIFFERENTIAL update the new
88 + // FeedEntity with some id will replace the old FeedEntity with the same id
89 + // (or delete it - see is_deleted below).
90 + // The actual GTFS entities (e.g. stations, routes, trips) referenced by the
91 + // feed must be specified by explicit selectors (see EntitySelector below for
92 + // more info).
93 + required string id = 1;
94 +
95 + // Whether this entity is to be deleted. Relevant only for incremental
96 + // fetches.
97 + optional bool is_deleted = 2 [default = false];
98 +
99 + // Data about the entity itself. Exactly one of the following fields must be
100 + // present (unless the entity is being deleted).
101 + optional TripUpdate trip_update = 3;
102 + optional VehiclePosition vehicle = 4;
103 + optional Alert alert = 5;
104 +
105 + // The extensions namespace allows 3rd-party developers to extend the
106 + // GTFS Realtime Specification in order to add and evaluate new features and
107 + // modifications to the spec.
108 + extensions 1000 to 1999;
109 +}
110 +
111 +//
112 +// Entities used in the feed.
113 +//
114 +
115 +// Realtime update of the progress of a vehicle along a trip.
116 +// Depending on the value of ScheduleRelationship, a TripUpdate can specify:
117 +// - A trip that proceeds along the schedule.
118 +// - A trip that proceeds along a route but has no fixed schedule.
119 +// - A trip that have been added or removed with regard to schedule.
120 +//
121 +// The updates can be for future, predicted arrival/departure events, or for
122 +// past events that already occurred.
123 +// Normally, updates should get more precise and more certain (see
124 +// uncertainty below) as the events gets closer to current time.
125 +// Even if that is not possible, the information for past events should be
126 +// precise and certain. In particular, if an update points to time in the past
127 +// but its update's uncertainty is not 0, the client should conclude that the
128 +// update is a (wrong) prediction and that the trip has not completed yet.
129 +//
130 +// Note that the update can describe a trip that is already completed.
131 +// To this end, it is enough to provide an update for the last stop of the trip.
132 +// If the time of that is in the past, the client will conclude from that that
133 +// the whole trip is in the past (it is possible, although inconsequential, to
134 +// also provide updates for preceding stops).
135 +// This option is most relevant for a trip that has completed ahead of schedule,
136 +// but according to the schedule, the trip is still proceeding at the current
137 +// time. Removing the updates for this trip could make the client assume
138 +// that the trip is still proceeding.
139 +// Note that the feed provider is allowed, but not required, to purge past
140 +// updates - this is one case where this would be practically useful.
141 +message TripUpdate {
142 + // The Trip that this message applies to. There can be at most one
143 + // TripUpdate entity for each actual trip instance.
144 + // If there is none, that means there is no prediction information available.
145 + // It does *not* mean that the trip is progressing according to schedule.
146 + required TripDescriptor trip = 1;
147 +
148 + // Additional information on the vehicle that is serving this trip.
149 + optional VehicleDescriptor vehicle = 3;
150 +
151 + // Timing information for a single predicted event (either arrival or
152 + // departure).
153 + // Timing consists of delay and/or estimated time, and uncertainty.
154 + // - delay should be used when the prediction is given relative to some
155 + // existing schedule in GTFS.
156 + // - time should be given whether there is a predicted schedule or not. If
157 + // both time and delay are specified, time will take precedence
158 + // (although normally, time, if given for a scheduled trip, should be
159 + // equal to scheduled time in GTFS + delay).
160 + //
161 + // Uncertainty applies equally to both time and delay.
162 + // The uncertainty roughly specifies the expected error in true delay (but
163 + // note, we don't yet define its precise statistical meaning). It's possible
164 + // for the uncertainty to be 0, for example for trains that are driven under
165 + // computer timing control.
166 + message StopTimeEvent {
167 + // Delay (in seconds) can be positive (meaning that the vehicle is late) or
168 + // negative (meaning that the vehicle is ahead of schedule). Delay of 0
169 + // means that the vehicle is exactly on time.
170 + optional int32 delay = 1;
171 +
172 + // Event as absolute time.
173 + // In Unix time (i.e., number of seconds since January 1st 1970 00:00:00
174 + // UTC).
175 + optional int64 time = 2;
176 +
177 + // If uncertainty is omitted, it is interpreted as unknown.
178 + // If the prediction is unknown or too uncertain, the delay (or time) field
179 + // should be empty. In such case, the uncertainty field is ignored.
180 + // To specify a completely certain prediction, set its uncertainty to 0.
181 + optional int32 uncertainty = 3;
182 +
183 + // The extensions namespace allows 3rd-party developers to extend the
184 + // GTFS Realtime Specification in order to add and evaluate new features
185 + // and modifications to the spec.
186 + extensions 1000 to 1999;
187 + }
188 +
189 + // Realtime update for arrival and/or departure events for a given stop on a
190 + // trip. Updates can be supplied for both past and future events.
191 + // The producer is allowed, although not required, to drop past events.
192 + message StopTimeUpdate {
193 + // The update is linked to a specific stop either through stop_sequence or
194 + // stop_id, so one of the fields below must necessarily be set.
195 + // See the documentation in TripDescriptor for more information.
196 +
197 + // Must be the same as in stop_times.txt in the corresponding GTFS feed.
198 + optional uint32 stop_sequence = 1;
199 + // Must be the same as in stops.txt in the corresponding GTFS feed.
200 + optional string stop_id = 4;
201 +
202 + optional StopTimeEvent arrival = 2;
203 + optional StopTimeEvent departure = 3;
204 +
205 + // The relation between this StopTime and the static schedule.
206 + enum ScheduleRelationship {
207 + // The vehicle is proceeding in accordance with its static schedule of
208 + // stops, although not necessarily according to the times of the schedule.
209 + // At least one of arrival and departure must be provided. If the schedule
210 + // for this stop contains both arrival and departure times then so must
211 + // this update.
212 + SCHEDULED = 0;
213 +
214 + // The stop is skipped, i.e., the vehicle will not stop at this stop.
215 + // Arrival and departure are optional.
216 + SKIPPED = 1;
217 +
218 + // No data is given for this stop. The main intention for this value is to
219 + // give the predictions only for part of a trip, i.e., if the last update
220 + // for a trip has a NO_DATA specifier, then StopTimes for the rest of the
221 + // stops in the trip are considered to be unspecified as well.
222 + // Neither arrival nor departure should be supplied.
223 + NO_DATA = 2;
224 + }
225 + optional ScheduleRelationship schedule_relationship = 5
226 + [default = SCHEDULED];
227 +
228 + // The extensions namespace allows 3rd-party developers to extend the
229 + // GTFS Realtime Specification in order to add and evaluate new features
230 + // and modifications to the spec.
231 + extensions 1000 to 1999;
232 + }
233 +
234 + // Updates to StopTimes for the trip (both future, i.e., predictions, and in
235 + // some cases, past ones, i.e., those that already happened).
236 + // The updates must be sorted by stop_sequence, and apply for all the
237 + // following stops of the trip up to the next specified one.
238 + //
239 + // Example 1:
240 + // For a trip with 20 stops, a StopTimeUpdate with arrival delay and departure
241 + // delay of 0 for stop_sequence of the current stop means that the trip is
242 + // exactly on time.
243 + //
244 + // Example 2:
245 + // For the same trip instance, 3 StopTimeUpdates are provided:
246 + // - delay of 5 min for stop_sequence 3
247 + // - delay of 1 min for stop_sequence 8
248 + // - delay of unspecified duration for stop_sequence 10
249 + // This will be interpreted as:
250 + // - stop_sequences 3,4,5,6,7 have delay of 5 min.
251 + // - stop_sequences 8,9 have delay of 1 min.
252 + // - stop_sequences 10,... have unknown delay.
253 + repeated StopTimeUpdate stop_time_update = 2;
254 +
255 + // Moment at which the vehicle's real-time progress was measured. In POSIX
256 + // time (i.e., the number of seconds since January 1st 1970 00:00:00 UTC).
257 + optional uint64 timestamp = 4;
258 +
259 + // The current schedule deviation for the trip. Delay should only be
260 + // specified when the prediction is given relative to some existing schedule
261 + // in GTFS.
262 + //
263 + // Delay (in seconds) can be positive (meaning that the vehicle is late) or
264 + // negative (meaning that the vehicle is ahead of schedule). Delay of 0
265 + // means that the vehicle is exactly on time.
266 + //
267 + // Delay information in StopTimeUpdates take precedent of trip-level delay
268 + // information, such that trip-level delay is only propagated until the next
269 + // stop along the trip with a StopTimeUpdate delay value specified.
270 + //
271 + // Feed providers are strongly encouraged to provide a TripUpdate.timestamp
272 + // value indicating when the delay value was last updated, in order to
273 + // evaluate the freshness of the data.
274 + //
275 + // NOTE: This field is still experimental, and subject to change. It may be
276 + // formally adopted in the future.
277 + optional int32 delay = 5;
278 +
279 + // The extensions namespace allows 3rd-party developers to extend the
280 + // GTFS Realtime Specification in order to add and evaluate new features and
281 + // modifications to the spec.
282 + extensions 1000 to 1999;
283 +}
284 +
285 +// Realtime positioning information for a given vehicle.
286 +message VehiclePosition {
287 + // The Trip that this vehicle is serving.
288 + // Can be empty or partial if the vehicle can not be identified with a given
289 + // trip instance.
290 + optional TripDescriptor trip = 1;
291 +
292 + // Additional information on the vehicle that is serving this trip.
293 + optional VehicleDescriptor vehicle = 8;
294 +
295 + // Current position of this vehicle.
296 + optional Position position = 2;
297 +
298 + // The stop sequence index of the current stop. The meaning of
299 + // current_stop_sequence (i.e., the stop that it refers to) is determined by
300 + // current_status.
301 + // If current_status is missing IN_TRANSIT_TO is assumed.
302 + optional uint32 current_stop_sequence = 3;
303 + // Identifies the current stop. The value must be the same as in stops.txt in
304 + // the corresponding GTFS feed.
305 + optional string stop_id = 7;
306 +
307 + enum VehicleStopStatus {
308 + // The vehicle is just about to arrive at the stop (on a stop
309 + // display, the vehicle symbol typically flashes).
310 + INCOMING_AT = 0;
311 +
312 + // The vehicle is standing at the stop.
313 + STOPPED_AT = 1;
314 +
315 + // The vehicle has departed and is in transit to the next stop.
316 + IN_TRANSIT_TO = 2;
317 + }
318 + // The exact status of the vehicle with respect to the current stop.
319 + // Ignored if current_stop_sequence is missing.
320 + optional VehicleStopStatus current_status = 4 [default = IN_TRANSIT_TO];
321 +
322 + // Moment at which the vehicle's position was measured. In POSIX time
323 + // (i.e., number of seconds since January 1st 1970 00:00:00 UTC).
324 + optional uint64 timestamp = 5;
325 +
326 + // Congestion level that is affecting this vehicle.
327 + enum CongestionLevel {
328 + UNKNOWN_CONGESTION_LEVEL = 0;
329 + RUNNING_SMOOTHLY = 1;
330 + STOP_AND_GO = 2;
331 + CONGESTION = 3;
332 + SEVERE_CONGESTION = 4; // People leaving their cars.
333 + }
334 + optional CongestionLevel congestion_level = 6;
335 +
336 + // The degree of passenger occupancy of the vehicle. This field is still
337 + // experimental, and subject to change. It may be formally adopted in the
338 + // future.
339 + enum OccupancyStatus {
340 + // The vehicle is considered empty by most measures, and has few or no
341 + // passengers onboard, but is still accepting passengers.
342 + EMPTY = 0;
343 +
344 + // The vehicle has a relatively large percentage of seats available.
345 + // What percentage of free seats out of the total seats available is to be
346 + // considered large enough to fall into this category is determined at the
347 + // discretion of the producer.
348 + MANY_SEATS_AVAILABLE = 1;
349 +
350 + // The vehicle has a relatively small percentage of seats available.
351 + // What percentage of free seats out of the total seats available is to be
352 + // considered small enough to fall into this category is determined at the
353 + // discretion of the feed producer.
354 + FEW_SEATS_AVAILABLE = 2;
355 +
356 + // The vehicle can currently accommodate only standing passengers.
357 + STANDING_ROOM_ONLY = 3;
358 +
359 + // The vehicle can currently accommodate only standing passengers
360 + // and has limited space for them.
361 + CRUSHED_STANDING_ROOM_ONLY = 4;
362 +
363 + // The vehicle is considered full by most measures, but may still be
364 + // allowing passengers to board.
365 + FULL = 5;
366 +
367 + // The vehicle is not accepting additional passengers.
368 + NOT_ACCEPTING_PASSENGERS = 6;
369 + }
370 + optional OccupancyStatus occupancy_status = 9;
371 +
372 + // The extensions namespace allows 3rd-party developers to extend the
373 + // GTFS Realtime Specification in order to add and evaluate new features and
374 + // modifications to the spec.
375 + extensions 1000 to 1999;
376 +}
377 +
378 +// An alert, indicating some sort of incident in the public transit network.
379 +message Alert {
380 + // Time when the alert should be shown to the user. If missing, the
381 + // alert will be shown as long as it appears in the feed.
382 + // If multiple ranges are given, the alert will be shown during all of them.
383 + repeated TimeRange active_period = 1;
384 +
385 + // Entities whose users we should notify of this alert.
386 + repeated EntitySelector informed_entity = 5;
387 +
388 + // Cause of this alert.
389 + enum Cause {
390 + UNKNOWN_CAUSE = 1;
391 + OTHER_CAUSE = 2; // Not machine-representable.
392 + TECHNICAL_PROBLEM = 3;
393 + STRIKE = 4; // Public transit agency employees stopped working.
394 + DEMONSTRATION = 5; // People are blocking the streets.
395 + ACCIDENT = 6;
396 + HOLIDAY = 7;
397 + WEATHER = 8;
398 + MAINTENANCE = 9;
399 + CONSTRUCTION = 10;
400 + POLICE_ACTIVITY = 11;
401 + MEDICAL_EMERGENCY = 12;
402 + }
403 + optional Cause cause = 6 [default = UNKNOWN_CAUSE];
404 +
405 + // What is the effect of this problem on the affected entity.
406 + enum Effect {
407 + NO_SERVICE = 1;
408 + REDUCED_SERVICE = 2;
409 +
410 + // We don't care about INsignificant delays: they are hard to detect, have
411 + // little impact on the user, and would clutter the results as they are too
412 + // frequent.
413 + SIGNIFICANT_DELAYS = 3;
414 +
415 + DETOUR = 4;
416 + ADDITIONAL_SERVICE = 5;
417 + MODIFIED_SERVICE = 6;
418 + OTHER_EFFECT = 7;
419 + UNKNOWN_EFFECT = 8;
420 + STOP_MOVED = 9;
421 + }
422 + optional Effect effect = 7 [default = UNKNOWN_EFFECT];
423 +
424 + // The URL which provides additional information about the alert.
425 + optional TranslatedString url = 8;
426 +
427 + // Alert header. Contains a short summary of the alert text as plain-text.
428 + optional TranslatedString header_text = 10;
429 +
430 + // Full description for the alert as plain-text. The information in the
431 + // description should add to the information of the header.
432 + optional TranslatedString description_text = 11;
433 +
434 + // The extensions namespace allows 3rd-party developers to extend the
435 + // GTFS Realtime Specification in order to add and evaluate new features
436 + // and modifications to the spec.
437 + extensions 1000 to 1999;
438 +}
439 +
440 +//
441 +// Low level data structures used above.
442 +//
443 +
444 +// A time interval. The interval is considered active at time 't' if 't' is
445 +// greater than or equal to the start time and less than the end time.
446 +message TimeRange {
447 + // Start time, in POSIX time (i.e., number of seconds since January 1st 1970
448 + // 00:00:00 UTC).
449 + // If missing, the interval starts at minus infinity.
450 + optional uint64 start = 1;
451 +
452 + // End time, in POSIX time (i.e., number of seconds since January 1st 1970
453 + // 00:00:00 UTC).
454 + // If missing, the interval ends at plus infinity.
455 + optional uint64 end = 2;
456 +
457 + // The extensions namespace allows 3rd-party developers to extend the
458 + // GTFS Realtime Specification in order to add and evaluate new features and
459 + // modifications to the spec.
460 + extensions 1000 to 1999;
461 +}
462 +
463 +// A position.
464 +message Position {
465 + // Degrees North, in the WGS-84 coordinate system.
466 + required float latitude = 1;
467 +
468 + // Degrees East, in the WGS-84 coordinate system.
469 + required float longitude = 2;
470 +
471 + // Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East.
472 + // This can be the compass bearing, or the direction towards the next stop
473 + // or intermediate location.
474 + // This should not be direction deduced from the sequence of previous
475 + // positions, which can be computed from previous data.
476 + optional float bearing = 3;
477 +
478 + // Odometer value, in meters.
479 + optional double odometer = 4;
480 + // Momentary speed measured by the vehicle, in meters per second.
481 + optional float speed = 5;
482 +
483 + // The extensions namespace allows 3rd-party developers to extend the
484 + // GTFS Realtime Specification in order to add and evaluate new features and
485 + // modifications to the spec.
486 + extensions 1000 to 1999;
487 +}
488 +
489 +// A descriptor that identifies an instance of a GTFS trip, or all instances of
490 +// a trip along a route.
491 +// - To specify a single trip instance, the trip_id (and if necessary,
492 +// start_time) is set. If route_id is also set, then it should be same as one
493 +// that the given trip corresponds to.
494 +// - To specify all the trips along a given route, only the route_id should be
495 +// set. Note that if the trip_id is not known, then stop sequence ids in
496 +// TripUpdate are not sufficient, and stop_ids must be provided as well. In
497 +// addition, absolute arrival/departure times must be provided.
498 +message TripDescriptor {
499 + // The trip_id from the GTFS feed that this selector refers to.
500 + // For non frequency-based trips, this field is enough to uniquely identify
501 + // the trip. For frequency-based trip, start_time and start_date might also be
502 + // necessary.
503 + optional string trip_id = 1;
504 +
505 + // The route_id from the GTFS that this selector refers to.
506 + optional string route_id = 5;
507 +
508 + // The direction_id from the GTFS feed trips.txt file, indicating the
509 + // direction of travel for trips this selector refers to. This field is
510 + // still experimental, and subject to change. It may be formally adopted in
511 + // the future.
512 + optional uint32 direction_id = 6;
513 +
514 + // The initially scheduled start time of this trip instance.
515 + // When the trip_id corresponds to a non-frequency-based trip, this field
516 + // should either be omitted or be equal to the value in the GTFS feed. When
517 + // the trip_id corresponds to a frequency-based trip, the start_time must be
518 + // specified for trip updates and vehicle positions. If the trip corresponds
519 + // to exact_times=1 GTFS record, then start_time must be some multiple
520 + // (including zero) of headway_secs later than frequencies.txt start_time for
521 + // the corresponding time period. If the trip corresponds to exact_times=0,
522 + // then its start_time may be arbitrary, and is initially expected to be the
523 + // first departure of the trip. Once established, the start_time of this
524 + // frequency-based trip should be considered immutable, even if the first
525 + // departure time changes -- that time change may instead be reflected in a
526 + // StopTimeUpdate.
527 + // Format and semantics of the field is same as that of
528 + // GTFS/frequencies.txt/start_time, e.g., 11:15:35 or 25:15:35.
529 + optional string start_time = 2;
530 + // The scheduled start date of this trip instance.
531 + // Must be provided to disambiguate trips that are so late as to collide with
532 + // a scheduled trip on a next day. For example, for a train that departs 8:00
533 + // and 20:00 every day, and is 12 hours late, there would be two distinct
534 + // trips on the same time.
535 + // This field can be provided but is not mandatory for schedules in which such
536 + // collisions are impossible - for example, a service running on hourly
537 + // schedule where a vehicle that is one hour late is not considered to be
538 + // related to schedule anymore.
539 + // In YYYYMMDD format.
540 + optional string start_date = 3;
541 +
542 + // The relation between this trip and the static schedule. If a trip is done
543 + // in accordance with temporary schedule, not reflected in GTFS, then it
544 + // shouldn't be marked as SCHEDULED, but likely as ADDED.
545 + enum ScheduleRelationship {
546 + // Trip that is running in accordance with its GTFS schedule, or is close
547 + // enough to the scheduled trip to be associated with it.
548 + SCHEDULED = 0;
549 +
550 + // An extra trip that was added in addition to a running schedule, for
551 + // example, to replace a broken vehicle or to respond to sudden passenger
552 + // load.
553 + ADDED = 1;
554 +
555 + // A trip that is running with no schedule associated to it, for example, if
556 + // there is no schedule at all.
557 + UNSCHEDULED = 2;
558 +
559 + // A trip that existed in the schedule but was removed.
560 + CANCELED = 3;
561 + }
562 + optional ScheduleRelationship schedule_relationship = 4;
563 +
564 + // The extensions namespace allows 3rd-party developers to extend the
565 + // GTFS Realtime Specification in order to add and evaluate new features and
566 + // modifications to the spec.
567 + extensions 1000 to 1999;
568 +}
569 +
570 +// Identification information for the vehicle performing the trip.
571 +message VehicleDescriptor {
572 + // Internal system identification of the vehicle. Should be unique per
573 + // vehicle, and can be used for tracking the vehicle as it proceeds through
574 + // the system.
575 + optional string id = 1;
576 +
577 + // User visible label, i.e., something that must be shown to the passenger to
578 + // help identify the correct vehicle.
579 + optional string label = 2;
580 +
581 + // The license plate of the vehicle.
582 + optional string license_plate = 3;
583 +
584 + // The extensions namespace allows 3rd-party developers to extend the
585 + // GTFS Realtime Specification in order to add and evaluate new features and
586 + // modifications to the spec.
587 + extensions 1000 to 1999;
588 +}
589 +
590 +// A selector for an entity in a GTFS feed.
591 +message EntitySelector {
592 + // The values of the fields should correspond to the appropriate fields in the
593 + // GTFS feed.
594 + // At least one specifier must be given. If several are given, then the
595 + // matching has to apply to all the given specifiers.
596 + optional string agency_id = 1;
597 + optional string route_id = 2;
598 + // corresponds to route_type in GTFS.
599 + optional int32 route_type = 3;
600 + optional TripDescriptor trip = 4;
601 + optional string stop_id = 5;
602 +
603 + // The extensions namespace allows 3rd-party developers to extend the
604 + // GTFS Realtime Specification in order to add and evaluate new features and
605 + // modifications to the spec.
606 + extensions 1000 to 1999;
607 +}
608 +
609 +// An internationalized message containing per-language versions of a snippet of
610 +// text or a URL.
611 +// One of the strings from a message will be picked up. The resolution proceeds
612 +// as follows:
613 +// 1. If the UI language matches the language code of a translation,
614 +// the first matching translation is picked.
615 +// 2. If a default UI language (e.g., English) matches the language code of a
616 +// translation, the first matching translation is picked.
617 +// 3. If some translation has an unspecified language code, that translation is
618 +// picked.
619 +message TranslatedString {
620 + message Translation {
621 + // A UTF-8 string containing the message.
622 + required string text = 1;
623 + // BCP-47 language code. Can be omitted if the language is unknown or if
624 + // no i18n is done at all for the feed. At most one translation is
625 + // allowed to have an unspecified language tag.
626 + optional string language = 2;
627 +
628 + // The extensions namespace allows 3rd-party developers to extend the
629 + // GTFS Realtime Specification in order to add and evaluate new features and
630 + // modifications to the spec.
631 + extensions 1000 to 1999;
632 + }
633 + // At least one translation must be provided.
634 + repeated Translation translation = 1;
635 +
636 + // The extensions namespace allows 3rd-party developers to extend the
637 + // GTFS Realtime Specification in order to add and evaluate new features and
638 + // modifications to the spec.
639 + extensions 1000 to 1999;
640 +}
added apps/room_gtfs/lib/gtfs-realtime.pb.ex
+315 −0
@@ -0,0 +1,315 @@
1 +defmodule TransitRealtime.FeedHeader.Incrementality do
2 + @moduledoc false
3 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
4 +
5 + field :FULL_DATASET, 0
6 + field :DIFFERENTIAL, 1
7 +end
8 +
9 +defmodule TransitRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship do
10 + @moduledoc false
11 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
12 +
13 + field :SCHEDULED, 0
14 + field :SKIPPED, 1
15 + field :NO_DATA, 2
16 +end
17 +
18 +defmodule TransitRealtime.VehiclePosition.VehicleStopStatus do
19 + @moduledoc false
20 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
21 +
22 + field :INCOMING_AT, 0
23 + field :STOPPED_AT, 1
24 + field :IN_TRANSIT_TO, 2
25 +end
26 +
27 +defmodule TransitRealtime.VehiclePosition.CongestionLevel do
28 + @moduledoc false
29 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
30 +
31 + field :UNKNOWN_CONGESTION_LEVEL, 0
32 + field :RUNNING_SMOOTHLY, 1
33 + field :STOP_AND_GO, 2
34 + field :CONGESTION, 3
35 + field :SEVERE_CONGESTION, 4
36 +end
37 +
38 +defmodule TransitRealtime.VehiclePosition.OccupancyStatus do
39 + @moduledoc false
40 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
41 +
42 + field :EMPTY, 0
43 + field :MANY_SEATS_AVAILABLE, 1
44 + field :FEW_SEATS_AVAILABLE, 2
45 + field :STANDING_ROOM_ONLY, 3
46 + field :CRUSHED_STANDING_ROOM_ONLY, 4
47 + field :FULL, 5
48 + field :NOT_ACCEPTING_PASSENGERS, 6
49 +end
50 +
51 +defmodule TransitRealtime.Alert.Cause do
52 + @moduledoc false
53 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
54 +
55 + field :UNKNOWN_CAUSE, 1
56 + field :OTHER_CAUSE, 2
57 + field :TECHNICAL_PROBLEM, 3
58 + field :STRIKE, 4
59 + field :DEMONSTRATION, 5
60 + field :ACCIDENT, 6
61 + field :HOLIDAY, 7
62 + field :WEATHER, 8
63 + field :MAINTENANCE, 9
64 + field :CONSTRUCTION, 10
65 + field :POLICE_ACTIVITY, 11
66 + field :MEDICAL_EMERGENCY, 12
67 +end
68 +
69 +defmodule TransitRealtime.Alert.Effect do
70 + @moduledoc false
71 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
72 +
73 + field :NO_SERVICE, 1
74 + field :REDUCED_SERVICE, 2
75 + field :SIGNIFICANT_DELAYS, 3
76 + field :DETOUR, 4
77 + field :ADDITIONAL_SERVICE, 5
78 + field :MODIFIED_SERVICE, 6
79 + field :OTHER_EFFECT, 7
80 + field :UNKNOWN_EFFECT, 8
81 + field :STOP_MOVED, 9
82 +end
83 +
84 +defmodule TransitRealtime.TripDescriptor.ScheduleRelationship do
85 + @moduledoc false
86 + use Protobuf, enum: true, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
87 +
88 + field :SCHEDULED, 0
89 + field :ADDED, 1
90 + field :UNSCHEDULED, 2
91 + field :CANCELED, 3
92 +end
93 +
94 +defmodule TransitRealtime.FeedMessage do
95 + @moduledoc false
96 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
97 +
98 + field :header, 1, required: true, type: TransitRealtime.FeedHeader
99 + field :entity, 2, repeated: true, type: TransitRealtime.FeedEntity
100 +
101 + extensions [{1000, 2000}]
102 +end
103 +
104 +defmodule TransitRealtime.FeedHeader do
105 + @moduledoc false
106 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
107 +
108 + field :gtfs_realtime_version, 1, required: true, type: :string
109 +
110 + field :incrementality, 2,
111 + optional: true,
112 + type: TransitRealtime.FeedHeader.Incrementality,
113 + default: :FULL_DATASET,
114 + enum: true
115 +
116 + field :timestamp, 3, optional: true, type: :uint64
117 +
118 + extensions [{1000, 2000}]
119 +end
120 +
121 +defmodule TransitRealtime.FeedEntity do
122 + @moduledoc false
123 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
124 +
125 + field :id, 1, required: true, type: :string
126 + field :is_deleted, 2, optional: true, type: :bool, default: false
127 + field :trip_update, 3, optional: true, type: TransitRealtime.TripUpdate
128 + field :vehicle, 4, optional: true, type: TransitRealtime.VehiclePosition
129 + field :alert, 5, optional: true, type: TransitRealtime.Alert
130 +
131 + extensions [{1000, 2000}]
132 +end
133 +
134 +defmodule TransitRealtime.TripUpdate.StopTimeEvent do
135 + @moduledoc false
136 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
137 +
138 + field :delay, 1, optional: true, type: :int32
139 + field :time, 2, optional: true, type: :int64
140 + field :uncertainty, 3, optional: true, type: :int32
141 +
142 + extensions [{1000, 2000}]
143 +end
144 +
145 +defmodule TransitRealtime.TripUpdate.StopTimeUpdate do
146 + @moduledoc false
147 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
148 +
149 + field :stop_sequence, 1, optional: true, type: :uint32
150 + field :stop_id, 4, optional: true, type: :string
151 + field :arrival, 2, optional: true, type: TransitRealtime.TripUpdate.StopTimeEvent
152 + field :departure, 3, optional: true, type: TransitRealtime.TripUpdate.StopTimeEvent
153 +
154 + field :schedule_relationship, 5,
155 + optional: true,
156 + type: TransitRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship,
157 + default: :SCHEDULED,
158 + enum: true
159 +
160 + extensions [{1000, 2000}]
161 +end
162 +
163 +defmodule TransitRealtime.TripUpdate do
164 + @moduledoc false
165 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
166 +
167 + field :trip, 1, required: true, type: TransitRealtime.TripDescriptor
168 + field :vehicle, 3, optional: true, type: TransitRealtime.VehicleDescriptor
169 + field :stop_time_update, 2, repeated: true, type: TransitRealtime.TripUpdate.StopTimeUpdate
170 + field :timestamp, 4, optional: true, type: :uint64
171 + field :delay, 5, optional: true, type: :int32
172 +
173 + extensions [{1000, 2000}]
174 +end
175 +
176 +defmodule TransitRealtime.VehiclePosition do
177 + @moduledoc false
178 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
179 +
180 + field :trip, 1, optional: true, type: TransitRealtime.TripDescriptor
181 + field :vehicle, 8, optional: true, type: TransitRealtime.VehicleDescriptor
182 + field :position, 2, optional: true, type: TransitRealtime.Position
183 + field :current_stop_sequence, 3, optional: true, type: :uint32
184 + field :stop_id, 7, optional: true, type: :string
185 +
186 + field :current_status, 4,
187 + optional: true,
188 + type: TransitRealtime.VehiclePosition.VehicleStopStatus,
189 + default: :IN_TRANSIT_TO,
190 + enum: true
191 +
192 + field :timestamp, 5, optional: true, type: :uint64
193 +
194 + field :congestion_level, 6,
195 + optional: true,
196 + type: TransitRealtime.VehiclePosition.CongestionLevel,
197 + enum: true
198 +
199 + field :occupancy_status, 9,
200 + optional: true,
201 + type: TransitRealtime.VehiclePosition.OccupancyStatus,
202 + enum: true
203 +
204 + extensions [{1000, 2000}]
205 +end
206 +
207 +defmodule TransitRealtime.Alert do
208 + @moduledoc false
209 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
210 +
211 + field :active_period, 1, repeated: true, type: TransitRealtime.TimeRange
212 + field :informed_entity, 5, repeated: true, type: TransitRealtime.EntitySelector
213 +
214 + field :cause, 6,
215 + optional: true,
216 + type: TransitRealtime.Alert.Cause,
217 + default: :UNKNOWN_CAUSE,
218 + enum: true
219 +
220 + field :effect, 7,
221 + optional: true,
222 + type: TransitRealtime.Alert.Effect,
223 + default: :UNKNOWN_EFFECT,
224 + enum: true
225 +
226 + field :url, 8, optional: true, type: TransitRealtime.TranslatedString
227 + field :header_text, 10, optional: true, type: TransitRealtime.TranslatedString
228 + field :description_text, 11, optional: true, type: TransitRealtime.TranslatedString
229 +
230 + extensions [{1000, 2000}]
231 +end
232 +
233 +defmodule TransitRealtime.TimeRange do
234 + @moduledoc false
235 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
236 +
237 + field :start, 1, optional: true, type: :uint64
238 + field :end, 2, optional: true, type: :uint64
239 +
240 + extensions [{1000, 2000}]
241 +end
242 +
243 +defmodule TransitRealtime.Position do
244 + @moduledoc false
245 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
246 +
247 + field :latitude, 1, required: true, type: :float
248 + field :longitude, 2, required: true, type: :float
249 + field :bearing, 3, optional: true, type: :float
250 + field :odometer, 4, optional: true, type: :double
251 + field :speed, 5, optional: true, type: :float
252 +
253 + extensions [{1000, 2000}]
254 +end
255 +
256 +defmodule TransitRealtime.TripDescriptor do
257 + @moduledoc false
258 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
259 +
260 + field :trip_id, 1, optional: true, type: :string
261 + field :route_id, 5, optional: true, type: :string
262 + field :direction_id, 6, optional: true, type: :uint32
263 + field :start_time, 2, optional: true, type: :string
264 + field :start_date, 3, optional: true, type: :string
265 +
266 + field :schedule_relationship, 4,
267 + optional: true,
268 + type: TransitRealtime.TripDescriptor.ScheduleRelationship,
269 + enum: true
270 +
271 + extensions [{1000, 2000}]
272 +end
273 +
274 +defmodule TransitRealtime.VehicleDescriptor do
275 + @moduledoc false
276 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
277 +
278 + field :id, 1, optional: true, type: :string
279 + field :label, 2, optional: true, type: :string
280 + field :license_plate, 3, optional: true, type: :string
281 +
282 + extensions [{1000, 2000}]
283 +end
284 +
285 +defmodule TransitRealtime.EntitySelector do
286 + @moduledoc false
287 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
288 +
289 + field :agency_id, 1, optional: true, type: :string
290 + field :route_id, 2, optional: true, type: :string
291 + field :route_type, 3, optional: true, type: :int32
292 + field :trip, 4, optional: true, type: TransitRealtime.TripDescriptor
293 + field :stop_id, 5, optional: true, type: :string
294 +
295 + extensions [{1000, 2000}]
296 +end
297 +
298 +defmodule TransitRealtime.TranslatedString.Translation do
299 + @moduledoc false
300 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
301 +
302 + field :text, 1, required: true, type: :string
303 + field :language, 2, optional: true, type: :string
304 +
305 + extensions [{1000, 2000}]
306 +end
307 +
308 +defmodule TransitRealtime.TranslatedString do
309 + @moduledoc false
310 + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto2
311 +
312 + field :translation, 1, repeated: true, type: TransitRealtime.TranslatedString.Translation
313 +
314 + extensions [{1000, 2000}]
315 +end

Parents: 92d2873