Hello Mikko,
DLMS Director gives me an error message (something like Can't convert GXEnum to GXStructure) while reading Push Setup object.
I've made a little investigation.
Problem arise while reading Push Protection parameters (attribute 10)
1: 7E A0 1A 02 23 61 74 A2 13 E6 E6 00 C0 01 C1 00 28 00 00 19 09 00 FF 0A 00 15 11 7E
<GetRequest>
<GetRequestNormal>
<!-- Priority: High, ServiceClass: Confirmed, Invoke ID: 1 -->
<InvokeIdAndPriority Value="C1" />
<AttributeDescriptor>
<!-- PushSetup -->
<ClassId Value="0028" />
<!-- 0.0.25.9.0.255 -->
<InstanceId Value="0000190900FF" />
<!-- Push protection parameters -->
<AttributeId Value="0A" />
</AttributeDescriptor>
</GetRequestNormal>
</GetRequest>
2: 7E A0 37 61 02 23 76 4D BC E6 E7 00 C4 01 C1 00 01 01 02 02 16 02 02 05 09 00 09 08 4E 52 54 04 F2 9F 75 BF 09 08 00 00 00 00 00 00 00 00 09 00 02 02 16 00 16 00 63 E6 7E
<GetResponse>
<GetResponseNormal>
<!-- Priority: High, ServiceClass: Confirmed, Invoke ID: 1 -->
<InvokeIdAndPriority Value="C1" />
<Result>
<Data>
<Array Qty="01" >
<Structure Qty="02" >
<Enum Value="02" />
<Structure Qty="05" >
<OctetString Value="" />
<OctetString Value="4E525404F29F75BF" />
<OctetString Value="0000000000000000" />
<OctetString Value="" />
<Structure Qty="02" >
<Enum Value="00" />
<Enum Value="00" />
</Structure>
</Structure>
</Structure>
</Array>
</Data>
</Result>
</GetResponseNormal>
</GetResponse>
Please note this block:
<Structure Qty="02" >
<Enum Value="00" />
<Enum Value="00" />
</Structure>
This is key_info_element ::= structure
where key_info_type: enum: (0) identified_key
and key_info_options: CHOICE {
identified_key_info_options, wrapped_key_info_options, agreed_key_info_options }
}
and identified_key_info_options ::= enum: (0) global_unicast_encryption_key, (1) global_broadcast_encryption_key
So here we have two enum values.
GXDLMSPushSetup.cs module (GetPushProtectionParameters):
GXStructure data = (GXStructure)keyInfo[1]; # Problem arise here because in case of "identified_key" keyInfo[1] is a enum, not a structure.
#In case of wrapped_key_info_options, agreed_key_info_options keyInfo[1] would be a structure.
if (p.KeyInfo.DataProtectionKeyType == DataProtectionKeyType.Identified)
{
p.KeyInfo.IdentifiedKey.KeyType = (DataProtectionIdentifiedKeyType)Convert.ToInt32(data[0]);
}
else if (p.KeyInfo.DataProtectionKeyType == DataProtectionKeyType.Wrapped)
{
p.KeyInfo.WrappedKey.KeyType = (DataProtectionWrappedKeyType)Convert.ToInt32(data[0]);
p.KeyInfo.WrappedKey.Key = (byte[])data[1];
}
else if (p.KeyInfo.DataProtectionKeyType == DataProtectionKeyType.Agreed)
{
p.KeyInfo.AgreedKey.Parameters = (byte[])data[0];
p.KeyInfo.AgreedKey.Data = (byte[])data[1];
}
Best regards, Andre