I finally succeeded in reading the Object List of a Landis Gyr E650 using the Arduino GuruxDLMS.c library. Next I was able to read the clock and registers, like 1.8.1 and 32.7.0, by explicitly setting the SN found in the object list.
I also have a question. I was able to read the registers using SN directly by setting the object’s shortName. I did:
//Read register
gxRegister register1;
cosem_init(BASE(register1), DLMS_OBJECT_TYPE_REGISTER, "1.1.1.8.1.255");
register1.base.shortName = 0x0b20;
com_read(BASE(register1), 3);
com_read(BASE(register1), 2);
obj_toString(BASE(register1), &data);
GXTRACE(PSTR("Register"), data);
Now that I am able to read the object list for this SN meter, there must be an easy way to retrieve the short name from the Object List. I retrieved the object list like this:
ret = com_getAssociationView();
if(ret != DLMS_ERROR_CODE_OK) {
GXTRACE_INT(PSTR("com_getAssociationView failed"), ret);
return ret;
}
GXTRACE_INT(PSTR("com_getAssociationView SUCCEEDED"), ret);
Could you help me how to read a register using it’s Logical Name by looking up it’s Short Name in the object list?
This is the only way to do it. You need to read the association view and then save a short name so you can use it later. There is no formula, etc to count short name from the logical name. You can think short name as a memory address and it might be different even the same meter between the firmware versions.
You can get short name from the shortName of the base object. Something like this:
Thanks for your reaction. My question is: is there any functions in the Gurux.c library to look up a LN in the object list to find the SN? Or do I just have to loop the object list like this:
gxObject* obj;
for (size_t pos = 0; pos != Client.GetObjects()->size; ++pos) {
ret = oa_getByIndex(Client.GetObjects(), pos, &obj);
}
Hi,
Hi,
This is the only way to do it. You need to read the association view and then save a short name so you can use it later. There is no formula, etc to count short name from the logical name. You can think short name as a memory address and it might be different even the same meter between the firmware versions.
You can get short name from the shortName of the base object. Something like this:
gxRegister reg;
//INIT, etc...
reg.base.shortName
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks for your reaction. My question is: is there any functions in the Gurux.c library to look up a LN in the object list to find the SN? Or do I just have to loop the object list like this:
gxObject* obj;
for (size_t pos = 0; pos != Client.GetObjects()->size; ++pos) {
ret = oa_getByIndex(Client.GetObjects(), pos, &obj);
}
Hi,
Hi,
You can find objects by logical name using oa_findByLN-method.
BR,
Mikko