Hello,
I am figuring out, how to generate an byte array with the writeList method of GXDLMSClient.
Version of gurux.dlms library is 2.1.6.
The method has following signature:
public final byte[][] writeList(final List<GXWriteItem> list)
But I am not sure, how to correctly fill the properties of GXWriteItem.
In this piece of code, I am trying to do so:
// Here I am creating object for particular class id.
ObjectType objType = ObjectType.forValue(simp.getClassid());
GXDLMSObject obj = dlms.createObject(objType);
// Setting logical name
obj.setLogicalName(simp.getObisCode());
//Creating GXWriteItem
GXWriteItem gXWriteItem = new GXWriteItem();
DataType dataType = DataType.forValue(simp.getDataType());
gXWriteItem.setDataType(dataType); // setting data type
gXWriteItem.setTarget(obj); // setting object
gXWriteItem.setIndex(simp.getAttr()); // setting attribute index
But I am unable to figure out some general mechanism, how to set the value of an GXDLMSObject.
Method setValue of GXDLMSObject appears to be unimplemented:
public void setValue(final GXDLMSSettings settings,
final ValueEventArgs e) {
throw new UnsupportedOperationException("setValue");
}
Can you please provide us an example, how to correctly use set with list, or point us to some online documentation?
GXDLMSClock clock = new GXDLMSClock();
GXWriteItem item = new GXWriteItem();
//Target object. Example clock.
item.setTarget(clock);
//Attribute index.
item.setIndex(2);
//This is optional parameter. It's used because there are no unsigned values in Java.
item.setDataType(DataType.OCTET_STRING);
Figuring out how set with list feature works in gurux.
Hi Jaroslav,
GXDLMSClock clock = new GXDLMSClock();
GXWriteItem item = new GXWriteItem();
//Target object. Example clock.
item.setTarget(clock);
//Attribute index.
item.setIndex(2);
//This is optional parameter. It's used because there are no unsigned values in Java.
item.setDataType(DataType.OCTET_STRING);
BR,
Mikko
Thank you for your response.
Thank you for your response.