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

  • 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