diff options
author | stuebinm | 2022-07-02 00:16:02 +0200 |
---|---|---|
committer | stuebinm | 2022-07-02 00:35:34 +0200 |
commit | 6c25964c0165530e7db6650eea79cbac99031353 (patch) | |
tree | 2b821e5e07320c211a8af0e70974cbbe6defef9e /gtfs | |
parent | 6b4e8ba88f35538d62bb78b9872bc298178cf96d (diff) |
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)
Diffstat (limited to 'gtfs')
32 files changed, 3333 insertions, 0 deletions
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) |