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. Node
  3. Add Capture Object To Profile Generic

Add capture object to Profile generic

By bushidik , 31 January, 2024
Forums
Gurux.DLMS

Hello!

I use a c++ Server example and want to add some 3 capture object to the profile generic class.
Server example uses file with 10000 rows for generic profile example, and also somw PreRead handler. The question is - can I get capture objects value without using this PreRead handler?

So my code is:

CGXDLMSData *test_data = new CGXDLMSData("0.0.94.7.131.0");
CGXDLMSVariant id = 999;
test_data->SetAccess(2, DLMS_ACCESS_MODE_READ);
test_data->SetValue(id);
test_data->GetAttributes().push_back(CGXDLMSAttribute(2, DLMS_DATA_TYPE_UINT32));
GetItems().push_back(test_data);

CGXDLMSData *test_data2 = new CGXDLMSData("0.0.94.7.131.1");
CGXDLMSVariant id2 = 222;
test_data2->SetAccess(2, DLMS_ACCESS_MODE_READ);
test_data2->SetValue(id2);
test_data2->GetAttributes().push_back(CGXDLMSAttribute(2, DLMS_DATA_TYPE_UINT32));
GetItems().push_back(test_data2);

CGXDLMSData *test_data3 = new CGXDLMSData("0.0.94.7.131.2");
CGXDLMSVariant id3 = 777;
test_data3->SetAccess(2, DLMS_ACCESS_MODE_READ);
test_data3->SetValue(id3);
test_data3->GetAttributes().push_back(CGXDLMSAttribute(2, DLMS_DATA_TYPE_UINT32));
GetItems().push_back(test_data3);

CGXDLMSProfileGeneric *tst_profileGeneric = new CGXDLMSProfileGeneric("0.0.94.7.131.255");
tst_profileGeneric->SetAccess(2, DLMS_ACCESS_MODE::DLMS_ACCESS_MODE_READ);
tst_profileGeneric->SetAccess(3, DLMS_ACCESS_MODE::DLMS_ACCESS_MODE_READ);
tst_profileGeneric->SetCapturePeriod(0);

// first row
tst_profileGeneric->AddCaptureObject(test_data, 2, 0);
tst_profileGeneric->AddCaptureObject(test_data2, 2, 0);
tst_profileGeneric->AddCaptureObject(test_data3, 2, 0);
id = 123;
test_data->SetValue(id);
id2 = 223;
test_data2->SetValue(id2);
id3 = 333;
test_data3->SetValue(id3);

// second row
tst_profileGeneric->AddCaptureObject(test_data, 2, 1);
tst_profileGeneric->AddCaptureObject(test_data2, 2, 1);
tst_profileGeneric->AddCaptureObject(test_data3, 2, 1);
tst_profileGeneric->SetProfileEntries(2);

GetItems().push_back(tst_profileGeneric);
tst_profileGeneric->Capture(this);

PreRead handler is not using and I can't get any value of captured oject via DLMSDirector, except the column names.
Please point out mistakes in my code

Best regards!

Profile picture for user Kurumi

Kurumi

2 years 7 months ago

Hi, Yes, you can add the…

Hi,

Yes, you can add the capture object after you have created the profile generic object.

https://github.com/Gurux/Gurux.DLMS.cpp/blob/e4cc2a03f20f46e63fd5c01377…

Then remove the profile generic handler from the preRead. Now all data is in the memory and the framework handles it. You can try this if you press the capture button in GXDLMSDirector and read values after that.

BR,
Mikko

bushidik

2 years 7 months ago

Thank's a lot It helped, now…

Thank's a lot

It helped, now I see the data from captured Data object.

Another question - how can I add a new row to the same Data object without adding a new column (like AddCaptureObject does) ?

Profile picture for user Kurumi

Kurumi

2 years 7 months ago

Hi, Whenever you invoke…

Hi,

Whenever you invoke capture it will add a new row. You add capture objects only once. If you modify capture objects you also need to clear the buffer.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 08/26/2026 - 09:04
    Gurux.DLMS.Python 1.0.203
  • Mon, 08/17/2026 - 11:28
    Gurux.DLMS.Python 1.0.202
  • Mon, 08/17/2026 - 09:47
    gurux.dlms.cpp 9.0.2608.1701
  • Mon, 08/17/2026 - 09:25
    gurux.dlms.c 9.0.2608.1701
  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701

New forum topics

  • Security vulnerability report — request for a private contact (GuruxDLMS.c / ANSI C)
  • Topic: Insufficient Memory Error When Reading Class 7 Profile Generic Objects
  • SN ReadResponse returns all-null values when response spans multiple HDLC frames
  • Gurux.Serial.Android 3.0.6 – CH340 (HL-340) USB-Serial Adapter Not Working,
  • Trying to talk to a L&G E360 meter (Using Python Gurux)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin