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. Unable To Read Invocation Counter(0.0.43.1.2.255).

Unable to read Invocation Counter(0.0.43.1.2.255).

By pradson , 28 April, 2023
Forums
Gurux.DLMS

Hi Mikko,

I am trying to read smart meter using Gurux.DLMS.cpp-master example application. I am unable to read innovation counter as mentioned below. Kindly find the trace log as well.

Kindly suggest.

// Trace log------------
TX: 16:47:51 00 01 00 10 00 01 00 1F 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 1E 5D FF FF
RX: 16:47:52 00 01 00 01 00 10 00 2B 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 03 E8 00 07
TX: 16:47:53 00 01 00 10 00 01 00 0D C0 01 81 00 01 00 00 2B 01 02 FF 02 00

//----------------------------------------------------------

std::string ln;
ln.append(m_InvocationCounter);
CGXDLMSData d(ln);
std::string str;
if ((ret = Read(&d, 2, str)) == 0)
{
m_Parser->GetCiphering()->SetInvocationCounter(1 + d.GetValue().ToInteger());
}

Thanks,
Pradson

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, You establish the…

Hi,

You establish the connection to the meter and read the invocation counter, but the meter reply is missing from the hex trace so I don't know what the meter returns.

BR,
Mikko

pradson

3 years 1 month ago

Hi Mikko, Thanks a lot for…

Hi Mikko,

Thanks a lot for reply.

I am able to connect the smart meter using DLMS Director tool. I have attached a screenshot of tool herewith. But I am unable to connect using C++ example application. I have filled the connection variable as mentioned below. The socket connection is succeeded but when read invocation counter inside the "comm.InitializeConnection()" method is get hanged. Please find the trace log as well-

Kindly guide me how should I fill the connection parameter for the same.

//************************** Trace log *************************
TX: 06:03:06 00 01 00 20 00 01 00 34 60 32 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 06 80 04 6C 6E 74 31 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF
RX: 06:03:07 00 01 00 01 00 20 00 21 61 1F A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 01 A3 05 A1 03 02 01 0D BE 06 04 04 0E 01 06 00

/*********************** Part of Example application start ****************************/
CGXDLMSSecureClient cl(true, 32, 1, DLMS_AUTHENTICATION_LOW, "lnt1", DLMS_INTERFACE_TYPE_WRAPPER);
cl.GetCiphering()->SetSecuritySuite(DLMS_SECURITY_SUITE_V0);
cl.GetCiphering()->SetSecurity(DLMS_SECURITY_AUTHENTICATION_ENCRYPTION);

systemTitle = "LTCLIENT";
authenticationKey = "1234123412341234";
blockCipherKey = "1234123412341234";
invocationCounter = "0.0.43.1.2.255";

CGXByteBuffer bb;
if (systemTitle != NULL)
{
bb.Clear();
bb.SetHexString(systemTitle);
cl.GetCiphering()->SetSystemTitle(bb);
}
if (authenticationKey != NULL)
{
bb.Clear();
bb.SetHexString(authenticationKey);
cl.GetCiphering()->SetAuthenticationKey(bb);
}
if (blockCipherKey != NULL)
{
bb.Clear();
bb.SetHexString(blockCipherKey);
cl.GetCiphering()->SetBlockCipherKey(bb);
}

autoIncreaseInvokeID = true;
cl.GetCiphering()->SetSecurity(security);
cl.SetAutoIncreaseInvokeID(autoIncreaseInvokeID);

CGXCommunication comm(&cl, 5000, trace, invocationCounter);

if ((ret = comm.Connect("1042:0049:2024:bb95:0000:0000:0000:0002", 4059)) != 0) {
printf("Couldn't connect to the device... %s.\r\n", CGXDLMSConverter::GetErrorMessage(ret));
}
if ((ret = comm.InitializeConnection()) != 0) {
printf("Connection initialization failed %s.\r\n", CGXDLMSConverter::GetErrorMessage(ret));
comm.Close();
return 0;
}
/*********************** Example application End ****************************/

Thanks & Regards,
Pradson

Image

pradson

3 years 1 month ago

I am awaiting for a response…

