add replacement value ff to date/time types having no replacement yet, made ident fields static

This commit is contained in:
john30
2015-10-25 19:45:42 +01:00
parent 6814cdf3a1
commit fe6c79296d
2 changed files with 57 additions and 43 deletions
+17 -12
View File
@@ -45,15 +45,15 @@ static const dataType_t dataTypes[] = {
{"IGN",MAX_POS*8,bt_str, IGN|ADJ, 0, 1, MAX_POS, 0}, // >= 1 byte ignored data {"IGN",MAX_POS*8,bt_str, IGN|ADJ, 0, 1, MAX_POS, 0}, // >= 1 byte ignored data
stringDataType, 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 {"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, 0, 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", 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, 0, 10, 10, 0}, // date in BCD, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x31,0x12,0x99) {"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, 0, 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", 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, 0, 10, 10, 0}, // date, 01.01.2000 - 31.12.2099 (0x01,0x01,0x00 - 0x1f,0x0c,0x63) {"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, 0, 8, 8, 0}, // time in BCD, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x59,0x59,0x23) {"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, 0, 8, 8, 0}, // time, 00:00:00 - 23:59:59 (0x00,0x00,0x00 - 0x17,0x3b,0x3b) {"HTI", 24, bt_tim, REQ, 0xff, 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] {"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, 0, 5, 5, 0}, // time as hh:mm, 00:00 - 23:59 (0x00,0x00 - 0x17,0x3b) {"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 0x63) [Vaillant type] {"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]
{"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) {"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) {"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] {"BDY", 8, bt_num, DAY|LST, 0x07, 0, 6, 1}, // weekday, "Mon" - "Sun" (0x00 - 0x06) [eBUS type]
@@ -1238,9 +1238,11 @@ result_t ValueListDataField::writeSymbols(istringstream& input,
} }
DataFieldSet* DataFieldSet::createIdentFields() DataFieldSet* DataFieldSet::s_identFields = NULL;
DataFieldSet* DataFieldSet::getIdentFields()
{ {
vector<SingleDataField*> fields; if (s_identFields==NULL) {
map<unsigned int, string> manufacturers; map<unsigned int, string> manufacturers;
manufacturers[0x06] = "Dungs"; manufacturers[0x06] = "Dungs";
manufacturers[0x0f] = "FH Ostfalia"; manufacturers[0x0f] = "FH Ostfalia";
@@ -1266,11 +1268,14 @@ DataFieldSet* DataFieldSet::createIdentFields()
manufacturers[0xb5] = "Vaillant"; manufacturers[0xb5] = "Vaillant";
manufacturers[0xc0] = "Toby"; manufacturers[0xc0] = "Toby";
manufacturers[0xc5] = "Weishaupt"; manufacturers[0xc5] = "Weishaupt";
fields.push_back(new ValueListDataField("manufacturer", "", "", uchDataType, pt_slaveData, 1, 8, manufacturers));//TODO static vector<SingleDataField*> fields;
fields.push_back(new ValueListDataField("manufacturer", "", "", uchDataType, pt_slaveData, 1, 8, manufacturers));
fields.push_back(new StringDataField("id", "", "", stringDataType, pt_slaveData, 5)); fields.push_back(new StringDataField("id", "", "", stringDataType, pt_slaveData, 5));
fields.push_back(new NumberDataField("software", "", "", pinDataType, pt_slaveData, 2, 16, 0)); fields.push_back(new NumberDataField("software", "", "", pinDataType, pt_slaveData, 2, 16, 0));
fields.push_back(new NumberDataField("hardware", "", "", pinDataType, pt_slaveData, 2, 16, 0)); fields.push_back(new NumberDataField("hardware", "", "", pinDataType, pt_slaveData, 2, 16, 0));
return new DataFieldSet("ident", "", fields); s_identFields = new DataFieldSet("ident", "", fields);
}
return s_identFields;
} }
DataFieldSet::~DataFieldSet() DataFieldSet::~DataFieldSet()
+12 -3
View File
@@ -671,10 +671,16 @@ class DataFieldSet : public DataField
public: public:
/** /**
* Create the @a DataFieldSet for parsing the identification message (service 0x07 0x04). * Get the @a DataFieldSet for parsing the identification message (service 0x07 0x04).
* @return the @a DataFieldSet for parsing the identification message. * @return the @a DataFieldSet for parsing the identification message. This is:<ul>
* <li>manufacturer name (list of known values)</li>
* <li>identification string (5 characters)</li>
* <li>software version number (0000-9999)</li>
* <li>hardware version number (0000-9999)</li>
* </ul>
* Note: the returned value may only be deleted once.
*/ */
static DataFieldSet* createIdentFields(); static DataFieldSet* getIdentFields();
/** /**
* Constructs a new instance. * Constructs a new instance.
@@ -745,6 +751,9 @@ public:
private: private:
/** the @a DataFieldSet containing the ident message @a SingleDataField instances, or NULL. */
static DataFieldSet* s_identFields;
/** the @a vector of @a SingleDataField instances part of this set. */ /** the @a vector of @a SingleDataField instances part of this set. */
vector<SingleDataField*> m_fields; vector<SingleDataField*> m_fields;