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. Issue In Reading ProfileGeneric Type Objects Data From Meter.

Issue in reading ProfileGeneric type objects data from meter.

By saraf_kshitiz, 20 November, 2024
Forums
Gurux DLMS for Android

Hello Mikko Kurumi Sir,
As I am able to read the objects from the meter through the Gurux DLMS android app,
I am getting trouble in reading the data of ProfileGeneric objects, for e.g.,
1.0.94.91.0.255 Instantaneous Profile, 1.0.99.1.0.255 BlockLoad Profile, 1.0.99.2.0.255 Daily Load Profile, etc.
I need to see "All" data (or particularly by custom date range).
The first challenge I'm getting is how do I get the data by custom date range.
Secondly, how do I process the data?
I need to see the data in a relational format like shown in the Windows application:-

+-------------------+-------------------+-------------------+-------------------+-------------------+
| 0.0.1.0.0.255 | 1.0.2.8.0.255 | 1.0.8.0.255 | 1.0.1.8.0.255 | 1.0.9.8.0.255 |
| Time Clock | Value Cum. | Value Cum. | Value Cum. | Value Cum. |
| | Energy-Wh(Exp) | Energy-VAh(Exp) | Energy-Wh(Imp) | Energy-VAh(Imp) |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 15-11-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 14-11-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 01-11-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 31-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 30-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 29-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 26-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 25-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 23-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 19-10-2024 | 0 | 0 | 57579 | 57627 |
| 00:00:00 | | | | |
+-------------------+-------------------+-------------------+-------------------+-------------------+

But, instead, I'm getting the data in the android application like this :-

1.0.99.2.0.255
Ch. 0 Load profile with recording period 2 #1
------------------------------------------------------------------
1.0.99.2.0.255
------------------------------------------------------------------
[Ljava.lang.Object;@fc53414
------------------------------------------------------------------
[gurux.dlms.GXSimpleEntry@84d74bd, gurux.dlms.GXSimpleEntry@9ba7ab2, gurux.dlms.GXSimpleEntry@d74aa03, gurux.dlms.GXSimpleEntry@7cb7d80, gurux.dlms.GXSimpleEntry@2e19fb9]
------------------------------------------------------------------
86400
------------------------------------------------------------------
FIFO
------------------------------------------------------------------
null
------------------------------------------------------------------
12
------------------------------------------------------------------
180
------------------------------------------------------------------

Is the data unparsed, or what is the issue I'm not able to understand?
How do I parse it, print the values instead.

Please respond, sir, at your earliest convenience.

saraf_kshitiz

7 months ago

Here's the tabular data …

Here's the tabular data of windows app (more readable) for reference :- 

+-------------------+-------------------+-------------------+-------------------+-------------------+
| 0.0.1.0.0.255    | 1.0.2.8.0.255    | 1.0.8.0.255       | 1.0.1.8.0.255    | 1.0.9.8.0.255     |
| Time Clock       | Value Cum.       | Value Cum.        | Value Cum.       | Value Cum.        |
|                  | Energy-Wh(Exp)   | Energy-VAh(Exp)   | Energy-Wh(Imp)   | Energy-VAh(Imp)   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 15-11-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 14-11-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 01-11-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 31-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 30-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 29-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 26-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 25-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 23-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+
| 19-10-2024       | 0                 | 0                 | 57579            | 57627             |
| 00:00:00         |                   |                   |                  |                   |
+-------------------+-------------------+-------------------+-------------------+-------------------+

Response in mobile app :- 

1.0.99.2.0.255
Ch. 0 Load profile with recording period 2  #1
------------------------------------------------------------------
1.0.99.2.0.255
------------------------------------------------------------------
[Ljava.lang.Object;@fc53414
------------------------------------------------------------------
[gurux.dlms.GXSimpleEntry@84d74bd, gurux.dlms.GXSimpleEntry@9ba7ab2, gurux.dlms.GXSimpleEntry@d74aa03, gurux.dlms.GXSimpleEntry@7cb7d80, gurux.dlms.GXSimpleEntry@2e19fb9]
------------------------------------------------------------------
86400
------------------------------------------------------------------
FIFO
------------------------------------------------------------------
null
------------------------------------------------------------------
12
------------------------------------------------------------------
180
------------------------------------------------------------------
Profile picture for user Kurumi

Kurumi

7 months ago

Hi, You need to loop profile…

Hi,

You need to loop profile generic buffer. Now you have printed the profile generic.
Check getProfileGenerics from the java client example.
https://github.com/Gurux/gurux.dlms.java/blob/c6cdf87ba570ecb5c73b16901…

BR,
Mikko

saraf_kshitiz

7 months ago

Hi, sir, Can you add this…

Hi, sir,
Can you add this function in the android library?
And, can you please explain how do I loop the profile generic buffer?
Just give me an example, I haven't read much of the code in the library, so it will take a bit of time for me to understand the written functions and use them.

Thank you,
Kshitiz Saraf

Profile picture for user Kurumi

Kurumi

7 months ago

Hi, The example loops the…

Hi,

The example loops the buffer and shows all the data. You need to study it.

BR,
Mikko

saraf_kshitiz

7 months ago

Hello, sir, I studied the…

Hello, sir, 
I studied the getProfileGenerics() function, and tried to use it. 

Here is my code :- 
 

/**
* Read profile generic (Historical) data.
*/
void getProfileGenerics() throws Exception {
// mAttributes.setText("");

Object[] cells;
GXDLMSObjectCollection profileGenerics = mDevice.getObjects().getObjects(ObjectType.PROFILE_GENERIC);
Log.d(TAG, "getProfileGenerics: " + profileGenerics + "\n" + profileGenerics.toArray().length);

for (GXDLMSObject it : profileGenerics) {
if (it.getLogicalName().equals("1.0.99.1.0.255") || it.getLogicalName().equals("1.0.99.2.0.255")) {
writeTrace("--------- Reading " + it.getClass().getSimpleName() + " " + it.getName().toString() + " " + it.getDescription());
writeTrace("--------- Reading " + it.getClass().getSimpleName() + " " + it.getName().toString() + " " + it.getDescription(), TraceLevel.INFO);

long entriesInUse = -1;
if (mClient.canRead(it, 7)) {
entriesInUse = ((Number) read(it, 7)).longValue();
}
long entries = -1;
if (mClient.canRead(it, 8)) {
entries = ((Number) read(it, 8)).longValue();
}
Log.d(TAG, "getProfileGenerics: " + "Entries: " + entriesInUse + "/" + entries);
writeTrace("Entries: " + entriesInUse + "/" + entries);
writeTrace("Entries: " + entriesInUse + "/" + entries, TraceLevel.INFO);

GXDLMSProfileGeneric pg = (GXDLMSProfileGeneric) it;
Log.d(TAG, "getProfileGenerics: object converted to GXDLMSProfileGeneric: " + pg);
// If there are no columns.
if (entriesInUse == 0 || pg.getCaptureObjects().isEmpty()) {
Log.d(TAG, "getProfileGenerics: entriesInUse: " + entriesInUse);
Log.d(TAG, "getProfileGenerics: pg.getCaptureObjects(): " + pg.getCaptureObjects());
Log.d(TAG, "getProfileGenerics: going to next object. ");
continue;
}
///////////////////////////////////////////////////////////////////
// Read first item.
try {
cells = readRowsByEntry(pg, 1, 1);
Log.d(TAG, "getProfileGenerics: cells: " + cells);
for (Object rows : cells) {
StringBuilder sb = new StringBuilder();
for (Object cell : (Object[]) rows) {
if (cell instanceof byte[]) {
sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
} else {
sb.append(cell).append(" | ");
}
Log.d(TAG, "getProfileGenerics: sb: " + sb);
}
writeTrace(sb.toString());
writeTrace(sb.toString(), TraceLevel.INFO);
}
} catch (Exception e) {
writeTrace("Error! Failed to read first row: " + e.getMessage());
writeTrace("Error! Failed to read first row: " + e.getMessage(), TraceLevel.ERROR);
e.printStackTrace();
// Continue reading if device returns access denied error.
continue;
}
///////////////////////////////////////////////////////////////////
// Read last day.
try {
Calendar start = Calendar.getInstance();
start.set(Calendar.HOUR_OF_DAY, 0);
start.set(Calendar.MINUTE, 0);
start.set(Calendar.SECOND, 0);
start.set(Calendar.MILLISECOND, 0);
start.add(Calendar.DATE, -1);

Calendar end = Calendar.getInstance();
end.set(Calendar.MINUTE, 0);
end.set(Calendar.SECOND, 0);
end.set(Calendar.MILLISECOND, 0);

GXDateTime s = new GXDateTime(start);
GXDateTime e = new GXDateTime(end);

cells = readRowsByRange(pg, s, e);
Log.d(TAG, "getProfileGenerics: cells: " + cells);
for (Object rows : cells) {
StringBuilder sb = new StringBuilder();
for (Object cell : (Object[]) rows) {
if (cell instanceof byte[]) {
sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
} else {
sb.append(cell).append(" | ");
}
Log.d(TAG, "getProfileGenerics: sb: " + sb);
}
writeTrace(sb.toString());
writeTrace(sb.toString(), TraceLevel.INFO);
}
} catch (Exception e) {
writeTrace("Error! Failed to read last day: " + e.getMessage());
writeTrace("Error! Failed to read last day: " + e.getMessage(), TraceLevel.ERROR);
e.printStackTrace();
// Continue reading if device returns access denied error.
continue;
}
}
}
}

And, I'm stuck on this line :- 

                if (entriesInUse == 0 || pg.getCaptureObjects().isEmpty()) {

I'm not able to getCaptureObjects, it is returning empty List, although they are configured in the meter, and I'm able to get them using windows director application. 

They look like :- 

+----------+---------------+-------------+
| Object   | Logical       |   Attribute |
| type     | Name          |       Index |
+==========+===============+=============+
| Clock    | 0.0.1.0.0.255 |           2 |
+----------+---------------+-------------+
| Register | 1.0.2.8.0.255 |           2 |
+----------+---------------+-------------+
| Register | 1.0.10.0.255  |           2 |
+----------+---------------+-------------+
| Register | 1.0.1.8.0.255 |           2 |
+----------+---------------+-------------+
| Register | 1.0.9.8.0.255 |           2 |
+----------+---------------+-------------+

Please guide, sir. 

Also, I modified the writeTrace function, as there were storage permission issues in android 14 :- 

void writeTrace(String line, TraceLevel level) {
// Only log if the current Trace level is higher or equal to the provided level.
if (Trace.ordinal() >= level.ordinal()) {
System.out.println(line); // Log to console.
}

ContentResolver resolver = requireContext().getContentResolver();
Uri contentUri = MediaStore.Files.getContentUri("external");

// Try to find the existing file first
Cursor cursor = resolver.query(contentUri,
new String[]{MediaStore.MediaColumns._ID, MediaStore.MediaColumns.DISPLAY_NAME},
MediaStore.MediaColumns.DISPLAY_NAME + "=?",
new String[]{"traces.txt"}, null);

Uri fileUri = null;

if (cursor != null && cursor.moveToFirst()) {
// File already exists, get its URI
@SuppressLint("Range") long id = cursor.getLong(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
fileUri = ContentUris.withAppendedId(contentUri, id);
} else {
// File doesn't exist, create a new one
ContentValues values = new ContentValues();
values.put(MediaStore.MediaColumns.DISPLAY_NAME, "traces.txt");
values.put(MediaStore.MediaColumns.MIME_TYPE, "text/plain");
values.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS);

// Insert a new file and get its URI
fileUri = resolver.insert(contentUri, values);
}

// Now open the file for appending and write the trace
try (OutputStream outputStream = resolver.openOutputStream(fileUri, "wa")) {
if (outputStream != null) {
// Write the trace line and add a newline
outputStream.write(line.getBytes());
outputStream.write("\n".getBytes()); // Adding newline after each trace
outputStream.flush();
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (cursor != null) {
cursor.close();
}
}
}
Profile picture for user Kurumi

Kurumi

7 months ago

Hi, You must read capture…

Hi,

You must read capture objects before you read the buffer. You can find more information from here:
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric

BR,
Mikko

saraf_kshitiz

6 months 4 weeks ago

Hi,Thanks, this is done now,…

Hi,

Thanks, this is done now, I'm able to read the data of ProfileGeneric objects. 
But, not able to further process the data of Scaler objects. 
My code looks like this :-

GXDLMSProfileGeneric pg = (GXDLMSProfileGeneric) it;
Log.d(TAG, "getProfileGenerics: it.getLogicalName(): " + it.getLogicalName());
if (scalerObjects.contains(it.getLogicalName())) {
read(pg);
readScalerAndUnits(profileGenerics);
} else {
read(pg);
}

The data I'm getting looks like this :- 

--------- Reading GXDLMSProfileGeneric 1.0.94.91.7.255 Ch. 0 Identifiers for India                            
Entries: 1/1                            
[-3    33]    [-3    35]    [-3    255]    [0    30]

And, I want the format as given in windows application :- 

+------------------+-------------------+--------------------+-------------------+------------------+-------------------+-------------------+-------------------+-------------------+-------------------+--------------------+-------------------+------------------+
| Voltage          | Phase Current     | Neutral Current    | Signed Power      | Frequency        | Apparent Power    | Active Power      | Cumulative Energy| Cumulative Energy| Scaler & Unit     | Scaler & Unit      | Scaler & Unit     | Power On Duration|
| (0.001, Voltage) | (0.001, Current)  | (0.001, Current)   | (0.001, NoUnit)   | (0.001, Frequency)| (1, ApparentPower)| (1, ActivePower)  | Wh (Import)       | VAh (Import)      | MD-W (Import)     | MD-VA (Import)     | MD-VA (Export)    | (1, Minute)      |
+------------------+-------------------+--------------------+-------------------+------------------+-------------------+-------------------+-------------------+-------------------+-------------------+-------------------+--------------------+------------------+

Please guide, sir. How do I read the scaler objects? 
Please note: both the example data I've given are of different objects. 

Profile picture for user Kurumi

Kurumi

6 months 3 weeks ago

Hi, Indian standard uses its…

Hi,

Indian standard uses its own table where register scalers are saved.

You can get the scaler with this formula:

10^-1 = 0.001

BR,
Mikko

saraf_kshitiz

6 months 3 weeks ago

Okay, sir, I'll try this…

Okay, sir,
I'll try this. And, how do I process the second integer value?
For example, 33 - Current, 35 - Voltage, 255 - NoUnit, 30 - ActiveEnergy :-

[-3 33] [-3 35] [-3 255] [0 30]
as
{0.001, Current} {0.001, Voltage} {0.001, NoUnit} {1, ActiveEnergy}

Also, I'm having issue in reading Block Load Profile object data, app is taking very much time to read this data, still it either crashes in the end (after 8-10 minutes), or we can wait and we have no other option, and I'm not reading ALL data, I'm reading by time range (for e.g., last 4 hours).

Object -> 1.0.99.1.0.255 : BlockLoad Profile

Please help, sir.

saraf_kshitiz

6 months 3 weeks ago

Hello Mikko Kurumi Sir, I am…

Hello Mikko Kurumi Sir, 
I am expecting a response for the issue, I'm not able to fetch the block load profile data from the meter, the app is taking an infinite amount of time for that. 
Except blockload profile, all other objects are read.

When I'm running the following code :-

GXDLMSProfileGeneric pg = (GXDLMSProfileGeneric) it;

if (pg.getLogicalName().equals("1.0.99.1.0.255")) readObject(it, 3);
else read(pg); // Read outer data for getting capture objects.
readScalerAndUnits(mDevice.getObjects().getObjects(ObjectType.PROFILE_GENERIC));

The BlockLoad Profile data is read successfully, I'm using readObject function defined in MainFragment.java and passing '3' as attributeIndex manually. 
Please give me a reference for studying what is attributeIndex and what value can be/should be passed here. 

Also, please suggest if I'm doing anything wrong in my code. 


Thanks, 
Kshitiz

Profile picture for user Kurumi

Kurumi

6 months 3 weeks ago

Hi, You are reading all the…

Hi,

You are reading all the load profile data. Use read by entry or read by range methods and not readObject method. It will read all the data from the profile generic object and it will take a long time.

You can get the unit like this:

Unit unit = Unit.forValue(33);

BR,
Mikko

saraf_kshitiz

6 months 3 weeks ago

Hi, I'm reading by date…

Hi, 

I'm reading by date range. Here's my full code :- 

    private void readPgObject(GXDLMSObject it) throws Exception {
// Object[] cells;
String logicalName = it.getLogicalName();
writeTracesAndLogs("\n--------- Reading " + logicalName + " " +
pgObjectNamesMap.get(logicalName) + " ---------\n");

long entriesInUse = -1;
if (mClient.canRead(it, 7)) entriesInUse = ((Number) read(it, 7)).longValue();
long entries = -1;
if (mClient.canRead(it, 8)) entries = ((Number) read(it, 8)).longValue();
writeTracesAndLogs("Entries: " + entriesInUse + "/" + entries);

GXDLMSProfileGeneric pg = (GXDLMSProfileGeneric) it;

if (pg.getLogicalName().equals("1.0.99.1.0.255")) readObject(it, 3); // In case of BlockLoad Profile
else read(pg); // Read outer data for getting capture objects.

List<Map.Entry<GXDLMSObject, GXDLMSCaptureObject>> captureObjects = pg.getCaptureObjects();
// log all simple entry items got from capture objects.
columnNames = new ArrayList<>();
for (Map.Entry<GXDLMSObject, GXDLMSCaptureObject> entry : captureObjects) {
String objLogicalName = entry.getKey().getLogicalName();
columnNames.add(objLogicalName + " " + pgObjectNamesMap.get(objLogicalName));
}

// If there are no columns.
if (entriesInUse == 0 || captureObjects.isEmpty()) {
Log.d(TAG, "readPgObject: capture objects are empty.");
} else {
// interateTableValues(readRowsByEntry(pg, 1, 1)); // Read by item count.
readByDateRange(pg);
}
}

private void writeTracesAndLogs(String log) {
writeTraceTxt(log);
writeTraceCSV(log, TraceLevel.INFO);
Log.d(TAG, "readPgObject: " + log);
}

private void readByDateRange(GXDLMSProfileGeneric pg) throws Exception {
Calendar start = Calendar.getInstance();
start.set(Calendar.DAY_OF_MONTH, 26);
start.set(Calendar.HOUR_OF_DAY, 15);
start.set(Calendar.MINUTE, 0);
start.set(Calendar.SECOND, 0);
start.set(Calendar.MILLISECOND, 0);
start.add(Calendar.DATE, 0);

Calendar end = Calendar.getInstance();
end.set(Calendar.MINUTE, 0);
end.set(Calendar.SECOND, 0);
end.set(Calendar.MILLISECOND, 0);

GXDateTime s = new GXDateTime(start);
GXDateTime e = new GXDateTime(end);
Log.d(TAG, "readByDateRange: GXDateTime(start): " + s);
Log.d(TAG, "readByDateRange: GXDateTime(end): " + e);

interateTableValues(readRowsByRange(pg, s, e));
}

private void interateTableValues(Object[] cells) {
StringBuilder sb = new StringBuilder();
for (String name : columnNames) {
sb.append(name).append(" | ");
}
writeTracesAndLogs(sb.toString());

for (Object rows : cells) {
Log.d(TAG, "interateTableValues: rows: " + rows);

sb = new StringBuilder();
for (Object cell : (Object[]) rows) {
Log.d(TAG, "interateTableValues: cell: " + cell);

if (cell instanceof byte[]) {
sb.append(GXCommon.bytesToHex((byte[]) cell)).append(" | ");
} else {
sb.append(cell).append(" | ");
}
Log.d(TAG, "interateTableValues: sb: " + sb);
}
writeTracesAndLogs(sb.toString());
}
showSnackBar(requireContext());
}

By this code, I'm able to read blockload profile data. I'm writing data to a csv file. 

But, I wanted to learn the "attributeIndex" thing, for e.g., I'm passing 3 in the function readObject(), and only 3 is working. what is that? can I get any documentation to study that? 

Profile picture for user Kurumi

Kurumi

6 months 3 weeks ago

Hi, In your code, you are…

Hi,

In your code, you are reading all rows:

if (pg.getLogicalName().equals("1.0.99.1.0.255")) readObject(it, 3);

You need to fix that.

BR,
Mikko

saraf_kshitiz

6 months 3 weeks ago

Hi, I'm reading all rows,…

Hi,
I'm reading all rows, but it is working fine for me.
I'm getting the data.

saraf_kshitiz

6 months 3 weeks ago

Hi Mikko Kurumi Sir, I want…

Hi Mikko Kurumi Sir, 

I want to show the attribute name in the edittext. 

Here's my code :- 

    private void showObject(GXDLMSObject target) {
mAttributes.setText("");
StringBuilder sb = new StringBuilder();
String newline = System.lineSeparator();
sb.append(target.getLogicalName());
if (target.getShortName() != 0) sb.append(" (").append(target.getShortName()).append(")");
sb.append(newline);
sb.append(pgObjectNamesMap.get(target.getLogicalName())).append(newline).append(newline);
sb.append(target.getDescription()).append(newline).append(newline);
sb.append(getLineSeparator('=')).append(newline);
for (int pos = 0; pos != target.getAttributeCount(); ++pos) {
GXDLMSAttributeSettings attributeSettings = target.getAttributes().find(pos);
// sb.append(target.getAttributes().get(0));
Log.d(TAG, "showObject: attributeSettings: " + attributeSettings);
if (attributeSettings != null) {
Log.d(TAG, "showObject: attributeSettings.getName(): " + attributeSettings.getName());
Log.d(TAG, "showObject: attributeSettings.getValues(): " + attributeSettings.getValues());
}
sb.append(": ");
sb.append(target.getValues()[pos]).append(newline);
if (pos == target.getAttributeCount()-1) sb.append(getLineSeparator('='));
else sb.append(getLineSeparator('-'));
sb.append(newline);
}
mAttributes.setText(sb.toString());
}

I've modified the showObject() function in MainFragment.java file. But, I'm not able to get the name of the attributeSetting. 

Please guide. 

Thanks, 
Kshitiz 

Profile picture for user Kurumi

Kurumi

6 months 2 weeks ago

Hi, You can get the…

Hi,

You can get the attribute names with getNames method like this.

Log.d(TAG, "showObject: attributeSettings.getName(): " + target.getNames()
[pos - 1]);

BR,
Mikko

saraf_kshitiz

6 months 2 weeks ago

Hello Mikko Sir, There is…

Hello Mikko Sir,

There is no function named "getNames()" in the class GXDLMSObject.
There is only "getName()" method which returns the logical name of the object.

Thanks,
Kshitiz

Profile picture for user Kurumi

Kurumi

6 months 2 weeks ago

Hi, You need to use…

Hi,

You need to use IGXDLMSBase interface. Like this:

Log.d(TAG, "showObject: attributeSettings.getName(): " + ((IGXDLMSBase)target).getNames()
[pos - 1]);

BR,
Mikko

saraf_kshitiz

6 months 2 weeks ago

Yes, Sir, It is done now,…

Yes, Sir,
It is done now, thanks.

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 06/19/2025 - 09:33
    Gurux.DLMS.Python 1.0.185
  • Wed, 06/18/2025 - 15:11
    Gurux.DLMS.Python 1.0.184
  • Wed, 06/18/2025 - 10:05
    Gurux.DLMS.Python 1.0.183
  • Wed, 06/18/2025 - 09:06
    GXDLMSDirector 9.0.2506.1801
  • Wed, 06/18/2025 - 08:41
    Gurux.DLMS.Net 9.0.2506.1801

New forum topics

  • HLS GMAC L+G 570
  • Unable to read parameter values from Landis+Gyr E550 meter using GXDLMSDirector - NoAccess status
  • data.SetComplete(false); But all data recieved
  • Crash (endless loop)
  • Server is not able to download object list with maxPduSize 64 or 128 (or anything below 156-bytes PDU size)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin