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. 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 2 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 2 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 2 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

  • 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

  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin