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. Problem With SetValue/addCaptureObject In GXDLMSProfileGeneric

Problem with setValue/addCaptureObject in GXDLMSProfileGeneric

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 flok , 9 January, 2019
Forums
Gurux DLMS for Java

Hi!
I have a problem with setValue/addCaptureObject in GXDLMSProfileGeneric: I get an exception that the attributeIndex is not valid because it is < 1. I think that the conversion from byte to integer for attributeIndex in setValue is wrong. In blue book 12.2 5.4.2 profile generic the attributeIndex of capture objects is defined as unsigned. The conversion in GXDLMSProfileGeneric seems to be signed. SO if I use the following line I get the expcted positive value:

addCaptureObject(obj, (((Byte)tmp[2]) & 0xFF), ((Number) tmp[3]).intValue());

Kind regards
flo

Profile picture for user Kurumi

Kurumi

7 years 5 months ago

Problem with setValue/addCaptureObject in GXDLMSProfileGeneric

Hi,

Attribute indexes are unsigned and I believe that your meter is returning -1 (0xFF). This is causing problems because there aren't so many attributes. What meter you are reading?

BR,

Mikko

flok

7 years 4 months ago

Hi,

Hi,

the meter is returning i.e. 254 but in Java byte is signed. So if you use ((Number) tmp[2]).intValue() for int conversion you get a negative value. If you use ((Byte)tmp[2]) & 0xFF) you get the real value because it handles the byte value as unsigned.
For most meters it is not relevant because they don't use such high attributeIndex but my Kamstrup Omnipower does use them for placeholders.
Kind regards
flo

Profile picture for user Kurumi

Kurumi

7 years 4 months ago

Problem with setValue/addCaptureObject in GXDLMSProfileGeneric

Hi,

I'll have to check that this is not causing any problems with the old meters.
What 0xFE means in Omnipower?

BR,

Mikko

Profile picture for user Kurumi

Kurumi

7 years 4 months ago

Problem with setValue/addCaptureObject in GXDLMSProfileGeneric

Hi,

We added new version where is XMLClient implementation. We also changed this in that way that attribute index is always positive.

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