Code Monkey home page Code Monkey logo

vdlm2dec's Introduction

VDLM2DEC

vdlm2dec is a vdl mode 2 decoder with built-in rtl_sdr or airspy front end.

It could decode up to 8 frequencies simultaneously ( but in the same 2Mhz range for rtl_sdr )

It decodes ARINC-622 ATS applications (ADS-C, CPDLC) via libacars library

Usage

For RTL-SDR:

vdlm2dec [-l logfile] [-g gain] [-i stid] [-v] [-q] [-J] [-l logfile] -r rtldevicenumber Frequencies(Mhz)

For Airspy R2 / Mini:

vdlm2dec [-l logfile] [-g gain] [-i stid] [-v] [-q] [-J] [-l logfile] [-k airspy_serial ] Frequencies(Mhz)

-p ppm : set rtl sdr ppm frequency (rtl-sdr only)

-i stid : local receiver station id

-b filter: filter output by label (ex: -b "H1:Q0" : only output messages with label H1 or Q0"

-v : verbose output

-q : quiet output

-J : json output

-R : Flights & Aircrafts registration json format output

-a : Aircraft registration csv format output

-l logfile : output log (default : stdout)

-j addr:port send to addr:port UDP packets in json that could be read by acarsserv or other online aggregator

-s addr:port : send received position in sbs format output to addr:port

-G : output messages from ground station

-E : output empty messages (not really useful)

-U : output undecoded messages (not really useful)

for the RTLSDR device

-r rtldevicenumber : decode from rtl dongle number rtldevicenumber or s/n

-g gain : set preamp gain in tenth of db (ie -g 90 for +9db)

for the AirSpy device

-g gain : set linearity gain (0 to 21).By default use maximum gain (airspy)

-k airspy_serial_number : decode from airspy device with supplied serial number specified in hex, ie 0xA74068C82F591693

Examples

For rtl-sdr :

./vdlm2dec -r 0 136.725 136.775 136.875 136.975

For airspy :

./vdlm2dec 136.725 136.775 136.875 136.975

[#4 (F:136.975 P:-2.1) 11/03/2018 15:52:27.259 --------------------------------
Command from Aircraft:3986E5 (airborne) to GroundD:2198B7 
Frame-I: Ns:0 Nr:0
ACARS
Aircraft reg: F-HBXF Flight id: YS7656
Mode: 2 Msg. label: Q0
Block id: 1 Ack: !
Msg. no: M36A

[#4 (F:136.975 P:-6.3) 11/03/2018 15:52:27.831 --------------------------------
Command from Aircraft:3946EC (airborne) to GroundD:2190F7 
Frame-I: Ns:1 Nr:0
unknown data

JSON out :

./vdlm2dec -J -r 0 136.725 136.775 136.875 136.975

{"timestamp":1675586802.2075,"station_id":"TL-LFRN-VDL2","freq":136.775,"hex":"02007D","icao":131197,"toaddr":2178181,"app":    {"name":"vdlm2dec","ver":"2.1"},"mode":"2","label":"H1","block_id":"2","ack":"!","tail":"CN-ROR","flight":"ATRAM6","msgno":"D65B","text":"#DFB0400000627932100\r\nD2010000031421170\r\nF1+0304+99+6702981040+034+366+00XXXX+02-00\r\nF2+0305+99+6702981036+034+369-00XXXX+02-00\r\nG1-3920308781084308430887\r\nG2-3920308781084308430888\r\nK100111011111X110101100\r\nK2","end":true}
{"timestamp":1675586807.2109711,"station_id":"TL-LFRN-VDL2","freq":136.725,"hex":"407795","icao":4224917,"toaddr":1153178,"app":{"name":"vdlm2dec","ver":"2.1"},"dsta":"GCRR","lat":47.4,"lon":-3.8,"epu":6,"alt":36000}
{"timestamp":1675586807.290592,"station_id":"TL-LFRN-VDL2","freq":136.775,"hex":"02007D","icao":131197,"toaddr":2178181,"app":       {"name":"vdlm2dec","ver":"2.1"},"mode":"2","label":"H1","block_id":"3","ack":"!","tail":"CN-ROR","flight":"ATRAM6","msgno":"D65C","text":"#DFB00111011111-110101100\r\nL1018CE000000000939A8501000100007F0920000040847\r\nL2018CE000000000939B0501000200007F092000004084A\r\n"}

Flights & Aircraft registration JSON output :

./vdlm2dec -R -r 0 136.725 136.775 136.875 136.975

{"timestamp":1546187157.8686321,"icao":"3C656D","tail":"D-AIKM"}
{"timestamp":1546187160.7268431,"icao":"020095","tail":"CN-ROU"}
{"timestamp":1546187164.189714,"flight":"BA092F","depa":"EGKK","dsta":"LPFR","icao":"406B84","tail":"G-GATS"}
{"timestamp":1546187173.913542,"icao":"440395","tail":"OE-IZO"}
{"timestamp":1546187215.3877859,"flight":"CJ8483","depa":"EGLC","dsta":"LEPA"}

Aircraft registration csv output:

./vdlm2dec -a -r 0 136.725 136.775 136.875 136.975

4D201F,9H-AEI
4CA2C9,EI-DEP
49514B,CS-TJK
400D8B,G-EZAA

Send to a remote aggregator:

./vdlm2dec -q -i XX-YYYYZ -j feed.acars.io:5555 -r 0 136.725 136.775 136.825 136.875 136.975

Send positions in sbs format to a local readsb:

./vdlm2dec -q -s 127.0.0.1:37000 -r 0 136.725 136.775 136.825 136.875 136.975

Notes :

  • Add --net-sbs-jaero-in-port=37000 to readsb command line to receive sbs packets
  • You could use -s and -j together :

./vdlm2dec -q -i XX-YYYYZ -s 127.0.0.1:37000 -j feed.acars.io:5555 -r 0 136.725 136.775 136.825 136.875 136.975

Compilation

vdlm2dec must compile directly on any modern Linux distrib. It has been tested on x86_64 with fedora 27, on tegra TK1,TX1 with Ubuntu

It depends on some external libraries :

Compile

For rtl_sdr :

mkdir build
cd build
cmake .. -Drtl=ON
make
sudo make install

For airspy :

mkdir build
cd build
cmake .. -Dairspy=ON
make
sudo make install

For raspberry Pi and others ARM machines :

The gcc compile option -march=native could not be working, so modify the add_compile_options in CMakeLists.txt to set the correct options for your platform.

Copyrights

vdlm2dec and acarsserv are Copyright Thierry Leconte 2015-2023

These code are free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 published by the Free Software Foundation.

They include cJSON Copyright (c) 2009-2017 Dave Gamble and cJSON contributors

vdlm2dec's People

Contributors

ckuethe avatar murrayma avatar reloc avatar tanerh avatar tleconte avatar wiedehopf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vdlm2dec's Issues

High CPU Use

Hi Thierry,

I'm running the latest commit cf6d072 with the new -b and libacars.
Previous versions have used about 45% of cpu on my Raspberry Pi v3.
When using 'top', this latest version appears to be running at 195% cpu; although I assume it is spread across all cpu's.
Why is the CPU use so high?
Regards
Stuart

Feature: Use RTL serialnumber to select the dongle

When one has multiple dongles connected using the device ID can be confusing.
Please implement the use of serialnumber.
There are several examples on github that have this feature (like dumpvdl2)..

Cheers,
Dick

Aircraft and Ground Station Identifiers (Request)

It is generally accepted that the aircraft identifier/ModeS/ICAO24 e.g. 400dad, and VDL2 ground station identifiers are usually displayed with upper case characters e.g. 400DAD.

Can vdlm2dec be changed accordingly?

VDL2 Ground Station Broadcast Location

A Broadcast Message transmitted from a VDL2 ground station usually contains a local airport name and location e.g a 4 character ICAO code (EGLC) and a latitude and longitude location.
Can vdlm2dec also decode this data and add it as minimum to the "-v 1" normal output logs?

A Broadcast message in vdlm2dec -v 3 format from vdl2 ground station 260F37 EGLC.

ppm -0.2
#5 19/01/2018 11:03:44.292
Command from Ground: 260f37 to: ffffff 
Frame-U: -/- XID
Parameter set ID
Procedure classes
HDLC options
Specific options: VDA:ESN:IHN:BHN:BCN
unknown private id c1
c1 04 45 47 4c 43                                  |..EGLC..........|
unknown private id c4
c4 06 53 49 54 00 00 01                            |..SIT...........|
unknown private id c5
c5 04 94 00 00 00                                  |................|
unknown private id c8
c8 03 20 30 00                                     |.. 0............|
-----------------------------------------------------------------------

The definition is in RTCA DO 224C.

The 4 character ICAO airport code EGLC is fairly obvious!

The latitude and longitude are encoded in the last 3 bytes or your message above e.g. 20 30 00
12 bits for the latitude, 12 bits for longitude.
First bit is sign; 0 = positive = North or East.
If sign = 1 = negative = South or West. Then need twos-compliment.
Remaining 11 bits are the value.
For EGLC latitude value is 515 = 51.5N, longitude = 0 = 0.0E (maybe not the best example to use!)

Issue building on Alpine Linux amd64

It looks like there's some kind of header issue with timeval on Alpine Linux.

#34 3.586 [ 15%] Building C object CMakeFiles/vdlm2dec.dir/crc.c.o
#34 3.660 [ 23%] Building C object CMakeFiles/vdlm2dec.dir/d8psk.c.o
#34 4.231 [ 30%] Building C object CMakeFiles/vdlm2dec.dir/label.c.o
#34 4.255 In file included from /vdlm2dec/label.c:5:
#34 4.255 /vdlm2dec/vdlm2.h:47:17: error: field 'tv' has incomplete type
#34 4.255   struct timeval tv;
#34 4.255                  ^~
#34 4.258 In file included from /vdlm2dec/label.c:6:
#34 4.258 /vdlm2dec/acars.h:47:24: error: field 'ts' has incomplete type
#34 4.258          struct timeval ts,tl;
#34 4.258                         ^~
#34 4.258 /vdlm2dec/acars.h:47:27: error: field 'tl' has incomplete type
#34 4.258          struct timeval ts,tl;
#34 4.258                            ^~
#34 4.268 make[2]: *** [CMakeFiles/vdlm2dec.dir/build.make:102: CMakeFiles/vdlm2dec.dir/label.c.o] Error 1
#34 4.270 make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/vdlm2dec.dir/all] Error 2
#34 4.270 make: *** [Makefile:130: all] Error 2

Segmentation fault with -G argument

Hi

When running V2.3 and adding the ground station messages to the command (-G), a segmentation fault is thrown. Is this obsolete? Maybe this can cause problems with -g (gain)? I suppose the readme documentation might need an updated arguments list.

Thanks!

Truncated hostname results unterminated string as station id

My Raspberry Pi box has 8 character hostname 'acarspi3', that does not fit in the given buffer with the terminating null character. In principle hostname() function should care of that, but the glibc implementation has an undefined behaviour in this case and omits the terminator, resulting garbage as station id in JSON output. The following modification solved the issue:

char sys_hostname[9];
sys_hostname[sizeof(sys_hostname) - 1] = '\0';
gethostname(sys_hostname, sizeof(sys_hostname) - 1);

Dates should be presented in EN-ISO8601 date format.

Dates are not is standard format and not easily machine-sortable.

current notation:

[#1 (F:136.725 P:-0.9) 08/10/2018 17:44:41.050

Better to start each line with a ISO8601-compliant date:

2018-10-08T17:44:41,050 [#1 (F:136.725 P:-0.9)

That way we can sort and purge log files very easily, and still keep good human redability.

Program aborts after Updating 78b23c5..7dc3a78

Hi Thierry,
This evening I upgraded using git pull which showed:
78b23c5..7dc3a78 master -> origin/master

I added the -G option which makes the command that is run from a .sh script looks like this:
/home/pi/vdlm2dec/vdlm2dec -v -G -j 176.9.123.123:60003 -l "/home/pi/vdlm2dec/logs/vdl2_rtlsdr-11_$(date +"%Y%m%d").log" -p -1 -r 00000011 136.725 136.775 136.825 136.875 136.975 >> "/home/pi/vdlm2dec/logs/process-vdlm2dec.log" 2>&1 &

The .sh script is coded so that it will restart the program when it fails.
The last few hours it has failed and restarted 6 times..
The previous version ran 24/7 without any problems.

I can't find anything in any of the logfiles.

Let me know if I can be of any help.

Cheers,
Dick

JSON Output - Enhancement

Hi Thierry,
As well as the normal acars data, you have included an additional packet in the JSON outputs (-j and -J) containing the destination. For completeness would it be possible to enhance the JSON outputs (-j and -J) to include all aviation related data for all messages e.g. Aircraft ICAO, Ground Station Id, Direction/Uplink/Downlink indicator, Location (Lat & Lon), altitude and destination.

Examples.

[#5 (F:136.975 P:-6.6) 08/02/2018 00:00:13.620 --------------------------------
Response from Aircraft:987654 (airborne) to GroundD:214A77
Frame-S: Nr:1 RR

JSON output would include Date, Time, Channel, Frequency, Aircraft ICAO, Ground Station Id, Direction/Uplink/Downlink indicator.

[#5 (F:136.975 P:-4.7) 08/02/2018 00:01:40.879 --------------------------------
Command from Aircraft:3C66B8 (airborne) to GroundD:10980A
Frame-U: XID
Connection management: HO|VDA|ESN
XID sequencing 0:3
Specific options: GDA:ESN:IHS:BHN:BCN
Destination airport EGCC
Aircraft Position 51.3 4.0 alt: 36000

JSON output would include Date, Time, Channel, Frequency, Aircraft ICAO, Ground Station Id, Direction/Uplink/Downlink indicator, Latitude, Longitude, Altitude and Destination.

Thanks
Stuart

IQ values in rtl.c

Inside of in_callback() the IQ values get adjusted by 127.37..

How did you determine this is a correct value to adjust them?

Thanks.

static void in_callback(unsigned char *rtlinbuff, uint32_t nread, void *ctx)
{
..
	for (i = 0; i < RTLINBUFSZ;) {
		float r, g;
		r = (float)rtlinbuff[i] - **(float)127.37;**
		i++;
		g = (float)rtlinbuff[i] - **(float)127.37;**
		i++;
		Cbuff[i / 2] = r + g * I;
	}
..
}

cmake not finding libacars-2

The CMakeLists.txt is only looking for libacars, and not libacars-2 (which is the latest from https://github.com/szpajder/libacars )

This diff will check for acars-2, first, and then acars, before giving up on that library.

(Forgive the indenting, please adjust as you'd like)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c619ab7..b86ea58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,13 +5,20 @@ add_compile_options(-Ofast -march=native )

 add_executable(vdlm2dec cJSON.c  crc.c  d8psk.c  label.c  main.c  outacars.c  out.c  outxid.c  rs.c  vdlm2.c  viterbi.c )

-find_library(LIBACARS acars)
-if(LIBACARS)
-message ( STATUS "Using libacars")
-add_definitions(-DHAVE_LIBACARS )
-target_link_libraries( vdlm2dec acars)
+find_library(LIBACARS2 acars-2)
+if(LIBACARS2)
+       message ( STATUS "Using libacars-2")
+       add_definitions(-DHAVE_LIBACARS )
+       target_link_libraries( vdlm2dec acars-2)
 else()
-message ( STATUS "Not using libacars")
+       find_library(LIBACARS acars)
+       if(LIBACARS)
+               message ( STATUS "Using libacars")
+               add_definitions(-DHAVE_LIBACARS )
+               target_link_libraries( vdlm2dec acars)
+       else()
+               message ( STATUS "Not using libacars (v1 or v2)")
+       endif()
 endif()

 option(rtl "Compiling for rtl sdr" )

json/UDP feed stops working randomly

Sometimes the udp feed just stops working, until the process is killed and re-started. It can work for 30 days and suddenly stop. Local decoding and logging to text file continues normally.

As there is no state of a UDP connection that can be monitored it is hard to detect and restart.

command line is

/usr/local/bin/vdlm2dec -l /var/log/vdlmlog.txt -g 430 -p 60 -i P-ESSN9-V -j 176.9.123.123 60003 -G -r 1 136.725 136.775 136.825 136.875 136.975

Acars Messages

Using vdlm2dec, I'm receiving acars messages similar to ...

[#5 (F:136.975 P:-5.2) 01/02/2018 06:35:57.089 --------------------------------
Command from Aircraft:4B17E5 (airborne) to GroundD:10902A 
Frame-I: Ns:5 Nr:4
ACARS
Aircraft reg: HB-JBH Flight id: LX0450
Mode: 2 Msg. label: H1
Block id: 7 Ack: !
Msg. no: 701A
Message :
#T7B- R001
ACARS Header
 HB-JBH,5318410-02,649537,200637,01631,LSZH,EGLC,06:13:14,2018:02:01,00000000
000010,152000
    0.76 (06:21:35)
0.000,0.000,0.000,0.000,03b15,03aa5,00001,0.312,0.000,21.984,22.727,00001

Block End

and ...

[#5 (F:136.975 P:-5.2) 01/02/2018 06:36:14.522 --------------------------------
Command from Aircraft:4B17E5 (airborne) to GroundD:10902A 
Frame-I: Ns:1 Nr:0
ACARS
Aircraft reg: HB-JBH Flight id: LX0450
Mode: 2 Msg. label: H1
Block id: 1 Ack: !
Msg. no: 701E
Message :
#T7B99.625,98.578,159.688,70.375,2.844,2.250,535.562,530.812,124.953,130.031
101.781,97.516,99.750,102.250,-113.000,-54.000,88.250,88.250,1800.000,1869.500
397.500,386.500,1674.000
ACARS Footer:  

I assume that the text 'ACARS' defines the start of an acars message, but what are 'ACARS Header' and 'ACARS Footer'? Are they part of the actual aircraft acars message or debug information? Can they be removed?

Likewise there are number of messages that end with a 'Block End' text. Is this part of the acars message or debug info?

Stuart

More support for Airspy?

My airspy only supports 10 and 2.5MSPS, but in vdl2.h I see:

#define SDRINRATE 5000000
#define SDRCLK 1250

So when I build for airspy and run, it says it can't find the requested scan rate. Using what you did for the Mini, I tried 2500000/625 and commented out the two calls to airspy_r820t_write() and now it opens the device, but doesn't seem to decode any data?

`$ airspy_info
airspy_lib_version: 1.0.7

Found AirSpy board 1
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy NOS v1.0.0-rc1-2-g64b62c3 64b62c3-dirty 2014-11-24
Part ID Number: 0x6906002B 0x00000030
Serial Number: 0x440464C83868664F
Supported sample rates:
10.000000 MSPS
2.500000 MSPS
Close board 1`

vdlm2dec -a

./vdlm2dec -a -r 0 136.725 136.775 136.875 136.975
Read async -1

The above error appears and does not allow the program to start.
The other 3 on the web page work without any problems.
-a appears to be the problem ?????

Current version not decoding.

Hi,
The current version which I downloaded and compiled this morning does not decode at all..
The most simple variant
./vdlm2dec -r 11 136.975

Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000011

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 49.600000
Set center freq. to 137025000Hz
Exact sample rate is: 2000000.052982 Hz

Does not result in any decodes..
I suppose you already know that, but just to be sure.....

Maybe you can start using the 'Master' and 'Unsafe' feature in Github. That way one can always easily fallback to the Master (working) version.

More lines of unknown datas

[#1 (F:136.975 P:-20.2) 08/09/2018 22:36:08.327 --------------------------------
Command from Aircraft:344583 (airborne) to GroundD:10F65A
Frame-I: Ns:3 Nr:6
unknown data

or

[#1 (F:136.975 P:-21.7) 08/09/2018 22:35:53.483 --------------------------------
Response from GroundD:10F65A (on ground) to Aircraft:3C5EED
Frame-S: Nr:4 RR

I reiceive more and more lines like these above.
Can I have the choice to store the data (or a track of it) in the database's acarsserv? I use your software and it's great!

Were should I put the -g attribute in the command string?

Trying to use the -g attribute but so far failed.
Tried different places in the string like:
/home/pi/vdlm2dec/vdlm2dec -g 280 -r 00000011 136.725 136.775 136.875 136.975
/home/pi/vdlm2dec/vdlm2dec -r 00000011 -g 280 -p -1 136.725 136.775 136.875 136.975
etc.

I always get warnings and/or only the "usage" display.

JSON Output - Aircraft ICAO Code

The JSON outputs (-j and -J) have the aircraft ICAO code included as a decimal value. It would be clearer to include the icao code as it's normally displayed as a Hex character string e.g. 400DAD ?

Stuart

macOS/Darwin does not implement pthread barriers

Not sure how high priority this is, but unlike acarsdec, vdlm2dec doesn't compile without modification since macOS Darwin doesn't implement POSIX thread barriers. There seem to be projects out there that have implemented this functionality easily themselves to avoid this compatibility issue, and thought it might be great if new users could just compile without problems.

This project for instance implemented pthread barriers to fix the compatibility issue:
pmwkaa/ioarena#10

Another example implementation:
https://github.com/ademakov/DarwinPthreadBarrier

References to pthread_barrier_t:

vdlm2.h:88:8:
extern pthread_barrier_t Bar1, Bar2;

main.c:187:2:
pthread_barrier_init(&bar1, NULL, nbch + 1);

main.c:188:24:
pthread_barrier_init(&Bar2, NULL, nbch + 1);

Also noticed that the build throws an error on the use of the undeclared identifier "HOST_NAME_MAX"

main.c:98:27: error: use of undeclared identifier 'HOST_NAME_MAX'
char sys_hostname[HOST_NAME_MAX+1];

Program aborts with "75 Read async -1"

Installed the Latest commit 45c3248 from scratch
and using these options
/home/pi/vdlm2dec/vdlm2dec -v -j 176.9.123.123:60003 -l "/home/pi/vdlm2dec/logs/vdl2_rtlsdr-11_$(date +"%Y%m%d").log" -p -1 -r 00000011 136.725 136.775 136.825 136.875 136.975
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000011

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 49.600000
Set center freq. to 137025000Hz
Exact sample rate is: 2000000.052982 Hz

the program aborts with errors like these:
75
Read async -1

pi@MYPI-16B:~/vdlm2dec $ vdlm2dec: no process found
75
Read async -1

pi@MYPI-16B:~/vdlm2dec $ 100
Read async -1

Various Decoding Issues

I'm an aviation enthusiast, not a C developer.

Issue 1
No mention of the -v options in the README although they appear in usage()
The -v output options shows 3 values 0, 1 & 2. Source code allows for an additional 4th option "-v 3". What is this?

Issue 2
Need to add a date and time stamp (in UTC) to every message for all output formats.

Issue 3
I'd prefer the frequency in place of the channel number. See issue on the 'acarsdec' Github.

Issue 4
The aircraft 6 character identifier (ModeS/ICAO24) appear to be incorrect. Example ...

#1 Command from Aircraft: 50a130 to: 08100a
Frame-I: -/- Ns:4 Nr:6
ACARS
Aircraft reg: G-EZFN Flight id: U229PF
Mode: 2
......

The message above shows the aircraft registration as G-EZFN. According to look-up sites the Identifier/ModeS/ICAO24 for G-EZFN should be 406130. You have 50a130.

Issue 5
A VDL2 broadcast message from a ground station e.g.

#5 Command from Ground: 278f37 to: ffffff
Frame-U: -/- XID
Parameter set ID
Procedure classes
HDLC options

.....

shows the ground station id as 278f37. This is my local EGLC ground station which should have an id of 260F37

Issue 6
For broadcast messages, other VDL2 decoding software decode the the data in the broadcast message e.g.
Name: EGLC
Location: 51.5N 0.0E

Issue 7
Add a UDP output. There have been various discussions regards UDP output for 'acarsdec' on Github. Maybe similar for this application.

Stuart

JSON output - include frequency

As discussed previously, and acarsdec issue #22, is it possible to include the received frequency in both the -j and -J JSON outputs.
Thanks
Stuart

Feature requests for extra command arguments

Hi

I would like to request the following arguments to synchronise them with your acarsdec software:

  1. possibility to have daily and hourly log files. I did not get the sql server up and running, so now I am logging the messages daily in json format instead. Arguments; -D and -H

  2. possibility to change the sample rate to reduce CPU load. Like with the latest acarsdec files, you can pass the sample rate to the software.

Thanks!

Add "By default use maximum gain" to description -g attribute

The readme and help state:
-g gain : set rtl preamp gain in tenth of db (ie -g 90 for +9db).

In acarsdec this attribute mentions:
-g gain : set rtl preamp gain in tenth of db (ie -g 90 for +9db). By default use maximum gain
Based on the messages vdlm2dec displays at startup
"Tuner gain : 49.600000"
I assume the "By default use maximum gain" is also true for vdlm2dec.

"decode more vdlm2 protocols (looking for info)"

Hi Thierry,
Not sure how to contact you directly, so I just created an "issue" ;-)
You mention "decode more vdlm2 protocols (looking for info)"
Have you seen the dumpvdl2 project of Tomasz?
He has implemented a lot of messages as well as multiple freq decoding.
I have been running it for several months now and also went to EHAM to catch upload and broadcast messages.

Cheers,
Dick

Logfile Creation (Request)

The current logging mechanism creates a log file when vdlm2dec starts, and continues to append to it until the application is stopped.
Would it be possible to enhance the logging option so that a new file is created at midnight UTC so that we get daily log files. (also applies to acarsdec) e.g. 20180120.txt, 20180121.txt etc.

Log received Frequency (Request)

When you view a vdlm2dec log it shows the received channel number.
Is it possible that the received frequency could be be included in the output logs (similar to acarsdec) in addition to the channel number?

Support for AirSpy MINI

Hello,

First of all - thank you for your efforts in developing this great software.
Is it possible to also add support for AirSpy MINI - it differs from the regular AirSpy R2 in terms of the supported sample rates:

### Regular AirSpy R2
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy NOS v1.0.0-rc10-3-g7120e77 2018-04-28
Supported sample rates:
	10.000000 MSPS
	2.500000 MSPS
### AirSpy MINI
Board ID Number: 0 (AIRSPY)
Firmware Version: AirSpy MINI v1.0.0-rc10-3-g7120e77 2018-04-28
Supported sample rates:
	6.000000 MSPS
	3.000000 MSPS

I was able to compile and run vdlm2dec by changing SDRINRATE in file "vdlm2.h" from "5000000" to "6000000", but not sure this is the only change that is needed.

#ifdef WITH_AIR
#define SDRINRATE 6000000
#define SDRCLK  1250
#endif

Thanks in advance!

Specific sequence of arguments cause warnings

When I start vdlm2dec this way:
/home/pi/vdlm2dec/vdlm2dec -v 2 -r 11 -p -1 136.725 136.775 136.825 136.875 136.975 -l "/home/pi/vdlm2dec/logs/vdl2_rtlsdr-11.log" >> "/home/pi/vdlm2dec/logs/process-vdlm2dec.log" 2>&1 &

The program starts and works as expected but gives 4 warnings:
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000011

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain : 49.600000
WARNING: Invalid frequency 0
WARNING: Invalid frequency -1000000
WARNING: Invalid frequency 0
WARNING: Invalid frequency 0
Set center freq. to 137025000Hz
Exact sample rate is: 2000000.052982 Hz

2 of the warnings go away when I remove the "-p -1" part like this:
/home/pi/vdlm2dec/vdlm2dec -v 2 -r 11 136.725 136.775 136.825 136.875 136.975 -l "/home/pi/vdlm2dec/logs/vdl2_rtlsdr-11.log" >> "/home/pi/vdlm2dec/logs/process-vdlm2dec.log" 2>&1 &

All warnings go away if the arguments are move to another place like this:
/home/pi/vdlm2dec/vdlm2dec -v 2 -l "/home/pi/vdlm2dec/logs/vdl2_rtlsdr-11.log" -p -1 -r 00000011 136.725 136.775 136.825 136.875 136.975 >> "/home/pi/vdlm2dec/logs/process-vdlm2dec.log" 2>&1 &

Cheers,
Dick

-i StationId option not working

Hi Thierry,

The -i command line option is not working.

With my limited knowledge of c, I think the problem is in main.c
getopt(argc, argv, "vqrp:g:l:Jj:iGEU"))

Should the 'i' have a colon after it so that reads the station id argument?

Stuart

Incorrect "Command from Ground:" status

The "Command from Ground: 3C4AAB to 214AB7 " suggest that 3C4AAB is a ground station, which is not the case.
A compare with the dumpvdl2 log shows that the aircraft reports an "on the ground" status.

vdlm2dec message:
[#5 (F:136.975 P:-5.1) 25/01/2018 12:01:10.361 --------------------------------
Command from Ground: 3C4AAB to 214AB7
Frame-I: Ns:0 Nr:0
ACARS
Aircraft reg: D-ABUK Flight id: DE2062
Mode: 2 Msg. label: Q0
Block id: 5 Ack: !
Msg. no: S24A
Message :

Same message but now from dumpvdl2:
[2018-01-25 12:01:10 GMT] [136.975] [-45.6/-52.3 dBFS] [6.7 dB]
3C4AAB (Aircraft, On ground) -> 214AB7 (Ground station): Command
AVLC type: I sseq: 0 rseq: 0 poll: 0
ACARS:
Reg: .D-ABUK Flight: DE2062
Mode: 2 Label: Q0 Blk id: 5 Ack: ! Msg no.: S24A
Message:

make of version f180941 fails

gcc -Ofast -Wall -pthread -D WITH_RTL -I /usr/local/include/librtlsdr -c -o label.o label.c
label.c:5:22: fatal error: acarsdec.h: No such file or directory
#include "acarsdec.h"

Apparently some acardec files are needed/referenced..

Id Status (Request)

Would it be possible to enhance vdlm2dec messages to include whether an id is an aircraft (and it's status) or a ground station? I think this information is avilable to you when decoding the VDL2 message.
As an example the current message format shows
Command from : 406CD0 (on ground) to : 10919A

Could this be changed to show something similar to
Command from : 406CD0 (aircraft, on ground) to : 10919A (ground station)
or
Command from : 406CD0 (aircraft, airborne) to : 10919A (ground station)
or
Command from : 10919A (ground station) to : 406CD0 (aircraft, on ground)
or
Command from : 10919A (ground station) to : 406CD0 (aircraft, airborne)

Thanks
Stuart

Tag Versions?

Hey @TLeconte,

I'm building some packages for vdlm2dec and acarsdec for inclusion on ReceiverOS (previously AROS, a project from https://github.com/airframesio). Do you think we can start adding version tags on the repository again? I'd like to be able to properly version the packages against known releases.

Thanks!

Odd status "T0" (T zero).

Hi Thierry,
Found a couple of these messages in the log using version V2.0 (ab8896d)
Observe the "T0" between "to" and ":0A0010"..

[#5 (F:136.975 P:-3.9) 02/02/2018 11:02:16.690 --------------------------------
Response from Aircraft:AA6C50 (airborne) to T0:0A0010
Frame-U: DM

Dumpvdl2 shows them with a status "Reserved".
[2018-02-02 11:02:16 GMT] [136.975] [-42.1/-51.8 dBFS] [9.6 dB]
AA6C50 (Aircraft, Airborne) -> 0A0010 (reserved): Response
AVLC: type: U (DM) P/F: 0

Cheers,
Dick

JSON -j UDP packet truncates at 500 bytes

Hi Thierry,

The JSON UDP -j output is currently truncating UDP packets at 500 bytes.
I'm not an expert in using 'c' , but found in 'out.c' there was a line which reads
char pkt[500];.
So I changed my copy to 1000, recompiled and it worked -- until I got a UDP packet that was greater than 1000 bytes!!
The message had an acars message of 985 characters; when you add the preceding data in JSON format it broke the 1000 barrier.
I know in traditional (analogue/2400bps) acars messages the maximum length of the acars message is 220 bytes. Is there a corresponding maximum length (1024?) defined for VDL2 processing?

Regards
Stuart

SDRPlay support

Hi,

Any chance you could support SDRPlay or SoapySDR APIs?

Thanks!

Confusing program version

Hi Thierry,

The master shows 2.1 but the program displays 2.0.
And in your last commit it seems you have changed it back from 2.1 to 2.0

Cheers,
Dick

Typo in outacars.c when setting fl->oooi.lon

The code in outacars.c for int outacars(flight_t *fl,unsigned char *txt, int len) looks like this:

if(oooi.epu) {
    fl->oooi.epu=oooi.epu;
    fl->oooi.lat=oooi.lat;
    fl->oooi.lat=oooi.lon;
}

Should set oooi.lon, not oooi.lat, on the last line.

multiple UDP outputs?

Is it possible to output multiple UDP such as -j 192.168.1.2:8880 -j feed.acars.io:5550

Channel Number output - base 0 or 1

Hi Thierry,

My vdlm2dec command line has the first frequency defined as 136.725.
The default log file output shows this as

[#1 (F:136.725 P:-1.5) 10/02/2018 ..... i.e <channel 1>

The equivalent JSON output shows as "

channel":0,"freq":136.725, ..... i.e. <channel 0>

The default log file appears to show the channel number as base 1. The JSON output appears to be base 0.
Both outputs are independant so it doesn't really make any significant difference, but would it be better for consistency if they were both base 0 or 1?

I haven't checked yet if this also applies to acarsdec.
edit -- same applies to acarsdec
Regards
Stuart

JSON output - duplicated data and bad format

Hi Thierry,

I've found some JSON format error / duplicated acars output in the JSON output.
There are 2 examples below. I've included them in this 1 Github issue as I suspect that are all closely linked to one area of the source code.

The examples include the default log file output and the equivalent JSON output.

Example 1

BA018F (Msg No M33A) sent an FST01 message.
There were then 2 acars messages without an actual acars message.
Then BA13GV (Msg. no: D00A) sent a long H1 acars message.

[#4 (F:136.875 P:1.8) 14/02/2018 15:14:47.266 --------------------------------
Command from Aircraft:400D89 (airborne) to GroundD:262243 
Frame-I: Ns:2 Nr:1
ACARS
Aircraft reg: G-MEDL Flight id: BA018F
Mode: 2 Msg. label: 15
Block id: 9 Ack: !
Msg. no: M33A
Message :
FST01EGLLEGPDN052435W0007268236  94  16- 3C 61273      388  16071514

[#5 (F:136.975 P:-2.4) 14/02/2018 15:14:47.282 --------------------------------
Command from Aircraft:3C5EF4 (airborne) to GroundD:10983A 
Frame-I: Ns:5 Nr:5

[#5 (F:136.975 P:-2.1) 14/02/2018 15:14:47.788 --------------------------------
Command from Aircraft:461F30 (airborne) to GroundD:214AB7 
Frame-I: Ns:6 Nr:7

[#5 (F:136.975 P:-4.7) 14/02/2018 15:14:48.314 --------------------------------
Response from Aircraft:406230 (airborne) to GroundD:260F37 
Frame-U: DM

[#4 (F:136.875 P:1.9) 14/02/2018 15:14:48.577 --------------------------------
Response from Aircraft:400D89 (airborne) to GroundD:262243 
Frame-S: Nr:2 RR

[#5 (F:136.975 P:-2.0) 14/02/2018 15:14:49.101 --------------------------------
Response from Aircraft:461F30 (airborne) to GroundD:214AB7 
Frame-S: Nr:0 RR

[#5 (F:136.975 P:-0.4) 14/02/2018 15:14:50.165 --------------------------------
Command from Aircraft:4074B0 (airborne) to GroundD:10902A 
Frame-I: Ns:0 Nr:3
ACARS
Aircraft reg: G-EZRR Flight id: U289DM
Mode: 2 Msg. label: _d
Block id: 4 Ack: O
Msg. no: S87A
Message :


[#2 (F:136.775 P:-3.6) 14/02/2018 15:14:50.819 --------------------------------
Response from Aircraft:4BAA6B (airborne) to GroundD:275D25 
Frame-S: Nr:2 RR

[#5 (F:136.975 P:-4.2) 14/02/2018 15:14:50.836 --------------------------------
Response from Aircraft:3C5EF5 (airborne) to GroundD:10914A 
Frame-S: Nr:5 SREJ

[#5 (F:136.975 P:-2.2) 14/02/2018 15:14:50.885 --------------------------------
Response from Aircraft:3C5EF4 (airborne) to GroundD:10983A 
Frame-S: Nr:6 RR

[#5 (F:136.975 P:-2.2) 14/02/2018 15:14:51.065 --------------------------------
Command from Aircraft:3991E9 (airborne) to GroundD:10919A 
Frame-I: Ns:6 Nr:7
ACARS
Aircraft reg: F-HEPJ Flight id: AF1069
Mode: 2 Msg. label: _d
Block id: 7 Ack: B
Msg. no: S46A
Message :


[#4 (F:136.875 P:-3.8) 14/02/2018 15:14:51.625 --------------------------------
Command from Aircraft:406B5B (airborne) to GroundD:261EE1 
Frame-I: Ns:6 Nr:5
ACARS
Aircraft reg: G-GATL Flight id: BA13GV
Mode: 2 Msg. label: H1
Block id: 1 Ack: !
Msg. no: D00A
Message :
#DFBA04/A32004,1,4/CCG-GATL,FEB14,151421,EGKK,LSGG,0000/
C105,18500,4000,03,0100,0,0110,03,X/
CE0067,00701,158,242,6259,303,I20A10/
EC011288,44532,25676,23/
EE017312,08989,04610,23/
N101,13,01,04,07,47,52,65,4795,4800/
N201,13,01,04,08,45,54,64,4620,4630/
S11305,4790,0813,0886,3594,1426,1305/
S21305,4615,0814,0882,3472,1427,1307/
T13465,4665,032,14914,0071,20003/
T23543,4620,025,14906,0071,19921/
V103D01,00404,08000,239,084,0003,1,1/
V203D01,00404,08000,245,084,0005,1,1/
V3011,002,182,XXX,0349,0/
V4002,002,296,XXX,0350,0/

The equivalent JSON output shows

{"timestamp":1518621287.27252,"station_id":"Pi3","channel":3,"freq":136.875,"icao":4197769,"mode":"2","label":"15","block_id":"9","ack":"!","tail":"G-MEDL","flight":"BA018F","msgno":"M33A","text":"FST01EGLLEGPDN052435W0007268236  94  16- 3C 61273      388  16071514","depa":"EGLL","dsta":"EGPD"}
{"timestamp":1518621290.1720109,"station_id":"Pi3","channel":4,"freq":136.975,"icao":4224176,"mode":"2","label":"_d","block_id":"4","ack":"O","tail":"G-EZRR","flight":"U289DM","msgno":"S87A"}
{"timestamp":1518621291.0586081,"station_id":"Pi3","channel":4,"freq":136.975,"icao":3772905,"mode":"2","label":"_d","block_id":"7","ack":"B","tail":"F-HEPJ","flight":"AF1069","msgno":"S46A"}
{"timestamp":1518621291.615262,"station_id":"Pi3","channel":3,"freq":136.875,"icao":4221787,"mode":"2","label":"H1","block_id":"1","ack":"!","tail":"G-GATL","flight":"BA13GV","msgno":"D00A","text":FST01EGLLEGPDN052435W0007268236  94  16- 3C 61273      388  16071514","depa":"EGLL","dsta":"EGPD"}

The long BA13GV H1 message has been replaced with the original BA018F FST message and the json format has been corrupted to show "text":FST01EGLL . It's missing the " at the start of the FST message.

Example 2

AC0855 (Msg No D74M) sent a message starting with #DFB37 13 12 12 131334
There were then 2 acars messages without an actual acars message.
Then W609AY (Msg. no: D02A) sent a H1 acars message with #DFBA321,007163,1,1,TB0.

[#1 (F:136.725 P:-0.2) 14/02/2018 14:49:11.506 --------------------------------
Command from Aircraft:C023BD (airborne) to GroundD:11983A 
Frame-I: Ns:5 Nr:4
ACARS
Aircraft reg: C-FNNW Flight id: AC0855
Mode: 2 Msg. label: H1
Block id: 6 Ack: !
Msg. no: D74M
Message :
#DFB37 13 12 12 131334
002211  0  01001000045474532 13 12 12 131332
002211  0  01001000045314529 13 12 12 131331

[#5 (F:136.975 P:-2.3) 14/02/2018 14:49:11.571 --------------------------------
Response from Aircraft:4408D7 (airborne) to GroundD:10983A 
Frame-S: Nr:7 RR

[#5 (F:136.975 P:-1.1) 14/02/2018 14:49:11.833 --------------------------------
Command from GroundD:260F37 (on ground) to Aircraft:406099 
Frame-I: Ns:0 Nr:1

[#4 (F:136.875 P:-2.6) 14/02/2018 14:49:12.359 --------------------------------
Response from Aircraft:461F65 (airborne) to GroundD:262242 
Frame-S: Nr:4 RR

[#5 (F:136.975 P:-1.7) 14/02/2018 14:49:13.111 --------------------------------
Command from Aircraft:A4E822 (airborne) to GroundD:10983A 
Frame-I: Ns:3 Nr:3
ACARS
Aircraft reg: N415QS Flight id: GS415Q
Mode: 2 Msg. label: _d
Block id: 2 Ack: K
Msg. no: M60A
Message :


[#1 (F:136.725 P:-0.1) 14/02/2018 14:49:13.653 --------------------------------
Response from Aircraft:C023BD (airborne) to GroundD:11983A 
Frame-S: Nr:5 RR

[#5 (F:136.975 P:-0.5) 14/02/2018 14:49:13.995 --------------------------------
Command from Aircraft:40612C (airborne) to GroundD:10987A 
Frame-I: Ns:3 Nr:3

[#1 (F:136.725 P:-2.3) 14/02/2018 14:49:14.800 --------------------------------
Command from Aircraft:4400B9 (airborne) to GroundD:11909A 
Frame-I: Ns:3 Nr:5

[#5 (F:136.975 P:-0.9) 14/02/2018 14:49:14.864 --------------------------------
Command from Aircraft:4B18F4 (airborne) to GroundD:10983A 
Frame-I: Ns:7 Nr:3

[#5 (F:136.975 P:-1.1) 14/02/2018 14:49:14.962 --------------------------------
Command from GroundD:29D1D7 (on ground) to Aircraft:4401DC 
Frame-I: Ns:7 Nr:2

[#5 (F:136.975 P:-1.3) 14/02/2018 14:49:15.077 --------------------------------
Command from GroundD:29D1D7 (on ground) to Aircraft:FFFFFF 
Frame-U: XID
Specific options: VDA:ESN:IHN:BHN:BCN
Airport coverage : EGSS 
ATN router nets : ADM: 534954 ARS : 000001
Station system mask : 200000
Station Position 51.9   0.3

[#1 (F:136.725 P:0.9) 14/02/2018 14:49:15.094 --------------------------------
Command from Aircraft:40600F (airborne) to GroundD:1191EA 
Frame-I: Ns:0 Nr:0
ACARS
Aircraft reg: G-EZTE Flight id: U214MX
Mode: 2 Msg. label: Q0
Block id: 1 Ack: !
Msg. no: S78A
Message :


[#1 (F:136.725 P:-2.1) 14/02/2018 14:49:15.177 --------------------------------
Command from Aircraft:3C65C4 (airborne) to GroundD:11983A 
Frame-I: Ns:5 Nr:1

[#5 (F:136.975 P:-1.5) 14/02/2018 14:49:15.651 --------------------------------
Command from Aircraft:471F73 (airborne) to GroundD:2651D7 
Frame-I: Ns:3 Nr:4
ACARS
Aircraft reg: HA-LXR Flight id: W609AY
Mode: 2 Msg. label: H1
Block id: 2 Ack: !
Msg. no: D02A
Message :
#DFBA321,007163,1,1,TB000000/REP048,00,00,1/HA-LXR,14FEB18,144905,EGGW,EPKT,W60009/TIA05WIZ090501,01,  5.00,  6.25/HA14133718,134309,14134341,134638/HB14143142,143320,14143454,14144846,1/AA134139,0,134703,0/AB141007,0,144117,0/AC000000,0,000000,0/AD000000,0,000000,0/KA134143,0,134700,0/KB141015,0,144117,0/KC000000,0,000000,0/KD000000,0,000000,0/BA141020,144018,  8.38,  4.75/BB000000,000000,  0.00,  0.00/BC000000,000000,  0.00,  0.00/BD000000,000000,  0.00,  0.00/CA134653,0,142718,0/CB000000,0,000000,0/CC000000,0,000000,0/CD000000,0,000000,0/DA134700,0,141015,0/DB000000,0,000000,0/DC000000,0,000000,0/DD000000,0,000000,0/EA000/EB000/EC000/ED035/EE035/EF029/EG023/EH040/FA01146,03157/FB01146,03159/FC07099/GA0139/MA  527/NA  51.8804, 0.000168/PA-  0.3746, 0.000092/QA035,000/RA 19.75, 19.00, 19.50, 18.75/SA1433,1469/TA135018,0,141153/UA135022,0,141146,  8440/:

The equivalent JSON output shows

{"timestamp":1518619751.496139,"station_id":"Pi3","channel":0,"freq":136.725,"icao":12592061,"mode":"2","label":"H1","block_id":"6","ack":"!","tail":"C-FNNW","flight":"AC0855","msgno":"D74M","text":"#DFB37 13 12 12 131334\r\n002211  0  01001000045474532 13 12 12 131332\r\n002211  0  01001000045314529 13 12 12 131331"}
{"timestamp":1518619753.1174209,"station_id":"Pi3","channel":4,"freq":136.975,"icao":10807330,"mode":"2","label":"_d","block_id":"2","ack":"K","tail":"N415QS","flight":"GS415Q","msgno":"M60A"}
{"timestamp":1518619755.657136,"station_id":"Pi3","channel":4,"freq":136.975,"icao":4661107,"mode":"2","label":"H1","block_id":"2","ack":"!","tail":"HA-LXR","flight":"W609AY","msgno":"D02A","text"::"#DFB37 13 12 12 131334\r\n002211  0  01001000045474532 13 12 12 131332\r\n002211  0  01001000045314529 13 12 12 131331"}

The W609AY H1 message has been replaced with the original AC0855 '#DFB37 13 12 12 1313...' message and the json format has been corrupted to show "text"::"#DFB37 13 12 1 . It's now got 2 colons after the text token.

I can supply more examples if required.
I haven't checked yet if this also applies to acarsdec.
Regards
Stuart

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.