Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » How to create a custom CommFB?(Request for examples of how to use the network architecture of Forte.)
How to create a custom CommFB? [message #1841275] Mon, 10 May 2021 17:57 Go to next message
Noname Noname is currently offline Noname NonameFriend
Messages: 6
Registered: October 2020
Junior Member
Hi,

I want to communicate with an external program via socket.
The external program doesn't understand the encoding that the CommFB uses with default parameters (just addr:port).
I also tried raw[].ip[addr:port], but the status of the CommFB goes immediately Terminated->No socket.
The data I'm trying to send is the first n bytes of a byte array. A message may contain 0x00 value bytes. The encoding I wish to use is just a header of 4 bytes that contains the length of the payload.

I am trying to learn how the Forte network stack is used, and create a custom encoding layer for a CommFB.
I've read the documentation (https://www.eclipse.org/4diac/en_help.php?helppage=html/development/forte_communicationArchitecture.html), but I do not understand the scope in which the layers operate.

I would really appreciate an example or explanation that shows how to create and use the comm layers.
1. Where do I create the layer instances? Are they declared inside the CommFB instance that uses them?
2. If I have several instances of a CommFB, do they share the comm stack? Is there just a single instance of each layer, or does each FB have its own layers?

Thanks in advance for your time.
Re: How to create a custom CommFB? [message #1841279 is a reply to message #1841275] Mon, 10 May 2021 20:38 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

Hi,

I think the raw layer is already a good example. What you need to do is to create your own external module. There you would place your layer .h and .cpp file. You could start with a copy of raw layer. Then you need to register your com layer to the 4diac FORTE build system. Again you can have a look in the CMakeList.txt file in the comm infra directory and look how it is done for the raw layer.

On configureation, or to be more exact when your comm fb gets the init+ event it will parse the string given at its ID input. Based on the values given 4diac FORTE will look in a dedicated automatically generated comlayers factory if a layer is registered for the given name and if yes an instance is created and attached to your comfb. i hope this answers your 1. questions.

regarding your 2. question: each comm fb has its own stack of commlayers. this allows to also store some internal state inside of the layer. This is for example needed when you have fragemented packets.

I hope this helps to proceede.

Re: How to create a custom CommFB? [message #1841293 is a reply to message #1841279] Tue, 11 May 2021 10:14 Go to previous messageGo to next message
Noname Noname is currently offline Noname NonameFriend
Messages: 6
Registered: October 2020
Junior Member
Thanks a lot for the quick reply!
Your answer clarified the confusion I had with the layers.
I feel a little silly for forgetting to find and look at the source files for the raw layer before I asked the questions.
Re: How to create a custom CommFB? [message #1841308 is a reply to message #1841293] Tue, 11 May 2021 18:44 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

You are welcome. I would love if our documentation is a bit better. But keeping up with the changes and expanding it is always such a hard job. So please don't feel silly. We are happy to support you.
Previous Topic:Sharing example forte on stm32f7
Next Topic:Struct datatype deploying causing crash
Goto Forum:
  


Current Time: Fri Apr 19 02:39:40 GMT 2024

Powered by FUDForum. Page generated in 0.02523 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top