KItinerary

vdvticketcontent.h
1/*
2 SPDX-FileCopyrightText: 2019-2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "kitinerary_export.h"
10#include "vdvbasictypes.h"
11
12#include <qobjectdefs.h>
13
14namespace KItinerary {
15
16#define VDV_NUM_PROPERTY(Name, Size) \
17public: \
18 VdvNumber<Size> Name; \
19 Q_PROPERTY(uint Name MEMBER Name)
20#define VDV_DATETIME_PROPERTY(Name) \
21public: \
22 VdvDateTimeCompact Name; \
23 Q_PROPERTY(QDateTime Name MEMBER Name)
24#define VDV_DATE_PROPERTY(Name) \
25public: \
26 VdvBcdDate Name; \
27 Q_PROPERTY(QDate Name MEMBER Name)
28
29#pragma pack(push)
30#pragma pack(1)
31
32/** Ticket data header. */
33class KITINERARY_EXPORT VdvTicketHeader
34{
35 Q_GADGET
36 VDV_NUM_PROPERTY(ticketId, 4)
37 VDV_NUM_PROPERTY(kvpOrgId, 2)
38 VDV_NUM_PROPERTY(productId, 2)
39 VDV_NUM_PROPERTY(pvOrgId, 2)
40 VDV_DATETIME_PROPERTY(validityBegin)
41 VDV_DATETIME_PROPERTY(validityEnd)
42};
43
44/** Product specific data - basic information. */
45class KITINERARY_EXPORT VdvTicketBasicData
46{
47 Q_GADGET
48 VDV_NUM_PROPERTY(paymentType, 1)
49 VDV_NUM_PROPERTY(travelerType, 1) // 1 adult, 2 child, 65 bike
50 VDV_NUM_PROPERTY(includedTravelerType1, 1) // 0 none, 1 adult, 2 child, 251 family child
51 VDV_NUM_PROPERTY(includedTravelerCount1, 1)
52 VDV_NUM_PROPERTY(includedTravelerType2, 1)
53 VDV_NUM_PROPERTY(includedTravelerCount2, 1)
54 VDV_NUM_PROPERTY(categroy, 1)
55 VDV_NUM_PROPERTY(serviceClass, 1) // 1 first class, 2 second class, 3 first class upgrade
56 VDV_NUM_PROPERTY(price, 3) // 24 bit big endian, price in Euro cent
57 VDV_NUM_PROPERTY(vat, 2) // VAT rate in 0,01% steps
58 VDV_NUM_PROPERTY(priceCategory, 1)
59 VDV_NUM_PROPERTY(productNumber, 3)
60public:
61 enum { Tag = 0xDA };
62};
63
64/** Product specific data - traveler information. */
65class KITINERARY_EXPORT VdvTicketTravelerData
66{
67 Q_GADGET
68 VDV_NUM_PROPERTY(gender, 1)
69 VDV_DATE_PROPERTY(birthDate)
70public:
71 char nameBegin;
72
73 inline const char* name() const
74 {
75 return &nameBegin;
76 }
77 inline int nameSize(int elementSize) const
78 {
79 return elementSize - sizeof(VdvTicketTravelerData) + 1;
80 }
81
82 enum { Tag = 0xDB };
83};
84
85/** Ticket validity area data block. */
86class KITINERARY_EXPORT VdvTicketValidityAreaData
87{
88 Q_GADGET
89 VDV_NUM_PROPERTY(type, 1)
90 VDV_NUM_PROPERTY(orgId, 2)
91
92public:
93 enum { Tag = 0xDC };
94};
95
96class KITINERARY_EXPORT VdvTicketValidityAreaDataType31 : public VdvTicketValidityAreaData
97{
98 Q_GADGET
99 VDV_NUM_PROPERTY(startId, 3)
100 VDV_NUM_PROPERTY(destinationId, 3)
101 VDV_NUM_PROPERTY(wayTextId, 2)
102 VDV_NUM_PROPERTY(ticketRelation, 4)
103 VDV_NUM_PROPERTY(pointCloudId, 4)
104
105public:
106 enum { Type = 0x31 };
107};
108
109/** Ticket transaction data block. */
110class KITINERARY_EXPORT VdvTicketCommonTransactionData
111{
112 Q_GADGET
113 VDV_NUM_PROPERTY(kvpOrgId, 2)
114 VDV_NUM_PROPERTY(terminalTypeCode, 1)
115 VDV_NUM_PROPERTY(terminalNumber, 2)
116 VDV_NUM_PROPERTY(terminalOrganizationNumber, 2)
117 VDV_DATETIME_PROPERTY(transactionDateTime)
118 VDV_NUM_PROPERTY(locationTypeCode, 1)
119 VDV_NUM_PROPERTY(locationNumber, 3)
120 VDV_NUM_PROPERTY(locationOrganizationNumber, 2)
121};
122
123/** Ticket issuer data block. */
124class KITINERARY_EXPORT VdvTicketIssueData
125{
126 Q_GADGET
127 VDV_NUM_PROPERTY(samSeq1, 4)
128 VDV_NUM_PROPERTY(version, 1)
129 VDV_NUM_PROPERTY(samSeq2, 4)
130 VDV_NUM_PROPERTY(samId, 3)
131};
132
133/** Ticket trailer, after padding. */
134class KITINERARY_EXPORT VdvTicketTrailer
135{
136 Q_GADGET
137public:
138 const char identifier[3];
139 VDV_NUM_PROPERTY(version, 2)
140};
141
142#pragma pack(pop)
143
144#undef VDV_NUM_PROPERTY
145#undef VDV_DATETIME_PROPERTY
146#undef VDV_DATE_PROPERTY
147
148}
149
Product specific data - basic information.
Ticket issuer data block.
Ticket trailer, after padding.
Product specific data - traveler information.
Ticket validity area data block.
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
Low-level data types used in VDV ticket structs.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:00:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.