using Gurux.DLMS.Push.Listener.Example.python with a Siemens IM 350 meter (via optical reader).
i get data from serial:
New data is received. COM3:7E
New data is received. COM3:A0 7B CF 00 02 00 23 13 62 B1 E6 E7 00 DB 08 53 4D 53 67 70 04 3E E7 61 20 00 54 70 3F 83 EC DE 75 78 F1 4E 0C 87 E3 35 21 0E 30 17 23 8E 5F A5 01 6D 66 5E AE 1F 34 77 B9 B5 87 D9 E5 57 3B 0B 3E 4E C3 37 AE 9A 39 46 47 3A 25 25 13 52 89 18 1A D5 5C CC A8 B1 9C 5C 05 A4 BD 5D 01 5B 72 16 1E 46 A2 25 28 D2 D7 E4 90 41 67 8D A6 D0 95 92 7B 0C 7B B3 A7 7D 37 D8 8C 44 15 7E
but this data cant be parsed as it is somehow splitted: first received 0x7e is missing on second line
if a do an e.data.insert(0, 0x7e) or comment self.reply.clear() (onReceived method, line 131) in the sample code (so do a data concat), the data can be xml-parsed correctly - and i get the right data.
so is this maybe a configuration setting to not omit first 0x7E byte ?
i know there is a eop setting, currently set for HDLC to 0x7E, that would explain the split - but if i change the eop to something else i always get one message data with 0x7E only and a second data line with the rest of the bytes...
All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.
New data is received message shown data that is read from the serial port.
Received bytes are saved for the receiver buffer and that buffer is used to parse the data after all the bytes are received. Because the data is encrypted, you need to set ciphering settings (block cipher and authentication keys) before the data can be parsed.
>>> All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.
yea correct, but there is a 0x7E at the begin and a 0x7E at the end of the frame: 0x7e ..... 0x7e
i think the sample push code do a wrong clear of the self.reply - so it will not concat bytes:
currently:
try:
if not self.client.getData(self.reply, data, self.notify):
self.reply.clear()
#If all data is received.
if self.notify.complete:
if not self.notify.isMoreData():
#Show received data as XML.
working with modification:
try:
if not self.client.getData(self.reply, data, self.notify):
#self.reply.clear()
#If all data is received.
if self.notify.complete:
self.reply.clear()
if not self.notify.isMoreData():
#Show received data as XML.
also in the Gurux.DLMS.Net GXDLMSPushListener.cs example the clearing is done AFTER notify.IsComplete - and not before
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
I believe that you are right and that line should be lower. There might be a bug in the Python code. This is tested next week. Let's wait for the results.
Hi,
Hi,
All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.
New data is received message shown data that is read from the serial port.
Received bytes are saved for the receiver buffer and that buffer is used to parse the data after all the bytes are received. Because the data is encrypted, you need to set ciphering settings (block cipher and authentication keys) before the data can be parsed.
BR,
Mikko
All the data is not
>>> All the data is not necessarily to come simultaneously in one frame and there might be 0x7E in the middle of the frame. For that reason, data is read until 0x7E is received.
yea correct, but there is a 0x7E at the begin and a 0x7E at the end of the frame: 0x7e ..... 0x7e
i think the sample push code do a wrong clear of the self.reply - so it will not concat bytes:
currently:
try:
if not self.client.getData(self.reply, data, self.notify):
self.reply.clear()
#If all data is received.
if self.notify.complete:
if not self.notify.isMoreData():
#Show received data as XML.
working with modification:
try:
if not self.client.getData(self.reply, data, self.notify):
#self.reply.clear()
#If all data is received.
if self.notify.complete:
self.reply.clear()
if not self.notify.isMoreData():
#Show received data as XML.
also in the Gurux.DLMS.Net GXDLMSPushListener.cs example the clearing is done AFTER notify.IsComplete - and not before
client.GetData(reply, data, notify);
// If all data is received.
if (notify.IsComplete)
{
reply.Clear();
what about the start 0x7E ?
Hi,
Hi,
I believe that you are right and that line should be lower. There might be a bug in the Python code. This is tested next week. Let's wait for the results.
BR,
Mikko
Thank you for your prompt
Thank you for your prompt reply !!!
Hi,
Hi,
This is fixed for the listener example and your name is added for the CREDITS.md.
BR,
Mikko
Wow thank you !
Wow thank you !