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. Node
  3. Convert Byte Array To GXDLMSObject

Convert byte array to GXDLMSObject

By PLAMEN VASILEV , 15 May, 2025
Forums
Gurux.DLMS

Hello,

I have an APDU byte array, and I'd like to convert it to GXDLMSObject so I can inspect and further work with it. I see that I can use GXDLMSTranslator to translate the byte array to XML, but I want to parse the byte array to a native GXDLMSObject. Is there any way to do that?

Many thanks
Plamen

PLAMEN VASILEV

1 year 4 months ago

So what I have is the…

So what I have is the following:
I have a hex string coming from an Hexing DCU grid meter reading upload.
The hex string is something like this:
0001010204090C07E902190200000000FF8800110006000000050600000032
which the Gurux PDU XML translator translates to:
<Data="01010204090C07E902190200000000FF8800110006000000050600000032" />
If I add C401C6 at the beginning to it - I am able to parse it as a response:
C401C60001010204090C07E902190200000000FF8800110006000000050600000032

<GetResponse>
<GetResponseNormal>
<!--Priority: HIGH ServiceClass: CONFIRMED invokeID: 6-->
<InvokeIdAndPriority Value="C6" />
<Result>
<Data>
<Array Qty="01" >
<Structure Qty="04" >
<!--2025-02-25 00:00:00-->
<OctetString Value="07E902190200000000FF8800" />
<UInt8 Value="00" />
<UInt32 Value="00000005" />
<UInt32 Value="00000032" />
</Structure>
</Array>
</Data>
</Result>
</GetResponseNormal>
</GetResponse>

-- Is there any way programatically to parse the byte array to a Gurux object so I can work with it. I don't want to have to parse the result XML if possible.

Thanks again
Plamen

PLAMEN VASILEV

1 year 4 months ago

Nevermind, I figured it out…

Nevermind, I figured it out. I removed the first byte and then used GXDLMSClient.getValue() and it returned a GXArray.

Profile picture for user Kurumi

Kurumi

1 year 4 months ago

Hi Plamen, I don't know why…

Hi Plamen,

I don't know why there is that one extra byte, but you are right. The data is there after you remove the first byte.

Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 08/26/2026 - 09:04
    Gurux.DLMS.Python 1.0.203
  • Mon, 08/17/2026 - 11:28
    Gurux.DLMS.Python 1.0.202
  • Mon, 08/17/2026 - 09:47
    gurux.dlms.cpp 9.0.2608.1701
  • Mon, 08/17/2026 - 09:25
    gurux.dlms.c 9.0.2608.1701
  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701

New forum topics

  • Security vulnerability report — request for a private contact (GuruxDLMS.c / ANSI C)
  • Topic: Insufficient Memory Error When Reading Class 7 Profile Generic Objects
  • SN ReadResponse returns all-null values when response spans multiple HDLC frames
  • Gurux.Serial.Android 3.0.6 – CH340 (HL-340) USB-Serial Adapter Not Working,
  • Trying to talk to a L&G E360 meter (Using Python Gurux)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin