Failure in Disconnect Request


I was sending a disconnect command by method 'CGXDLMSClient::DisconnectRequest', but nothing happened. I noticed that disconnect command should be sent only if DLMS_CONNECTION_STATE_HDLC is defined.

I believe that this flag must be set up when my app (client side) send an SNRM message in method 'CGXDLMSClient::SNRMRequest'.

I change this method from

ret = CGXDLMS::GetHdlcFrame(m_Settings, DLMS_COMMAND_SNRM, &data, reply);


ret = CGXDLMS::GetHdlcFrame(m_Settings, DLMS_COMMAND_SNRM, &data, reply);

and disconnect command is been sent as I expected.

I would like to know if my comments make sense. Thanks.

Closed (fixed)
Bug report
Evandro Padrao ...
Wed, 01/16/2019 - 19:22
Thu, 01/17/2019 - 09:11


Evandro Padrao Carvalho de Aguiar's picture

Checking the "Gurux DLMS library for ANSI C", the flag DLMS_CONNECTION_STATE_HDLC is set up in the function "cl_parseUAResponse".

Then, I believe that this flag should be set up in the method "CGXDLMS::SNRMRequest". And this flag must be removed in the method "CGXDLMSClient::DisconnectRequest".

Kurumi's picture


You are right. ANSI C++ is not HDLC flag, but it's set on ParseUAResponse. The reason is that connection to the HDLC is not set when SNRMRequest is called. This is fixed and the new version is released.


Kurumi's picture

Status: Active » Closed (fixed)
Evandro Padrao Carvalho de Aguiar's picture

For me sound strange the HDLC flag is set on ParseUAResponse because when 'client side' sends a 'Disconnect Request' (code 0x53) I believe that the HDLC flag must be reset. But, the meter responses a 'UA Request' (code 0x73) and if the 'client side' evaluates the response by ParseUAResponse the HDLC flag will be set again.

Kurumi's picture

Hi Evandro,

This is done because if the meter doesn't accept the client we don't want to send the release.
For this reason, HDLC flag is set on ParseUAResponse.

You are right that HDLC flag should be clear on DisconnectRequest.

We'll change this. New version is released today.


Roberto Sánchez's picture

Hi Mikko,
I was testing the connection and disconnection comand over the relay OBIS( The Java code is:

GXDLMSDisconnectControl relay = new GXDLMSDisconnectControl("");
byte[][] data = relay.remoteReconnect(dlms_client);
GXReplyData r = new GXReplyData();
readDataBlock(data, r);

At the begining it was not working, but after doing some research I realize that one part in the code was causing an error in my data packet. This part of the code is in GXDLMSClient class, in the function:
public final byte[][] method(final Object name, final ObjectType objectType,
final int methodIndex, final Object value,
final DataType dataType)

In the process of buiding the trace for UseLogicalNameReferencing, one can find the calc. for CI, LN, Attribute ID an then there is a section that says: "// Method Invocation Parameters is not used." and the code below, was causing the error in my trace:

if (type == DataType.NONE) { attributeDescriptor.setUInt8(0); }
else { attributeDescriptor.setUInt8(1);}

I deleted this part and now, the command is working as I expected. My question: Is this code valid for some kind of meters, or is this a bug?

Thanks for your help.

Kurumi's picture


This is used for several different meters. Standard says clearly that there is data. If your meter can't handle remoteReconnect where is data part there is an error on the meter.

From Blue Book:
data ::= integer (0)