for example, I want to get first index of array:
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="01011F0700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
what the function use, to read the "0003", "01011F0700FF", "00", and "0000"?
unfortunatelly,
I cant find "obj_CaptureObjectsToString" in ANSI C
gxProfileGeneric profile1;
I try to get this, response is OK.
cosem_init(&profile1.base, DLMS_OBJECT_TYPE_PROFILE_GENERIC, "1.1.98.128.4.255");
ret = com_read(&profile1.base, 3);
I check: "profile1.capturedObject.size" = 6, and data Type of the "profile1.capturedObject" is "gxArray"
can we just get the first index of the array, then pass it to "va_getByIndex()"?
then get the value using it->ulVal; for example
if it possible, how to do it?
and also how to get the first index of the array, and what variable Type to store it?
I am Sorry Mikko,
but the &profile1.capturedObject is dont have member .Arr, but .data, and the type is void **data. and the captureObject type is gxArray.
and also arr_getByIndex first parameter is variantArray *arr.
or we need to use arr_getByIndex to handle profile1.capturedObjects ?
is there any solution?
Hi,
Hi,
You can access array/structure like this:
dlmsVARIANT* it;
//First value
va_getByIndex(&data1.value.Arr, 0, &it)
ii->bVal
//Second value
va_getByIndex(&data1.value.Arr, 1, &it)
ii->bVal
obj_toString gets content of the object as a string.
BR,
Mikko
Hey Mikko,
Hey Mikko,
thank you for your reply,
and it's work with removing & from the &data1.value.arr
Best Regards,
Fery_rz
Hello Mikko,
Hello Mikko,
can you give example to get data from profile generic?
<Result>
<Data>
<Array Qty="0006" >
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="01011F0700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="0101330700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="0101470700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="0101200700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="0101340700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="0101480700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
</Array>
</Data>
</Result>
for example, I want to get first index of array:
<Structure Qty="0004" >
<LongUnsigned Value="0003" />
<OctetString Value="01011F0700FF" />
<Integer Value="00" />
<LongUnsigned Value="0000" />
</Structure>
what the function use, to read the "0003", "01011F0700FF", "00", and "0000"?
Best regards,
Fery
Hi,
Hi,
Check obj_CaptureObjectsToString. It does exactly this.
obj_toString calls it.
BR,
Mikko
Hello mikko
Hello mikko
unfortunatelly,
I cant find "obj_CaptureObjectsToString" in ANSI C
gxProfileGeneric profile1;
I try to get this, response is OK.
cosem_init(&profile1.base, DLMS_OBJECT_TYPE_PROFILE_GENERIC, "1.1.98.128.4.255");
ret = com_read(&profile1.base, 3);
I check: "profile1.capturedObject.size" = 6, and data Type of the "profile1.capturedObject" is "gxArray"
can we just get the first index of the array, then pass it to "va_getByIndex()"?
then get the value using it->ulVal; for example
if it possible, how to do it?
and also how to get the first index of the array, and what variable Type to store it?
regards,
Fery
Hi,
Hi,
obj_CaptureObjectsToString is internal method. obj_toString calls it.
You can also access data like this:
dlmsVARIANT* structure, it;
//First structure
va_getByIndex(&profile1.capturedObject.Arr, 0, &structure);
//First item
va_getByIndex(&structure->.Arr, 0, &it);
//Second item
va_getByIndex(&structure->.Arr, 1, &it);
BR,
Mikko
Hi,
Hi,
it->vt tells data type.
BR,
Mikko
I am Sorry Mikko,
I am Sorry Mikko,
but the &profile1.capturedObject is dont have member .Arr, but .data, and the type is void **data. and the captureObject type is gxArray.
and also arr_getByIndex first parameter is variantArray *arr.
or we need to use arr_getByIndex to handle profile1.capturedObjects ?
is there any solution?
Best Regards,
Fery
Hello,
Hello,
I've found the obj_CaptureObjectsToString, then I try to implement this
dlmsVARIANT *structure, *it;
arr_getByIndex(&profile1.captureObjects, 0, (void **)&structure);
va_getByIndex(structure->Arr, 0, &it);
but my controller get crash when "va_getByIndex(structure->Arr, 0, &it);" above is added.
just trying to do: printf("%i\r\n", structure->vt);
the result is 1073450804
Regards,
Fery
Hi Fery,
Hi Fery,
I'm sorry. This was my mistake. Correct example code is:
gxKey* kv;
arr_getByIndex(&profile1.capturedObject, 0, &kv);
gxObject* obj = (gxObject*)kv->key;
Attribute and data index you can get from value.
gxTarget* t = (gxTarget*)kv->value
BR,
Mikko