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!
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
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) ?
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