Reading profile generic

1 viestiä / 0 new
Uusin kirjoitus
hanumaan
Reading profile generic

Hi ...
I am.. try to reading profile generic data, below is the code snippet i have tried..

GXDLMSProfileGeneric gp = new GXDLMSProfileGeneric("1.0.94.91.0.255");
GXReplyData reply_data = new GXReplyData();

byte[][] temp = mClient.read(gp, 3);
for (byte[] it : temp) {
readDataBlock(temp, reply_data);
}
if (gp.getDataType(3) == DataType.NONE) {
gp.setDataType(3, reply_data.getValueType());
}
mClient.updateValue(gp, 3, reply_data.getValue());
byte[][] temp1 = mClient.read(gp, 2);
for (byte[] it : temp1) {
readDataBlock(temp1, reply_data);
}
if (gp.getDataType(2) == DataType.NONE) {
gp.setDataType(2, reply_data.getValueType());
}
mClient.updateValue(gp, 2, reply_data.getValue());

GXDLMSProfileGeneric gpScalar = new GXDLMSProfileGeneric("1.0.94.91.3.255");
byte[][] temp2 = mClient.read(gpScalar, 3);

for (byte[] it : temp2) {
readDataBlock(temp2, reply_data);
}
if (gpScalar.getDataType(3) == DataType.NONE) {
gpScalar.setDataType(3, reply_data.getValueType());
}
mClient.updateValue(gpScalar, 3, reply_data.getValue());

byte[][] temp4 = mClient.read(gpScalar, 2);
for (byte[] it : temp4) {
readDataBlock(temp4, reply_data);
}
if (gpScalar.getDataType(2) == DataType.NONE) {
gpScalar.setDataType(2, reply_data.getValueType());
}
mClient.updateValue(gpScalar, 2, reply_data.getValue());

first question Is this the write way to get profile generic data and its scalar values? or there is better way or readymade methods to read package recieved from the meter.