removed invalid replacement from types marked as required (BTI,HTI,HTM) and allow replacement value in VTM as documented, documentation
This commit is contained in:
+10
-10
@@ -44,15 +44,15 @@ static const dataType_t dataTypes[] = {
|
||||
{"IGN",MAX_POS*8,bt_str, IGN|ADJ, 0, 1, MAX_POS, 0}, // >= 1 byte ignored data
|
||||
stringDataType,
|
||||
{"HEX",MAX_POS*8,bt_hexstr, ADJ, 0, 2, 47, 0}, // >= 1 byte hex digit string, usually separated by space, e.g. 0a 1b 2c 3d
|
||||
{"BDA", 32, bt_dat, BCD, 0xff, 10, 10, 0}, // date with weekday in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x00 - Sun=0x06)
|
||||
{"BDA", 24, bt_dat, BCD, 0xff, 10, 10, 0}, // date in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x31,0x12,0x99)
|
||||
{"HDA", 32, bt_dat, 0, 0xff, 10, 10, 0}, // date with weekday, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x1f,0x0c,WW,0x63, WW is weekday Mon=0x01 - Sun=0x07))
|
||||
{"HDA", 24, bt_dat, 0, 0xff, 10, 10, 0}, // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x1f,0x0c,0x63)
|
||||
{"BTI", 24, bt_tim, BCD|REV|REQ, 0xff, 8, 8, 0}, // time in BCD, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x59,0x59,0x23)
|
||||
{"HTI", 24, bt_tim, REQ, 0xff, 8, 8, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x17,0x3b,0x3b)
|
||||
{"BDA", 32, bt_dat, BCD, 0xff, 10, 10, 0}, // date with weekday in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x00 - Sun=0x06, replacement 0xff)
|
||||
{"BDA", 24, bt_dat, BCD, 0xff, 10, 10, 0}, // date in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x31,0x12,0x99, replacement 0xff)
|
||||
{"HDA", 32, bt_dat, 0, 0xff, 10, 10, 0}, // date with weekday, 01.01.2000 - 31.12.2099 (0x01,0x01,WW,0x00 - 0x1f,0x0c,WW,0x63, WW is weekday Mon=0x01 - Sun=0x07, replacement 0xff)
|
||||
{"HDA", 24, bt_dat, 0, 0xff, 10, 10, 0}, // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x1f,0x0c,0x63, replacement 0xff)
|
||||
{"BTI", 24, bt_tim, BCD|REV|REQ, 0, 8, 8, 0}, // time in BCD, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x59,0x59,0x23)
|
||||
{"HTI", 24, bt_tim, REQ, 0, 8, 8, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x17,0x3b,0x3b)
|
||||
{"VTI", 24, bt_tim, REV, 0x63, 8, 8, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x3b,0x3b,0x17, replacement 0x63) [Vaillant type]
|
||||
{"HTM", 16, bt_tim, REQ, 0xff, 5, 5, 0}, // time as hh:mm, 00:00 - 23:59 (0x00,0x00 - 0x17,0x3b)
|
||||
{"VTM", 16, bt_tim, REV|REQ, 0xff, 5, 5, 0}, // time as hh:mm, 00:00 - 23:59 (0x00,0x00 - 0x3b,0x17, replacement 0xff) [Vaillant type]
|
||||
{"HTM", 16, bt_tim, REQ, 0, 5, 5, 0}, // time as hh:mm, 00:00 - 23:59 (0x00,0x00 - 0x17,0x3b)
|
||||
{"VTM", 16, bt_tim, REV, 0xff, 5, 5, 0}, // time as hh:mm, 00:00 - 23:59 (0x00,0x00 - 0x3b,0x17, replacement 0xff) [Vaillant type]
|
||||
{"TTM", 8, bt_tim, 0, 0x90, 5, 5, 10}, // truncated time (only multiple of 10 minutes), 00:00 - 24:00 (minutes div 10 + hour * 6 as integer)
|
||||
{"TTH", 8, bt_tim, 0, 0, 5, 5, 30}, // truncated time (only multiple of 30 minutes), 00:30 - 24:00 (minutes div 30 + hour * 2 as integer)
|
||||
{"BDY", 8, bt_num, DAY|LST, 0x07, 0, 6, 1}, // weekday, "Mon" - "Sun" (0x00 - 0x06) [eBUS type]
|
||||
@@ -630,7 +630,7 @@ result_t StringDataField::readSymbols(SymbolString& input, const unsigned char b
|
||||
if (m_length == 4 && i == 2 && m_dataType.type == bt_dat)
|
||||
continue; // skip weekday in between
|
||||
ch = input[baseOffset + offset];
|
||||
if ((m_dataType.flags & BCD) != 0) {
|
||||
if ((m_dataType.flags & BCD) != 0 && ((m_dataType.flags & REQ) != 0 || ch != m_dataType.replacement)) {
|
||||
if ((ch & 0xf0) > 0x90 || (ch & 0x0f) > 0x09)
|
||||
return RESULT_ERR_OUT_OF_RANGE; // invalid BCD
|
||||
ch = (unsigned char)((ch >> 4) * 10 + (ch & 0x0f));
|
||||
@@ -835,7 +835,7 @@ result_t StringDataField::writeSymbols(istringstream& input,
|
||||
}
|
||||
lastLast = last;
|
||||
last = value;
|
||||
if ((m_dataType.flags & BCD) != 0) {
|
||||
if ((m_dataType.flags & BCD) != 0 && ((m_dataType.flags & REQ) != 0 || value != m_dataType.replacement)) {
|
||||
if (value > 99)
|
||||
return RESULT_ERR_OUT_OF_RANGE; // invalid BCD
|
||||
value = ((value / 10) << 4) | (value % 10);
|
||||
|
||||
@@ -61,23 +61,23 @@ int main()
|
||||
{"x,,bda", "26.10.2014","10fe07000426100614", "00", ""}, // Sunday
|
||||
{"x,,bda", "01.01.2000","10fe07000401010500", "00", ""}, // Saturday
|
||||
{"x,,bda", "31.12.2099","10fe07000431120399", "00", ""}, // Thursday
|
||||
{"x,,bda", "-.-.-", "10fe07000400000000", "00", ""},
|
||||
{"x,,bda", "-.-.-", "10fe070004ffff00ff", "00", ""},
|
||||
{"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", "-.-.-", "10fe070003000000", "00", ""},
|
||||
{"x,,bda:3", "-.-.-", "10fe070003ffffff", "00", ""},
|
||||
{"x,,bda:3", "", "10fe070003321299", "00", "rw"},
|
||||
{"x,,bda,2", "", "", "", "c"},
|
||||
{"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", "-.-.-", "10fe07000400000000", "00", ""},
|
||||
{"x,,hda", "-.-.-", "10fe070004ffff00ff", "00", ""},
|
||||
{"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", "-.-.-", "10fe070003000000", "00", ""},
|
||||
{"x,,hda:3", "-.-.-", "10fe070003ffffff", "00", ""},
|
||||
{"x,,hda:3", "", "10fe070003200c63", "00", "rw"},
|
||||
{"x,,hda,2", "", "", "", "c"},
|
||||
{"x,,bti", "21:04:58", "10fe070003580421", "00", ""},
|
||||
@@ -101,6 +101,7 @@ int main()
|
||||
{"x,,vtm", "00:00", "10fe0700020000", "00", ""},
|
||||
{"x,,vtm", "23:59", "10fe0700023b17", "00", ""},
|
||||
{"x,,vtm", "24:00", "10fe0700020018", "00", ""},
|
||||
{"x,,vtm", "-:-", "10fe070002ffff", "00", ""},
|
||||
{"x,,vtm", "", "10fe0700023b18", "00", "rw"},
|
||||
{"x,,vtm", "24:01", "10fe0700020118", "00", "rw"},
|
||||
{"x,,vtm,2", "", "", "", "c"},
|
||||
|
||||
Reference in New Issue
Block a user