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. Does The Gurux C++ Library Support Struct and Array?

Does the Gurux C++ library support struct and array?

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By cuiby , 27 November, 2015
Forums
General discussion

Hi Support,

I'm wondering if the C++ library in github.com can support struct and array data type.
It seems reading is ok, but did it handle these 2 types while writing?

Baoye

Profile picture for user Kurumi

Kurumi

10 years 6 months ago

Does the Gurux C++ library support struct and array?

Hi,

Yes it does. You have to make sure that you write right data types or meter returns error or do not accept data.

BR,

Mikko

cuiby

10 years 6 months ago

In reply to Does the Gurux C++ library support struct and array? by Kurumi

Thank you for your reply.

Thank you for your reply.

I'm trying to use the following function to change the value of some attributes, but without success.

Write(CGXDLMSObject* pObject, int attributeIndex, CGXDLMSVariant& value)

1. If the value parameter is an array of string , could you help to check if the sending out package includes the byte of length of that string?
2. Could you provide me a sample code showing how to fill an array of struct data structure before calling this function?

Thanks
Baoye

Profile picture for user Kurumi

Kurumi

10 years 6 months ago

Writing array

Hi

What COSEM Interface you want to use? Can you post an example from the data you want to save?

BR,

Mikko

cuiby

10 years 5 months ago

Write/update cosem objects

Hi Mikko,

Thank you for your reply. I'm trying to verify how to fill array before generating message. E.g, object of Auto Connect interface has an attribute named destination_list, which is an array of string. Could you show me how to fill the value (CGXDLMSVariant) before calling Write function?

Thanks,
Baoye

Profile picture for user Kurumi

Kurumi

10 years 5 months ago

Write/update cosem objects

Hi,

Below is small example. We updated new version to GitHub, so get new version first.

BR,

Mikko

CGXDLMSVariant ln2 = "OBIS CODE";
CGXDLMSVariant item1 = "AAAA";
CGXDLMSVariant item2 = "BBBB";
CGXDLMSVariant item3 = "CCCC";
CGXDLMSVariant arr;
arr.Arr.push_back(item1);
arr.Arr.push_back(item2);
arr.Arr.push_back(item3);
arr.vt = DLMS_DATA_TYPE_ARRAY;
ret = cl.Write(ln2, OBJECT_TYPE_DATA, 2, arr, packets);

Profile picture for user Kurumi

Kurumi

10 years 5 months ago

Write/update cosem objects

Hi,

I added another example here: In this example you can set COSEM objects directly and write data to the meter.

BR,

Mikko
CGXDLMSAutoConnect ac;
ac.GetDestinations().push_back("AAAA");
ac.GetDestinations().push_back("BBBB");
ac.GetDestinations().push_back("CCCC");
ret = cl.Write(&ac, 6, packets);

cuiby

10 years 5 months ago

improvement and bugs

Hi Mikko,

Thanks for your information. I downloaded the new library and noticed there are some improvements regarding this issue, especially for the length of the string type and handling of array.

What I want to mention here is the issue of handling the structure type of data while writing. It seems missing the amount of the element in the message. Please confirm.
Another problem I want to report is the DLMS_COMMAND_WRITE_REQUEST package probably has some bytes issue when the application use SN.

Thanks,
Baoye

Profile picture for user Kurumi

Kurumi

10 years 5 months ago

improvement and bugs

Hi,

I just checked this with Logican name referencing and it seens to work as should be. Get latest version from Github. We have made some changes last weeks.

I will check this with Short Name referecing after next week.

BR,

Mikko

Profile picture for user Kurumi

Kurumi

10 years 2 months ago

Hi,

Hi,

I just informs you that we have released new API for Gurux DLMS library for ANSI C++.
You can get more information from here:
http://www.gurux.fi/newAPI
BR,
Mikko

  • 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

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin