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. How To Use Object Methods?

How to use object methods?

Profile picture for user Frank
By Frank, 10 March, 2025
Forums
General discussion

Hi

I have been exploring the library and I am wondering how to use the object methods.

Using a GXDLMSRegister object as am example, it has a Reset method that takes a gxdlmsclient input. i tried to pass a secure client to it and nothing happened. I tried reading after running the method but it throws unacceptable frame error.

I can also see that it returns a byte[][]. Do I have to write this bytes to the meter? but the write method in the communicator class takes an gxdlmsobject and attribute index as an input.

i tried to follow the director code but its a little hard to find the button binding because the selectedview is dynamically generated by which i meant that the ui is not created in the designer so its a bit hard to follow the ui bindings.

Lastly, to the dev team, I've been learning a lot about coding just from reviewing your library/products. Thanks for being FOSS as well as for being responsive!!

Profile picture for user Frank

Frank

8 months ago

Hi So, i've tried debugging…

Hi

So, i've tried running the director in debug mode and was able to somewhat get how it is done??

GXDLMSSecureClient client = dev.Comm.client;

GXActionArgs ve = new GXActionArgs(RegisterObject, 1);
ve.Client = client;
dev.KeepAliveStop();
ve.Action = ActionType.Action;
ve.Value = (sbyte)0;

GXReplyData reply = new GXReplyData();
if (ve.Index < 0 || ve.Client.CanInvoke(ve.Target, ve.Index))
{
dev.Comm.MethodRequest(ve.Target, ve.Index, ve.Value, ve.Text, reply);
}
object data = dev.Comm.ReadValue(ve.Target, ve.Index);

im wondering how i can utilize the built in methods in the objects tho since it is already there

object ob = RegisterObject.Reset(client);

Edit:

so far this is the implementation that i have mocked up

GXDLMSSecureClient client = GXDevice.Comm.client;
GXReplyData reply = new GXReplyData();
GXDevice.KeepAliveStop();

byte[][] ob = RegisterObject.Reset(client);
string str = string.Format("Method object {0}, interface {1}", RegisterObject.LogicalName, RegisterObject.ObjectType);
foreach (byte[] it in ob)
{
reply.Clear();
GXDevice.Comm.ReadDataBlock(it, str, 1, reply);
}
//GXDevice.Comm.ReadValue(RegisterObject, 2);
GXDevice.Comm.Read(null, RegisterObject, false);
RefreshData();
GXDevice.KeepAliveStart();

maybe there is a more straightforward way for this?

Profile picture for user Kurumi

Kurumi

8 months ago

Hi, the method generates the…

Hi,

the method generates the bytes and you need to send the generated bytes to the meter like this:

GXReplyData reply = new GXReplyData();
GXDLMSRegister r = new GXDLMSRegister();
byte[][] data = r.Reset(client);
ReadDataBlock(data, reply);

BR,
Mikko

Profile picture for user Frank

Frank

8 months ago

hi mikko thanks for the…

hi mikko

thanks for the reply^^
that is what i do now, thank you!

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 10/29/2025 - 08:51
    gurux.dlms.c 9.0.2510.2901
  • Thu, 10/16/2025 - 09:59
    gurux.dlms.java 4.0.83
  • Wed, 10/08/2025 - 10:21
    gurux.dlms.c 9.0.2510.0801
  • Fri, 09/26/2025 - 10:02
    gurux.dlms.cpp 9.0.2509.2601
  • Fri, 09/26/2025 - 09:45
    gurux.dlms.c 9.0.2509.2601

New forum topics

  • Guidance on using the source codes
  • How to get/convert user readable format data from readRowsByRange
  • Insufficient memory to continue the execution of the program.
  • The client instance code failed to connect to the electricity meter for authentication
  • Unable to Release Request when closing connection with meter.
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin