diff --git a/src/lib/ebus/datatype.cpp b/src/lib/ebus/datatype.cpp index 59a62ce1..6a5c62ff 100755 --- a/src/lib/ebus/datatype.cpp +++ b/src/lib/ebus/datatype.cpp @@ -345,11 +345,11 @@ result_t DateTimeDataType::readSymbols(size_t offset, size_t length, const Symbo } switch (type) { case 2: // date only - if (!hasFlag(REQ) && symbol == m_replacement) { + if (!hasFlag(REQ) && (symbol == m_replacement || (!hasFlag(REZ) && symbol == 0))) { if (i + 1 != length) { *output << NULL_VALUE << "."; break; - } else if (last == m_replacement) { + } else if (last == m_replacement || (!hasFlag(REZ) && last == 0)) { if (length == 2) { // number of days since 01.01.1900 *output << NULL_VALUE << "."; } @@ -1228,7 +1228,7 @@ DataTypeList::DataTypeList() { // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x1f,0x0c,0x63, replacement 0xff) add(new DateTimeDataType("HDA:3", 24, 0, 0xff, true, false, 0)); // date, days since 01.01.1900, 01.01.1900 - 06.06.2079 (0x00,0x00 - 0xff,0xff) - add(new DateTimeDataType("DAY", 16, 0, 0xff, true, false, 0)); + add(new DateTimeDataType("DAY", 16, REZ, 0xff, true, false, 0)); // date+time in minutes since 01.01.2009, 01.01.2009 - 31.12.2099 (0x00,0x00,0x00,0x00 - 0x02,0xda,0x4e,0x1f) add(new DateTimeDataType("DTM", 32, REQ, 0x100, true, true, 0)); // time in BCD, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x59,0x59,0x23) diff --git a/src/lib/ebus/datatype.h b/src/lib/ebus/datatype.h index f6bd1a23..c5e77a46 100755 --- a/src/lib/ebus/datatype.h +++ b/src/lib/ebus/datatype.h @@ -194,6 +194,9 @@ enum PartType { /** bit flag for @a DataType: stored duplicate for backwards compatibility, not to be traversed in lists any more. */ #define DUP 0x2000 +/** bit flag for @a DataType: special marker for non-tolerated secondary replacement value of zero (date only). */ +#define REZ 0x4000 + /** * Parse a float value from the 32 bit representation (IEEE 754). * @param value the 32 bit representation of the float value. diff --git a/src/lib/ebus/test/test_data.cpp b/src/lib/ebus/test/test_data.cpp index fc44392a..1c09989d 100755 --- a/src/lib/ebus/test/test_data.cpp +++ b/src/lib/ebus/test/test_data.cpp @@ -143,11 +143,13 @@ int main() { {"x,,bda", "20.02.2021", "10fe07000420020621", "00", ""}, // Saturday {"x,,bda", "31.12.2099", "10fe07000431120499", "00", ""}, // Thursday {"x,,bda", "-.-.-", "10fe070004ffff00ff", "00", ""}, + {"x,,bda", "-.-.-", "10fe07000400000000", "00", "W"}, {"x,,bda", "", "10fe07000432100014", "00", "rw"}, {"x,,bda:3", "26.10.2014", "10fe070003261014", "00", ""}, {"x,,bda:3", "01.01.2000", "10fe070003010100", "00", ""}, {"x,,bda:3", "31.12.2099", "10fe070003311299", "00", ""}, {"x,,bda:3", "-.-.-", "10fe070003ffffff", "00", ""}, + {"x,,bda:3", "-.-.-", "10fe070003000000", "00", "W"}, {"x,,bda:3", "", "10fe070003321299", "00", "rw"}, {"x,,bda,2", "", "", "", "c"}, {"x,,bdz", "26.10.2014", "10fe07000426100614", "00", ""}, // Sunday @@ -155,16 +157,19 @@ int main() { {"x,,bdz", "20.02.2021", "10fe07000420020521", "00", ""}, // Saturday {"x,,bdz", "31.12.2099", "10fe07000431120399", "00", ""}, // Thursday {"x,,bdz", "-.-.-", "10fe070004ffff00ff", "00", ""}, + {"x,,bdz", "-.-.-", "10fe07000400000000", "00", "W"}, {"x,,bdz", "", "10fe07000432100014", "00", "rw"}, {"x,,hda", "26.10.2014", "10fe0700041a0a070e", "00", ""}, // Sunday {"x,,hda", "01.01.2000", "10fe07000401010600", "00", ""}, // Saturday {"x,,hda", "31.12.2099", "10fe0700041f0c0463", "00", ""}, // Thursday {"x,,hda", "-.-.-", "10fe070004ffff00ff", "00", ""}, + {"x,,hda", "-.-.-", "10fe07000400000000", "00", "W"}, {"x,,hda", "", "10fe070004200c0463", "00", "rw"}, {"x,,hda:3", "26.10.2014", "10fe0700031a0a0e", "00", ""}, {"x,,hda:3", "01.01.2000", "10fe070003010100", "00", ""}, {"x,,hda:3", "31.12.2099", "10fe0700031f0c63", "00", ""}, {"x,,hda:3", "-.-.-", "10fe070003ffffff", "00", ""}, + {"x,,hda:3", "-.-.-", "10fe070003000000", "00", "W"}, {"x,,hda:3", "", "10fe070003200c63", "00", "rw"}, {"x,,hda,2", "", "", "", "c"}, {"x,,day", "26.10.2014", "10fe070002d0a3", "00", ""},