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. Forums
  3. 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 9 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

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin