Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Write Data 0.0.94.96.19.255 (Metering Mode) In C#

Write data 0.0.94.96.19.255 (Metering Mode) in C#

By Shekhar, 2 December, 2024
Forums
Gurux.Serial

Dear Sir,

We have to write Metering Mode in 0 to 1 0r 1 to 0 .

byte[] systemTitle = Encoding.Default.GetBytes(textBox_Ser_sys.Text);
byte[] BlockCipherKey = Encoding.Default.GetBytes(textBox3_encription.Text);
byte[] AuthenticationKey = Encoding.Default.GetBytes(textBox2_authentication.Text);
byte[] lls = Encoding.Default.GetBytes(textBox4_lls.Text);
Client = new GXDLMSSecureClient(true, 20, 1, Authentication.Low, textBox4_lls.Text, InterfaceType.HDLC);
Client.Ciphering.Security = Security.AuthenticationEncryption;

Client.Ciphering.SystemTitle = systemTitle;//HexStringToByteArray("71 77 65 72 74 79 75 69");
Client.Ciphering.BlockCipherKey = BlockCipherKey;
Client.Ciphering.AuthenticationKey = AuthenticationKey;
Client.Password = lls;
Client.ChallengeSize = 0x16;
// Client.Standard = Standard.India;
Client.ServiceClass = ServiceClass.Confirmed;
Client.MaxReceivePDUSize = 65535;
Client.UtcTimeZone = true;
//Client.W
Client.ClientAddress = 0x20;
Media = new GXSerial();
GXSerial serial = Media as GXSerial;
serial.PortName = cmbPortName.Text;
serial.BaudRate = 9600;
serial.DataBits = 8;
serial.Parity = System.IO.Ports.Parity.None;
serial.StopBits = System.IO.Ports.StopBits.One;
pack_num = "Port Connecting";
Thread.Sleep(100);
Application.DoEvents();
InitializeConnection();
GXDLMSData data = new GXDLMSData("0.0.94.96.19.255");
object obj2 = Read(data, 2);
GXDeltaUInt8 d1 = new GXDeltaUInt8(1);
data.Value =d1;
byte[][] ddd= Client.Write(data, 2);
//Senting Log
7E A0 2C 03 41 32 9F 9F E6 E6 00 C8 1E 30 00 00
00 02 78 C8 46 9D 5C 2A 60 7D 3C 71 92 7A 7C 85
F2 E5 7A 4D F4 22 42 55 07 47 9F CC BF 7E
//Receiving Log
7E A0 25 41 03 52 E2 C3 E6 E7 00 CC 17 30 00 00
00 03 03 51 D3 20 6D 91 75 29 FD C7 28 07 C4 F1
01 16 18 F5 32 30 7E
Meter not updated with new value

Thanks Advanced

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, Your data type must be…

Hi,

Your data type must be the same as the meter uses.
Read the value and check what data type your meter uses and change GXDeltaUInt8 to the correct data type.
BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, After reading data…

Dear Sir,

After reading data type is Uint8.
we are using same.
when we are using GXDLMSDirector mater has updated .
Unable to understand where are we missing .
Please help us.
Thanks

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, You are not using the…

Hi,

You are not using the same data type.
In your code you are using GXDeltaUInt8, not GXUInt8.
You need to change it.

BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, We are unable to…

Dear Sir,

We are unable to find GXUInt8 only available GXDeltaUInt8.
may i know in version this available ?.
So we just changed by this way but till not updated in meter.

GXByteBuffer buffer = new GXByteBuffer();
buffer.SetUInt8(1);
data.Value = buffer.GetUInt8();
byte[][] ddd= Client.Write(data, 2);
Thank You.

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, You have selected the…

Hi,

You have selected the serial port group and I don't know what programming language you are using. If you are using C# you can do it like this:

data.Value = (byte) 1;
byte[][] ddd= Client.Write(data, 2);

BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, I am using c#…

Dear Sir,

I am using c#.

