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. GXDLMSRegisterMonitor Write Attr 4 Actions Bug

GXDLMSRegisterMonitor write Attr 4 actions bug

By xsmy , 12 October, 2024
Forums
Gurux DLMS for Java

when i write GXDLMSRegisterMonitor actions Attribute value error occurs "Access Error : Device reports a unmatched type."

When checking the source code, I found that the Java version of getvalue was inconsistent with the C# code. The correct one seemed to be ARRAY, while the Java code was written as STRUCTURE.

Java Code:

public final Object getValue(GXDLMSSettings settings, ValueEventArgs e) {
if (e.getIndex() == 1) {
return GXCommon.logicalNameToBytes(this.getLogicalName());
} else if (e.getIndex() == 2) {
return this.getThresholds();
} else {
GXByteBuffer bb;
if (e.getIndex() == 3) {
bb = new GXByteBuffer();
bb.setUInt8(DataType.STRUCTURE.getValue());
bb.setUInt8(3);
GXCommon.setData(settings, bb, DataType.UINT16, this.monitoredValue.getObjectType().getValue());
GXCommon.setData(settings, bb, DataType.OCTET_STRING, GXCommon.logicalNameToBytes(this.monitoredValue.getLogicalName()));
GXCommon.setData(settings, bb, DataType.INT8, this.monitoredValue.getAttributeIndex());
return bb.array();
} else if (e.getIndex() != 4) {
e.setError(ErrorCode.READ_WRITE_DENIED);
return null;
} else {
bb = new GXByteBuffer();
bb.setUInt8(DataType.STRUCTURE.getValue());
if (this.actions == null) {
bb.setUInt8(0);
} else {
bb.setUInt8(this.actions.length);
GXDLMSActionSet[] var4 = this.actions;
int var5 = var4.length;

for(int var6 = 0; var6 < var5; ++var6) {
GXDLMSActionSet it = var4[var6];
bb.setUInt8((byte)DataType.STRUCTURE.getValue());
bb.setUInt8(2);
bb.setUInt8((byte)DataType.STRUCTURE.getValue());
bb.setUInt8(2);
GXCommon.setData(settings, bb, DataType.OCTET_STRING, GXCommon.logicalNameToBytes(it.getActionUp().getLogicalName()));
GXCommon.setData(settings, bb, DataType.UINT16, it.getActionUp().getScriptSelector());
bb.setUInt8((byte)DataType.STRUCTURE.getValue());
bb.setUInt8(2);
GXCommon.setData(settings, bb, DataType.OCTET_STRING, GXCommon.logicalNameToBytes(it.getActionDown().getLogicalName()));
GXCommon.setData(settings, bb, DataType.UINT16, it.getActionDown().getScriptSelector());
}
}

return bb.array();
}
}
}

-------------------------------------------------------------------

C# Code

object IGXDLMSBase.GetValue(GXDLMSSettings settings, ValueEventArgs e)
{
if (e.Index == 1)
{
return GXCommon.LogicalNameToBytes(LogicalName);
}
if (e.Index == 2)
{
return this.Thresholds;
}
if (e.Index == 3)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((int)DataType.Structure);
data.SetUInt8(3);
GXCommon.SetData(settings, data, DataType.UInt16, MonitoredValue.ObjectType); //ClassID
GXCommon.SetData(settings, data, DataType.OctetString, GXCommon.LogicalNameToBytes(MonitoredValue.LogicalName)); //Logical name.
GXCommon.SetData(settings, data, DataType.Int8, MonitoredValue.AttributeIndex); //Attribute Index
return data.Array();
}
if (e.Index == 4)
{
GXByteBuffer data = new GXByteBuffer();
data.SetUInt8((int)DataType.Array);
if (Actions == null)
{
data.SetUInt8(0);
}
else
{
data.SetUInt8((byte)Actions.Length);
foreach (GXDLMSActionSet it in Actions)
{
data.SetUInt8((int)DataType.Structure);
data.SetUInt8(2);
data.SetUInt8((int)DataType.Structure);
data.SetUInt8(2);
GXCommon.SetData(settings, data, DataType.OctetString, GXCommon.LogicalNameToBytes(it.ActionUp.LogicalName)); //Logical name.
GXCommon.SetData(settings, data, DataType.UInt16, it.ActionUp.ScriptSelector); //ScriptSelector
data.SetUInt8((int)DataType.Structure);
data.SetUInt8(2);
GXCommon.SetData(settings, data, DataType.OctetString, GXCommon.LogicalNameToBytes(it.ActionDown.LogicalName)); //Logical name.
GXCommon.SetData(settings, data, DataType.UInt16, it.ActionDown.ScriptSelector); //ScriptSelector
}
}
return data.Array();
}
e.Error = ErrorCode.ReadWriteDenied;
return null;
}

Profile picture for user Kurumi

Kurumi

1 year 11 months ago

Hi, Thank you for pointing…

Hi,

Thank you for pointing this out. This is now fixed to Java version 4.0.71.
Get the latest version.

BR,
Mikko

xsmy

1 year 11 months ago

thanks

thanks

  • 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