Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Read Data From Data Object Type Array

Read data from Data object type Array

By KostaG , 18 July, 2024
Forums
General discussion

Hi,

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?

Thank you,
BR.

Profile picture for user Kurumi

Kurumi

2 years ago

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

KostaG

2 years ago

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.

KostaG

2 years ago

Hi, I just managed to read…

Hi,

I just managed to read the value correctly.
Anyways, thank you for the help.

BR.

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin