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. GXDLMS.cpp MultipleBlocks Support

GXDLMS.cpp MultipleBlocks support

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 vgpetrovprog , 17 June, 2021
Forums
Gurux.DLMS

Hi !
In GXDLMS.cpp MultipleBlocks support must be added for DLMS_COMMAND_METHOD_REQUEST and DLMS_COMMAND_METHOD_RESPONSE.

I replaced in GXDLMS.cpp CGXDLMS::GetLNPdu
as in the comment // Change Request type if Set request and multiple blocks is needed.
if( p.GetCommand() == DLMS_COMMAND_SET_REQUEST )
by
if( p.GetCommand() == DLMS_COMMAND_SET_REQUEST || p.GetCommand() == DLMS_COMMAND_METHOD_REQUEST )

and as in the comment // Change request type If get response and multiple blocks is needed.
if (p.GetCommand() == DLMS_COMMAND_GET_RESPONSE )
by
if (p.GetCommand() == DLMS_COMMAND_GET_RESPONSE || p.GetCommand() == DLMS_COMMAND_METHOD_RESPONSE )

But after the transmission of the first block, the response is 97 - frame rejection.
What code do I need to add?

Thank you in advance.

Profile picture for user Kurumi

Kurumi

4 years 11 months ago

Hi,

Hi,

It needs more than just that. Action must parse and generate APDUs differently. Do you have an example from the message(s) that you want to handle?

BR
Mikko

vgpetrovprog

4 years 11 months ago

Yes. Dump response.

Yes. Dump response.
response
7E A8 87 61 02 11 FA E7 08 E6 E7 00 C7 02 81 00 00 00 00 01 00 82 03 F4 01 00 01 15 01 06 09 0C 07 E5 05 14 04 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 AF 54 05 00 00 AA D4 10 05 B4 01 06 09 0C 07 E5 05 15 05 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 02 D9 42 05 00 00 AC 16 10 05 B4 01 06 09 0C 07 E5 05 16 18 EA 7E
7E A0 08 02 11 61 D1 DB 70 7E
7E A8 87 61 02 11 FC D1 6D 06 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 BE 5A 05 00 00 AD 58 10 05 B4 01 06 09 0C 07 E5 05 17 00 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 C5 E2 05 00 00 AE 9E 10 05 B4 01 06 09 0C 07 E5 05 18 01 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 87 75 7E
7E A0 08 02 11 61 F1 D9 51 7E
7E A8 87 61 02 11 FE C3 4E 00 05 00 04 CD 5E 05 00 00 AF E2 10 05 B4 01 06 09 0C 07 E5 05 19 02 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 D4 F0 05 00 00 B1 28 10 05 B4 01 06 09 0C 07 E5 05 1A 03 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 DC 68 05 00 00 B2 6A 10 05 B4 01 06 09 0C 07 E5 05 1B 04 00 00 00 00 19 1D 7E
7E A0 08 02 11 61 11 D7 B6 7E
7E A8 87 61 02 11 F0 BD A7 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 E3 DC 05 00 00 B3 AC 10 05 B4 01 06 09 0C 07 E5 05 1C 05 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 EB 4C 05 00 00 B4 EE 10 05 B4 01 06 09 0C 07 E5 05 1D 06 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F2 E5 8D 7E
7E A0 08 02 11 61 31 D5 97 7E
7E A8 87 61 02 11 F2 AF 84 B4 05 00 00 B6 2E 10 05 B4 01 06 09 0C 07 E5 05 1E 00 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F4 7E 05 00 00 B7 66 10 05 B4 01 06 09 0C 07 E5 05 1F 01 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F4 D0 05 00 00 B8 9C 10 05 B4 01 06 09 0C 07 E5 06 01 02 00 00 00 00 00 00 00 0A 10 4F 44 7E
7E A0 08 02 11 61 51 D3 F4 7E
7E A8 87 61 02 11 F4 99 E1 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F5 22 05 00 00 B9 D2 10 05 B4 01 06 09 0C 07 E5 06 02 03 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F5 72 05 00 00 BB 04 10 05 B4 01 06 09 0C 07 E5 06 03 04 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F5 C4 05 00 00 BC BE FF 7E
7E A0 08 02 11 61 71 D1 D5 7E
7E A8 87 61 02 11 F6 8B C2 32 10 05 B4 01 06 09 0C 07 E5 06 04 05 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F6 14 05 00 00 BD 5E 10 05 B4 01 06 09 0C 07 E5 06 05 06 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 F7 18 05 00 00 BE 8E 10 05 B4 01 06 09 0C 07 E5 06 06 00 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 02 DC 7E
7E A0 08 02 11 61 91 DF 32 7E
7E A8 87 61 02 11 F8 F5 2B 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 04 FB 8A 05 00 00 BF D0 10 05 B4 01 06 09 0C 07 E5 06 07 01 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 03 20 50 10 3E 68 10 05 B4 01 06 09 0C 07 E5 06 08 02 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 30 31 33 35 0F 00 05 00 05 04 72 05 00 00 C2 50 10 05 B4 01 06 09 F9 EC 7E
7E A0 08 02 11 61 B1 DD 13 7E
7E A0 25 61 02 11 FA F3 D5 0C 07 E5 06 09 03 00 00 00 00 00 00 00 0A 10 49 4E 43 32 33 34 30 30 34 32 34 31 51 DD 7E
7E A0 14 02 11 61 DE 5C 4B E6 E6 00 C3 02 81 00 00 00 01 1D D7 7E
7E A0 08 61 02 11 97 F5 71 7E

Profile picture for user Kurumi

Kurumi

4 years 11 months ago

Hi,

Hi,

Data is not correct. There is one byte too much. DataBlock-SA is invalid.

C702
81 //Invoke ID and priority.
00 //last-block
00000001 //block-number
00 //This is not needed.
8203F4.... raw-data

We'll test this and I'll let you know tomorrow.

BR,
Mikko

vgpetrovprog

4 years 11 months ago

C7 - METHOD_RESPONSE

C7 - METHOD_RESPONSE
02 - RequestType
81 - InvokeId
00 - Is not last block
00 00 00 01 - BlockIndex
00 - Status
82 - count < 0x10000
03 F4 - count 1012
01 00 01 ... - array

00 - Status - the code that this 0 adds
GXDLMS.cpp CGXDLMS::GetLNPdu
// Add status if reply.
if (p.GetStatus() != 0xFF)
{
if (p.GetStatus() != 0 && p.GetCommand() == DLMS_COMMAND_GET_RESPONSE)
{
reply.SetUInt8(1);
}
reply.SetUInt8(p.GetStatus());
}

Profile picture for user Kurumi

Kurumi

4 years 11 months ago

Hi,

Hi,

You are right. It's the status code. This seems to be quite easy to add. We try to release this on Monday.

BR,
Mikko

Profile picture for user Kurumi

Kurumi

4 years 11 months ago

Hi,

Hi,

I have asked this from DLMS UA. According to standard status is not in the method response.
In my mind, it should be there.

BR,
Mikko

vgpetrovprog

4 years 11 months ago

Hi !

Hi !

Whether this status is necessary or not - I don't know.
I see a problem in receiving the second block.
The client (not Gurux) receives the first block and requests the second block.
7E A0 14 02 11 61 DE 5C 4B E6 E6 00 C3 02 81 00 00 00 01 1D D7 7E

But Gurux responds in the negative 97 - frame rejection.
7E A0 08 61 02 11 97 F5 71 7E

See the last two lines of the dump.

Profile picture for user Kurumi

Kurumi

4 years 11 months ago

Hi,

Hi,

This is the problem that I was talking about. The status code is missing from the action response. There is no way to report if the block number is wrong. At the moment your meter adds the status code, but the DLMS standard says that there is no status code. Parsing will fail because of that.

BR,
Mikko

vgpetrovprog

4 years 11 months ago

Pardon me.

Pardon me.
I asked the question badly.
I need to explain to you.

Need to transfer the response (METHOD_RESPONSE) using GURUX.CPP.
I replaced in GXDLMS.cpp CGXDLMS::GetLNPdu
as in the comment // Change request type If get response and multiple blocks is needed.
if (p.GetCommand() == DLMS_COMMAND_GET_RESPONSE )
by
if (p.GetCommand() == DLMS_COMMAND_GET_RESPONSE || p.GetCommand() == DLMS_COMMAND_METHOD_RESPONSE )

GURUX successfully generates and transmits (odd lines) C7 METHOD_RESPONSE
and receives answers (even lines).
See the dump in the post above.

The first block is successfully transmitted.
And the second block is not transmitted.
The client (not Gurux) receives the first block.
7E A0 14 02 11 61 DE 5C 4B E6 E6 00 C3 02 81 00 00 00 01 1D D7 7E

GURUX responds in the negative 97 - frame rejection.
7E A0 08 61 02 11 97 F5 71 7E

This is the problem.
How to fix the code so that GURUX would pass the second block?

I replaced in GXDLMS.cpp CGXDLMS::GetLNPdu
as in the comment // Change Request type if Set request and multiple blocks is needed.
if( p.GetCommand() == DLMS_COMMAND_SET_REQUEST )
by
if( p.GetCommand() == DLMS_COMMAND_SET_REQUEST || p.GetCommand() == DLMS_COMMAND_METHOD_REQUEST )

But this is not enough.

vgpetrovprog

4 years 10 months ago

Hi.

Hi.
I have compared the requests DLMS_COMMAND_GET_REQUEST and DLMS_COMMAND_METHOD_REQUEST.

7E A0 14 02 11 61 DE 5C 4B E6 E6 00 C3 02 81 00 00 00 01 1D D7 7E
C3 - METHOD_REQUEST
02 - DLMS_GET_COMMAND_TYPE_NEXT_DATA_BLOCK
81
00 00 00 01
1D D7 7E

The function CGXDLMSLNCommandHandler::HandleMethodRequest
does not handle the type DLMS_GET_COMMAND_TYPE_NEXT_DATA_BLOCK.
Reads Attribute ID as for the type DLMS_GET_COMMAND_TYPE_NORMAL.
Here is the error code DLMS_ERROR_CODE_OUTOFMEMORY.
And forming a response DLMS_COMMAND_UNACCEPTABLE_FRAME.
7E A0 08 61 02 11 97 F5 71 7E

To handle the type DLMS_GET_COMMAND_TYPE_NEXT_DATA_BLOCK
correctly you need to change the function CGXDLMSLNCommandHandler::HandleMethodRequest
like the function CGXDLMSLNCommandHandler::HandleGetRequest.

Profile picture for user Kurumi

Kurumi

4 years 10 months ago

Hi,

Hi,

This is implemented and it's in the testing phase. It's released at the beginning of August.

BR,
Mikko

vgpetrovprog

4 years 9 months ago

Hi.

Hi.

Can I get a test version of the library ?

Profile picture for user Kurumi

Kurumi

4 years 9 months ago

HI,

HI,

Only our clients can access the test versions. This is released this week.

BR,
Mikko

vgpetrovprog

4 years 6 months ago

Hi.

Hi.
Unfortunately, this new functionality is not added to the examples:
GuruxDLMSServerExample and GuruxDLMSClientExample.
For use, I need a simple example.
Do you have examples?

  • 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