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. 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 9 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 9 months ago

thanks

thanks

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • 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
  • Mon, 06/15/2026 - 08:52
    gurux.dlms.c 9.0.2606.1501

New forum topics

  • Service not known error on gprs communication
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
  • Connecting Meter to Agent via serial
  • Reading block profile with Compact array
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin