Skip to content

Conversation

@ivanhercaz
Copy link

Dear Redwire Labs Team,

I know this PR is a bit huge and it may be splitted into several branches and make pull requests per feature. But at this moment I think the best will be to sync this work. Although I try each commit to be self-explanatory I leave below a summary of the changes done and some important remarks (with important at the beginning):

  • We implemented UDP sockets in both sides, C and Elixir. In Elixir, BACNetUDP module simulates BACNet module but using UDP sockets, and there is a BACNetUDP.Helper module that eases our debugging, testing and fixing work (it is also aliased in IEx as H and Helper.
  • In relation with the UDP sockets, I have to commit yet a better way of choose one way or the another, because at this moment it is mandatory to change USE_UDP_SOCKETS in src/port.h to choose. I will change it soon. The USE_UDP_SOCKETS is used in src/main.c and src/port.h to enable them.
  • In src/bacnet.c you can see some changes we have done (mainly pending todos, doubts and the decouple the concept of bacnet_network_id into bacnet_farside_network_number and bacnet_nearside_network_number.
  • Important: our CMakelists.txt file is completely different to yours, so we may need to discuss about this.
  • In relation with the bacnet-stack and the VSCode debugger configuration, we work with the structure of having a directory in which then there are two directories: one is the bacnet_ex and the another one is the bacnet-stack. I know it is vendor-locked to our current way to develop, but it isn't mandatory to be done in that way and it is easy to find another way.
  • To ease the debugging through the symbols of the bacnetd and the bacnet-stack a symbolic link to ../bacnet-stack was added, so only opening the bacnet_ex we can see all the source files.
  • Important: in mix.exs I disable the :cmake compiler because it was causing issues when getting the dependencies from the firmware. Anyway, this change is something it isn't required to be merged in your main unless you find some way of conditional choose it (I have not though about it yet, so prefer to discuss with you).

I think I am not forgetting nothing, but if I remember something more I will update this message. Anyway, I keep the pull request as a draft because I want to made some changes, as the one of the configuration of USE_UDP_SOCKETS, that I probably will do using an environment variable: easy to implement, easy to use.

I also wants to sync our branches with the latest from your main.

Regards,
Iván

ivanhercaz and others added 30 commits March 18, 2025 18:25
Use them with Helper or its alias H.
There is a note in the code for Ed and Abelino.
@ivanhercaz
Copy link
Author

I added two more commits solving the next:

  • USE_UDP_SOCKETS can be defined using a Cmake option.
  • Add USE_UDP_SOCKETS in a part of the top of main.c I forget when I added the conditionals #if. And now the #if are #ifdef and #ifndef.
  • Remove the use of the first argument of bacnetd as the instance of the gateway device. It was added by me in the past to make work something, but at this moment it isn't necessary not provide nothing.

BACnetEd and others added 3 commits April 15, 2025 15:50
Because of how the bacnet-stack works, it is recommended to terminate the `SUPPORTED_OBJECT_TABLE` with a sentinel value that indicates the end.

Steve Karg's usual way is to set the last value of the list to a value completely null with the exception of the type in which is set `MAX_BACNET_OBJECT_TYPE`.

Co-authored-by: Ed <edward@bac-test.com>
(cherry picked from commit 50a6de3)
@ivanhercaz
Copy link
Author

@abelino, @amclain: if this PR should be cleaned and splitted in several-feature PRs, let me know. I could try to separate the stuff in branches without breaks and then create a pull request for each one. Although, we still have things to discuss on this PR I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants