Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Can We Use DLMS Client and Server With Same Controller

Can we use DLMS client and server with same controller

Forum Rules

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.

By Harshad Patel , 16 June, 2022
Forums
Gurux.DLMS

1. Is it possible to run DLMS client and DLMS server with single controller ?
If yes then is there any example ?

2. Can we generate full frame by giving value to DLMS server ?
Example : Can we generate full frame of voltage by giving value like 230Voltage to DLMS server ?

3. Is there any way to identify request from the response of meter ?
Like if meter send voltage request(1.0.12.7.0.255) response, then is there any way to identify a perticualr response from meter is for voltage

4. Can we get OBIS code in response of meter ?

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

1. Yes you can, but there is no example at the moment. It can be cone in autumn.
2. Yes. You just set the value and the framework handles everything else.
3. No. In DLMS framing there is a sequence counter, but PDU doesn't identify the response.
4. No.

BR,
Mikko

Harshad Patel

4 years 1 month ago

For second number question

For second number question
2. Yes. You just set the value and the framework handles everything else.
Any API or example, means how we can achive this ?
Is there any user guide ?

I am using c library

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

Read those as a start:
https://www.gurux.fi/Gurux.DLMS.Server
https://www.gurux.fi/Gurux.DLMS.microcontrollers

You can see how to create an active power register object from here:
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…

activePowerL1 is using activePowerL1Value as a reference value. When you update the UINT32 activePowerL1Value it's updated automatically for activePowerL1.

You need to call addRegisterObject to initialize it and add object for ALL_OBJECTS list.

BR,
Mikko

Harshad Patel

4 years 1 month ago

I have added changes as below

I have added changes as below
Please can you let me know is it correct or not ?

Firstly I need only voltage related changes. So, I have added Voltage object in const gxObject* ALL_OBJECTS[] as per attached image [AllObject.jpg]

After that I have added voltage object with "svr_InitObjects" as per attached image [svr_InitObjects.jpg]

Next I have init server and client connection. Client got connected successfully with meter.
Please find attached image [ServerClientMeterConnection.jpg]

After that I am trying to generate frame from server based on fixed value of voltage.
But not able to generate frame.
Please find attached image of code [TryingTogetFrameFromValue.jpg].

Image

Harshad Patel

4 years 1 month ago

After that I have added

After that I have added voltage object with "svr_InitObjects" as per attached image [svr_InitObjects.jpg]

Image

Harshad Patel

4 years 1 month ago

Next I have init server and

Next I have init server and client connection. Client got connected successfully with meter.
Please find attached image [ServerClientMeterConnection.jpg]

Image

Harshad Patel

4 years 1 month ago

After that I am trying to

After that I am trying to generate frame from server based on fixed value of voltage.
But not able to generate frame.
Please find attached image of code [TryingTogetFrameFromValue.jpg].

Image

Vitaol

4 years 1 month ago

Hi, I don't fully understand

Hi, I don't fully understand what are you trying to accomplish, but as far as I understand (I’m not related to gurux) svr_handleRequest3 it’s not going to generate a frame from a value.
If you want to read the voltage you should request it from the client, here you have an example:
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…
And then the server must use the method svr_handleRequest to analyze the request and generate the response frame for the voltage.

Harshad Patel

4 years 1 month ago

Inshort I want below

Inshort I want below functionality
Need to run DLMS client and DLMS server in single controller.
By using DLMS client I need to read data from meter.
Lets take an example like I want to read current from meter. So I have send the request to read current from meter using DLMS client library.
Till now its working fine. means able to read the current from meter using DLMS client.
Now I got the response from meter and I have parsed it and get the value of current using GURUX library.

Now i want to pass that current value to DLMS server and need to generate frame.
Can I do that, if yes then , is there any API ?

Vitaol

4 years 1 month ago

If I understand correctly you

If I understand correctly you want to read the value using the client and save the value at the server.
You can pass the value by reference in the addvoltageObject method with the macro GX_UINT32_BYREF and pass it the pointer to the variable where the client store the value.
Example:
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…
In the example the activePowerL1Value variable is passed as reference, this way whe it values is requested it's always updated.

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

Vitaol is correct. You need to implement both the server and the client. When svr_preRead is invoked you need to read value from the meter and server returns that read value.
Value is updated to e->value. You also need to set e->handled = 1.

Check how clock is read and implement it in the same way.
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…
BR,
Mikko

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

A VERY simple example is done in the next week to help you to get started.

BR,
Mikko

Harshad Patel

4 years 1 month ago

Can you please provide link

Can you please provide link for example ?

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

You can use this as a starting point.

https://github.com/Gurux/GuruxDLMS.c/tree/master/GuruxDLMSDataGateway/D…

It converts WRAPPER frames to HDLC frames.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
  • DLMS server - serving multiple similar datasets gathered from multiple meters across distinct logical addresses
More

Who's new

  • cWYHszETmudslY…
  • Aij
  • vondamc1
  • JosephNok
  • IUJbutxeSTSNcNRN
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin