I am having trouble trying to decode, from client-side, a Data object with Array type. I managed to read the Data object but I don't know how to retrieve it's values. Can you help me with this problem?
Sorry, I forgot about the language. I'm programming in ANSI C. I do the following in server-side to store the data in the GXArray in the preRead method:
Hi,1 You didn't tell what…
Hi,
You didn't tell what programming language you are using, but it's already converted from bytes to variant values.
You can loop the array something like this:
GXDLMSData data = new GXDLMSData();
//Read the value.
foreach(var it in (GXArray) data.Value)
{
//Print value.
}
BR,
Mikko
Sorry, I forgot about the…
Sorry, I forgot about the language. I'm programming in ANSI C. I do the following in server-side to store the data in the GXArray in the preRead method:
e->value.vt = DLMS_DATA_TYPE_OCTET_STRING;
e->byteArray = 1;
e->handled = 1;
e->skipMaxPduSize = 1;
bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_ARRAY);
hlp_setObjectCount(25 * 2, e->value.byteArr);
for (uint16_t i = 0; i < 25; i++) {
bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_FLOAT32);
bb_setFloat(e->value.byteArr, data_buffer[i]);
}
I checked using GXDLMSDIrector that I'm writing correctly the data values to the Array. I tried what you proposed but it's not working.
Any ideas of what could be the problem here?
BR.
Hi, I just managed to read…
Hi,
I just managed to read the value correctly.
Anyways, thank you for the help.
BR.