File indexing completed on 2024-11-24 04:46:19
0001 /* 0002 SPDX-FileCopyrightText: 2019-2021 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kitinerary_export.h" 0010 #include "vdvbasictypes.h" 0011 0012 #include <qobjectdefs.h> 0013 0014 namespace KItinerary { 0015 0016 #define VDV_NUM_PROPERTY(Name, Size) \ 0017 public: \ 0018 VdvNumber<Size> Name; \ 0019 Q_PROPERTY(uint Name MEMBER Name) 0020 #define VDV_DATETIME_PROPERTY(Name) \ 0021 public: \ 0022 VdvDateTimeCompact Name; \ 0023 Q_PROPERTY(QDateTime Name MEMBER Name) 0024 #define VDV_DATE_PROPERTY(Name) \ 0025 public: \ 0026 VdvBcdDate Name; \ 0027 Q_PROPERTY(QDate Name MEMBER Name) 0028 0029 #pragma pack(push) 0030 #pragma pack(1) 0031 0032 /** Ticket data header. */ 0033 class KITINERARY_EXPORT VdvTicketHeader 0034 { 0035 Q_GADGET 0036 VDV_NUM_PROPERTY(ticketId, 4) 0037 VDV_NUM_PROPERTY(kvpOrgId, 2) 0038 VDV_NUM_PROPERTY(productId, 2) 0039 VDV_NUM_PROPERTY(pvOrgId, 2) 0040 VDV_DATETIME_PROPERTY(validityBegin) 0041 VDV_DATETIME_PROPERTY(validityEnd) 0042 }; 0043 0044 /** Product specific data - basic information. */ 0045 class KITINERARY_EXPORT VdvTicketBasicData 0046 { 0047 Q_GADGET 0048 VDV_NUM_PROPERTY(paymentType, 1) 0049 VDV_NUM_PROPERTY(travelerType, 1) // 1 adult, 2 child, 65 bike 0050 VDV_NUM_PROPERTY(includedTravelerType1, 1) // 0 none, 1 adult, 2 child, 251 family child 0051 VDV_NUM_PROPERTY(includedTravelerCount1, 1) 0052 VDV_NUM_PROPERTY(includedTravelerType2, 1) 0053 VDV_NUM_PROPERTY(includedTravelerCount2, 1) 0054 VDV_NUM_PROPERTY(categroy, 1) 0055 VDV_NUM_PROPERTY(serviceClass, 1) // 1 first class, 2 second class, 3 first class upgrade 0056 VDV_NUM_PROPERTY(price, 3) // 24 bit big endian, price in Euro cent 0057 VDV_NUM_PROPERTY(vat, 2) // VAT rate in 0,01% steps 0058 VDV_NUM_PROPERTY(priceCategory, 1) 0059 VDV_NUM_PROPERTY(productNumber, 3) 0060 public: 0061 enum { Tag = 0xDA }; 0062 }; 0063 0064 /** Product specific data - traveler information. */ 0065 class KITINERARY_EXPORT VdvTicketTravelerData 0066 { 0067 Q_GADGET 0068 VDV_NUM_PROPERTY(gender, 1) 0069 VDV_DATE_PROPERTY(birthDate) 0070 public: 0071 char nameBegin; 0072 0073 inline const char* name() const 0074 { 0075 return &nameBegin; 0076 } 0077 inline int nameSize(int elementSize) const 0078 { 0079 return elementSize - sizeof(VdvTicketTravelerData) + 1; 0080 } 0081 0082 enum { Tag = 0xDB }; 0083 }; 0084 0085 /** Ticket validity area data block. */ 0086 class KITINERARY_EXPORT VdvTicketValidityAreaData 0087 { 0088 Q_GADGET 0089 VDV_NUM_PROPERTY(type, 1) 0090 VDV_NUM_PROPERTY(orgId, 2) 0091 0092 public: 0093 enum { Tag = 0xDC }; 0094 }; 0095 0096 class KITINERARY_EXPORT VdvTicketValidityAreaDataType31 : public VdvTicketValidityAreaData 0097 { 0098 Q_GADGET 0099 VDV_NUM_PROPERTY(startId, 3) 0100 VDV_NUM_PROPERTY(destinationId, 3) 0101 VDV_NUM_PROPERTY(wayTextId, 2) 0102 VDV_NUM_PROPERTY(ticketRelation, 4) 0103 VDV_NUM_PROPERTY(pointCloudId, 4) 0104 0105 public: 0106 enum { Type = 0x31 }; 0107 }; 0108 0109 /** Ticket transaction data block. */ 0110 class KITINERARY_EXPORT VdvTicketCommonTransactionData 0111 { 0112 Q_GADGET 0113 VDV_NUM_PROPERTY(kvpOrgId, 2) 0114 VDV_NUM_PROPERTY(terminalTypeCode, 1) 0115 VDV_NUM_PROPERTY(terminalNumber, 2) 0116 VDV_NUM_PROPERTY(terminalOrganizationNumber, 2) 0117 VDV_DATETIME_PROPERTY(transactionDateTime) 0118 VDV_NUM_PROPERTY(locationTypeCode, 1) 0119 VDV_NUM_PROPERTY(locationNumber, 3) 0120 VDV_NUM_PROPERTY(locationOrganizationNumber, 2) 0121 }; 0122 0123 /** Ticket issuer data block. */ 0124 class KITINERARY_EXPORT VdvTicketIssueData 0125 { 0126 Q_GADGET 0127 VDV_NUM_PROPERTY(samSeq1, 4) 0128 VDV_NUM_PROPERTY(version, 1) 0129 VDV_NUM_PROPERTY(samSeq2, 4) 0130 VDV_NUM_PROPERTY(samId, 3) 0131 }; 0132 0133 /** Ticket trailer, after padding. */ 0134 class KITINERARY_EXPORT VdvTicketTrailer 0135 { 0136 Q_GADGET 0137 public: 0138 const char identifier[3]; 0139 VDV_NUM_PROPERTY(version, 2) 0140 }; 0141 0142 #pragma pack(pop) 0143 0144 #undef VDV_NUM_PROPERTY 0145 #undef VDV_DATETIME_PROPERTY 0146 #undef VDV_DATE_PROPERTY 0147 0148 } 0149