Hello Mikko Sir,
I'm trying to read rows by index because I have to read and display the data of Instantaneous Profile Object (1.0.94.91.0.255).
For that, I am running the following code snippet which works perfectly fine for getting Name Plate Profile (0.0.94.91.10.255) object data :-
Object[] rows = {};
try {
GXDLMSProfileGeneric pg = new GXDLMSProfileGeneric(ln);
gxConnection.readObject(pg, 3);
List<Map.Entry<GXDLMSObject, GXDLMSCaptureObject>> captureObjects = pg.getCaptureObjects();
mCaptureObjects.clear();
for (Map.Entry<GXDLMSObject, GXDLMSCaptureObject> entry : captureObjects) {
mCaptureObjects.add(deviceObjects.findByLN(ObjectType.NONE,
entry.getKey().getLogicalName()));
}
long startTime = System.currentTimeMillis();
rows = gxConnection.readRowsByIndex(pg, 1, 1);
long endTime = System.currentTimeMillis();
Log.d(TAG, "Data fetch time: " + (endTime - startTime) + "ms");
} catch (Exception e) {
new ExceptionHandler(requireActivity()).showError(e,
getString(R.string.read_object_error));
}The error I'm getting is :-
showError: Number of columns do not match. (Ask Gemini)
java.lang.RuntimeException: Number of columns do not match.
at gurux.dlms.objects.GXDLMSProfileGeneric.setBuffer(GXDLMSProfileGeneric.java:859)
at gurux.dlms.objects.GXDLMSProfileGeneric.setValue(GXDLMSProfileGeneric.java:714)
at gurux.dlms.GXDLMSClient.updateValue(GXDLMSClient.java:1482)
at gurux.dlms.GXDLMSClient.updateValue(GXDLMSClient.java:1455)
at gurux.dlms.android.connection.DeviceConnection.readRowsByIndex(DeviceConnection.java:317)
at gurux.dlms.android.fragments.ObjectReadsFragment.lambda$getDataList$1$gurux-dlms-android-fragments-ObjectReadsFragment(ObjectReadsFragment.java:80)
at gurux.dlms.android.fragments.ObjectReadsFragment$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:222)
at android.os.Looper.loop(Looper.java:314)
at android.app.ActivityThread.main(ActivityThread.java:8680)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)Error is in line :-
rows = gxConnection.readRowsByIndex(pg, 1, 1);
What am I doing wrong? And if this line works fine for reading Nameplate profile, then why there is internal gurux code error in case of Instantaneous profile?
I will be waiting for a response, sir.
Thanks,
Kshitiz
Hello Mr. Kshitiz, The…
Hello Mr. Kshitiz,
The number of columns does not match. means that the number of columns in capture objects differs from the buffer.
Try to read your meter with GXDLMSDirector. If you get the same error, you need to ask the reason for this from the meter manufacturer and if there is a meter firmware update that fixes this.
BR,
Mikko
Hi Mikko Sir, Yes it was an…
Hi Mikko Sir,
Yes it was an issue of column mismatch in capture objects and buffer.
It has been fixed by reading all the indexes of the object and reading the capture objects separately.
Thanks,
Kshitiz