- dynamic model generator can now use default values also for type templates

pull/6/head
Michael Zillgith 11 years ago
parent 66da568bea
commit 9f3854fbfb

@ -33,7 +33,8 @@ reportCallbackFunction(void* parameter, ClientReport report)
if (ClientReport_hasTimestamp(report)) { if (ClientReport_hasTimestamp(report)) {
time_t unixTime = ClientReport_getTimestamp(report) / 1000; time_t unixTime = ClientReport_getTimestamp(report) / 1000;
#ifdef _MSC_VER //#ifdef _MSC_VER
#ifdef WIN32
char* timeBuf = ctime(&unixTime); char* timeBuf = ctime(&unixTime);
#else #else
char timeBuf[30]; char timeBuf[30];

@ -2078,8 +2078,10 @@ MmsMapping_setConnectionIndicationHandler(MmsMapping* self, IedConnectionIndicat
static bool static bool
isMemberValueRecursive(MmsValue* container, MmsValue* value) isMemberValueRecursive(MmsValue* container, MmsValue* value)
{ {
bool isMemberValue = false;
if (container == value) if (container == value)
return true; isMemberValue = true;
else { else {
if ((MmsValue_getType(container) == MMS_STRUCTURE) || if ((MmsValue_getType(container) == MMS_STRUCTURE) ||
(MmsValue_getType(container) == MMS_ARRAY)) (MmsValue_getType(container) == MMS_ARRAY))
@ -2088,14 +2090,15 @@ isMemberValueRecursive(MmsValue* container, MmsValue* value)
int compCount = MmsValue_getArraySize(container); int compCount = MmsValue_getArraySize(container);
int i; int i;
for (i = 0; i < compCount; i++) { for (i = 0; i < compCount; i++) {
if (isMemberValueRecursive(MmsValue_getElement(container, i), value)) if (isMemberValueRecursive(MmsValue_getElement(container, i), value)) {
return true; isMemberValue = true;
break;
}
} }
} }
} }
return false; return isMemberValue;
} }
static bool static bool

@ -109,9 +109,18 @@ public class DataAttributeDefinition {
String value = elementNode.getTextContent(); String value = elementNode.getTextContent();
if (attributeType != AttributeType.ENUMERATED) { if (attributeType == AttributeType.ENUMERATED) {
this.value = new DataModelValue(attributeType, this.type, value); this.value = new DataModelValue(attributeType, this.type, value);
} }
else {
try {
this.value = new DataModelValue(attributeType, (SclType) null, value);
} catch (IllegalValueException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
} }
} }

@ -287,9 +287,9 @@ public class DynamicModelGenerator {
if (value == null) { if (value == null) {
value = dataAttribute.getDefinition().getValue(); value = dataAttribute.getDefinition().getValue();
if (value != null) // if (value != null)
if (value.getValue() == null) // if (value.getValue() == null)
value.updateEnumOrdValue(ied.getTypeDeclarations()); // value.updateEnumOrdValue(ied.getTypeDeclarations());
} }
if (value != null) { if (value != null) {

Loading…
Cancel
Save