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. Different String Formats

Different String formats

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 enemy235 , 29 August, 2019
Forums
Gurux DLMS for Java

Hi,
I'm trying to read some objects, but sometimes I get wrong/different String. Reading methods are described lower.

This is console output when I read just specific attribute.
-------- Reading GXDLMSData 0.0.42.0.0.255 Ch. 0 COSEM Logical device name
Index: 1 Value: 00 00 2A 00 00 FF

This output I get, when I read whole object.
-------- Reading GXDLMSData 0.0.42.0.0.255 Ch. 0 COSEM Logical device name
Index: 1 Value: 0.0.42.0.0.255
Index: 2 Value: 47 75 72 75 78 31 32 33 34 35 36

I'm using similar methods from GXDLMSReader - getReadOut(), edited to get only 1 GXDLMSObject. Second method has another parameter int for atribute.

parameters GXDLMSObject it, int pos/atribute

writeTrace("-------- Reading " + it.getClass().getSimpleName() + " "
+ it.getName().toString() + " " + it.getDescription(),
TraceLevel.INFO);
for (int pos : ((IGXDLMSBase) it).getAttributeIndexToRead(true)) { //this for is not used if atribute is
specified
try {
Object val = read(it, pos);
showValue(pos, val);
} catch (Exception ex) {
writeTrace("Error! Index: " + pos + " " + ex.getMessage(),
TraceLevel.ERROR);
writeTrace(ex.toString(), TraceLevel.ERROR);
// Continue reading.
}
}

I'm also trying to read multiple objects using readList. What is the best option to print those values.
I tried to add these lines to end of method readList() in GXDLMSReader.

for(int i=0; i<list.size(); i++) {
GXDLMSObject it = list.get(i).getKey();
System.out.println("-------- Reading " + it.getClass().getSimpleName() + " "+ it.getName().toString() + " " + it.getDescription());
showValue(list.get(i).getValue(), values.get(i));
}
With this solution, I have same problem as described before (Wrong string formats).

Profile picture for user Kurumi

Kurumi

6 years 9 months ago

Hi,

Hi,

I believe that you are returning data received from the meter in case 1 and in case 2 you are returning value from data object attribute index 1 (logical name).

BR,
Mikko

enemy235

6 years 9 months ago

Hi,

Hi,
I just tried those methods and now they are working just fine. But some values still shows these ASCII strings. I was +- just like you said.

-------- Reading GXDLMSData 0.0.42.0.0.255 Ch. 0 COSEM Logical device name
Index: 1 Value: 0.0.42.0.0.255
Index: 2 Value: 47 75 72 75 78 31 32 33 34 35 36

What is the best method to print the GXDLMSObject? I ended up with this, placed id GXDLMSReader:
GXDLMSObject oo = dlms.getObjects().findByLN(ObjectType.NONE, "0.0.42.0.0.255");
int pos = 0;
for(Object item : oo.getValues()) {
showValue(pos++, item);
}

Profile picture for user Kurumi

Kurumi

6 years 9 months ago

Hi,

Hi,

Logical device name is bytearray.
You need to call UpdateOBISCodeInformation like this:
GXDLMSConverter c = new GXDLMSConverter();
c.UpdateOBISCodeInformation(oo);

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