- 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)) {
time_t unixTime = ClientReport_getTimestamp(report) / 1000;
#ifdef _MSC_VER
//#ifdef _MSC_VER
#ifdef WIN32
char* timeBuf = ctime(&unixTime);
#else
char timeBuf[30];

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

@ -109,9 +109,18 @@ public class DataAttributeDefinition {
String value = elementNode.getTextContent();
if (attributeType != AttributeType.ENUMERATED) {
if (attributeType == AttributeType.ENUMERATED) {
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();
}
}
}
}
}

@ -40,7 +40,7 @@ public class DataModelValue {
}
public DataModelValue(AttributeType type, SclType sclType, String value) throws IllegalValueException {
switch (type) {
case ENUMERATED:
EnumerationType enumType = (EnumerationType) sclType;

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

Loading…
Cancel
Save