AcarsDeco2: Porovnání verzí

Z Poznámkový blok
Přejít na: navigace, hledání
(Úvod)
(Úvod)
 
Řádka 6: Řádka 6:
 
Bohužel původní projekt byl odstraněn. Naštěstí zatím je pár odkazů na githubu:
 
Bohužel původní projekt byl odstraněn. Naštěstí zatím je pár odkazů na githubu:
 
* https://github.com/abcd567a/ad2
 
* https://github.com/abcd567a/ad2
 +
Pro jistotu jsem si jej ulozil i k sobe:
 +
* http://slapnet.cz/zabbix/acarsdeco2_rpi2-3_debian9_20181201.tgz
  
 
== Instalace ==
 
== Instalace ==

Aktuální verze z 30. 11. 2023, 23:37

Úvod

ACAERS je bezpečnostni systém v leteckém provozu používaná u velkých letadel. Využívá se k přenosu technických zpráv mezi letadlem a mateřskou společností.

Jeden z nejlépe spracoavných decodérů, včetně web rozhraní nabízí xdeco.org.

Bohužel původní projekt byl odstraněn. Naštěstí zatím je pár odkazů na githubu:

Pro jistotu jsem si jej ulozil i k sobe:

Instalace

Z výše uvedené stránky stáhneme aktuální program v sekci "Download". Bohužel soubor je uložen na Googlu. Po stažení přesuneme soubor na požadovaný počítač.

Soubor rozbalíme a nakopírujeme do adresáře /opt/acarsdeco.

sudo mkdir /opt/acarsdeco2
sudo tar -xvf acarsdeco2_rpi2-3_debian9_20181201.tgz -C /opt/acarsdeco2/

Automatocké spouštění

Pravděpodobně budeme chtít aby se acarsdeco spustil automaticky při spuštění počítače. Pro tento účel máme několik možností. Pro starší distribuce je určen skript který se ukádá do adresáře init.d. U novějších distribucí je tato slušba nahrazena serviced-

etc/init.d

V adresáři /etc/init.d vytvoříme nový soubor, z názvem acarsdeco2.init do kterého vložíme:

#! /bin/sh
#
#  -h [ --help ]         This help message
#  --device-list         List Available devices
#  --device-index arg    Select SDR device (default: 0)
#  --device-serial arg   Select SDR device by serial no
#  --gain arg            Set gain in Receiver, dB (default: Auto)
#  --freq-correction arg Set frequency correction, ppm (default: 0)
#  --agc                 Enable Automatic Gain Control in SDR (default: off)
#  --freq arg            Set frequency, Hz. Specify option --freq multiple times to multiple channels (--freq XX --freq YY ..)
#  --inConnect arg       Input connector. Format: (sbs|ad2):host:port
#  --inConnectId arg     Named input connector. Format: (sbs|ad2):host:port:ID
#  --inServer arg        Input server. Format: (sbs|ad2):port
#  --inServerId arg      Named input server. Format: (sbs|ad2):port:ID
#  --inServerUdp arg     Input UDP server. Format: (sbs|ad2):port
#  --outServer arg       Output server. Format: (sbs|ad2|pp):port
#  --outConnect arg      Output connector. Format (sbs|ad2|pp):host:port
#  --outConnectUdp arg   Output UDP connector. Format: (sbs|ad2|pp):host:port
#  --http-port arg       Set port for http server (default: 8080)
#  --vrs-url arg         Set VirtualRadarServer url for aircraft images Example: http://example.com (default: off)
#  --pictures-url arg    Set aircraft pictures url Example: http://site.com/path/to/ (default: off)
#  --silhouettes arg     Set path to directory of aircrafts' silhouettes
#  --banners arg         Set path to directory of operators' logos
#  --frdb arg            Set path to flightroutes database file
#  --db arg              Set path to basestation database file
#  --no-uplink           Don't display uplink messages (default: on)
#  --no-sq               Don't display label: SQ messages (default: on)
#  --no-empty            Don't display empty messages (default: on)
#  --logfile arg         Set log filename (default: off)
#  --logfile-sbs arg     Set path to SBS CSV log filename (default: off)
#  --logfile-esbs arg    Set path to extended SBS CSV log filename (default:off)
#  --no-console          Disable logging on console (default: on)

device=2
gain=34
ppm=68
net=sbs:30008
web=8080
frq="131525000 131725000 131825000"
vrs="http://letpc.slapnet.cz:80"
log="/var/log/acars.log"
path="/opt/acarsdeco2"
prog="acarsdeco2"
picture="http://radar.slapnet.cz/imgairplanes/pictures.php?f="

 
start(){
    acars=""
    if [ "$device"  != "" ]; then acars="$acars --device-index $device"; fi
    if [ "$gain"    != "" ]; then acars="$acars --gain $gain"; fi
    if [ "$ppm"     != "" ]; then acars="$acars --freq-correction $ppm"; fi
    if [ "$agc"     != "" ]; then acars="$acars --agc $agc"; fi
    for rx in $frq; do acars="$acars --freq $rx"; done
    if [ "$web"     != "" ]; then acars="$acars --http-port $web"; fi
    if [ "$vrs"     != "" ]; then acars="$acars --vrs-url $vrs"; fi
    if [ "$picture" != "" ]; then acars="$acars --pictures-url $picture"; fi
    if [ "$net"     != "" ]; then acars="$acars --outServer $net"; fi
    if [ "$log"     != "" ]; then acars="$acars --logfile $log"; fi
    cd $path
    $path/$prog $acars >> /dev/null 2>&1 &
    PID=$!
    sleep 1
    echo "ACARSdeco2 spusten pod PID=$PID ($acars)"
    sleep 1
}

stop(){
    echo -n "Ukonceni vsech ACARSdeco2 serveru: "
    PID=`pidof $prog`
    echo "pid: $PID"
    if [ "$PID" ]; then
        for ID in $PID; do
            kill -9 $ID
        done
    fi
}

list(){
    $path/$prog --device-list
}

case "$1" in
   start)
        start
   ;;
   stop)
        stop
   ;;
   restart)
        stop
        start
   ;;
   list)
        list
   ;;
   *)
   echo $"Moznosti: $0 {start|stop|restart|list}"
   retval=1
esac

Po upravě nastavení pak můžeme server spustit pomocí tohoto skriptu s příslušným parametrem.

systectl

Pro spuštění jako service vytvoříme prvně v adresáři /opt/acarsdeco/ konfigurační soubor acarsdeco2.conf kde následně upravíme nastavení dle svých potřeb.

sudo nano /opt/acarsdeco2/acarsdeco2.conf
#Program options:
#  --device-list         List available SDR devices
#  --device-index arg    Select SDR device (default: 0)
#  --device-serial arg   Select SDR device by serial number
#  --gain arg            Set preamp gain of receiver, dB (default: auto)
#  --freq-correction arg Set oscillator frequency correction, ppm (default: 0)
#  --agc                 Enable automatic gain control in SDR chip (default: off)
#  --freq arg            Set receiver frequency, Hz Specify option --freq multiple
#                        times to multiple channels (Example: --freq XX --freq YY ...)
#  --inConnect arg       Input connector. Format: (sbs|ad2):host:port
#  --inConnectId arg     Named input connector. Format: (sbs|ad2):host:port:ID
#  --inServer arg        Input server. Format: (sbs|ad2):port
#  --inServerId arg      Named input server. Format: (sbs|ad2):port:ID
#  --inServerUdp arg     Input UDP server. Format: (sbs|ad2):port
#  --outServer arg       Output server. Format: (sbs|ad2|pp):port
#  --outConnect arg      Output connector. Format (sbs|ad2|pp):host:port
#  --outConnectUdp arg   Output UDP connector. Format: (sbs|ad2|pp):host:port
#  --http-port arg       Set port for http server (default: 8080)
#  --vrs-url arg         Set VirtualRadarServer url for additional aircraft data
#                        Example: http://example.com (default: off)
#  --pictures-url arg    Set aircraft pictures collection url
#                        Example: http://site.com/path/to/ (default: off)
#  --pictures arg        Set aircraft pictures collection local path
#                        Example: http://site.com/path/to/ (default: off)
#  --silhouettes arg     Set path to directory of aircrafts' silhouettes
#  --banners arg         Set path to directory of operators' logos
#  --frdb arg            Set path to flightroutes database file
#  --db arg              Set path to basestation database file
#  --no-uplink           Don't display uplink messages (default: on)
#  --no-sq               Don't display messages with SQ label (default: on)
#  --no-empty            Don't display empty messages (default: on)
#  --logfile arg         Set path to log filename (default: off)
#  --logfile-sbs arg     Set path to SBS CSV log filename (default: off)
#  --logfile-esbs arg    Set path to extended SBS CSV log filename (default: off)
#  --no-console          Disable logging on console (default: on)
#

ARGS="
--device-index 2
--gain 48
--freq-correction 91
--freq 131525000 --freq 131725000 --freq 131825000
--http-port 8080
--pictures-url http://radar.slapnet.cz/imgairplanes/pictures.php?f=
--logfile-esbs /var/log/acars/sbs-e
--no-console
"

Pro jednoduší editaci nastavíme práva pro konfigurační soubor a symlink:

sudo chmod 660 /opt/acarsdeco2/acarsdeco2.conf
sudo chown pi /opt/acarsdeco2/acarsdeco2.conf
sudo ln -s /opt/acarsdeco2/acarsdeco2.conf /home/pi/acarsdeco2.conf

Poté vytvoříme vlastní skript pro spuštění služby a vložíme do něj nastavení:

sudo systemctl edit --force --full acarsdeco2.service
[Unit]
Description=Aircraft Communications Addressing and Reporting System
Documentation=http://xdeco.org/?page_id=42
After=network-online.target

[Service]
Type=simple
EnvironmentFile=/opt/acarsdeco2/acarsdeco2.conf
ExecStart=/opt/acarsdeco2/acarsdeco2 $ARGS

[Install]
WantedBy=multi-user.target

Nastavíme aby se služba pouštěla po startu a následně ji spustíme. Také ověříme že je spuštěna.

sudo systemctl enable acarsdeco2.service
sudo systemctl start acarsdeco2.service
sudo systemctl status acarsdeco2.service

Případně sledovat co se dějě ...

journalctl -fe -u acarsdeco2

Poznamky

--gain 38.0 - setting gain for receiver R820T. Determine the optimal value for your receiving conditions once, for example, in SDRSharp,
--freq-correction 65 - correction of dongle internal oscillator. This is absolutely critical accurate adjustment for multi-channel receiver,
--freq 131550000 --freq 131725000 - frequency of ACARS channel (up to 3),
--http-port 8090 - set the port number for HTTP server. Default 8080,
--vrs-url http://192.168.1.10:8080 - network address of VirtualRadarServer for getting aircraft pictures in the WEB window,
--udp 127.0.0.1:9742 - set UDP client for transmitting ACARS data to PlanePlotter,
--net 30008 - set TCP server for transmit data in Kinetic SBS-3 ACARS format on port 30008.

Odkazy