00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef FORMATSTRINGS_H
00011 #define FORMATSTRINGS_H
00012 #include "typedefs.h"
00013 #include "i18n.h"
00014
00015 string formatEventType(unsigned char etype){
00016 ostringstream o;
00017 int major = etype >> 4;
00018 int minor = etype & 0xF;
00019 o << int(etype) << " - ";
00020 if(major == 0){
00021 o << tr("General events: ");
00022 const char* gevents[] = {"No further details","Insertion of a non-valid card", "Card conflict", "Time overlap", "Driving without an appropriate card", "Card insertion while driving", "Last card session not correctly closed", "Over speeding", "Power supply interruption", "Motion data error" };
00023 if(minor <= 0x9) o << tr(gevents[minor]);
00024 else o << tr("RFU");
00025 } else if(major == 1){
00026 o << tr("Vehicle unit related security breach attempt events: ");
00027 const char* sevents[] = {"No further details", "Motion sensor authentication failure", "Tachograph card authentication failure", "Unauthorised change of motion sensor", "Card data input integrity error", "Stored user data integrity error", "Internal data transfer error", "Unauthorised case opening", "Hardware sabotage"};
00028 if(minor <= 0x8) o << tr(sevents[minor]);
00029 else o << tr("RFU");
00030 } else if(major == 2){
00031 o << tr("Sensor related security breach attempt events: ");
00032 const char* sevents[] = {"No further details", "Authentication failure", "Stored data integrity error", "Internal data transfer error", "Unauthorised case opening", "Hardware sabotage"};
00033 if(minor <= 0x5) o << tr(sevents[minor]);
00034 else o << tr("RFU");
00035 } else if(major == 3){
00036 o << tr("Recording equipment faults: ");
00037 const char* sevents[] = {"No further details", "VU internal fault", "Printer fault", "Display fault", "Downloading fault", "Sensor fault"};
00038 if(minor <= 0x5) o << tr(sevents[minor]);
00039 else o << tr("RFU");
00040 } else if(major == 4){
00041 o << tr("Card faults: ");
00042 const char* sevents[] = {"No further details"};
00043 if(minor <= 0x1) o << tr(sevents[minor]);
00044 else o << tr("RFU");
00045 } else if(major >= 5 && major <= 7){
00046 o << tr("RFU groups");
00047 } else if(major >= 8 && major <= 0xF){
00048 o << tr("Manufacturer specific");
00049 } else o << tr("(error: blame programmer)");
00050 return o.str();
00051 }
00052
00053 string formatEventRecordPurpose(unsigned char etype){
00054 const char* rpurp[] = {"one of the 10 most recent (or last) events or faults", "the longest event for one of the last 10 days of occurrence", "one of the 5 longest events over the last 365 days", "the last event for one of the last 10 days of occurrence", "the most serious event for one of the last 10 days of occurrence", "one of the 5 most serious events over the last 365 days", "the first event or fault having occurred after the last calibration","an active/on-going event or fault"};
00055 if(etype <= 7) return tr(rpurp[etype]);
00056 else if(8 <= etype && etype <= 0x7F){
00057 return tr("RFU");
00058 } else if(0x80 <= etype && etype <= 0x7F){
00059 return tr("Manufacturer specific");
00060 } else return tr("(err:blame programmer)");
00061 }
00062
00063 string nationNumeric(unsigned char country){
00064 static const char* countries[] = {"No information available", "Austria", "Albania", "Andorra", "Armenia", "Azerbaijan", "Belgium", "Bulgaria", "Bosnia and Herzegovina", "Belarus", "Switzerland", "Cyprus", "Czech Republic", "Germany", "Denmark", "Spain", "Estonia", "France", "Finland", "Liechtenstein", "Faeroe Islands", "United Kingdom", "Georgia", "Greece", "Hungary", "Croatia", "Italy", "Ireland", "Iceland", "Kazakhstan", "Luxembourg", "Lithuania", "Latvia", "Malta", "Monaco", "Republic of Moldova", "Macedonia", "Norway", "Netherlands", "Portugal", "Poland", "Romania", "San Marino", "Russian Federation", "Sweden", "Slovakia", "Slovenia", "Turkmenistan", "Turkey", "Ukraine", "Vatican City", "Yugoslavia"};
00065 if(country <= 0x33) return tr(countries[country]);
00066 if(0x34 <= country && country <= 0xFC) return tr("Reserved for future use");
00067 if(country == 0xFD) return tr("European Community");
00068 if(country == 0xFE) return tr("Europe, but not EC and not registered");
00069 if(country == 0xFF) return tr("outside of Europe, not registered");
00070 return tr("error in nationNumeric");
00071 }
00072
00073 string formatSpecificCondition(unsigned char country){
00074 static const char* countries[] = {"RFU", "Out of scope – Begin", "Out of scope – End", "Ferry/Train crossing"};
00075 if(country <= 0x3) return tr(countries[country]);
00076 else return tr("RFU");
00077 }
00078 string formatCalibrationPurpose(unsigned char cpurp){
00079 const char* cpurps[] = {"reserved value (should not appear)", "activation: recording of calibration parameters known, at the moment of the VU activation", "first installation: first calibration of the VU after its activation", "installation: first calibration of the VU in the current vehicle", "periodic inspection"};
00080 if(cpurp <= 4) return tr(cpurps[cpurp]);
00081 else return tr("(not specified)");
00082 }
00083
00084 string formatControlType(unsigned char ctype){
00085 ostringstream o;
00086 if(ctype & (1 << 7)) o << tr("card downloaded, ");
00087 if(ctype & (1 << 6)) o << tr("VU downloaded, ");
00088 if(ctype & (1 << 5)) o << tr("printing done, ");
00089 if(ctype & (1 << 4)) o << tr("display used, ");
00090 return o.str();
00091 }
00092
00093 string formatEquipmentType(unsigned char value){
00094 const char* vals[] = {"Reserved","Driver Card","Workshop Card","Control Card","Company Card","Manufacturing Card","Vehicle Unit","Motion Sensor"};
00095 if(value <= 7) return tr(vals[value]);
00096 else return tr("RFU");
00097 }
00098
00099 string formatDailyWorkPeriod(unsigned char value){
00100 const char* vals[] = {
00101 "Begin, related time = card insertion time or time of entry",
00102 "End, related time = card withdrawal time or time of entry",
00103 "Begin, related time manually entered (start time)",
00104 "End, related time manually entered (end of work period)",
00105 "Begin, related time assumed by VU",
00106 "End, related time assumed by VU ",
00107 };
00108 if(value <= 5) return tr(vals[value]);
00109 else return tr("(not specified)");
00110 }
00111
00112 #endif