2026-04-12 13:41:40 +02:00
2026-04-12 13:41:40 +02:00
2026-02-14 14:32:42 +01:00
2026-02-14 14:32:02 +01:00
2026-02-14 14:32:41 +01:00
2026-02-19 20:39:36 +01:00
2026-04-12 13:41:40 +02:00
2026-04-07 10:21:04 +02:00
2026-04-07 10:21:04 +02:00
2024-08-29 14:58:33 +02:00
2026-02-14 14:32:37 +01:00
2026-02-14 14:32:02 +01:00
2026-02-14 14:32:40 +01:00
2024-09-15 16:52:54 +02:00
2026-02-14 14:32:44 +01:00
2026-02-14 14:32:34 +01:00
2026-02-14 14:32:34 +01:00
2026-02-14 14:32:41 +01:00
2026-02-14 14:32:41 +01:00
2026-02-14 14:32:13 +01:00
2026-02-14 14:32:12 +01:00
2026-02-14 14:32:13 +01:00
2026-02-14 14:32:48 +01:00
2026-02-14 14:32:40 +01:00
2026-02-14 14:31:29 +01:00
2026-02-14 14:32:05 +01:00

unisim_cpp

Guidelines

There are a few rules to follow when creating a big project with multiple people.

1 Pragma once

Change this setting in Qt creator

Edit > Preferences > C++ > File Naming > Headers > Include guard template and check the box "Use pragma once instead"

2 File naming

Change this setting in Qt creator

Edit > Preferences > C++ > File Naming > Headers > Suffix
Change this to hpp

Change this setting in Qt creator

Edit > Preferences > C++ > File Naming > Sources > Suffix
Change this to cpp

Line endings

Change this setting in Qt creator

Edit > Preferences > Text Editor > Behavior > File Encodings > Default line endings
Change this to Unix (LF)

3 How to write type names

Use snake case and make the first letter a capital letter to show that it is a type name

4 Linting rules

Please run clang-format using the given .clang-format file and check that linting passes on bitbucket piplines

5 No broken code in main branch

Always use a pull request to merge code in the main branch, this makes it so that no broken code can get in the main branch.

Creating a new simulator

How to create a client ui
How to create a server sim

Setup

Requirements

Fedora packages:

sudo dnf install gtest-devel cmake git ninja-build qt6-qttools-devel qt6-qtsvg-devel qt6-qtwebsockets-devel qt6-qtserialport-devel libsocketcan qt6-qtserialbus-devel libgpiod-devel

Clone repo

Easiest way to download a repo from our bitbucket is to use an ssh-key. Put or generate the key on the system and copy the private key to your bitbucket account. (Cog > Personal Bitbucket Settings > SSH keys) Then run this command on the system.

git clone --recurse-submodules git@bitbucket.org:belgiantrain/unisim-cpp.git

Server build

cmake -S . -B ./build/ -G Ninja
cmake --build ./build/ --target unisim_server #your sims (sim_*)

Client build

cmake -S . -B ./build/ -G Ninja
cmake --build ./build/ --target unisim_client #your ui (ui_*)

Running the project

Copy the libsim_* and/or libui_* together with the server or client to /usr/local/bin

sudo cp build/bin/unisim_* build/bin/libsim_* build/bin/libui_* /usr/local/bin/

then run

unisim_client -s $Server_IP

or

unisim_server

for more info on each executables commandline params run with -h option

Enabling CAN bus on Raspberry Pi

Append this to /boot/config.txt

dtparam=spi=on
dtoverlay=mcp2515-can0,spi0-0,oscillator=16000000,interrupt=22
dtoverlay=mcp2515-can1,spi0-1,oscillator=16000000,interrupt=26
dtoverlay=spi-bcm2835-overlay

Copy can_dev.service to /etc/systemd/system. Reboot to apply changes. It could be that can0 is switched with can1.

sudo cp can_dev.service /etc/systemd/system
sudo systemctl enable can_dev.service
sudo reboot

Autostart server on boot

Copy unsim_cpp.service to /etc/systemd/system If you use can you could copy can_dev.service as well (Remove -c can0 if you don't use can)

sudo cp unisim_cpp.service /etc/systemd/system
sudo systemctl enable --now unisim_cpp.service
S
Description
No description provided
Readme
1.1 MiB
Languages
C++ 94.3%
CMake 2.7%
Go 1.9%
HTML 0.8%
Shell 0.2%
Other 0.1%