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. Forums
  3. Directly Reading An OBIS Code Seems To Be Not Working [C++]

Directly reading an OBIS code seems to be not working [C++]

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 amjaber , 19 April, 2018
Forums
General discussion

Hello,

I am using you C++ implementation to read some DLMS meters I have around. I can read an OBIS code with FindByLn successfully, but not without it. Here a snippet of the code I am using for the both cases:

if ((ret = comm.InitializeConnection()) == 0
&& (ret = comm.GetAssociationView()) == 0)
{
std::string reply;
CGXDLMSRegister r("0.0.1.0.0.255");
objectsToRead = "0.0.1.0.0.255";
// objectsToRead = "1.0.9.8.7.255"; // voltage from Standards OBIS codes
CGXDLMSObject o(DLMS_OBJECT_TYPE_ALL, objectsToRead);
std::cout << "Reading directly:" << "\n";
if ( (ret = comm.Read(&o, 3, reply)) == DLMS_ERROR_CODE_OK) {
std::cout << "reply: " << reply << "\n";
} else {
std::cout << "ret: " << ret << "\n";
}
if ( (ret = comm.Read(&o, 2, reply)) == DLMS_ERROR_CODE_OK) {
std::cout << "reply: " << reply << "\n";
} else {
std::cout << "ret: " << ret << "\n";
}

std::cout << "\n";
// Using FindByLN
CGXDLMSObject* obj = cl.GetObjects().FindByLN(DLMS_OBJECT_TYPE_ALL, objectsToRead);
std::cout << "Reading with FindByLn:" << "\n";
if ( (ret = comm.Read(obj, 3, reply)) == DLMS_ERROR_CODE_OK) {
std::cout << "reply: " << reply << "\n";
} else {
std::cout << "ret: " << ret << "\n";
}
if ( (ret = comm.Read(obj, 2, reply)) == DLMS_ERROR_CODE_OK) {
std::cout << "reply: " << reply << "\n";
} else {
std::cout << "ret: " << ret << "\n";
}
}

And here is the output:
InitializeConnection
GetAssociationView
Reading directly:
ret: 9
ret: 9

Reading with FindByLn:
reply: 180
reply: 4/19/2018 09:31:55

May you please help me figure it out? I want to read directly because it will be faster than using GetAssociationView before reading, as GetAssociationView takes some time.

Thanks in advance

Profile picture for user Kurumi

Kurumi

8 years 1 month ago

Directly reading an OBIS code seems to be not working [C++]

Hi,

You did not tell what you want to read, but you need to define object type and OBIS code.
If they are right meter reply error. For this reason you can't use DLMS_OBJECT_TYPE_ALL when you read
data from the meter. You can use it to find item by OBIS code.

Something like this:

CGXDLMSRegister r("1.0.9.8.7.255");

comm.Read(&o, 3, reply);

BR,
Mikko

amjaber

8 years 1 month ago

Thank you very much, I used

Thank you very much, I used CGXDLMSRegister before but it gave segmentation fault, I thought it was not working, it turn out I have used a wrong OBIS code, Now CGXDLMSRegister works for all the registers I want to read. Thank you again and sorry for my silly mistake.

Best Regards,
Abdulrahman

Profile picture for user Kurumi

Kurumi

8 years 1 month ago

Directly reading an OBIS code seems to be not working [C++]

Hi,

Thank you for let me know that you solved it.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin