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. GX_ARRAY

GX_ARRAY

By KostaG , 8 June, 2023
Forums
General discussion

Hi,

I have a big sized array of 2048 uint32_t values that I want to send through DLMS. Searching the forums, I this way of doing this:

static dlmsVARIANT ARRAY[2];
GX_INT16(ARRAY[0]) = 1;
static variantArray tmp;
VA_ATTACH(tmp, ARRAY, 1);
GX_ARRAY(d.value, tmp);

But I have a micro with limited specifications and doing it this way takes so much memory from my micro. Is there any other more specific way of doing this?

Thank you.
Regards

Profile picture for user Kurumi

Kurumi

3 years ago

Hi, You need to have all the…

Hi,

You need to have all the array items on the memory. That is the only way to do it.
Are you reading the values from the EEPROM or FLASH?

BR,
Mikko

KostaG

3 years ago

I am reading them from RAM…

I am reading them from RAM. The problem is that the object associated to that array is so much bigger to the correspondig array and it consumes too much memory.

Profile picture for user Kurumi

Kurumi

3 years ago

Hi, Is this data in data or…

Hi,

Is this data in data or register object or are you using profile generic to save this?

If it's stored in data object you need to serialize data to byte buffer and then send it. The downside is that it also requires 10 KB of RAM. How much memory do you have available?

BR,
Mikko

KostaG

2 years 12 months ago

Hi, It is stored in a data…

Hi,

It is stored in a data object.

I don't have that much RAM available. Is there any way to store just that array data object in flash memory instead of ram? If it does exists, what would be the way to do it?

Profile picture for user Kurumi

Kurumi

2 years 12 months ago

Hi, You can create…

Hi,

You can create gxbytebuffer and append data to it in svr_preRead. Something like this:

if (e->target == BASE(YOUR_DATA_OBJECT) && e->index == 2)
{
if (e->value.byteArr == NULL)
{
e->value.byteArr = (gxByteBuffer*)malloc(sizeof(gxByteBuffer));
bb_init(e->value.byteArr);
}
e->value.vt = DLMS_DATA_TYPE_OCTET_STRING;
e->handled = 1;
e->byteArray = 1;

bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_ARRAY);
hlp_setObjectCount(e->value.byteArr, YOUR_OBJECT_COUNT);
//Add all objects in a loop....
{
bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_UINT16);
bb_setUInt8(e->value.byteArr, YOUR_VALUE);
}
}

BR,
Mikko

KostaG

2 years 11 months ago

Okay, I will try this. …

Okay, I will try this.

Thank you for your help.

Regards.

KostaG

2 years 11 months ago

Hi, Is it possible to…

Hi,

Is it possible to increment the size of the bytebuffer? I try to read all the data stored in the array but it only reads half of it.

Regards.

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin