From b0ac21655c609dbce610db16672a091cd93f26b7 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 9 Dec 2022 21:23:03 +0100 Subject: VDV 452 example dataset I'm not at all sure if this is correct or complies with the standard — it looks like it conceivably does, but the standard is rather vague in places, and I don't know for sure what some of the terms in it mean. --- vdv-protocol.cabal | 1 + vdv-server/Example452.hs | 107 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 vdv-server/Example452.hs diff --git a/vdv-protocol.cabal b/vdv-protocol.cabal index 7feaa13..8518916 100644 --- a/vdv-protocol.cabal +++ b/vdv-protocol.cabal @@ -46,6 +46,7 @@ library exposed-modules: VDV453.Kommunikationsschicht , VDV451 , VDV452 + , Example452 executable vdv-testclient diff --git a/vdv-server/Example452.hs b/vdv-server/Example452.hs new file mode 100644 index 0000000..319500b --- /dev/null +++ b/vdv-server/Example452.hs @@ -0,0 +1,107 @@ +{-# LANGUAGE OverloadedLists, OverloadedStrings #-} + +-- | + +module Example452 where +import VDV451 (Latitude(..), Longitude(..), ÖPNVOptions(..), ÖPNVTable(..), öpnvSchnittstellenZip) +import VDV452 +import Data.Vector (Vector) +import Data.Time (Day, fromGregorian, getCurrentTime, utctDay) +import Codec.Archive.Zip (Archive) + + +t993 :: Day -> Vector BasisVerGueltigkeit +t993 day = [ BasisVerGueltigkeit day 1 ] + +t485 :: Vector MengeBasisVersionen +t485 = [ MengeBasisVersionen 1 "die eine und einzige version" ] + + + +t998 :: Vector MengeOnrTyp +t998 = [ MengeOnrTyp 1 OnrHaltepunkt "HP" "Haltepunkt" ] + +t997 :: Vector MengeOrtTyp +t997 = [ MengeOrtTyp 1 OrtHaltestelle "Haltestelle" ] + +t253 :: Vector RecOrt +t253 = [ RecOrt 1 OnrHaltepunkt 10 "Passau Hbf" 10 8000298 "de:09262:156" 0 OrtHaltestelle Nothing "PA" "Passau Hbf" Nothing (Just $ Longitude 13.450776) (Just $ Latitude 48.573632) Nothing Nothing + , RecOrt 1 OnrHaltepunkt 11 "Freyung Bf" 11 8002094 "de:09272:4851" 1 OrtHaltestelle Nothing "FR" "Freyung" Nothing (Just $ Longitude 13.548351) (Just $ Latitude 48.802843) Nothing Nothing] + + + + +-- mögliche anzeigetexte eines DFI +t994 :: Vector RecZnr +t994 = [ RecZnr 1 1 "PA" "Passau Hbf" "Passau Hbf" "Passau Hbf" "" + , RecZnr 1 2 "FR" "Freyung" "Freyung" "Freyung" "" + ] + +t290 :: Vector MengeTagesart +t290 = [ MengeTagesart 1 1 "normaler Betriebstag" + , MengeTagesart 1 2 "Sonderfahrt Dezember"] + +t348 :: Vector Firmenkalender +t348 = [ Firmenkalender 1 (fromGregorian 3 12 2022) "Sonderfahrt Dezember" 2 ] + +t222 :: Vector MengeFgr +t222 = [ MengeFgr 1 1 "gibt nur eine" ] + +t332 :: Vector MengeFahrtart +t332 = [ MengeFahrtart 1 Normalfahrt "Normal"] + +t333 :: Vector MengeBereich +t333 = [ MengeBereich 1 1 "bahn" "die ilztalbahn fährt bahn, sonst nix" ] + + +-- let's just say there's 30km between the stations +t299 :: Vector RecSel +t299 = [ RecSel 1 1 OnrHaltepunkt 10 11 OrtHaltestelle 30000 ] + +-- let's just say there's an hour between the two stations +t282 :: Vector SelFztFeld +t282 = [ SelFztFeld 1 1 1 OrtHaltestelle 10 11 OrtHaltestelle 3600 ] + + +-- zwei halte für eine fahrt auf linie 13 +t246 :: Vector LidVerlauf +t246 = [ LidVerlauf 1 1 56446 "" OrtHaltestelle 10 1 Nothing 0 True True False False False False + , LidVerlauf 1 2 56446 "" OrtHaltestelle 11 2 Nothing 0 True True False False False False] + +-- keine ahnung was die routennummer soll, steht jetzt auf 0 +t226 :: Vector RecLid +t226 = [ RecLid 1 56446 "itb" 1 0 0 "itb" "Ilztalbahn" Normalfahrt Nothing "Ilztalbahn" ] + + + + +t715 :: Vector RecFrt +t715 = [ RecFrt 1 1 28800 56446 2 Nothing Normalfahrt 1 "" Nothing 56446 False False "P 56446" 0 ] + + +mkArchive :: IO Archive +mkArchive = do + time <- getCurrentTime + let options = ÖPNVOptions + { öpnvSource = "Datentest" + , öpnvProgramVersion = "0.0.1" + , öpnvDataVersion = "test-1" + } + pure $ öpnvSchnittstellenZip options time + [ ÖPNVTable (t993 (utctDay time)) + , ÖPNVTable t485 + , ÖPNVTable t998 + , ÖPNVTable t997 + , ÖPNVTable t253 + , ÖPNVTable t994 + , ÖPNVTable t290 + , ÖPNVTable t348 + , ÖPNVTable t222 + , ÖPNVTable t332 + , ÖPNVTable t333 + , ÖPNVTable t299 + , ÖPNVTable t282 + , ÖPNVTable t246 + , ÖPNVTable t226 + , ÖPNVTable t715 + ] -- cgit v1.2.3