I am awaiting for a response. Kindly help me regarding the same.

Thanks,

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi Pradson, Your connection…

Hi Pradson,

Your connection is not established using cippering. You have give systemTitle, authenticationKey and blockCipherKey in ASCII format. You need to use AddString instead of SetHexString.

BR,
Mikko

pradson

3 years 1 month ago

Hi Mikko, Thanks for reply…

Hi Mikko,

Thanks for reply.

I had also tried earlier as you said but I was unable to read and update "Invocation Counter". I have changed the method from "SetHexString" to "AddString" as I mentioned below-

Anything else which I should mention. Please suggest.

/////////// Code /////////////////
if (systemTitle != NULL)
{
bb.Clear();
bb.AddString(systemTitle);
cl.GetCiphering()->SetSystemTitle(bb);
}
if (authenticationKey != NULL)
{
bb.Clear();
bb.AddString(authenticationKey);
cl.GetCiphering()->SetAuthenticationKey(bb);
}
if (blockCipherKey != NULL)
{
bb.Clear();
bb.AddString(blockCipherKey);
cl.GetCiphering()->SetBlockCipherKey(bb);
}
////////////////////////////////////////////////////////////////////////////

Thanks,
Pradson

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, Try to read the meter…

Hi,

Try to read the meter with the client example and then check what are the differences between the client example and your code.

BR,
Mikko

pradson

3 years 1 month ago

Hi, I have checked with the…

Hi,

I have checked with the client example. I am facing same problem "inside the UpdateFrameCounter() method and hanged when read invocation counter".

Kindly find the trace content.

///////////////// Trace content //////////////////
TX: 16:44:24 00 01 00 10 00 01 00 1F 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 1E 1D FF FF
RX: 16:44:24 00 01 00 01 00 10 00 2B 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 03 E8 00 07
TX: 16:44:24 00 01 00 10 00 01 00 0D C0 01 81 00 01 00 00 2B 01 02 FF 02 00
/////////////////////////////////////////////////////////

Thanks,
Pradson

Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi Pradson, I don't know why…

Hi Pradson,

I don't know why your meter is not reply when you read the invocation counter. Everything looks correct. Check your parameters. I believe that one of them is different than the meter expects.

BR,
Mikko

pradson

3 years 1 month ago

HI Mikko, Thanks for reply…

HI Mikko,

Thanks for reply.

Even, I have tried with "GuruxDLMSClientExample.exe" application with the fallowing argument list "-h 9522:0122:4022:24bb:0000:0000:0000:0002 -p 4059 -i WRAPPER -c 32 -a XXXX -P lnt1 -C AuthenticationEncryption -T XXXXXXXXXX -A XXXXXXXXXX -B XXXXXXXXXX -v 0.0.43.1.2.255 -I -t Verbose". The socket connection is succeeded but it freezes when read the invocation counter at this method "if ((ret = Read(&d, 2, str)) == 0)" under the UpdateFrameCounter() method of the InitializeConnection() method.

I am sharing the code snippet where it freezes-

//------------------ part of GuruxDLMSClientExample ---------------
std::string ln;
ln.append(m_InvocationCounter);
CGXDLMSData d(ln);
std::string str;
if ((ret = Read(&d, 2, str)) == 0) // NOTE: at this point it freezes.
{
m_Parser->GetCiphering()->SetInvocationCounter(1 +
d.GetValue().ToInteger());
}
printf("Invocation counter: %li\n", m_Parser->GetCiphering()->GetInvocationCounter());
reply.Clear();
Disconnect();
//----------------------------------------

I have tried with same parameter through DLMSDirector tool. It connects to the meter and able to get association view as well. Even, I can read the desired object.

I am sharing the TRACE log of the "GuruxDLMSClientExample"-
UpdateFrameCounter
TX: 11:22:07 00 01 00 10 00 01 00 1F 60 1D A1 09 06 07 60 85 74 05 08 01 01 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 40 1E 5D FF FF
RX: 11:22:09 00 01 00 01 00 10 00 2B 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 00 10 03 E8 00 07
TX: 11:22:33 00 01 00 10 00 01 00 0D C0 01 81 00 01 00 00 2B 01 02 FF 02 00

