Skip to main content
Home
for DLMS smart meters

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 1 month 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 1 month ago

thanks

thanks

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 12/11/2025 - 13:22
    Gurux.DLMS.Python 1.0.194
  • Thu, 12/11/2025 - 11:01
    gurux.dlms.java 4.0.86
  • Wed, 12/10/2025 - 08:45
    gurux.dlms.java 4.0.85
  • Tue, 12/02/2025 - 10:21
    gurux.dlms.c 9.0.2512.0201
  • Mon, 12/01/2025 - 13:55
    Gurux.DLMS.Python 1.0.193

New forum topics

  • Gurux.Net
  • GXTIME Conversion Issue
  • DLMS Meter Gurux DLMS Director Properties
  • Using MAX3232 + FT232RL to Energy meter with GXDLMS Director
  • Incomplete Firmware Upgrade Process
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin