Hi Mikko Kurumi Sir,
I'm unable to parse the hex values of Billing Date object when I'm reading Billing Profile from the meter.
I'm getting readings like this :-
Entries: 4/13
0.0.0.1.2.255 Billing Date
07 E9 01 06 01 12 1C 30 FF 80 00 00
07 E9 01 01 03 00 00 00 FF 80 00 00
Here's my code :-
for (Object rows : cells) {
sb = new StringBuilder();
index = 0;
for (Object cell : (Object[]) rows) {
if (cell instanceof byte[]) {
sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
} else {
// If voltage attribute is there in the data
if (voltageFlag) {
if (index == voltageIndex) cell = getCorrectVoltage(cell);
}
sb.append(cell).append(" | ");
}
index++;
}
if (ObisCodesMapping.profileGenericScalers.contains(pg.getLogicalName()))
processScalerPgData(sb);
writeTraceCSV(sb.toString());
}
showSnackBar(mContext);
I believe the if condition is running the statement : sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
The bytes are converted to hex values, how do I parse this to datetime?
Waiting for your response.
Thanks,
Kshitiz.
Hi Kshitiz, The date-time…
Hi Kshitiz,
The date-time should be changed automatically if the capture object is a clock.
You can also change bytes to date-time like this:
GXDLMSClient.changeType((byte[])cell, ObjectType.DATE_TIME);
BR,
Mikko
Hi Mikko Sir, Your given…
Hi Mikko Sir,
Your given code works fine and gives parsed datetime value for billing date.
You've been a great help and support.
There's just a minor update, DataType.DATETIME is used instead the parameter you gave. The code that worked for me looks like :-
Thanks,
Kshitiz