When we are using GXDLMSDirector .exe meter value updated in meter, log are given below-
send : 00 01 00 30 00 01 00 22 C9 20 30 00 00 00 18 5E
6D E2 60 35 2F 13 C9 73 B1 AE A7 CC AF 4B AE 70
0A 9A B0 3A DE 2B 6F 77 3A 8E
Rec. 00 01 00 01 00 30 00 17 CD 15 30 00 00 00 18 6E
49 76 A0 F8 9C AF E2 54 F5 11 2F 15 33 2C 72
But When i am trying to same with C# meter value not updated, log are below-
send1- 7E A0 63 03 41 10 C1 39 E6 E6 00 60 55 A1 09 06
07 60 85 74 05 08 01 03 A6 0A 04 08 71 77 65 72
74 79 75 69 8A 02 07 80 8B 07 60 85 74 05 08 02
01 AC 0A 80 08 41 41 41 41 31 32 33 34 BE 23 04
21 21 1F 30 00 00 00 0C D8 4F AF F2 B3 8A 29 66
75 19 44 76 CA C8 A4 F9 4D 60 88 B1 0C 96 CE AB
24 6E CE B1 7E
Rec1. 7E A0 56 41 03 30 7E FC E6 E7 00 61 48 A1 09 06
07 60 85 74 05 08 01 03 A2 03 02 01 00 A3 05 A1
03 02 01 00 A4 0A 04 08 47 50 4D 30 30 32 37 38
BE 23 04 21 28 1F 30 00 00 00 18 A3 48 B1 FF 08
BE F7 3D 43 62 74 BE D8 19 E6 EB 39 44 D5 3C E7
92 FF AF FF 84 3D 60 7E
send2 7E A0 2C 03 41 32 9F 9F E6 E6 00 C8 1E 30 00 00
00 0D 35 23 FF DE 8E 73 4D 13 90 D9 C1 38 26 EA
19 B0 C0 14 D9 0E FE FB B1 C8 46 A3 42 7E
Rec2 7E A0 25 41 03 52 E2 C3 E6 E7 00 CC 17 30 00 00
00 19 CF 04 6F B4 87 FC 25 DB 00 14 CB 08 CB 2B
B0 29 82 E3 B8 03 7E

Both Authentication are same only deferent between LLS(C#) and HLS ( GXDLMSDirector) .

We have not getting any type of error but value not updated in meter but when i used GXDLMSDirector value updated .

Please help us how can we resolved this?.

Thanks Advanced
Shekhar

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, I need your block cipher…

Hi,

I need your block cipher key to decrypt the data.
Use the example that I shared with you.

BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, Our block cipher…

Dear Sir,

Our block cipher key=bbbbbbbbbbbbbbbb

LLS key- AAAA1234
HLS key- BBBB1234BBBB1234
HLS FU key- CCCC1234CCCC1234
system title- qwertyui
Authentication & Encryption key- bbbbbbbbbbbbbbbb

We have checked with as per your guideline but meter value not updated
GXDLMSData data = new GXDLMSData("0.0.94.96.19.255");
object obj2 = Read(data, 2);
data.Value =(byte)1;
byte[][] ddd= Client.Write(data, 2);

Thanks Advanced .

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, I can see from your…

Hi,

I can see from your trace that the meter is returning Success.
Everything is working as expected.

BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, We have 2…

Dear Sir,

We have 2 manufacture make meter and both are similar behavior meter updated data by GXDLMSDirector with HLS but meter data not updated by C# .

I think meter support only with HLS , any idea to use HLS instead of LLS in c# code.

Thanks Advanced

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, GXDLMSDirector is made…

Hi,

GXDLMSDirector is made with C#.

You can see the command line arguments for the client example when you select the meter. You need to use those arguments to establish the connection to the meter.

BR,
Mikko

Shekhar

1 year 2 months ago

Dear Sir, May i know any…

Dear Sir,

May i know any refences code for arguments to establish the connection with GXDLMSDirector.

We unable to find example in client example.

Thanks Advanced

Profile picture for user Kurumi

Kurumi

1 year 2 months ago

Hi, The connection…

Hi,

The connection parameters depend on the used meter model.

If you can connect with GXDLMSDirector you can see the correct command line arguments to the client example when you select the meter in GXDLMSDirector.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Sun, 02/01/2026 - 19:47
    gurux.dlms.cpp 9.0.2602.0101
  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87

New forum topics

  • Asynchronous support in Gurux DLMS stack (.NET)?
  • Multiple meter loop On OFF Problem
  • Python GXDLMSTranslator
  • Issue with KWH Value Reading Using Gurux DLMS Library.
  • CEWE Prometer 100
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin