Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Saving AssociationView To File In GuruxDLMS.c

Saving AssociationView to file in GuruxDLMS.c

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Prakash , 10 August, 2022
Forums
Gurux.DLMS

Hi,

The function com_getAssociationView is supposed to read from the file if it exists, else read from meter and save to file. But it is not saving to the file even though 58 objects were read from the meter. Upon inspecting I found that CURRENT_ASSOCIATION[0] is null. Please let me know how to save to the file.

Sample code:
int ret = com_open(&con, port);

if (ret == 0) {
//Initialize connection.
if ((ret = com_initializeOpticalHead(&con)) != 0 || (ret =
com_updateInvocationCounter(&con, invocationCounter)) != 0
|| (ret = com_initializeOpticalHead(&con)) != 0 || (ret =
com_initializeConnection(&con)) != 0 || (ret =
com_readAllObjects(&con, outputFile)) != 0) {
printf("connection failed: %d\r\n", ret);
} else {
printf("connected ...\r\n");
while (1) {
bool result;
uint16_t volt = getVoltage(&result);
printf("volt: %d\r\n", volt);
sleep(2);
}
}
}

Logs:
InitializeConnection
GetAssociationView
-------- Reading Object Data 0.0.0.1.0.255
Index: 2 Value: 2
-------- Reading Object Data 0.0.0.1.1.255
Index: 2 Value: 2
-------- Reading Object Data 0.0.42.0.0.255
Index: 2 Value: 4C 4E 54 42 32 58 58 58 58 58 58 58 43 35
-------- Reading Object Data 0.0.94.91.0.255
Index: 2 Value: 0
-------- Reading Object Data 0.0.94.91.9.255
Index: 2 Value: 5
-------- Reading Object Data 0.0.94.91.11.255
Index: 2 Value: 43 33
-------- Reading Object Data 0.0.94.91.12.255
Index: 2 Value: 35 2D 33 30 41 20 20 20
-------- Reading Object Data 0.0.96.1.0.255
Index: 2 Value: 20 20 20 20 20 20 20 20 41 32 35 33 33 39 39 37
-------- Reading Object Data 0.0.96.1.1.255
Index: 2 Value: 53 63 68 6E 65 69 64 65 72 20 45 6C 65 63 74 72 69 63 20 49 6E 64 69 61 20 50 72 69 76 61 74 65 20 4C 69 6D 69 74 65 64
-------- Reading Object Data 0.0.96.1.4.255
Index: 2 Value: 2022
-------- Reading Object Data 0.0.96.2.0.255
Index: 2 Value: 0
-------- Reading Object Data 0.0.96.11.1.255
Index: 2 Value: 0
-------- Reading Object Data 0.0.96.11.4.255
Index: 2 Value: 0
-------- Reading Object Data 0.0.96.11.2.255
Index: 2 Value: 102
-------- Reading Object Data 0.0.96.11.3.255
Index: 2 Value: 0
-------- Reading Object Data 0.0.96.11.5.255
Index: 2 Value: 0
-------- Reading Object Data 1.0.0.2.0.255
Index: 2 Value: 54 44 30 30 2E 30 31
-------- Reading Object Data 1.0.0.8.0.255
Index: 2 Value: 1800
-------- Reading Object Data 1.0.0.8.4.255
Index: 2 Value: 1800
-------- Reading Object Data 1.0.0.8.5.255
Index: 2 Value: 86400
-------- Reading Object Data 0.128.140.128.128.255
Index: 2 Value: 0
-------- Reading Object Data 0.128.150.128.128.255
Index: 2 Value: 53 52 30 34 2E 30 34
-------- Reading Object Data 0.128.169.128.128.255
Index: 2 Value: 6
-------- Reading Object Register 0.0.0.1.2.255
Index: 3 Value: Scaler: 1 Unit: NoUnit
Index: 2 Value: 07 E6 08 01 FF 00 00 FF FF 01 4A 00
-------- Reading Object Register 0.0.94.91.14.255
Index: 3 Value: Scaler: 1 Unit: Minute
Index: 2 Value: 20880
-------- Reading Object Register 1.0.1.7.0.255
Index: 3 Value: Scaler: 10 Unit: Active power
Index: 2 Value: 0
-------- Reading Object Register 1.0.1.8.0.255
Index: 3 Value: Scaler: 100 Unit: Active energy
Index: 2 Value: 27
-------- Reading Object Register 1.0.9.7.0.255
Index: 3 Value: Scaler: 10 Unit: Apparent power
Index: 2 Value: 0
-------- Reading Object Register 1.0.9.8.0.255
Index: 3 Value: Scaler: 100 Unit: Apparent energy
Index: 2 Value: 30
-------- Reading Object Register 1.0.11.7.0.255
Index: 3 Value: Scaler: 0.010000 Unit: Current
Index: 2 Value: 0
-------- Reading Object Register 1.0.12.7.0.255
Index: 3 Value: Scaler: 0.010000 Unit: Voltage
Index: 2 Value: 22849
-------- Reading Object Register 1.0.13.7.0.255
Index: 3 Value: Scaler: 0.010000 Unit: NoUnit
Index: 2 Value: 0
-------- Reading Object Register 1.0.14.7.0.255
Index: 3 Value: Scaler: 0.010000 Unit: Frequency
Index: 2 Value: 5000
-------- Reading Object Register 1.0.91.7.0.255
Index: 3 Value: Scaler: 0.010000 Unit: Current
Index: 2 Value: 0
-------- Reading Object ExtendedRegister 1.0.1.6.0.255

Thanks,
Prakash

Prakash

3 years 11 months ago

There is some problem with

There is some problem with com_readAllObjects() call while reading extended registers. So I am not using com_readAllObjects(). It means you can't use oa_findByLN(). I directly use com_read(). For example:

unsigned char ln[] = { 1,0,32,7,0,255 };
gxRegister regObj;
INIT_OBJECT(regObj, DLMS_OBJECT_TYPE_REGISTER, ln);

int ret = com_read(&con, &regObj->base, 2);
if (ret == DLMS_ERROR_CODE_OK) {
} else {
}

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
  • Service not known error on gprs communication
  • Help Needed: Interfacing Saral 100 Energy Meter with Microcontroller via RS232
More

Who's new

  • qZgCuGshgQLxtN…
  • Georgegeowl
  • brsRKNujhfnXWm…
  • TmncVuWXpMBjtlVn
  • suMPQCGuZJqlCP…
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin