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. Forums
  3. Problem In Parse a Frame From Meter

Problem in parse a frame from meter

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 NGR0223 , 23 March, 2022
Forums
General discussion

I am new to DLMS, I have some problem in parse the response frame while using the gurux.dlms.cpp.master.

I want to read the IC 0x15, the OBIS "0.0.40.0.0.255" and the attribute 3 by constructing the CGXDLMSObject, then I read it through the CGXCommunication::Read(). Part of code is as follows:

CGXDLMSObject *obj = new CGXDLMSObject(classId, ln);
std::vector<CGXByteBuffer> data;
int ret = comm.Read(obj, attr, nullptr, data);

I have got the correct response frame from the meter. But I want to get the payload of the frame. I have searched for the way to do it. The mothod in the link(https://www.gurux.fi/node/14896) seems does not work correctly. Part of code is as follows:

unsigned char *responseFrame = {0x00, 0x01, 0x00, 0x01, 0x00, 0x05, 0x00, 0x0B, 0xC4, 0x01,
0x81, 0x00, 0x02, 0x02, 0x0F, 0x05, 0x12, 0x00, 0x01}
CGXDLMSSecureClient client( // );
CGXReplyData payload;
CGXReplyData notify;
CGXByteBuffer reply;
reply.Set(responseFrame, lengthFrame);
if ((ret = client.GetData(reply, payload, notify) == 0)
{
cout << payload.GetData().ToHexString() << endl;
// 00 02 0F 05 12 00 01
}

So if i want to get the string "C4 01 81 00 02 02 0F 05 12 00 01", what should I modify my code or could you tell me a correct way.

Thanks!

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

Don't use CGXDLMSObject. Use CGXDLMSRegister, CGXDLMSData, etc. instead. They will parse data and you don't need to do anything.

Something like this:
CGXDLMSRegister*obj = new CGXDLMSRegister(ln);

BR,
Mikko

NGR0223

4 years 2 months ago

In reply to Hi, by Kurumi

Thank you for your reply.

Thank you for your reply.

I will try to generate the request frame through the method you had mentioned.

However, my question is how should I parse a unsigned char array with the response frame from meter, for example, to verify the intergrity of the response frame and get the payload of it.

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

DLMS is a very complicated protocol and describing it shortly is not possible.
https://www.gurux.fi/DLMSInNutshell

Good thing is that DLMS is very well documented. You can get started if you read the following standard documents.

IEC 62056-47 COSEM transport layers for IPv4 networks
IEC 62056-53 COSEM application layer
IEC 62056-61 OBIS Object identification system

I strongly propose that you use Gurux open source libraries. It will save a lot of time.

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