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.
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.
Hello Mikko,
I hope the holidays went well. I was implementing a client application and I don't want my client to timeout because of the meter's timeout time setted. So what I am trying is sending a keepalive message to the meter before it times out and closes the connection.
But when I do that without making any modifications to gurux.dlms package, only by calling the keepAlive method in the GXDLMSClient class, it throws an exception and just closes the connection and I can not send a message after that.
Here is the bytes sent for keep alive as a request and received response.
-> 7E A0 08 02 21 09 B1 E6 3E 7E
<- 7E A0 08 09 02 21 B1 5F FF 7E
and the connection times out after that and throws an exception.
So I looked into the GXDLMSClient class, keepAlive() method and it is not calling the getKeepAlive() method of the GXDLMSSettings class, rather it is calling the getRecieverReady() method.
public final byte[] keepAlive() {
// There is no need for keep alive in IEC 62056-47.
if (this.getInterfaceType() == InterfaceType.WRAPPER) {
return new byte[0];
}
return GXDLMS.getHdlcFrame(settings, settings.getReceiverReady(), null);
}
I don't know if you have done that on purpose or if it was an error so I changed the implementation of the method to the below code and recompiled and packaged it again and used it.
public final byte[] keepAlive() {
// There is no need for keep alive in IEC 62056-47.
if (this.getInterfaceType() == InterfaceType.WRAPPER) {
return new byte[0];
}
return GXDLMS.getHdlcFrame(settings, settings.getKeepAlive(), null);
}
Changed only settings.getReceiverReady() to settings.getKeepAlive(). Now the connection doesn't timeout but I am facing a header CRC problem in the requests I send to the meter after the keepalive is performed.
Below is the byte that is sent as a keepalive request and the received reply from the meter.
-> 7E A0 08 02 21 09 B1 E6 3E 7E
<- 7E A0 08 09 02 21 D1 59 9C 7E
After the above request and response, the client changes the header CRC of the request messages generated and send to the meter and causing a checksum problem.
Here are the bytes that I generated to read the same object before and after keep-alive is sent to the meter.
before keepalive request, I was able to read from the meter with this request
-> 7E A0 1A 02 21 09 BA FD 22 E6 E6 00 C0 01 C1 00 01 00 00 60 02 0C FF 02 00 71 2A 7E
after keepalive request, the header CRC of the read request is changed and I can not read from the meter, it causes a checksum error
-> 7E A0 1A 02 21 09 DC CD 24 E6 E6 00 C0 01 C1 00 01 00 00 60 02 0C FF 02 00 71 2A 7E
I did not change any inputs or parameters in between requests.
I can not figure out why it is changing the header CRC and I am not sure if I should keep using the keepalive method of the GXDLMSClient class with settings.getReceiverReady() or settings.getKeepAlive() method.
If you please help me figure out what is happening here I would appreciate it.
Thank you in advance.
Sincerely,
Adonay Eshetu
Hi Adonay,
Hi Adonay,
The header checksum is changed because the HDLC sequence number is updated.
All the meters don't support HDLC keepalive. For that reason, we aren't using it anymore.
I propose that you read the logical name of the association view as a keep alive. It'll work with all the meters. Something like this:
GXDLMSAssociationLogicalName item = new GXDLMSAssociationLogicalName();
Read(item, 1);
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thank you for the help, It is working fine now.
Sincerely,
Adonay Eshetu