Difference between python and C#

2 posts / 0 new
Last post
SgmUsr
Difference between python and C#

Hello to everyone,

I'm using Gurux Python and I'm trying to make the first serial communication only with snrmRequest() and aarqRequest().

With c# I'm setting the public client like this:
this.ClientPublic = new GXDLMSClient();
this.ClientPublic.UseLogicalNameReferencing = true;
this.ClientPublic.InterfaceType = InterfaceType.HDLC;
this.ClientPublic.ClientAddress = 16;
this.ClientPublic.Password = GXCommon.HexToBytes("xxxxx");
this.ClientPublic.Authentication = Authentication.None;
this.ClientPublic.ServerAddress = GXDLMSClient.GetServerAddress(1, 16);
this.ClientPublic.ProposedConformance = Conformance.GeneralProtection | Conformance.Get |
Conformance.Set | Conformance.Action;
this.ClientPublic.CtoSChallenge = GXCommon.HexToBytes("CPLc2s00");
this.ClientPublic.Standard = Standard.Italy;
and the aarqRequest() works;
- 7E A0 08 02 21 21 93 05 D1 7E
- 7E A0 21 21 02 21 73 3F 41 81 80 14 05 02 01 00 06 02 01 00 07 04 00 00 00 01 08 04 00 00 00 01 69 6D 7E
- 7E A0 2C 02 21 21 10 17 2A E6 E6 00 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 00 19 04 00 BD BC 7E
- 7E A0 44 21 02 21 30 47 B6 E6 E7 00 61 35 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 A4 0A 04 08 34 35 11 02 10 41 01 03 BE 10 04 0E 08 00 06 5F 1F 04 00 40 00 10 00 E5 00 07 31 ED 7E

I'm trying to configure in the same way the python library but the aarqRequest() doesn't work:
self.clientPublic = GXDLMSClient()
self.clientPublic.clientAddress = 0x10
self.clientPublic.proposedConformance = Conformance.GENERAL_PROTECTION | Conformance.GET | Conformance.SET | Conformance.ACTION
##self.clientPublic.useLogicalNameReferencing = True
self.clientPublic.interfaceType = InterfaceType.HDLC
self.clientPublic.authentication = Authentication.NONE
self.clientPublic.ctoSChallenge = 'xxxxx'
self.clientPublic.password = 'xxxxx'
self.clientPublic.serverAddress = GXDLMSSecureClient.getServerAddress2(1, 16, 0)
self.clientPublic.useLogicalNameReferencing = True

- 7ea0080221219305d17e
- 7ea021210221733f418180140502010006020100070400000001080400000001696d7e
- 7ea02c022121320728e6e600601da109060760857405080101be10040e01000000065f1f0400400019ffff652b7e
- 7ea00821022197e0d17e

What is the difference between these 2 configuration?

Thanks

Kurumi
Kurumi's picture

Hi,

HDLC sequence number is invalid in AARQ request. It should be 0x10 and it's 0x10 in Python. I just checked your code and it worked like expected. You must modify the source code and for this reason HDLC sequence number is wrong.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi