diff options
Diffstat (limited to '')
-rw-r--r-- | gtfs/GTFS/Realtime/VehiclePosition.hs | 183 | ||||
-rw-r--r-- | gtfs/GTFS/Realtime/VehiclePosition/CarriageDetails.hs | 120 | ||||
-rw-r--r-- | gtfs/GTFS/Realtime/VehiclePosition/CongestionLevel.hs | 85 | ||||
-rw-r--r-- | gtfs/GTFS/Realtime/VehiclePosition/OccupancyStatus.hs | 109 | ||||
-rw-r--r-- | gtfs/GTFS/Realtime/VehiclePosition/VehicleStopStatus.hs | 73 |
5 files changed, 570 insertions, 0 deletions
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 |