KItinerary

ssbv2ticket.h
1/*
2 SPDX-FileCopyrightText: 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 "ssbticketbase.h"
11
12#include <QDateTime>
13#include <QMetaType>
14
15namespace KItinerary {
16
17/** ERA SSB ticket barcode (version 2).
18 * @see ERA TAP TSI TD B.12 - ยง15 Appendix B - SSB - old version
19 */
20class KITINERARY_EXPORT SSBv2Ticket : protected SSBTicketBase
21{
22 Q_GADGET
23 SSB_NUM_PROPERTY(version, 0, 4)
24 SSB_NUM_PROPERTY(issuerCode, 4, 14)
25 SSB_NUM_PROPERTY(publicKeyVersion, 18, 4)
26 SSB_NUM_PROPERTY(rct2TypeIndicator, 22, 1)
27 SSB_NUM_PROPERTY(numberOfTickets, 23, 6)
28 SSB_NUM_PROPERTY(numberOfAdultPassengers, 29, 7)
29 SSB_NUM_PROPERTY(numberOfChildPassengers, 36, 7)
30 SSB_NUM_PROPERTY(firstDayOfValidityDay, 43, 9)
31 SSB_NUM_PROPERTY(lastDayOfValidityDay, 52, 9)
32 SSB_NUM_PROPERTY(customerNumberType, 61, 1)
33 SSB_LONG_PROPERTY(customerNumber, 62, 47)
34 SSB_NUM_PROPERTY(departureStationType, 109, 1)
35 SSB_NUM_PROPERTY(departureStationNum, 110, 30)
36 SSB_STR_PROPERTY(departureStationAlpha, 110, 5)
37 SSB_NUM_PROPERTY(arrivalStationType, 140, 1)
38 SSB_NUM_PROPERTY(arrivalStationNum, 141, 30)
39 SSB_STR_PROPERTY(arrivalStationAlpha, 141, 5)
40 SSB_NUM_PROPERTY(departureTime, 171, 6)
41 SSB_NUM_PROPERTY(trainNumber, 177, 25) // alpha 5 encoding??
42 SSB_LONG_PROPERTY(reservationReference, 202, 40)
43 SSB_NUM_PROPERTY(classOfTransport, 242, 6)
44 SSB_NUM_PROPERTY(coachNumber, 248, 10)
45 SSB_NUM_PROPERTY(seatNumber, 258, 7) // 250 in trenitalia??
46 SSB_STR_PROPERTY(berthNumber, 265, 1)
47 SSB_NUM_PROPERTY(overbookingIndicator, 211, 1)
48 SSB_STR_PROPERTY(issuerPNRNumber, 272, 7)
49 SSB_NUM_PROPERTY(ticketType, 314, 4)
50 SSB_NUM_PROPERTY(specimen, 318, 1)
51 SSB_STR_PROPERTY(viaStations, 319, 5) // is that the correct encoding? page 131 of TAP TSI Annex B.6 could also be read as 6 times 5 bit content
52 SSB_NUM_PROPERTY(railwayCarrierCode, 349, 14)
53 SSB_STR_PROPERTY(reference, 363, 8)
54
55 Q_PROPERTY(QByteArray rawData READ rawData STORED false)
56
57public:
59 explicit SSBv2Ticket(const QByteArray &data);
61
62 /** Returns @c true if this is a valid SSB ticket. */
63 bool isValid() const;
64
65 /** First day of validity. */
66 Q_INVOKABLE QDate firstDayOfValidity(const QDateTime &contextDate = QDateTime::currentDateTime()) const;
67 /** Last day of validity. */
68 Q_INVOKABLE QDate lastDayOfValidity(const QDateTime &contextDate = QDateTime::currentDateTime()) const;
69
70 /** Raw barcode data. */
71 QByteArray rawData() const;
72
73 /** Returns @c true if @p data might be an ERA SSB ticket. */
74 static bool maybeSSB(const QByteArray &data);
75};
76
77}
78
79Q_DECLARE_METATYPE(KItinerary::SSBv2Ticket)
80
Internal base class for ERA SSB tickets.
ERA SSB ticket barcode (version 2).
Definition ssbv2ticket.h:21
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
QDateTime currentDateTime()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:28:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.