CasCom - 2022-02-25

Hi,
please excuse my noob question, but I am totaly new to the Powerlink topic and I am kind of stuck. I hope I could get some help in this place.

Till now I've used the exampIe from kalycito which works good for me. I'm using openConigurator (Standalone and Eclipseplugin) to generate my "Network-Layout".
In a next step I have to implement a CN for a Powerlink Network that contains 2 Records (1 for TPDO, 1 for RPDO)
From this thread I suspect I have to link each sub-object on its own, but.... How? (Respectively what is meant by "....you have to link each sub-object individually..." I could not imagine any code for that . It's been more than 15 years since I wrote anything in c/c++ :( )

In our xdd file we have the definition of the following Records:

<Object index="2000" name="BytesOut_REC" objectType="9">Bitte entschuldigen Sie meine langen ausführungen und mein eingeschränktes englisch
    <SubObject subIndex="00" name="NumberOfEntries" objectType="7" dataType="0005" defaultValue="0x4"                      accessType="const" />
    <SubObject subIndex="01" name="StatusWord"      objectType="7" dataType="0004"                    PDOmapping="default" accessType="rw"    />
    <SubObject subIndex="02" name="AckCmd"          objectType="7" dataType="0005"                    PDOmapping="default" accessType="rw"    />
    <SubObject subIndex="03" name="Dev1"            objectType="7" dataType="0005"                    PDOmapping="default" accessType="rw"    />
    <SubObject subIndex="04" name="Dev2"            objectType="7" dataType="0005"                    PDOmapping="default" accessType="rw"    />
</Object>
<Object index="2100" name="BytesIn_REC" objectType="9">
    <SubObject subIndex="00" name="NumberOfEntries" objectType="7" dataType="0005" defaultValue="0x6"                      accessType="const" />
    <SubObject subIndex="01" name="CmdID"           objectType="7" dataType="0005"                    PDOmapping="default" accessType="ro"    />
    <SubObject subIndex="02" name="DevID"           objectType="7" dataType="0005"                    PDOmapping="default" accessType="ro"    />
    <SubObject subIndex="03" name="Para1"           objectType="7" dataType="0003"                    PDOmapping="default" accessType="ro"    />
    <SubObject subIndex="04" name="Para2"           objectType="7" dataType="0003"                    PDOmapping="default" accessType="ro"    />
    <SubObject subIndex="05" name="Para3"           objectType="7" dataType="0003"                    PDOmapping="default" accessType="ro"    />
    <SubObject subIndex="06" name="Para4"           objectType="7" dataType="0003"                    PDOmapping="default" accessType="ro"    />
</Object>

The demo code from kalycito use:
- struct PI_IN / PI OUT for the ProcessImage structure
- oplk_allocProcessImage to allocate the memory
- oplk_getProcessImageIn/Out to get a Pointer to the PI_IN/PI_OUT struct
- oplk_linkProcessImageObject Method to link the objects.

My idea was to extend the demo_cn_console code to work with the defined RECORDS. (Of course it doesn't work out ;) )
My thougts and questions to this:
- Do I have to put every Sub-object into the struct?
- Do I have to set the amount of memory by "counting the bytes" of the sub-objects of the record? (including or excluding subindex 0 ?)
- In the doc. to the oplk_linkProcessImageObject they always talk about first object/variable ("The sub-index of the object where the first variable should be linked to" , "the offset of the first process variable in the process image."). How do I link the other subobjects?
- Is oplk_linkProcessImageObject the "right way" to work with records, or is there a "better" way (as mentioned in the other tread: oplk_linkObject()). But the question stays the same: How to do/code that?

One last question: Is there perhaps a demo code out there, or do anyone have a short example, like the demo_cn_console, which works with records?

Please excuse my long explanations and my limited english, but it is not my native language
Thanks for reading :)

Best regards,
Cas