Commit b241585f authored by Volker Krause's avatar Volker Krause
Browse files

Expand FCB definitions to the point all existing samples parse correctly

parent d294d4ba
Pipeline #248938 passed with stage
in 5 minutes and 2 seconds
......@@ -153,6 +153,17 @@ void Fcb::ReturnRouteDescriptionType::decode(UPERDecoder &decoder)
assert(false);
}
void Fcb::CardReferenceType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR(cardIssuer, 1, 32000);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(cardId);
FCB_READ_UTF8STRING(cardName);
FCB_READ_UNCONSTRAINED_INT(cardType);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(leadingCardId);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(trailingCardId);
}
void Fcb::TariffType::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
......@@ -166,7 +177,7 @@ void Fcb::TariffType::decode(UPERDecoder &decoder)
// FCB_READ_CUSTOM(seriesDataDetails); TODO
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(tariffId);
FCB_READ_UTF8STRING(tariffDesc);
// FCB_READ_SEQUENCE_OF_CUSTOM(reductionCard); TODO
FCB_READ_SEQUENCE_OF_CUSTOM(reductionCard);
}
void Fcb::OpenTicketData::decode(UPERDecoder &decoder)
......@@ -209,6 +220,41 @@ void Fcb::OpenTicketData::decode(UPERDecoder &decoder)
FCB_READ_CUSTOM(extension);
}
void Fcb::PassData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
FCB_READ_INT_IA5_PAIR_UNCONSTRAINED(reference);
FCB_READ_INT_IA5_PAIR(productOwner, 1, 32000);
FCB_READ_INT_IA5_PAIR(productId, 0, 32000);
FCB_READ_CONSTAINED_INT(passType, 1, 250);
FCB_READ_UTF8STRING(passDescription);
FCB_READ_EXTENDED_ENUM(classCode);
FCB_READ_CONSTAINED_INT(validFromDay, -1, 700);
FCB_READ_CONSTAINED_INT(validFromTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validFromUTCOffset, -60, 60);
FCB_READ_CONSTAINED_INT(validUntilDay, 0, 370);
FCB_READ_CONSTAINED_INT(validUntilTime, 0, 1440);
FCB_READ_CONSTAINED_INT(validUntilUTCOffset, -60, 60);
// FCB_READ_CUSTOM(validityPeriodDetails); TODO
FCB_READ_CONSTAINED_INT(numberOfValidityDays, 0, 370);
FCB_READ_CONSTAINED_INT(numberOfPossibleTrips, 1, 250);
FCB_READ_CONSTAINED_INT(numberOfDaysOfTravel, 1, 250);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(activatedDay, 0, 370);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(countries, 1, 250);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedCarrierNum, 1, 32000);
// TODO includedCarrierIA5 SEQUENCE OF IA5String OPTIONAL,
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(excludedCarrierNum, 1, 32000);
// TODO excludedCarrierIA5 SEQUENCE OF IA5String OPTIONAL,
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(includedServiceBrands, 1, 32000);
FCB_READ_SEQUENCE_OF_CONTRAINED_INT(excludedServiceBrands, 1, 32000);
// FCB_READ_SEQUENCE_OF_CUSTOM(validRegion); TOODO
FCB_READ_SEQUENCE_OF_CUSTOM(tariffs);
FCB_READ_UNCONSTRAINED_INT(price);
// FCB_READ_SEQUENCE_OF_CUSTOM(vatDetail); TODO
FCB_READ_UTF8STRING(infoText);
FCB_READ_CUSTOM(extension);
}
void Fcb::DocumentData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
......@@ -222,6 +268,13 @@ void Fcb::DocumentData::decode(UPERDecoder &decoder)
OpenTicketData t;
t.decode(decoder);
ticket = QVariant::fromValue(t);
break;
}
case 3: {
PassData p;
p.decode(decoder);
ticket = QVariant::fromValue(p);
break;
}
}
}
......@@ -229,7 +282,18 @@ void Fcb::DocumentData::decode(UPERDecoder &decoder)
void Fcb::ControlData::decode(UPERDecoder &decoder)
{
decodeSequence(decoder);
// TODO
FCB_READ_SEQUENCE_OF_CUSTOM(identificationByCardReference);
identificationByIdCard = decoder.readBoolean();
identificationByPassportId = decoder.readBoolean();
FCB_READ_UNCONSTRAINED_INT(identificationItem);
passportValidationRequired = decoder.readBoolean();
onlineValidationRequired = decoder.readBoolean();
FCB_READ_CONSTAINED_INT(randomDetailedValidationRequired, 0, 99);
ageCheckRequired = decoder.readBoolean();
reductionCardCheckRequired = decoder.readBoolean();
FCB_READ_UTF8STRING(infoText);
//FCB_READ_SEQUENCE_OF_CUSTOM(includedTickets); TODO
FCB_READ_CUSTOM(extension);
}
Fcb::UicRailTicketData::UicRailTicketData() = default;
......
......@@ -184,7 +184,17 @@ class SeriesDetailType {
class CardReferenceType {
UPER_EXTENDABLE_GADGET
// TODO
UPER_ELEMENT_OPTIONAL(int, cardIssuerNum)
UPER_ELEMENT_OPTIONAL(QByteArray, cardIssuerIA5)
UPER_ELEMENT_OPTIONAL(int, cardIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, cardIdIA5)
UPER_ELEMENT_OPTIONAL(QString, cardName)
UPER_ELEMENT_OPTIONAL(int, cardType)
UPER_ELEMENT_OPTIONAL(int, leadingCardIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, leadingCardIdIA5)
UPER_ELEMENT_OPTIONAL(int, trailingCardIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, trailingCardIdIA5)
UPER_GADGET_FINALIZE
};
class TariffType {
......@@ -263,6 +273,48 @@ class OpenTicketData {
UPER_GADGET_FINALIZE
};
class ValidityPeriodDetailType {
// TODO
};
class PassData {
UPER_EXTENDABLE_GADGET
UPER_ELEMENT_OPTIONAL(int, referenceNum)
UPER_ELEMENT_OPTIONAL(QByteArray, referenceIA5)
UPER_ELEMENT_OPTIONAL(int, productOwnerNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productOwnerIA5)
UPER_ELEMENT_OPTIONAL(int, productIdNum)
UPER_ELEMENT_OPTIONAL(QByteArray, productIdIA5)
UPER_ELEMENT_OPTIONAL(int, passType)
UPER_ELEMENT_OPTIONAL(QString, passDescription)
UPER_ELEMENT_DEFAULT(KItinerary::Fcb::TravelClassType, classCode, second)
UPER_ELEMENT_DEFAULT(int, validFromDay, 0)
UPER_ELEMENT_OPTIONAL(int, validFromTime)
UPER_ELEMENT_OPTIONAL(int, validFromUTCOffset)
UPER_ELEMENT_DEFAULT(int, validUntilDay, 0)
UPER_ELEMENT_OPTIONAL(int, validUntilTime)
UPER_ELEMENT_OPTIONAL(int, validUntilUTCOffset)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ValidityPeriodDetailType, validityPeriodDetails)
UPER_ELEMENT_OPTIONAL(int, numberOfValidityDays)
UPER_ELEMENT_OPTIONAL(int, numberOfPossibleTrips)
UPER_ELEMENT_OPTIONAL(int, numberOfDaysOfTravel)
UPER_ELEMENT_OPTIONAL(QList<int>, activatedDay)
UPER_ELEMENT_OPTIONAL(QList<int>, countries)
UPER_ELEMENT_OPTIONAL(QList<int>, includedCarrierNum)
UPER_ELEMENT_OPTIONAL(QList<QByteArray>, includedCarrierIA5)
UPER_ELEMENT_OPTIONAL(QList<int>, excludedCarrierNum)
UPER_ELEMENT_OPTIONAL(QList<QByteArray>, excludedCarrierIA5)
UPER_ELEMENT_OPTIONAL(QList<int>, includedServiceBrands)
UPER_ELEMENT_OPTIONAL(QList<int>, excludedServiceBrands)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::RegionalValidityType>, validRegion)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TariffType>, tariffs)
UPER_ELEMENT_OPTIONAL(int, price)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::VatDetailType>, vatDetail)
UPER_ELEMENT_OPTIONAL(QString, infoText)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
UPER_GADGET_FINALIZE
};
class TokenType {
UPER_GADGET
UPER_ELEMENT_OPTIONAL(int, tokenProviderNum)
......@@ -295,7 +347,7 @@ class ControlData {
UPER_ELEMENT_OPTIONAL(int, randomDetailedValidationRequired)
UPER_ELEMENT(bool, ageCheckRequired)
UPER_ELEMENT(bool, reductionCardCheckRequired)
UPER_ELEMENT_OPTIONAL(QString, infoString)
UPER_ELEMENT_OPTIONAL(QString, infoText)
UPER_ELEMENT_OPTIONAL(QList<KItinerary::Fcb::TicketLinkType>, includedTickets)
UPER_ELEMENT_OPTIONAL(KItinerary::Fcb::ExtensionData, extension)
UPER_GADGET_FINALIZE
......@@ -337,6 +389,8 @@ Q_DECLARE_METATYPE(KItinerary::Fcb::VatDetailType)
Q_DECLARE_METATYPE(KItinerary::Fcb::IncludedOpenTicketType)
Q_DECLARE_METATYPE(KItinerary::Fcb::LuggageRestrictionType)
Q_DECLARE_METATYPE(KItinerary::Fcb::OpenTicketData)
Q_DECLARE_METATYPE(KItinerary::Fcb::ValidityPeriodDetailType)
Q_DECLARE_METATYPE(KItinerary::Fcb::PassData)
Q_DECLARE_METATYPE(KItinerary::Fcb::TokenType)
Q_DECLARE_METATYPE(KItinerary::Fcb::DocumentData)
Q_DECLARE_METATYPE(KItinerary::Fcb::CardReferenceType)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment