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. Fetch Data Error

Fetch data error

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 Varun Sharma , 18 November, 2020
Forums
General discussion

Hello sir,
Started a new topic today.
Good morning sir,

ret = comm.InitializeConnection();
char buff[200];
string value;
//CGXDLMSProfileGeneric *obj = new CGXDLMSProfileGeneric("1.0.94.91.0.255");//Instant
//obj->SetAccess(2, DLMS_ACCESS_MODE_READ);
index = 2;
value.clear();
if ((ret = comm.Read(obj, index, value)) != DLMS_ERROR_CODE_OK)
{
obj->GetBuffer();
sprintf_s(buff, 100, "Error! Index: %d %s\r\n", index, CGXDLMSConverter::GetErrorMessage(ret));
comm.WriteValue(GX_TRACE_LEVEL_ERROR, buff);
printf("%s", buff);
}
else
{
obj->GetBuffer();
#if _MSC_VER > 1000
sprintf_s(buff, 100, "Index: %d Value: ", index);
#else
sprintf(buff, "Index: %d Value: ", index);
#endif
comm.WriteValue(trace, buff);
comm.WriteValue(trace, value.c_str());
comm.WriteValue(trace, "\r\n");
printf("%s", buff);
}

This is the code i m using and below are my questions:-
1. On serial port it is showing 2nd attribute but "ret" value always comes 258.
see log
7e a0 19 03 41 32 3a bd e6 e6 00 c0 01 81 00 07 ~ ..A2:½ææ.À...
00 00 5e 5b 0a ff 02 00 85 d2 7e ..^[.ÿ..…Ò~
[18/11/2020 11:14:14] Read data (COM1)
7e a0 4f 41 03 52 a8 86 e6 e7 00 c4 01 c1 00 01 ~ OA.R¨†æç.Ä.Á..
01 02 07 0a 0b 30 30 30 30 30 31 32 33 34 35 36 .....00000123456
0a 15 45 4c 53 45 57 45 44 59 20 49 4e 44 49 41 ..ELSEWEDY INDIA
20 50 56 54 4c 54 44 0a 05 31 2e 38 31 30 11 05 PVTLTD..1.810..
0a 02 43 33 0a 05 35 2d 36 30 41 12 07 d0 ea e5 ..C3..5-60A..Ðêå
7e ~
2. The method WriteValue() don't print anything but printf() prints the buffer value.
3. After reading 2nd attribute plz show me the code to fetch values because I need to save and show them. Tried a lot but not getting success.

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

It seems that you didn't read capture objects attribute #2 before reading the buffer.

http://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric
BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More

Who's new

  • Thomasqto
  • Uka Ibe
  • CTKNhZElptjSlOrpkXl
  • YCbccqfLGRMnlCWoJhXP
  • Malcolmactig
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin