Files
Kari Argillander 369da70f2a Strip tabs and trailing white spaces, and fix end of files (#748)
* format: Strip trailing whitespaces

We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.

Commit was generated with:

    pre-commit run --all-files trailing-whitespace

* format: Files should have exactly one new line end of them

It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.

Commit was generated with:

    pre-commit run --all-files end-of-file-fixer

* format: Convert tabs to spaces

Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.

Commit was generated with:

    pre-commit run --all-files remove-tabs

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2024-08-25 14:13:57 -05:00

45 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Parallel bacepics connected with Foreign Device to BBMD
# Assume that we are using the default IP address:
BACNET_IP_ADDRESS=`ip route get 8.8.8.8 | fgrep src | cut -f7 -d" "`
BACNET_IP_PORT=47808
echo "Spawning BBMD server at UDP port ${BACNET_IP_PORT}"
# Launch the local BBMD
./bacserv $BACNET_IP_PORT BACServer-$BACNET_IP_PORT &
# Allow the local BBMD time to get running
sleep 1
#list of devices from command line assigned UDP port number as key
epics_port_start=47810
port_key=${epics_port_start}
declare -A device
# capture the devices from the command line
for d in "$@"
do
device[${port_key}]=${d}
epics_port_max=$((port_key++))
done
# spawn the epics clients
export BACNET_BBMD_ADDRESS=$BACNET_IP_ADDRESS
export BACNET_BBMD_PORT=$BACNET_IP_PORT
echo "Spawning clients to register as foreign device to BBMD" $BACNET_BBMD_ADDRESS:$BACNET_BBMD_PORT
# note: leaving port 47809 free for example bvlc.sh clients
for port in $(seq ${epics_port_start} ${epics_port_max})
do
# note: is there a limit to the number of Foreign Device Registrations?
export BACNET_IP_PORT=${port} ; \
./bacepics ${device[${port}]} > epics-${device[${port}]}-${port}.txt &
pids[${port}]=$!
echo "Spawned EPICS client using UDP port ${port} reading ${device[${port}]}"
done
echo "Waiting for the clients to finish..."
for pid in ${pids[*]}; do
wait $pid
done
killall bacserv