Read system data layer object from PLC

Hi,
I try to read some system data layer.

If I try to read a type STRING or BOOL, I can read data in PLC with function DL_ReadNode without problem.
For exampIe: if declare Value as type Bool and I can read:
system/resources/network/interfaces/XF10/ipForwarding

if I declare Value as type STRING, I canb read:
system/resources/network/interfaces/XF10/mode

But If I try to read OBJECT:
system/resources/network/interfaces/XF10/addresses
DL_ReadNode return me always ACCES_ERROR(4).

In this example how I must declare Value to read:
system/resources/network/interfaces/XF10/addresses
with DL_ReadNode function?

Thanks.

Best reply by Sgilk

Hi Nova ,

I looked into this for awhile and I think we might be lacking the functionality or at least documentation to do this. First of all, it took me awhile to find the PLC library associated with the datalayer type definition "networkmanager_Address".

I only found it by browsing the documentation of each ctrlX library. I found some POUs in the CXA_DEVICEADMIN_FBS library that look like they are intended to handle these types of operations. There are not associated DUTs in the library.

There are not examples in the documentation on using the POUs. I haven't been successful in reading out the addresses. Here is my code for reference. I think this is close as the address string returns "<" when I have addresses configured and an empty string when I do not.

Declaration

 

 

PROGRAM PLC_PRG
VAR
  m_fbReadNodeValue: DL_ReadNodeValue;
  m_ExecuteReadNodeValue : BOOL;;
  m_DataNodeValue : CXA_Datalayer.DL_NodeValue;
  m_Type : CXA_Datalayer.DL_DATA_TYPE;

  AddressData : CXA_DEVICEADMIN_FBS.networkmanager_Address;
  AddressString : STRING;
END_VAR

 

 

Implementation

 

 

m_ExecuteReadNodeValue := TRUE;

m_fbReadNodeValue(Execute:=m_ExecuteReadNodeValue, NodeName:= 'system/resources/network/interfaces/XF50/addresses', NodeValue:= m_DataNodeValue);
IF (m_fbReadNodeValue.Done = TRUE) THEN
	m_Type := m_DataNodeValue.GetType();
	AddressData.getRootAsAddress(data := m_DataNodeValue.GetData(), size := m_DataNodeValue.GetSize());
	AddressString := AddressData.getAddress();
END_IF

IF (m_fbReadNodeValue.Done = TRUE) OR (m_fbReadNodeValue.Error = TRUE) THEN
    m_ExecuteReadNodeValue := FALSE;
	m_fbReadNodeValue(Execute:=m_ExecuteReadNodeValue, NodeName:= 'system/resources/network/interfaces/XF50/addresses', NodeValue:= m_DataNodeValue);
END_IF

 

 

 

View original
4 replies