removed part column from templates
This commit is contained in:
Regular → Executable
+16
-11
@@ -153,41 +153,46 @@ result_t DataField::create(vector<string>::iterator& it,
|
|||||||
PartType partType;
|
PartType partType;
|
||||||
unsigned int divisor = 0;
|
unsigned int divisor = 0;
|
||||||
const bool isTemplate = dstAddress == SYN;
|
const bool isTemplate = dstAddress == SYN;
|
||||||
|
bool hasPartStr = false;
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
// name,part,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
// templates: name,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
||||||
|
// normal: name,part,type[:len][,[divisor|values][,[unit][,[comment]]]]
|
||||||
const string name = *it++;
|
const string name = *it++;
|
||||||
if (it == end)
|
if (it == end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (isTemplate == true)
|
||||||
|
partType = pt_any;
|
||||||
|
else {
|
||||||
const char* partStr = (*it++).c_str();
|
const char* partStr = (*it++).c_str();
|
||||||
if (it == end)
|
if (it == end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (fields.empty() == true) {
|
hasPartStr = partStr[0] != 0;
|
||||||
firstName = name;
|
|
||||||
firstComment = comment;
|
|
||||||
}
|
|
||||||
if (dstAddress == BROADCAST || isMaster(dstAddress) == true
|
if (dstAddress == BROADCAST || isMaster(dstAddress) == true
|
||||||
|| (isTemplate == false && isSetMessage == true && partStr[0] == 0)
|
|| (isSetMessage == true && hasPartStr == false)
|
||||||
|| strcasecmp(partStr, "M") == 0) { // master data
|
|| strcasecmp(partStr, "M") == 0) { // master data
|
||||||
partType = pt_masterData;
|
partType = pt_masterData;
|
||||||
}
|
}
|
||||||
else if ((isTemplate == false && isSetMessage == false && partStr[0] == 0)
|
else if ((isSetMessage == false && hasPartStr == false)
|
||||||
|| strcasecmp(partStr, "S") == 0) { // slave data
|
|| strcasecmp(partStr, "S") == 0) { // slave data
|
||||||
partType = pt_slaveData;
|
partType = pt_slaveData;
|
||||||
}
|
}
|
||||||
else if (isTemplate) {
|
|
||||||
partType = pt_any;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
result = RESULT_ERR_INVALID_PART;
|
result = RESULT_ERR_INVALID_PART;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fields.empty() == true) {
|
||||||
|
firstName = name;
|
||||||
|
firstComment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
string typeStr = *it++;
|
string typeStr = *it++;
|
||||||
if (typeStr.empty() == true) {
|
if (typeStr.empty() == true) {
|
||||||
if (name.empty() == false || partStr[0] != 0)
|
if (name.empty() == false || hasPartStr == true)
|
||||||
result = RESULT_ERR_MISSING_TYPE;
|
result = RESULT_ERR_MISSING_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user