I am using latest version of "GuruxDLMSClientExample". I am using same example for IPv4 and IPv6. There is no any differences there?
Please suggest the solution. I have been trying for a long.

I have shared the smart meter details through email. Kindly check and revert about the issue.

Thanks,
Pradson

Image
Profile picture for user Kurumi

Kurumi

3 years 1 month ago

Hi, Can you share the…

Hi,

Can you share the communication log from the GXDLMSDirector? Only four first rows are enough so I can the correct settings for you.

BR,
Mikko

pradson

3 years 1 month ago

Hi, Kindly find the logs- 17…

Hi,

Kindly find the logs-

17:50:41
<glo_GetRequest Value="30000009229B6D1CEE3B7A212C1D0D24882C8BD0EA79B7F3D21E1BF9569B" />

17:50:42
<glo_GetResponse Value="3000001C8CE274C1C0300686559C7E92EE1C3E342AC7CEE55DA284DCFFC434C9B06AAD" />

17:51:32
<glo_GetRequest Value="3000000923F58BF1A1E61C9BF969038F3BF77530E7082BBE64D64E1A2D53" />

17:51:33
<glo_GetResponse Value="3000001C8D2692C974AF85FE2B204170E6A2939F951D9CD17DF4BEBD4B" />

17:52:22
<glo_GetRequest Value="300000092493A7EE9BCF640FE6CE19390DCDE3D001308D64C138F0E7000B" />

17:52:23
<glo_GetResponse Value="3000001C8E400FCAAD4F02D88F8D056563B3241C6848576DA0437F6228" />

Thanks,
Pradson

pradson

3 years 1 month ago

Hi Mikko, Kindly check the…

Hi Mikko,

Kindly check the logs and suggest the solution asap.

Thanks,
Pradson

pradson

3 years 1 month ago

Hi, I am awaiting for your…

Hi,

I am awaiting for your response.

Thanks,
Pradson

pradson

3 years ago

I am awaiting for your…

I am awaiting for your response.

Thanks,

pradson

3 years ago

Hi Mikko, Please help…

Hi Mikko,

Please help regarding the same.

Thanks & Regards,
Pradson

pradson

3 years ago

I am awaiting for your…

I am awaiting for your response.

Thanks,
Pradson

pradson

3 years ago

I am still awaiting for…

I am still awaiting for your response.

Thanks,

Profile picture for user Kurumi

Kurumi

3 years ago

Hi Pradson, I need the first…

Hi Pradson,

I need the first rows as hex format. Also your meter is not using pre-established connections so you need to add those rows, not the reading.

BR,
Mikko

pradson

3 years ago

Hi, Thanks for reply. I have…

Hi,

Thanks for reply.

I have shared the logs already-

17:50:41
<glo_GetRequest Value="30000009229B6D1CEE3B7A212C1D0D24882C8BD0EA79B7F3D21E1BF9569B" />

17:50:42
<glo_GetResponse Value="3000001C8CE274C1C0300686559C7E92EE1C3E342AC7CEE55DA284DCFFC434C9B06AAD" />

17:51:32
<glo_GetRequest Value="3000000923F58BF1A1E61C9BF969038F3BF77530E7082BBE64D64E1A2D53" />

17:51:33
<glo_GetResponse Value="3000001C8D2692C974AF85FE2B204170E6A2939F951D9CD17DF4BEBD4B" />

17:52:22
<glo_GetRequest Value="300000092493A7EE9BCF640FE6CE19390DCDE3D001308D64C138F0E7000B" />

17:52:23
<glo_GetResponse Value="3000001C8E400FCAAD4F02D88F8D056563B3241C6848576DA0437F6228" />

Thanks,
Pradson

Profile picture for user Administrator

Administrator

3 years ago

Hi, The meter expects that…

Hi,

The meter expects that the service class is confirmed. Because this is the default service class for other programming languages it's changed to the same.

Get the latest version from GitHub and re-build your app.

BR,
Mikko

pradson

3 years ago

Hi Mikko, Thanks a lot. Now…

Hi Mikko,

Thanks a lot. Now its working.

Thanks,
Pradson

  • 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