pull/1/head
SP9SKP 2018-01-04 10:13:05 +01:00
rodzic c07892b98b
commit ceedd37a1f
220 zmienionych plików z 176662 dodań i 1 usunięć

Wyświetl plik

@ -1 +1,18 @@
# spdxl
SPdxl is modification of dxlAPRS.
The toolchain contains:
- afskmodem soundmodem for 300-19200bd afsk/fsk modulation, 2 channels
- aprsmap powerful aprs-viewer using open street map
- gps2aprs aprs-tracker using connected gps-mouse
- gps2digipos generate pos-beacon for digi/igate using connected gps
- sondemod decode data produced by a RS92, SRC-C34, DFM06, RS41 wx-sonde, received with sondeudp
- sondeudp soundmodem for RS92 wx-sonde
- udpbox intelligent aprs-digipeater
- udpflex interface between serial RMNC/KISS and AXUDP
- udpgate4 aprs-igate
- udphub L2-switch for AX25, one AXUDP port from a digipeater interfaced
to many users
- udprfnet
For more Details see doc

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,12 @@
Filename Place to be what it does ...
================================================================
favicon.png where the executeable is icon for taskbar
font.png -----------""----------- font for all text within aprsmap
symbols.png -----------""----------- symbols within aprsmap
hints.txt -----------""----------- info about a button does hover
gm.sh -----------""----------- shell script for downloading osm-maps
poi.txt osm/ point of interest file
help.txt where the executeable is interactive help
NEW.txt whereever you want version-history of aprsmap

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 518 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 6.4 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 6.3 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.6 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 3.3 KiB

Wyświetl plik

@ -0,0 +1,148 @@
#!/bin/sh
# file created by aprsmap of a list of tiles to fetch
ORIGFN="gettiles"
# map directory path specified by aprsmap
#DIR="osm"
DIR=$2
# move the original file to a temporary file to prevent a race
# condition with aprsmap where aprsmap sometimes attempts to write
# to the original file before this script completes processing.
FN=`mktemp`
mv $ORIGFN $FN
# 3 sec timeout, 3 sec wait between retries, 1 retry
WGETCMDBASE="wget -q -T 3 -w 3 -t 1 "
OSMSERVERS="\
http://a.tile.openstreetmap.org \
http://b.tile.openstreetmap.org \
http://c.tile.openstreetmap.org \
http://osm.oe2xzr.ampr.at/osm/tiles \
"
OSMSERVERSTOPO="\
http://a.tile.thunderforest.com/landscape \
http://b.tile.thunderforest.com/landscape \
http://c.tile.thunderforest.com/landscape \
http://osm.oe2xzr.ampr.at/osm/tiles_topo \
"
OSMSERVERSCYCLE="\
http://a.tile.opencyclemap.org/cycle \
http://b.tile.opencyclemap.org/cycle \
http://osm.oe2xzr.ampr.at/osm/tiles_cyclemap \
"
OSMSERVERSTRANSPORT="\
http://a.tile.opencyclemap.org/transport \
http://b.tile.opencyclemap.org/transport \
"
# note: mapquest sat and quest tile servers are no longer providing direct access
OSMSERVERSSAT="\
http://osm.oe2xzr.ampr.at/osm/tiles_sat \
http://otile1.mqcdn.com/tiles/1.0.0/sat \
http://otile2.mqcdn.com/tiles/1.0.0/sat \
http://otile3.mqcdn.com/tiles/1.0.0/sat \
http://otile4.mqcdn.com/tiles/1.0.0/sat \
"
OSMSERVERSQUEST="\
http://otile1.mqcdn.com/tiles/1.0.0/osm \
http://otile2.mqcdn.com/tiles/1.0.0/osm \
http://otile3.mqcdn.com/tiles/1.0.0/osm \
http://otile4.mqcdn.com/tiles/1.0.0/osm \
"
#--------------------------------------------------------------------------------------------------
# if the tiles directory does not exist then create one
if ! [ -d $DIR ]; then
mkdir $DIR
fi
# if tiles directory found
if [ -d $DIR ] ; then
# search zero-size files and destroy them
#echo -n "cleanup zero-files ... "
#find $DIR/tiles -size 0 -delete
#echo "done."
# while true; do
for i in 1 2 3 4 5 6 7 8 9 10; do
if [ -r $FN ] ; then
while read mapa mapb mapc mapd ; do
if ! [ -d $DIR/$mapa ] ; then
mkdir $DIR/$mapa
fi
if ! [ -d $DIR/$mapa/$mapb ] ; then
mkdir $DIR/$mapa/$mapb
fi
if ! [ -d $DIR/$mapa/$mapb/$mapc ] ; then
mkdir $DIR/$mapa/$mapb/$mapc
fi
if [ tiles = $mapa ]; then
SERVERS=$OSMSERVERS
EXTENT="png"
elif [ tiles_topo = $mapa ]; then
SERVERS=$OSMSERVERSTOPO
EXTENT="png"
elif [ tiles_cyclemap = $mapa ]; then
SERVERS=$OSMSERVERSCYCLE
EXTENT="png"
elif [ tiles_transport = $mapa ]; then
SERVERS=$OSMSERVERSTRANSPORT
EXTENT="png"
# note: mapquest sat and quest tile servers are no longer providing direct access
elif [ tiles_sat = $mapa ]; then
SERVERS=$OSMSERVERSSAT
EXTENT="jpg"
elif [ tiles_quest = $mapa ]; then
SERVERS=$OSMSERVERSQUEST
EXTENT="png"
fi
MAPFILE=$DIR/$mapa/$mapb/$mapc/$mapd.$EXTENT
echo "Loading tile: $MAPFILE ..."
for OSMSERVER in $SERVERS ; do
echo -n "-> from $OSMSERVER - "
$WGETCMDBASE -O $MAPFILE "$OSMSERVER/$mapb/$mapc/$mapd.png"
if [ -s $MAPFILE ] ; then
echo "done."
if [ jpg = $EXTENT ]; then
jpegtopnm $MAPFILE | pnmtopng > $DIR/$mapa/$mapb/$mapc/$mapd.png
rm -f $MAPFILE
fi
break
else
# rm $MAPFILE
# echo -n "Zero-length file, using alternative URL - "
# $WGETCMDBASE -O $MAPFILE "$OSMSERVER/$mapa/$mapb/$mapc/$mapd.png"
# if [ -s $MAPFILE ] ; then
# echo "done."
# break
# else
rm $MAPFILE
echo "Zero-length file, trying next mirror."
# fi
fi
done
done < $FN
rm -f $FN
fi
done
else
echo Directory $DIR not found.
exit 1
fi
exit 0

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

42336
aprsmap_common/poi.txt 100644

Plik diff jest za duży Load Diff

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 18 KiB

27
doc/Changelog.txt 100644
Wyświetl plik

@ -0,0 +1,27 @@
04.01.2018:
sondemod/sondeudp:
- added decoding PilotSonde
- added decoding M10
- improve decoding DFM
- writing *.cal files to /tmp
sondemod:
- write last radiosonde data to /tmp/sonde.csv (parameter -e)
- when rinex too old, file /tmp/toold are created
- sending decoded data to SP9SKP database https://skp.wodzislaw.pl/sondy
sdrtst:
- waterfall on console
- write waterfall to /tmp/wtf<number>.bin (parameter -n)
- offset to AFC (new parameter in file with frequencies)
example:
f 404.000 15 -6500 50 0 24000 # M10
f 401.465 50 1200 0 0 12000 # pilotSonde
f 403.000 5 0 0 70 12000 # RS41,RS92 and others
www:
- require lighttpd and php
- simple monitoring and configuration by web

Wyświetl plik

@ -0,0 +1,3 @@
GPL License Exception:
- there currenty are no exclusions

Wyświetl plik

@ -0,0 +1,65 @@
dxlAPRS is Free Software toolchain to operate APRS(r). The toolchain contains:
- afskmodem soundmodem for 300-19200bd afsk/fsk modulation, 2 channels
- aprsmap powerful aprs-viewer using open street map
- gps2aprs aprs-tracker using connected gps-mouse
- gps2digipos generate pos-beacon for digi/igate using connected gps
- sondemod decode data produced by a RS92 wx-sonde, received with sondeudp
- sondeudp soundmodem for RS92 wx-sonde
- udpbox intelligent aprs-digipeater
- udpflex interface between serial RMNC/KISS and AXUDP
- udpgate4 aprs-igate
- udphub L2-switch for AX25, one AXUDP port from a digipeater interfaced
to many users
- udprfnet
The whole toolchain is copyrighted by Christian Rabler (oe5dxl) and many others
who contributed code (see the actual source code and the git commit messages
for details). You can redistribute dxlAPRS toolchain and/or modify it under
the terms of version 2 of the GNU General Public License as published by the
Free Software Foundation. Most of it can also be distributed, at your option,
under any later version of the GNU General Public License -- see individual
files for exceptions.
Also note that the GPL and the other licenses are copyrighted by the Free
Software Foundation and other organizations, but the instance of code that they
refer to (the dxlAPRS toolchain source code) is copyrighted by me and others
who actually wrote it.
-- Christian Rabler (oe5dxl)
Like many other projects, dxlAPRS toolchain has a tradition of including big
blocks of License headers in all files. This not only blows up the source code
with mostly redundant information, but also makes it very difficult to generate
License Clearing Reports. An additional problem is that even the same licenses
are referred to by a number of slightly varying text blocks (full, abbreviated,
different indentation, line wrapping and/or white space, with obsolete address
information, ...) which makes automatic processing a nightmare.
To make this easier, such license headers in the source files will be replaced
with a single line reference to Unique License Identifiers as defined by the
Linux Foundation's SPDX project [1]. For example, in a source file the full
"GPL v2.0 or later" header text will be replaced by a single line:
SPDX-License-Identifier: GPL-2.0+
Ideally, the license terms of all files in the source tree should be defined by
such License Identifiers; in no case a file can contain more than one such
License Identifier list.
If a "SPDX-License-Identifier:" line references more than one Unique License
Identifier, then this means that the respective file can be used under the
terms of either of these licenses, i. e. with
SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause
you can chose between GPL-2.0+ and BSD-3-Clause licensing.
We use the SPDX Unique License Identifiers here; these are available
at [2].
[1] http://spdx.org/
[2] http://spdx.org/licenses/
Full name SPDX Identifier OSI Approved File name URI
=======================================================================================================================================
GNU General Public License v2.0 only GPL-2.0 Y gpl-2.0.txt http://www.gnu.org/licenses/gpl-2.0.txt
GNU General Public License v2.0 or later GPL-2.0+ Y gpl-2.0.txt http://www.gnu.org/licenses/gpl-2.0.txt

Wyświetl plik

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

Wyświetl plik

@ -0,0 +1,23 @@
#!/bin/bash
cd /tmp
if ls /tmp/toold > /dev/null 2>&1
then
if ls /tmp/rinex_de > /dev/null 2>&1
then
rm /tmp/rinex_de
cd /tmp
/usr/bin/python /root/SDR/getrinex_us.py
#wget http://aprs.ehamnet.cz/gps_rinex.txt -O rinex
else
touch /tmp/rinex_de
cd /tmp
/usr/bin/python /root/SDR/getrinex_de.py #de
fi
rm /tmp/toold
sleep 20
rm /tmp/toold
fi

4
doc/start/RINEX 100755
Wyświetl plik

@ -0,0 +1,4 @@
#!/bin/bash
cd /tmp
/usr/bin/python /root/SDR/getrinex_de.py

67
doc/start/START 100755
Wyświetl plik

@ -0,0 +1,67 @@
#!/bin/bash
/root/SDR/RINEX
cp /root/SDR/sdrcfg0.txt /tmp/sdrcfg0.txt
cp /root/SDR/sdrcfg1.txt /tmp/sdrcfg1.txt
cp /root/SDR/sdrcfg2.txt /tmp/sdrcfg2.txt
mkfifo /root/SDR/fifo0
mkfifo /root/SDR/fifo1
mkfifo /root/SDR/fifo2
chown www-data:www-data /tmp/*.txt
cd /root/SDR
#sleep 20
set -x
killall -9 rtl_tcp udpgate4 sondemod sondeudp sdrtst screen
if test `find "rinex" -mmin +1440`
then
./RINEX
fi
screen -S rs -t bash -A -d -m /bin/bash
screen -S rs -X screen -t rtl_tcp0
screen -S rs -p rtl_tcp0 -X stuff $'/usr/local/bin/rtl_tcp0 -a 127.0.0.1 -p 1234 -g 40 -P 0 -d 0 -b 15 \n'
screen -S rs -X screen -t rtl_tcp1
screen -S rs -p rtl_tcp1 -X stuff $'/usr/local/bin/rtl_tcp1 -a 127.0.0.1 -p 1235 -g 40 -P 0 -d 1 -b 15 \n'
screen -S rs -X screen -t rtl_tcp2
screen -S rs -p rtl_tcp2 -X stuff $'/usr/local/bin/rtl_tcp2 -a 127.0.0.1 -p 1236 -g 40 -P 0 -d 2 -b 15 \n'
sleep 2
screen -S rs -X screen -t sdrtst0
screen -S rs -p sdrtst0 -X stuff $'/root/SDR/bin/sdrtst -t 127.0.0.1:1234 -Z 100 -c /tmp/sdrcfg0.txt -v -s /root/SDR/fifo0 -r 25000 -n 1 \n'
screen -S rs -X screen -t sdrtst1
screen -S rs -p sdrtst1 -X stuff $'/root/SDR/bin/sdrtst -t 127.0.0.1:1235 -Z 100 -c /tmp/sdrcfg1.txt -v -s /root/SDR/fifo1 -r 25000 -n 2 \n'
screen -S rs -X screen -t sdrtst2
screen -S rs -p sdrtst2 -X stuff $'/root/SDR/bin/sdrtst -t 127.0.0.1:1236 -Z 100 -c /tmp/sdrcfg2.txt -v -s /root/SDR/fifo2 -r 16000 -n 3 \n'
sleep 5
screen -S rd -t bash -A -d -m /bin/bash
screen -S rd -X screen -t sondeudp0
screen -S rd -p sondeudp0 -X stuff $'/root/SDR/bin/sondeudp -f 25000 -l 128 -c 0 -o /root/SDR/fifo0 -I N0CALL-14 -v -u 127.0.0.1:4000 \n'
screen -S rd -X screen -t sondeudp1
screen -S rd -p sondeudp1 -X stuff $'/root/SDR/bin/sondeudp -8 -f 25000 -l 128 -c 0 -o /root/SDR/fifo1 -I N0CALL-14 -v -u 127.0.0.1:4000 \n'
screen -S rd -X screen -t sondeudp2
screen -S rd -p sondeudp2 -X stuff $'/root/SDR/bin/sondeudp -8 -1 -f 16000 -l 128 -c 0 -o /root/SDR/fifo2 -I N0CALL-14 -v -u 127.0.0.1:4000 \n'
sleep 5
screen -S rd -X screen -t sondemod
screen -S rd -p sondemod -X stuff $'while [ 1 ] ; do /root/SDR/bin/sondemod -v -x /tmp/rinex -T 1440 -r 127.0.0.1:4010 -o 4000 -I N0CALL-14 -R 30 -d -A 3000 -B 2 -b 45 -p 0 -K DB_PASS -e 10 ; done\n'
#screen -S rd -X screen -t almanach
#screen -S rd -p almanach -X stuff $'while [ 1 ] ; do sleep 1800; /root/SDR/RINEX ; done \n'
screen -S rd -X screen -t udpgate
screen -S rd -p udpgate -X stuff $'/root/SDR/bin/udpgate4 -v -R 127.0.0.1:4011:4010 -s N0CALL-15 -n 20:/root/SDR/beacon.txt -t 14580 -g poland.aprs2.net:14580 -p APRS_PASS \n'
#radiosondy.info

Wyświetl plik

@ -0,0 +1,2 @@
!4900.00N/01800.00E`

Wyświetl plik

@ -0,0 +1,2 @@
* * * * * /root/SDR/CHECK_TOOLD
0 4 * * * rm /tmp/*.cal

Wyświetl plik

@ -0,0 +1,57 @@
import os, sys, string
import datetime
import urllib
today = datetime.datetime.now()
def GetFtpPath(day_offset):
res = ''
res += 'ftp://cddis.gsfc.nasa.gov/gps/data/daily/'
res += str( datetime.datetime.now().timetuple().tm_year )
res += "/brdc/brdc"
res += string.zfill( ( datetime.datetime.now().timetuple().tm_yday + day_offset ), 3 )
res += '0.'
res += str( datetime.datetime.now().timetuple().tm_year )[2:]
res += 'n.Z'
return res
def GetFtpPathDe(day_offset):
res = ''
res += 'ftp://igs.bkg.bund.de/IGS/BRDC/'
res += str( datetime.datetime.now().timetuple().tm_year )
res += "/"
res += today.strftime('%j')
res += "/brdc"
res += string.zfill( ( datetime.datetime.now().timetuple().tm_yday + day_offset ), 3 )
res += '0.'
res += str( datetime.datetime.now().timetuple().tm_year )[2:]
res += 'n.Z'
return res
def FtpGet(remoteFile, out):
urllib.urlretrieve('ftp://server/path/to/file', out)
def main():
remoteFile = GetFtpPathDe(0)
print remoteFile
try:
urllib.urlretrieve( remoteFile, '/tmp/rinex.Z' )
except:
remoteFile = GetFtpPathDe(-1)
print remoteFile
urllib.urlretrieve( remoteFile, '/tmp/rinex.Z' )
try:
os.system('7z e ' + '/tmp/rinex.Z -aoa')
os.system('rm /tmp/rinex.Z')
except:
print "extraction requires cygwin"
if __name__ == '__main__':
main()

Wyświetl plik

@ -0,0 +1,58 @@
import os, sys, string
import datetime
import urllib
today = datetime.datetime.now()
def GetFtpPath(day_offset):
res = ''
res += 'ftp://cddis.gsfc.nasa.gov/gps/data/daily/'
res += str( datetime.datetime.now().timetuple().tm_year )
res += "/brdc/brdc"
res += string.zfill( ( datetime.datetime.now().timetuple().tm_yday + day_offset ), 3 )
res += '0.'
res += str( datetime.datetime.now().timetuple().tm_year )[2:]
res += 'n.Z'
return res
def GetFtpPathDe(day_offset):
res = ''
res += 'ftp://igs.bkg.bund.de/IGS/BRDC/'
res += str( datetime.datetime.now().timetuple().tm_year )
res += "/"
res += today.strftime('%j')
res += "/brdc"
res += string.zfill( ( datetime.datetime.now().timetuple().tm_yday + day_offset ), 3 )
res += '0.'
res += str( datetime.datetime.now().timetuple().tm_year )[2:]
res += 'n.Z'
return res
def FtpGet(remoteFile, out):
urllib.urlretrieve('ftp://server/path/to/file', out)
def main():
remoteFile = GetFtpPath(0)
print remoteFile
try:
urllib.urlretrieve( remoteFile, '/tmp/rinex.Z' )
except:
remoteFile = GetFtpPath(-1)
print remoteFile
urllib.urlretrieve( remoteFile, '/tmp/rinex.Z' )
try:
os.system('7z e ' + '/tmp/rinex.Z -aoa')
os.system('rm /tmp/rinex.Z')
except:
print "extraction requires cygwin"
if __name__ == '__main__':
main()

Wyświetl plik

@ -0,0 +1,16 @@
p 5 0
p 8 1
f 400.600 10 0 0 60 12000 #poprad
f 401.000 10 0 0 60 12000 #wieden
f 401.100 10 0 0 60 12000 #praga
f 401.465 50 1200 0 0 12000 #pilotSonde
f 401.500 10 0 90 60 12000 #poprad
f 401.600 10 28 30 60 12000 #?
#f 402.000 5 0 60 60 12000 #?
f 402.000 2 -6500 60 0 24000 #M10
f 402.010 2 0 80 60 12000 #Segedyn
f 402.100 10 0 0 60 12000 #Prosciejow
f 402.200 10 0 70 60 12000 #?
f 402.300 10 0 70 60 12000 #Greifswald
#f 402.470 50 0 0 0 12000 #pilotSonde
f 402.470 30 1200 0 0 12000 #pilotSonde

Wyświetl plik

@ -0,0 +1,18 @@
p 5 0
p 8 1
f 404.000 15 -6500 50 0 24000 #M10
f 403.790 10 0 70 60 12000 #Lindenberg-DFM09
f 403.750 10 0 60 60 12000 #Senica-DFM09
#f 403.690 60 0 70 0 12000 #
f 403.670 10 0 60 60 12000 #Senica-DFM06
#f 403.630 60 0 0 0 12000 #
#f 403.590 60 0 0 0 12000 #
f 403.500 10 0 0 70 12000 #Łeba
f 403.400 10 0 70 60 12000 #
#f 403.390 60 0 0 0 12000 #
f 403.350 5 0 70 70 12000 #Wiedeń
f 403.100 5 0 70 70 12000 #Łeba,
#f 403.010 5 0 0 60 12000 #Budapeszt-DFM09
f 403.000 5 0 0 70 12000 #Łeba,
f 402.870 20 0 70 60 12000 #Amberg
f 402.700 20 0 70 60 12000 #Amberg

Wyświetl plik

@ -0,0 +1,7 @@
p 5 0
p 8 1
f 405.700 10 0 70 70 #Linda
f 405.300 10 0 70 70 #Linda
f 405.100 10 0 0 70 #Linda
f 404.500 10 0 0 70 #Legionowo-RS41

174
src/Execlogin.c 100644
Wyświetl plik

@ -0,0 +1,174 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
/* "@(#)Execlogin.c May 11 0:17:50 2017" */
#define X2C_int32
#define X2C_index32
#ifndef Execlogin_H_
#include "Execlogin.h"
#endif
#define Execlogin_C_
#include <unistd.h>
#include <fcntl.h>
#ifndef osi_H_
#include "osi.h"
#endif
#include <osic.h>
#ifndef mlib_H_
#include "mlib.h"
#endif
#include <stdlib.h>
#ifndef aprsstr_H_
#include "aprsstr.h"
#endif
#include <signal.h>
/*FROM stat IMPORT stat, stat_t;*/
/*, execv*/
/*IMPORT ptty; */
/**********************************************************************/
/* Find a currently unused pseudo tty and open its master side;
* return-value: 0=ok, <0=error
* on successfull function return, fd will contain the file descriptor,
* and PtyName the absolute path to the master-pty in the file system */
static int32_t GetNewTty(int32_t * fd, char ptsname[],
uint32_t ptsname_len)
{
int32_t res;
struct termios term;
*fd = open("/dev/ptmx", O_RDWR+O_NONBLOCK);
if (*fd<0L) osi_WrStrLn("error /dev/ptmx open", 21ul);
if (osi_getptsname(*fd, (char *)ptsname, ptsname_len)) {
osi_WrStrLn("no ttyname", 11ul);
}
/* WrStrLn(ptsname); */
if (osic_grantpts(*fd)) osi_WrStrLn("error ptty grant", 17ul);
if (osic_unlockpts(*fd)) osi_WrStrLn("error ptty unlock", 18ul);
res = tcgetattr(*fd, &term);
term.c_lflag = 0UL;
res = tcsetattr(*fd, 0L, &term);
return 0L;
} /* end GetNewTty() */
/**********************************************************************/
/* open the corresponding slave of a pseudo tty pair, adjust the
* terminal setting, redirect our stdin/out/err to this tty, and
* finalle make it our controlling terminal.
* return: 0=success, -1=failure */
static int32_t GetSlavePty(char name[], uint32_t name_len)
{
int32_t fd;
int32_t res;
struct termios term;
struct termios * anonym;
int32_t GetSlavePty_ret;
X2C_PCOPY((void **)&name,name_len);
res = chown((char *)name, 0L, 0L);
res = chmod((char *)name, 384L);
/* IF setsid()<0 THEN Close(fd); RETURN -1; END; */
/* fd:=open(name, O_RDWR+O_NOCTTY); */
fd = open(name, O_RDWR);
if (fd<0L) {
GetSlavePty_ret = -1L;
goto label;
}
/* now adjust the terminal settings */
res = tcgetattr(fd, &term);
{ /* with */
struct termios * anonym = &term;
anonym->c_lflag = (uint32_t)((uint32_t)anonym->c_lflag|0x8UL|0x2UL)
;
anonym->c_oflag = (uint32_t)((uint32_t)anonym->c_oflag|0x4UL);
anonym->c_iflag = (uint32_t)(((uint32_t)
anonym->c_iflag|0x100UL|0x1UL)&~0x1000UL);
}
/* c_cflag := CARDINAL( BITSET(c_cflag)-BITSET(CLOCAL)); */
res = tcsetattr(fd, 0L, &term);
/* create new session id, and set controlling terminal */
if (setsid()<0L) {
osic_Close(fd);
GetSlavePty_ret = -1L;
goto label;
}
if (ioctl(fd, 21518L, 0)<0L) {
osic_Close(fd);
GetSlavePty_ret = -1L;
goto label;
}
/* and finally redirect stdin, stdout, stderr */
if (fd) res = dup2(fd, 0L);
if (fd!=1L) res = dup2(fd, 1L);
if (fd!=2L) res = dup2(fd, 2L);
if (fd>2L) osic_Close(fd);
GetSlavePty_ret = 0L;
label:;
X2C_PFREE(name);
return GetSlavePty_ret;
} /* end GetSlavePty() */
/**********************************************************************/
/* Construct an array of arguments, and execute /bin/login with it.
* 'name' contains the username, which will be passed to /bin/login.
* it may be empty, in which case login will ask for the name.
* 'host' may optionally contain the users remote hostname, which e.g.
* is displayed by the 'who' command.
* 'passwd' can be set TRUE to force skipping the password authentication.
* This requires 'name' to be non-empty. */
extern int32_t Execlogin_StartLogin(struct Execlogin_tEXEC * cmd)
{
int32_t res;
int32_t PtyFd;
char PtyName[1024];
if (GetNewTty(&PtyFd, PtyName, 1024ul)<0L) return -1L;
res = fork();
if (res<0L) {
osic_Close(PtyFd);
return -1L;
}
if (res>0L) {
/* daddy */
/* signal(SIGINT, SIG_IGN); */
signal(SIGCHLD, SIG_IGN);
return PtyFd;
}
else {
/* child */
for (res = 0L; res<=1023L; res++) {
osic_Close(res);
} /* end for */
osic_Close(PtyFd);
/*
signal.signal(signal.SIGINT, signal.SIG_IGN);
signal.signal(signal.SIGHUP, signal.SIG_IGN);
*/
res = GetSlavePty(PtyName, 1024ul);
if (res<0L) exit(1L);
res = execv(cmd->cmdfn, cmd->args);
/* res := execve(cmd.cmdfn^, cmd.args^, NIL); */
/* RETURN -1; */
X2C_ABORT();
}
return 0;
} /* end StartLogin() */
extern void Execlogin_BEGIN(void)
{
static int Execlogin_init = 0;
if (Execlogin_init) return;
Execlogin_init = 1;
aprsstr_BEGIN();
osi_BEGIN();
}

31
src/Execlogin.h 100644
Wyświetl plik

@ -0,0 +1,31 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef Execlogin_H_
#define Execlogin_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#include <unistd.h>
struct Execlogin_tEXEC;
struct Execlogin_tEXEC {
char * cmdfn;
X2C_pCHAR * args;
};
extern int32_t Execlogin_StartLogin(struct Execlogin_tEXEC *);
extern void Execlogin_BEGIN(void);
#endif /* Execlogin_H_ */

292
src/Makefile 100644
Wyświetl plik

@ -0,0 +1,292 @@
#
# Makefile for dxlAPRS toolchain containing:
# - afskmodem soundmodem for afsk/fsk up to 19200 bd using Linux OSS
# - gps2aprs aprs-tracker using some serial gps, produces axudp frames which
# may be sent with afskmodem
# - gps2digipos generates a beaconfile for a (mobile) aprs-digi,
# using some serial GPS
# - sondeudp soundmodem for RS92 (and other) wx-ballons using Linux OSS,
# the produced axudp frames are beeing post-processed by sondemod
# to generate aprs-beacons
# - sondemod RS92 (and other) wx-ballon decoder (takes data from sondeudp
# and generates aprs-beacons)
# - udpbox very powerful aprs-digi and axudp "distributor"
# - udpgate4 very powerful aprs-igate server (with http-interface)
# - udpflex interfaces serial stuff like TNC2, TNC3, KISS, RMNC
# to axudp frames
# - udphub L2 AX25 switch to process many Packet Radio clients on one
# single AXUDP interface from Flexnet, XNET, ...
# - aprsmap powerful APRS viewer based on Openstreetmap
# ---------------------- common section ---------------------------------------
HOSTARCH := $(shell uname -m | \
sed -e s/i.86/x86/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/ppc64/powerpc/ \
-e s/ppc/powerpc/ \
-e s/macppc/powerpc/\
-e s/sh.*/sh/)
export HOSTARCH
HOSTOS := $(shell uname -s)
export HOSTOS
ifeq ($(HOSTOS),Darwin)
# Using gcc as symlink to Mac's clan
GCCVERSION_GE4 := true
STRIPFLAGS =
else
GCCVERSION := $(shell $(CROSS_COMPILE)gcc --version | \
grep gcc | sed 's/.*gcc (.*) //g' | cut -d '.' -f 1)
GCCVERSION_GE4 := $(shell [ $(GCCVERSION) -ge 4 ] && echo true)
STRIPFLAGS = -s
endif
.SUFFIXES:
MAKEFLAGS += -r
CC = $(CROSS_COMPILE)gcc
STRIP = $(CROSS_COMPILE)strip
INCL = .
ifeq ($(GCCVERSION_GE4),true)
CDEFS = -Wall \
-Wno-unused-variable -Wno-parentheses -Wno-pointer-sign \
-Wno-format -Wno-return-type -Wno-char-subscripts \
-Wno-uninitialized \
-Werror=implicit-function-declaration
else
CDEFS = -w
endif
ifeq ($(HOSTOS),Darwin)
CFLAGS = -I$(INCL) -c -O2 -fdata-sections -ffunction-sections -I/usr/X11/include -DMACOS
LFLAGS = -L/usr/X11/lib -lX11
else
CFLAGS = -I$(INCL) -c -O2 -fdata-sections -ffunction-sections
LFLAGS = -Wl,--gc-sections
endif
# ---------------------- armv6 (raspberry pi 1) specific -----------------------
ifeq ($(PLATFORM), armv6tce)
EXTLIB = lib_armv6/
XLIBS = $(EXTLIB)libpng15/libpng.a \
$(EXTLIB)libz.a \
$(EXTLIB)libjpeg.a \
$(EXTLIB)libxcb.so.1 $(EXTLIB)libXdmcp.so.6 $(EXTLIB)libXau.so.6 \
-L$(EXTLIB) -lXext -lX11
CFLAGS += -march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s
CFLAGS += -Ilib_armv6/libpng15/ -I$(EXTLIB) -I.
LFLAGS +=
else ifeq ($(PLATFORM), armv6)
EXTLIB = lib_armv6/
XLIBS = $(EXTLIB)libpng16/libpng.a \
$(EXTLIB)libz.a \
$(EXTLIB)libjpeg.a \
$(EXTLIB)libxcb.so.1 $(EXTLIB)libXdmcp.so.6 $(EXTLIB)libXau.so.6 \
-L$(EXTLIB) -lXext -lX11
CFLAGS += -march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s
CFLAGS += -Ilib_armv6/libpng16/ -I$(EXTLIB) -I.
LFLAGS +=
# ---------------------- armv7hf (bur am335x pp) specific ---------------------
else ifeq ($(PLATFORM), armv7hf)
EXTLIB = lib_armv7hf/
XLIBS = $(EXTLIB)libpng.a \
$(EXTLIB)libz.a \
$(EXTLIB)libjpeg.a \
$(EXTLIB)libxcb.so $(EXTLIB)libXdmcp.so $(EXTLIB)libXau.so \
-L$(EXTLIB) -lXext -lX11
CFLAGS += -march=armv7-a -mfpu=neon -mfloat-abi=hard
CFLAGS += -I$(EXTLIB)
LFLAGS +=
# -------------------------- x86_64 specific -----------------------------------
else ifeq ($(HOSTARCH), x86_64)
TARGETS = aprsmap-static
XLIBS = -lpng -ljpeg -lXext -lX11
APRSMAP_STATIC = aprsmap-$(HOSTARCH)
ifeq ($(PLATFORM), x86_32)
CFLAGS += -m32
LFLAGS += -m32
APRSMAP_STATIC = aprsmap-x86
endif
# -------------------------- x86_32 (default) specific ------------------------
else ifeq ($(HOSTARCH), x86)
TARGETS = aprsmap-static
EXTLIB = /usr/lib/i386-linux-gnu/
XLIBS = $(EXTLIB)libz.a \
$(EXTLIB)libjpeg.a \
-lpng -lXext -lX11
APRSMAP_STATIC = aprsmap-$(HOSTARCH)
else
XLIBS += -lpng -ljpeg -lXext -lX11
endif
# ------------------ objects enumeration ------------------
OBJ_COMMON = \
Select.o \
aprspos.o \
aprsstr.o \
osic.o \
osi.o \
soundctl.o \
tcp.o \
udp.o
OBJ_AFSKMODEM = \
afskmodem.o \
afskmodemptt.o
OBJ_GPS2APRS = gps2aprs.o
OBJ_GPS2DIGIPOS = gps2digipos.o
OBJ_SONDEMOD = \
geodesy.o \
gps.o \
gpspos.o \
navigation.o \
rinex.o \
sem.o \
sondeaprs.o \
time_conversion.o \
yuma.o \
sondemod.o
OBJ_SONDEUDP = sondeudp.o \
rsc.o \
rsc_decode.o
OBJ_UDPBOX = udpbox.o
OBJ_UDPGATE4 = udpgate4.o
OBJ_UDPFLEX = udpflex.o
OBJ_UDPHUB = udphub.o
OBJ_APRSMAP = \
aprsdecode.o \
aprsmap.o \
aprstat.o \
aprstext.o \
beep.o \
maptool.o \
pngread.o \
pngwrite.o \
jpgdec.o \
useri.o \
xosi.o
OBJ_SDRTST = tcpb.o sdr.o sdrtest.o
OBJ_SDRRADIO = tcpb.o sdr.o radio.o
OBJ_L2CAT = l2.o frameio.o deflate.o Execlogin.o cleanup.o l2cat.o
OBJ_ADSB2APRS = adsb2aprs.o tcpb.o
TARGETS += \
afskmodem \
gps2aprs \
gps2digipos \
udpbox \
udpgate4 \
udpflex \
udphub \
sondemod \
sondeudp \
aprsmap \
sdrtst \
sdrradio \
adsb2aprs
ifneq ($(HOSTOS), Darwin)
TARGETS += l2cat
endif
OBJS = \
$(OBJ_COMMON) \
$(OBJ_AFSKMODEM) \
$(OBJ_GPS2APRS) \
$(OBJ_GPS2DIGIPOS) \
$(OBJ_SONDEMOD) \
$(OBJ_SONDEUDP) \
$(OBJ_UDPBOX) \
$(OBJ_UDPGATE4) \
$(OBJ_UDPFLEX) \
$(OBJ_UDPHUB) \
$(OBJ_APRSMAP) \
$(OBJ_SDRTST) \
$(OBJ_SDRRADIO) \
$(OBJ_L2CAT) \
$(OBJ_ADSB2APRS)
# ------------------- target make rules -------------------
# -----------------
%.o: %.c
@echo [compiling] $@
@$(CC) $(CDEFS) $(CFLAGS) -o $@ $<
all: $(TARGETS)
clean:
rm -f $(OBJS) $(TARGETS) aprsmap-x86 aprsmap-x86_64
afskmodem: $(OBJ_AFSKMODEM) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o afskmodem $(OBJ_COMMON) $(OBJ_AFSKMODEM) -lm
$(STRIP) afskmodem $(STRIPFLAGS)
gps2aprs: $(OBJ_GPS2APRS) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o gps2aprs $(OBJ_COMMON) $(OBJ_GPS2APRS) -lm
$(STRIP) gps2aprs $(STRIPFLAGS)
gps2digipos: $(OBJ_GPS2DIGIPOS) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o gps2digipos $(OBJ_COMMON) $(OBJ_GPS2DIGIPOS) -lm
$(STRIP) gps2digipos $(STRIPFLAGS)
sondemod: $(OBJ_SONDEMOD) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o sondemod $(OBJ_COMMON) $(OBJ_SONDEMOD) -lm -L/usr/lib/i386-linux-gnu -lssl -lcrypto -lcurl
$(STRIP) sondemod $(STRIPFLAGS)
sondeudp: $(OBJ_SONDEUDP) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o sondeudp $(OBJ_COMMON) $(OBJ_SONDEUDP) -lm
$(STRIP) sondeudp $(STRIPFLAGS)
udpbox: $(OBJ_UDPBOX) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o udpbox $(OBJ_COMMON) $(OBJ_UDPBOX) -lm
$(STRIP) udpbox $(STRIPFLAGS)
udpgate4: $(OBJ_UDPGATE4) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o udpgate4 $(OBJ_COMMON) $(OBJ_UDPGATE4) -lm
$(STRIP) udpgate4 $(STRIPFLAGS)
udpflex: $(OBJ_UDPFLEX) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o udpflex $(OBJ_COMMON) $(OBJ_UDPFLEX) -lm
$(STRIP) udpflex $(STRIPFLAGS)
udphub: $(OBJ_UDPHUB) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o udphub $(OBJ_COMMON) $(OBJ_UDPHUB) -lm
$(STRIP) udphub $(STRIPFLAGS)
aprsmap-static: $(OBJ_APRSMAP) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o $(APRSMAP_STATIC) $(OBJ_APRSMAP) $(OBJ_COMMON) \
$(XLIBS) -lpthread -lxcb -lXau -lXdmcp -lm -lpthread -ldl -lz \
-static
$(STRIP) $(APRSMAP_STATIC) $(STRIPFLAGS)
aprsmap : $(OBJ_APRSMAP) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o aprsmap $(OBJ_APRSMAP) $(OBJ_COMMON) $(XLIBS) -lm
$(STRIP) aprsmap $(STRIPFLAGS)
aprsmap-cleanobj:
rm -f $(OBJ_APRSMAP) $(OBJ_COMMON)
sdrtst : $(OBJ_SDRTST) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o sdrtst $(OBJ_SDRTST) $(OBJ_COMMON) -lm
$(STRIP) sdrtst $(STRIPFLAGS)
sdrradio : $(OBJ_SDRRADIO) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o sdrradio $(OBJ_SDRRADIO) $(OBJ_COMMON) -lm
$(STRIP) sdrradio $(STRIPFLAGS)
l2cat : $(OBJ_L2CAT) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o l2cat $(OBJ_L2CAT) $(OBJ_COMMON) -lm
$(STRIP) l2cat $(STRIPFLAGS)
adsb2aprs: $(OBJ_ADSB2APRS) $(OBJ_COMMON)
$(CC) $(LFLAGS) -o adsb2aprs $(OBJ_ADSB2APRS) $(OBJ_COMMON) -lm
$(STRIP) adsb2aprs $(STRIPFLAGS)
diag:
echo $(HOSTARCH)
# end of makefile

141
src/NEW-aprs.txt 100644
Wyświetl plik

@ -0,0 +1,141 @@
afskmodem
---------
22.6.2013
Timeout fuer Frames im Sendepuffer, default auf 60s, sollte aber fuer aprs
mit -T <sekunden> bei den Modem Parametern auf 5 bis 15s gestellt werden
damit bei Ueberreichweiten oder nach sonstigem Dauer-DCD keine "historischen"
Frames abgesetzt werden. Sehr kurze Zeit hilft durch Sendeverzicht dynamisch
stark belegten Kanal zu entlasten.
udpgate4
--------
9.7.2013
tcp connect zu AprsIs auf NODELAY, also werden nimmer mehrere Zeilen
zu einem tcp Frame zusammengfasst. Macht etwas mehr Krach am Netz aber
ist paar ms schneller. Laut aprs.fi so gewollt.
Der (-T) 15s-Verzoegerungs-Check ist nun beim allen outgoing Connects weils
zuvor den Check auf den Test-connect (ob ein bevorzugter Server wieder geht)
umgschatet hat und der eigentlich laufende Link dann unbeobachtet haengen konnte.
WWW-Heard Liste nun nach Call, Port, Uhrzeit, Framezahl, und QRB auf
und absteigend sortierbar. Anklicken der Spalte in der Kopfzeile schaltet
auf das jeweilige Sortierkriterium, nochmal anklicken invertiert.
Der Zustand wird wie bei der Reload-Zeit im url gespeichert, es gibt weder
cookies noch ip Nummern speicherung. Einschraenkung: die getestenten Brauser
verwursteln den sortier-Schalter beim einstellen einer neuen Reload-Zeit
also bei Bedarf Zeit vorher eingeben.
11.7.2013
WWW-Link mit Klick auf ein Call in der Heard Liste mittels File "calllink.txt"
im www Server root directory (-D). Es gilt nur die 1. Zeile im File.
Beispiel fuer findu.com, db0anf oder aprs.fi:
"http://www.findu.com/cgi-bin/raw.cgi?call=$c" target="_blank"
"http://www.db0anf.de/app/aprs/stations/basic?call=$c" target="_blank"
"http://aprs.fi/?c=raw&call=$c&limit=5&view=decoded" target="_blank"
$c wird ersetzt durch das angeklickte Call, $$ wird zu $.
Es koennen HTML link Optionen angegegen werden, hier zB. target="_blank"
fuer oeffnen eines neuen Tab oder Fenster.
Mit diesen URLs zuerst eine kleine www-Seite oeffnen zum Auswaehlen von
Servern waere praktisch.
udpbox
------
24.7.2013
Im Digimodus (-d) werden Messages zu sich selbst (from=to) nicht mehr gesendet.
udpgate4
--------
26.7.2013
MH-counter Tabelle von 8 auf 16 Bit erweitert. Aufgrund der sortierbaren
Liste werden lange Speicherzeiten bevorzugt und bei schnellen Baken liefen
die einzelnen (mhzeit/48) Zaehler in die Begrenzung.
30.7.2013
Eingestellte bit/s fuer Messages net>rf (-R -M) werden auf der www Seite
unter "Connects" "UDP" txport "Range Filter" angezeigt.
7.10.2013
Ziffer+Buchstaben ist kein "Call" mehr und daher geht keine Messages von dem
Absender in den Speicher. Geht aber in Echtzeit als 3rd-Party-Frame raus, da
nicht-Call-Absender wie WHOIS oder WLNK zu direkt gehoerten Usern muessen.
Logserver: -r <path/file> schreibt 24h rawlog in je ein File mit Datum am
Filenamen hinten dran.
3. 2. 2014 (v 0.50)
Gate to Rf, wenn von Rf empfangen zeige (original APRS101.pdf) den via Pfad
soweit er durchlaufen is. Wenn via TCPIP, Pfad entfernen (aprs.fi).
Gate to Rf >0km sende Messages (ausser an sich selber) wenn das Ziel via
gehoert aber nicht direkt gehoert.
src path gate to rf gate to net msg to rf msg from net msg via msg dir
------------------------------------------------------------------------------------
net + + 1) +
net igatecall 1)
net RFONLY 1)
net NOGATE +
net TCPXX +
net TCPIP + + 1) +
net qA? + + 1) +
------------------------------------------------------------------------------------
rf + + 2)
rf igatecall
rf RFONLY +
rf NOGATE +
rf TCPXX
rf TCPIP +
rf qA? +
------------------------------------------------------------------------------------
1) if source is non-call (WINLINK WHO-IS...) and destination heard direct
2) if source heard direct else to msg via
gps2aprs:
---------
1.11.2013
Zeit (ddhhmm oder hhmmss) oder File in Kommentar einfuegen
udpbox
------
21.1.2014
\\rm als Macro in einer Bakenzeile loescht das Bakenfile,
der Inhalt wird also genau 1x gesendet.
Das verschwundene File kann als Handshake zu einem Task
dienen, wieder neuen Inhalt zu generieren.
-P <sekunden> piggyback-beacon, Baken werden maximal um diese Zeit
frueher gesendet als der Bakentimer eingestellt ist
sofern gerade ein anderer Frame gesendet werden soll.
Zweck ist die Bake direkt an den anderen Frame dran
ohne extra Txdelay und Kollisionswahrscheinlichkeit
zu senden.
-S laesst die (default ausgefilterten) Msg an sich selbst durch.

874
src/NEW-aprsmap.txt 100644
Wyświetl plik

@ -0,0 +1,874 @@
+ libpng und libz statisch dazu gelinkt
+ font symbol und osm karten nun im png format
+ 4 kursor tasten zum karte verschieben und backspace fuer letzte position(en)
(sofern die bei allen x11 gleichen hexcode haben)
+ osm karten in unterverzeichnissen nach zoom faktor 1..16
vorhandene maps loeschen oder einsortieren
+ wenn tiles fehlen wird sofern vorhanden die mit dem naechste zoomfaktor gedehnt eingesetzt
+ ./gm.sh starten bzw anpassen nach bedarf zum karten holen
+ linke maus auf karte klicken oder auf track oder symbol offnet menue
viele funktionen mit klick erreichbar aber noch nicht alle
menues noch chaotisch aber mal zum testen
+ wetter grafik + statistik auf x11 abrufbar
+ ESC taste zum menues schliessen
+ funktion der klicks auf symbol/text/map/track getrennt konfigurierbar
+ 5 watch calls (ohne wildcard) statt "follow car"
+ wetter symbol etwas besser anklickbar (symbols.png)
(alpha kanal nach heller verschoben, sollte mal nach 255 wenn alle symbole dafuer adaptiert)
+ rechte maustaste = BACKSPACE (back in zoom/pan-history) (bei www version lokal back am browser)
+ map move steps teil der fenstergroesse
6.1.2013
+ marker auf "Next click to Map": ohne einrasten auf symbole
"Next click to Symbol oder Text": mit einrasten auf genaue position wenn vorhanden
+ marker loeschen und keycode "@"
+ zoom to markers wieder da "Y"
+ kmh histogramm und animation entsprechend der eingestellten sichtbarkeits zeit des tracks
+ blaue popup menues sortiert nach der groesse angereiht von links oben
+ "Expandes Tiles" geht auch weg wenn alle tiles 1:1
+ call in die watchlist mit click
7.1.2013
+ Taste "@" umgewidmet auf "on click" Reset
+ Taste ":" loescht beide Marker
+ 30s langer Retry Mechanismus zum Tiles Laden,
sobald "gettiles" geloescht, je Sekunde 1 Ladeversuch aller benoetigten oder expandierter
Tiles und was fehlt oder "png error" hat wird erneut im "gettiles" angefordert.
7.1.2013
+ Tasten "<" und ">" entsprechend "Debug Track" raw+decoded Text der Waypoints oder Baken
durchsteppen und setzt Marker 1
+ Backspace history size 20 statt 10
10. 1. 2013
+ Tasten < > getauscht und Textinfo bleibt sichtbar
+ Click to WxSymbol neu und dort dann entweder 1 nicht-Wetter Messwert oder beliebig viele
Wetterwerte zugleich ein/aus schaltbar (Menue bleibt offen)
14. 1. 2013
+ Letzter Wettermesswert in der Kopfzeile der Wettergrafik
+ Wettergrafik passt sich der Fensterbreite an (ab 320 Breite)
+ Raw+Decoded Fenster bleibt trotz "Marker to Klick" Messdaten Fenster offen
16. 1. 2013
+ Decodiert positionless Wx Daten
+ Decodiert negative NN im "/A="-Format
+ Zoom to Markers geht auch bei Zoomlevel>14
+ Fractional Map Zoom rechnet etwa 2x so schnell und richtiger
+ Shift-Taste bei Map Move macht 1/10 Schrittweite
+ Shift-Taste bei Zoom (derzeit nur mit Maus) macht 1/10 Zoom Schritte
20. 1. 2013
+ Klick auf Track mit Raw+Decoded fuer den Geklickten Wegpunkt
+ Raw+Decoded mit Wegpunkt Nummer / Gesamtpunkte zur Orientierung wo man ist
+ Cut + Paste Puffer wird mit angeklicktem Call gefuellt
+ Paste in Texteingabefelder
- leider geht beides nicht nach aussen weil die fenster heute mit "selections"
miteinander telefonieren und das ist etwa so aufwendig wie das gesamte interface
zum X11 bis jetzt
+ (derzeit noch nicht ein/ausschaltbares) Textfenster mit Scrollbalken fuer lange
Texte. Zum Test mit Rawdaten von tcp connect.
- nach 4 Tagen Suche noch nicht gefunden wie man Kill des Fensters abfangen kann
ohne dass dabei alles abschmiert. Da auch die ganzen Xlib Aufrufe zum Text
reinzeichnen keiner auf Windoof/sontswas portieren wird, wirds wieder abgeschafft.
26. 1. 2013
- Textfenster mal wieder weg
+ rawlog File wird nun auch nach dem Einlesen geschlossen und wie bisher beim Schreiben
fuer jede Zeile neu geoeffnet
+ Marker 1 zu klick misst, wenn genau 1 objekt mit klick erfasst wird mit Einrasten
auf dieses, wenn "on next click set marker 2" immer ohne Einrasten
3. 2. 2013
+ (minimierbare) fixe Toolbar (die minimierte verdeckt noch manchmal Text Messages)
+ Popup Menues ausgemistet, z.B "Show All" nur wenns nicht schon ist
+ Von den neuen Kommandos aus der Toolbar gehen erst ein paar wirklich (W V Q S)
Messages, Listen, Config noch nicht
6. 2. 2013
+ Fahrtrichtungspfeil + Windfahne bei Wx Symbol, 20kmh pro Strich
beides als Teil vom Symbol anklickbar und abschaltbar
10. 2. 2013
+ Auswahl ob Toolbar oder Popup Fenster, damit beim Start normale Toolbar da ist.
Muss noch optimiert werden was in welchem Menue sein soll und was offen bleibt
oder verschwindet. Histogramme verdecken die Pulldown Menues aus der Toolbar.
+ Hoehenangabe bei den Symbolen, noch nicht abschaltbar weil alle Symbol-Attribute
ab einem einstellbaren Wert (mindest meter, km/h) konfigurierbar erscheinen sollten.
13. 2. 2013
+ Text Editor mit Scrollen fuer Config und (wenn fertig) Messages, Parameter werden
erst einzelne ausgewertet
+ Screenshot mit Filename
+ rawlog einlesen mit Filenamen (Datum Eingabe noch nicht ausgewertet)
16. 2. 2013
+ Watch Calls per Click suchen freien Platz in der Liste weil jetzt tastaturlos
auch wieder abschaltbar
+ Watch Calls mit * als Wildcard
+ Setzen der Start Map Position auf Bildmitte per Lokator, Long/Lat, oder mit "?"
im Config und dann Marker 1 setzen auf der Map
+ eigene Position im Config auch mit "?" mit Marker 1 uebertragbar.
+ Config File Speichern/Laden beim Start verwenden und automatisch bei Quit
Speichren
- fehlt noch Auswerten einiger Config Parameter zb Helligkeiten und "next click to Wx"
15. 2. 2013
+ Ausser Igate/Network und LogDatum Configs sollten alle gehen und gekoppelt sein mit den
Schiebereglern. Manche Werte, die beim teilweise eingegeben sein Unfug machen, werden
erst bei "Save" "Reload" oder Start ausgewertet.
28. 2. 2013
+ Bei Click auf Pixel das zu mehr als 1 Objekt gehoert, werden die gefundenen Objekte
bei jedem weiteren Click der Reihe nach an die 1. Stelle cykliert
+ Logfile Import mit Datum + ganze Stunde
+ Netbeacon aus Configparametern damit per Modem empfangenes ein Symbol fuer MH hat
(noch nicht per tcp gesendet)
3. 3. 2013
+ Objekte Loeschen
+ Filtern von Call, Igate, Objekt/Item-Absender (erst mal ohne Wildcards)
7. 3. 2013
+ transparente Menues oder schwarzer oder grauer Hintergrund
(Config Transparency 2..100, 1, 0)
+ Config Baken Symbol mit Auswahlmenu ("My Symbol" clicken)
+ Objekt loeschen mit DEL-Taste
17. 4. 2013
+ Nach wochenlangem Kampf mit den Windoof Compilern ist nun etwa Gleichstand bei der
Win32 Version und es kann wieder am gemeinsamen Teil weiter gebaut werden.
Die innere Struktur ist etwas umgekrempelt zwecks minimiertem systemabhaengigen
Teil. Leider hat sich die "Tile" Filestruktur (mit schnell mal 3500 Files in einem
Verzeichnis) am Win als Bremse erwiesen und daher ist noch eine Unterverzeichnis-
Ebene dazu gekommen und die Struktur nun gleich wie auf den Servern und "Marble".
Zum Konvertieren der vorhandenen Maps ist das "rentile" script dabei das man
noch anpassen muss und mit der Kommandozeile, die drin angegeben ist, Aufrufen.
Es wird nix geloescht nur kopiert. "gm.sh" ist auch darauf angepasst.
+ Neu sind nur ein paar Filter im Config und fuer Besitzer eines Mausrades damit Zoomen
und Pull der Map mit der mittleren Maustaste. Fuer Touchpad-geschaedigte muss man sich
noch eine Alternative mit Shift/Alt oder Klick auf die leere Map ausdenken.
Screenshot geht nun auch als "bmp" wenns File .bmp heisst.
17. 4. 2013
+ Pull Map auch mit linker Maustaste auf leere Map (configurierbar ?)
+ Shift + Click to Map: Set Marker 1 (configurierbare andere kommandos ?)
+ On next Click to Wxsymbol: Raw+Decoded zu den Wettergrafiken dazu einschaltbar
20. 4. 2013
+ tcp Connect zum Server mit neuer Syntax, -g <ip>:<port>[#<filter>] -g 44.143.100.1:14580#m/300
MYCALL und PASSWORT jetzt schon aus dem Config statt -s -p
+ Netzbake: "File" > "Config" -> Mycall, MyPos, Net Beacontext, My Symbol,
Netbeacontime mit Enable, PassCode mit Enable
My Symbol Anklicken fuer Auswahl
My Position "?" an 1. Stelle und dann Marker 1 Setzen
29. 4. 2013
+ tcp Connect nun probisorisch im File>Config, wenn man editiert gruen ausschalten und wenn
fertig wieder ein.
+ auf Wunsch Massstab auf der Karte (noch nicht schaltbar) und auch problematisch wegen
nicht entfernungstreuer Merkator Karten bei kleinem Zoom
4. 5. 2013
+ Vorschlag von dl8rdl eingebaut, Maps Download im Hintergrund komplett fuer das sichtbare
Fenster von Zoom 1 bis einstellbarem maximalen Zoom mit Vorkalkulation der Datenmenge,
abbrechen, weitertun, und Fortschrittsanzeige.
+ Messages empfangen (derzeit erst von tcp)
6. 5. 2013
+ "DAO"-Erweiterung in Frame-Decoder eingebaut zum Position auf etwa 20cm genau uebertragen
und auch genauere Auswertung vom GPS-raw-Format und Anpassung der Rundung auf Feldmitte
(leider ist die fliesskomma Genauigkeit nur etwa 1-2m)
8. 5. 2013
+ Mehr Status Meldungen von "on/off" Schaltern und (Shortcut) Funktionen
+ <Make Video> legt "map.y4m" auch auf Linux neu an wenn nicht (zB. als named-pipe) vorhanden,
meldet Schreibvorgang, refresht alle 1s den Bildschirm und ist abbrechbar.
+ Buttons mit noch nicht implementierter Funktion melden das.
+ Im Screenshot Filenamen wird "%t" durch Datum-Uhrzeit und %n durch "000" bis "999"
ersetzt bis der Filename neu ist.
+ Shortcut Tasten Liste im <Help>
10. 5. 2013
+ 4 direkt waehlbare Map Positionen + Zooms im Zoom-Menue oder per "1..4" Tasten.
Dabei kann entweder der Zoomlevel oder die Position oder beides abgerufen werden.
Der Eintrag dieser "Views" kann manuell im File>Config>View durch "Zoomfaktor Position"
(wobei Position auch ein QTH-Lokator sein kann), oder eines von beiden, oder viel
schneller durch "Shift" + Click auf einen der 3 "Views" im Zoom Menue erfolgen.
Dabei wird die aktuelle Karten-Position mit Zoom gespeichert.
Shortcuts anders: "1" (one user) nun "."
"2" +rf nun "="
"On next click" neu einstellen erforderlich
12. 5. 2013
+ Tooltipps mit Text aus externem File "hints.txt" und schon etlichen Texten drin.
Darf natuerlich verbessert oder uebersetzt werden wobei das Ergebnis der Arbeit
sofort aktiv ist sobald das hints.txt gespeichert ist.
|Buttonnummer Text
die fehlenden Texte werden als "<Buttonnummer> hint text" gezeigt
die Struktur des File>Config wird noch umgebaut daher mit den hints dafuer abwarten
15. 5. 2013
+ "Zitter"-Toleranz fuer Mausposition innerhalb der die Hints sichtbar bleiben
+ Zeigt aktuelle "Mbytes written" des Video Files
+ List>Internals zeigt System Zustand
+ "L" Shortcut nun "toggle Labels on/off" Labels=Text bei den Symbolen
+ Fine Zoom Steps im Config
17. 5. 2013
+ "L" und "O" bzw "Labels off" "Objects off" wird nun nimmer in Form von 0% Helligkeit
im Config verewigt
+ In Vorbereitung auf ein Text-Fenster kommt nun mal List>Messages und List>Bulletins
auf das Start Terminal Fenster raus, wobei die Bulletins noch nach
Absender/Eintreffzeit sortiert sind und nicht nach der BLN<nummer>
+ Angeklickte Objekte kann man in Infos>List Raw oder Infos>+Decoded auf das Textfenster
auflisten lassen (ohne farbige Fehlermeldungen)
18. 5. 2013
+ Config>Show Incoming "n" Zeigt TCP-Frames auf dem Textfenster, "n+" Dekodiert
fuer die Radio Ports entsprechend 1 2 3 ... und 1+ 2+ ... Dekodiert
21. 5. 2013
+ Raw+Decoded Sprechblase aktualisiert sich mit ankommenden Daten falls sie den letzten
Wegpunkt anzeigt
+ Delete Waypoint, wenn mit Debug oder Raw+Decoded markiert. Mit DEL-Taste zum entfernen
von (falschen) Wegpunkten. Marker 1 springt dann zum naechsten (vermutlichen) Fehler weiter.
(Wann alles loeschen oder nur Waypoint muss noch besser definiertbar sein)
+ Hoehe wird auch bei Symbolen ohne km/h Daten angezeigt falls Hoehendaten vorhanden und
eingeschaltet.
23. 5. 2013
+ UDP-Port im Config (erst mal 1 Stueck)
+ Fenstergroesse veraendern schneller
+ Trackfilter Fehlererkennung verbessert
+ Bei Debug Funktionen Verzoegerungszeit von doppelten Waypoints in Sekunden sichtbar
29. 5. 2013
+ Zwecks schnellem Tracks Debuggen mit "E" oder File>Infos>Waypoints-Button toggelt
alle, oder nur die als verdaechtig markierte Waypoints anzeigen mit den "<"">" Tasten
oder den Buttons daneben.
+ rawlog mit lesbarem Datum/Zeitstempel, das alte Format wird lesend auch akzeptiert.
+ axudp-kiss (usb)seriell Interface (udpflex) erweitert, sodass nebst an/abstecken von
usb-Seriellen auch ein resetteter TNC2 an empfangenen (nun nicht mehr kiss) Daten
erkannt und wieder auf kiss geschaltet wird. Geht mit init File auch fuer andere TNC
wie in THD7x oder TMD7x.
udpflex (linux), udpflex.exe (win32)
8. 6. 2013
+ Configurierbare default Speed fuer Animation
+ Parkplatzzittern-Erkennung fuer Animation Startzeit verbessert
+ Source Code Entruempelung zum einfacheren Compilieren fuer verschiedene Prozessoren
15. 6. 2013
+ km/h und/oder Hoehe in Animation und Video wobei Lesbarkeit bei schneller Aenderung
noch verbessert werden kann.
+ Uhrzeit beim Log schreiben laeuft nun auch waehrend Animation in Echtzeit.
+ +-24h Zeitversatz Systemzeit/angezeigte Zeit einstellbar
5. 7. 2013
+ Objekte mit extra "keep in memory time" zB um den schon nach 5 bis 6h recycelten
Blitz-Object-Namen keinen Track erzeugen zu lassen.
+ Logfile browsen geht gleichzeitig mit online Betrieb. Dazu wurde eine zweite
Uhrzeit geschaffen die den Logdaten folgt und die Echtzeit Daten werden unabhaengig
von den Logdaten (wie sonst auch) im RAM und writelog gepspeichert.
Es kann jederzeit zwischen Log und Echtzeit gschalten werden und in den Logdaten
an Anfang, Ende, und in "Fullbright" Zeitspruengen vor und zurueck gegangen werden
womit immer alle Daten einmal sichtbar sind.
+ Status Bar zeigt Betriebszustand, erst mal experimentell zum sehen was man braucht
mit Buchstaben bis Symbole entworfen sind. Bei TCP (Internet) und und UDP (Funk)
wandert die Farbe von gruen nach rot binnen 1 Min. solang keine Daten ankommen.
Message soll mal anstatt dem Popup Fenster vorhandene Messages anzeigen und erst bei
draufklicken Inhalt zeigen.
16. 7. 2013
+ Hoehen Diagramm ueber Wegstrecke, mit Trackfiler on "F" wird versucht die manchmal
ungenaue Hoehenmessung etwas glatt zu buegeln.
+ Beim Track anklicken wird der Wegpunkt ausgewaehlt der der Klickpunkt am naechten
liegt.
+ Popup Meldungen, die Befehle bestaetigen, werden nach ein paar Sekunden wieder
entfernt. Da, um CPU Zeit zu sparen, der Bildschirm nur aktualisiert wird wenn neue
Daten kommn, geschieht das Loeschen nur im Zuge einem Updates.
19. 7. 2013
+ "On Next Click To Track" mit Speed oder Altitude aktiviert, setzt eine Marke auf
dem Diagramm, die der angeklicken Stelle am Track entspricht.
+ "On Next Click To Track" kann mit 1 Click Wegpunkt loeschen aktivert werden.
+ Ein angewaehltes Objekt kann mit "Save" als Logfile mit dem Filenamen des Objekts
gespeichert werden (derzeit nur im Startverzeichnis). Existiert das File, wird
hinten dran geschrieben. Es werden alle Daten aus dem RAM geschrieben auch wenn
mit Trackfilter oder Fullbright Time ausgeblendet.
Manuell geloeschte Baken/Wegpunkte sind weg.
22. 7. 2013
+ Video/Animation Speed Einstellbereich erweitert von 1:1 (Echtzeit) bis 200s/Frame
womit die Speed-Zahl statt (Echt-)Sekunden zu Frames jetzt multiplikator fuer
Echtzeit ist.
+ Start Delay fuer beschleunigte Darstellung (wenn sich nichts bewegt) einstellbar
+ Log Import fuer ein Call wobei immer auf eine Zeitspanne gesucht wird in der das
Call aktiv war (keine wildcards)
25. 7. 2013
+ "On Next Click" mit mehreren Optionen gleichzeitig (wo es Sinn macht).
9. 8. 2013
+ Durch erweitern der Menue-Darstellung auf Tabellen mit Farben und verbessern des
Zeilen-Editors (Maus kann Cursor setzen ...) ist Messages erstellen und verwalten
moeglich geworden. Empfangene Messages sind noch ohne Tabelle.
2. 9. 2013
+ Nach komplettem Umbau des Konfigurations-Tools mit dynamischer Anzahl der
Eintraege geht nun Messages senden, mehrere Aprs-Server-urls die abgeklappert
werden bis einer antwortet, beliebig viele Watchcalls, Filtereintraege, Baken...
Der Texteditor kann Insert/Overtype und Cursor setzen mit der Maus.
Mit Shift-Linksklick auf die Karte wird die Position in die Editorzeile
kopiert (jetzt einfach wiederholbar bis man "getroffen" hat)
(Die eigene Position und die Zoom>"Views" muessen neu eingegeben werden)
+ Die aktuelle Fenstergroesse wird im Konfigfile mit gespeichert.
"View 1" wird beim Programmstart dargestellt.
(speichern der aktuellen Ansicht mit Shift-Linksklick im Zoom-Menue)
+ Nach der Frage "was brauch ich alles um online zu gehn" ist dies nun in
einem Menue. Dabei kann man abgestuft von ganz ohne Call bis Call und eigene
Position nur dem Server sagen (zwecks funktionieren der m/... Filter) bis
Bake und Messages ins Netz senden konfigurieren.
+ Igate-Funktion ist nur in der Linux Version vorhanden da das Win-tcp-System
keine Info ueber bestaetigte Daten hat und dann einen als "haengend" erkannten
Link nicht terminieren kann, ohne die veralteten Daten noch rauszuweinen.
Das waere im aktuellen AprsIs-Netz ohne Timestamps nicht mehr akzeptabel.
Auch die Linux Igate-Funktion sollte auf keinen Fall fuer einen Digi verwendet
werden da zB. beim Logfiles durchsuchen die Durchlaufzeit erheblich werden kann.
Fuer Igate gibts ohnhin ein eigenes Tool.
+ UDP-Ports fuer Funk rx/tx mit Soundmodem oder mittels "udpflex" (USB)seriellen
TNC gibts derzeit 4. Eine dynamische Anzahl braucht noch Aufwand bei den
Schaltknöpfen in den Menues.
Der Funk-Baken/Objekt/Items-Editor ist noch in Entwicklung, dort dann auch
wieder die verschwundene "Rfbeacomtime" fuer jede Bake extra.
(bis da hin 1 Bake manuell ins aprsmap.cfg)
4. 9. 2013
+ Baken senden mit Macros fuer Uhrzeit und File einfuegen (Wetterbake). Jede Bake
mit Port und Intervall Angabe und Zielport geht auch Net. Mit Beacons Shift Time
wird die Startzeit jeder weiteren Bake so verschoben, dass sie nicht innerhalb der
"dupe delete" zeit (meinst 57s) der Igates landen.
Syntax: intervall(s):port:rawformat 600:1:NOCALL>CQ:>test
\\z tag+zeit, \\h zeit, \\:filename:, \\\ \\
8. 9. 2013
+ Maus Hint Texte verbessert und deren Erscheinen an der Status Bar.
+ User Infos erweitert, gefahrene km, Zaehler fuer Baken, Messages, Acks, Rejects
9. 9. 2013
+ "Show Objects of Sender" zeigt alle (anderen) Objekte und Items von dem Absender
des Ausgewaehlten Objekts auf einer dafuer gezoomten Karte unter "Info>Objects of.."
+ Shift-Click auf die Status-Bar (die bunten Laempchen) oeffnet direkt das zugehoerige
Config-Menue soweit Sinnvoll.
11. 9. 2013
+ Menue Positionierung korrigiert und Menues nimmer schliessen bei Shift-Click
auf Map zum Position in Editor Zeile kopieren
13. 9. 2013
+ Statusbar Netzwerk-Buttons Mouse-Over wenn nicht online normale Hints,
wenn online, Status Info. X/N zeigt offline/online (sollten mal Symbole werden)
+ "w" Temperatur-Karte wie bisher, "W" (w mit Shift) Regen-Karte mit blau fuer
24h und rot fuer aktuellen Regen (noch ohne Fehlerfilter, luegende Stationen
anklicken und mit DEL entsorgen).
16. 9. 2013
+ Logfile lesen mitn Binaersuche fuer den Anfang ab wo ins RAM eingelesen wird
mit dem Vorteil, dass auch lange Logs beim Programmstart und Log Import schnell
nach Datum durchsucht sind, aber das Logfile muss nach Datum sortiert sein.
Derzeit max 4GB Logfile.
19. 9. 2013
+ Message (Query) Kommandowoerter + Antworten in Config > Rf-Ports.
Standard Querys (?APRSP) als auch beliebige Woerter koennen definiert
werden und in der Antwort Macros wie \\h Uhrzeit, \\p Path, \\l Position,
\\v Programm Version, \\<filename> File senden, \\>filename> schreiben,
letzteres zum aktivieren von einem Programm zum was Steuern oder Sprachausgabe
"TALK:\\>/tmp/talk.txt>Text um \\h Gesprochen!"
"?HELP:?APRSP, ?VER, TALK"
22. 9. 2013
+ Windfahne und Temperatur beim Symbol mit Timeout.
+ 1 Kommastelle mehr bei Koordinaten-Ausgabe und bei Maus-Koordinaten
Grad/Minuten/Sekunden-Schreibweise zuaetzlich.
+ Win32: bei der (oder mehr) Start-Fenstergroesse die der Bildschirm kann,
"Maximized" Fenster.
7. 10. 2013
+ Filesystem auf "Longfiles" umgestellt damit sollte Logfile >2GB geschrieben
und dank Binaersuche auch flott importiert werden koennen.
+ Programm Starter fuer Maps-Downloader bei Bedarf (gm.sh bzw gm.bat)
der kann sich nach getaner Arbeit beenden. Status in der Status-Bar
mit "D" statt "E" fuer Downloader laeuft erkennbar.
+ Beliebige Map-Typen configurierbar mit korrektur der Basis-Helligkeit,
die ersten 3 wie gewohnt mit Shortcut "7" "8" "9", die 1. beim Start aktiv.
Sat-Maps erst wenn ein JPEG-Dekoder vorhanden ist (ausser man wandelt
sie beim Download in PNG). Neu (voreingestellt): cyclemap
11. 10. 2013
+ Wegstrecken Summe (ohne Track) auf der Map (shift-click, click, click...)
+ Log Import (bis auf Suche rueckwaerts nach Call) bei unsortiertem File
versucht etwas zu verbessern
13. 10. 2013
+ Schriftgroesse einstellbar (Config > Map Paramter > Font Size)
15. 10. 2013
+ Screenshot auch als ".png" (vorerst nur Linux Version)
und osm-Verzeichnispfad wieder configurierbar
+ "On next click to Track" bei mehrfacher Auswahl mit "Zoom to" wird erst gezoomt
und dann im 1 Track Mode die anderen Funktionen aktiv.
31. 10. 2013
+ Beep-Sounds mit beliebiger Frequenz und Dauer wenn Message oder Ack eintrifft,
wenn sich wer in den Warnradius bewegt mit steigender Frequenz und/oder Dauer
je naeher er zum Zentrum kommt und wenn ein Call aus der Watch Liste aktiv wird.
Alle getrennt schaltbar und limitiert auf maximal alle 5s.
Windoof 7 oder 8 geschaedigte koennten evtl. keinen Piepser haben dann gibts als
Ersatz 3 System-Sounds (mit 0ms einschalten, bis 500, bis 1000, ab 1000Hz
jeweils ein anderer Gong).
Config > Map Moving > Bell/Sound
6. 11. 2013
+ In Animation und gedimmten nicht-movern wird die schrift der "mover" im
nun Vordergrund gehalten
+ Einfaches Hyperlink Hilfetext System mit File "help.txt" unter "Help"
erreichbar mit ein bisschen Text als Beispiel
18. 11. 2013
+ Einstellbarer Timer zum Verzoegern vom Mapdownload Start waehrend Karte
verschieben, wer so vermeiden will, dass in hohem Zoom der Streifen an Karten
entlang der Bewegung durch die Botanik geladen wird. Config / Timers
+ Index Taste im Help Fenster
+ Schutz vor ewig loopenden Mapdownloads wenn durch zB volle Platte oder nicht
identischem Schreib/Lese-Pfad immer die gleichen Karten angefordert werden.
Kommt ein Kartenteil immer wieder, wird nach ein paar Versuchen 1. nur mehr
1 Karte angefordert, 2. die Pause zwischen Anforderungen immer Verdoppelt
und 3. poppt eine Fehlermeldung auf.
+ Copy/Paste hinein ins Program (rechte Maustaste im Textfeld oder ctrl-v)
(bei linux jetzt mit dem aktuellen "keiner verstehts..." selection-Verfahren)
22. 11. 2013
+ "Ok" im config-Zeileneditor schliesst das Fenster nach dem Speichern.
+ Map download Timing (im Fehlerfall) optimiert, dass mit dem in entwicklung
befindlichen hochgeschwindigkeits-Downloader von oe5krn bei falscher
Einstellung oder voller Platte keine "Gigabyte" ins Nirvana geladen werden.
28. 11. 2013
+ "B" und "M" (gross) fuer Bakeneditor und Message senden
+ Index bei Helptext
+ Umfangreicher Baken/Objekt/Item Editor mit verschiebbarem Fenster,
Import von vorhandenen Objekten auf der Karte durch anklicken.
Testen lokal vorm Senden.
Einmal senden oder mit Timer und Verschiebung der Sendezeiten, dass die
Duplikatloeschung in den Igates Sendungen mit gleichen Inhalt aber
verschiedener Frequenz (oder direkt per tcp) im Netz sichtbar laesst.
Einfaches Fernloeschen von Items und Objects.
Normal/Mic-E/Compressed mit DAO Erweiterung fuer 20cm Genauigkeit
(die aber je nach Fliesskommaarithmetik nur etwa 1m schafft)
mit Bytezaehler der Gesamtlaenge beim editieren der Kommentarzeile zum
optimieren der Kompressionsart.
Macros zum Einfuegen von Files zB fuer Wetterbake
+ Query standard Antworten (?APRST ...) vorkonfiguriert mit opt-out wers
nicht will. Config > Rf Ports > Query Keywords
+ Fehler behoben, Decodieren von Items mit kurzem Label.
Unsichtbare User wegen keinem oder falschem Symbol (die aber trotzdem
watch/approxy-piepsen) haben nun Label und Track
+ Listings im "Show 1 Modus" zeigen nun nur was zu dem User gehoert
4. 12. 2013
+ Config > Rf-Ports > Monitor Headline
Damit kann man 0 bis 20 Calls + Tempertur oder km/h als "Ticker"
von aktuellen Frames auf der Fenster-Ueberschrift durchlaufen lassen.
Bei minimiertem Fenster ist das aktuellste Call in der Taskleiste.
N> kommt von, N< get ans Netz, 1> 2> Funkports, N- heisst der Frame
ist entweder in den Callfiltern oder ohne verwertbarem Inhalt.
+ (grosses) "F" Shortcut Find (Call, Locator, Breite/Laenge)
+ Bakeneditor "Draw" schreibt nimmer ins rawlog
10. 12. 2013
+ Calls + Temp,km/h,Hoehe der ankommenden und abgehenden Daten in der
Fenster-Kopfzeile. Anzahl der Calls Config>Rf-Ports>Monitor Headline.
Updaterate auf (Mittelwert) 1s limitiert.
+ Maus-Verhalten umgestellt (aehnlich anderen Programmen).
Linksklick wartet auf Maus-Bewegung (mit ein bisschen Zitter Toleranz)
und zieht Karte (auch wenn ein Symbol getroffen) oder, am oberen Rand
angefasst, konnen einige Menues und die Status-Bar positioniert werden
mit "ankleben" an den Fensterrand und gespeichert in aprsmap.cfg.
Beim auslassen der Maustaste, wenn nicht bewegt, wird der normale Klick
ausgeloest.
Mittlere Maustaste zieht alles was ziehbar ist und an beliebiger Stelle
angefasst.
Rechte Maustaste wie bisher Back-in-zoom-History oder in einer
Texteingabe "Paste" (falls was im copy/paste Puffer ist)
15. 12. 2013
+ Message Senden nun bis 67 Zeichen wie im Protokoll vorgesehen statt 57.
+ Umlautwandler auf "Ae Oe Ue ss" (bis mal ein 8 Bit Zeichensatz definiert ist).
+ Message Eingabezeile geleert wenn die vorherige Message abgeschickt wurde oder
an ein anderes Call als zuvor gesendet werden soll.
+ Schnelles Zoomen mit Shift-Linksklick und Rahmen um den gewuenschten Inhalt
aufziehen.
+ (nur Linux) jpeg-Dekoder fuer Maps wobei erst .png versucht wird dann
jpeg in .png Filenamen und zuletzt jpeg als .jpg (gm.sh modifizieren).
16. 1. 2014
+ Config / Online / Serverfilter Aenderungen werden bei "Ok" sofort zum
Server geschickt. (sofern der die "# filter ..." Syntax versteht)
+ mit "<" ">" durch einen Track wandern geht mit gleichzeitig geoeffneter
Altitude- und Speed-Statistik und zeigt dort die Stelle am Track und die
Messwerte numerisch.
+ Tools / List neu mit verschieb- maximier-, ikonisierbarem Textfenster
mit Scrollbalken (und Cursortasten und Mausrad) und nach Zeit und
alfabetisch sortierbarem Inhalt.
Es kann Rohdaten und dekodiert listen. Text kann man markieren und mit
"Paste" in andere Anwendungen kopieren (auch auf Win ohne umstaendlichen
Dialog). Gibt man in Tools / Find ("F"-Taste) ein Wort ein, werden alle
gleichnamigen Stellen farblich hervorgehoben zB. "APLM01" oder ein Call.
Klickt man auf eine Zeile, wird auf der Landkarte die Herkunft gezeigt,
sofern die Zeile eine Position enthaelt und wenn nicht, die letzte
bekannte Position vom Absender der Zeile.
Das Live-Monitor-Fenster fuer empfangene und gesendete Daten hat anstatt
sortieren "Clr" fuer Inhalt loeschen, es stoppt raufscrollen wenn man
mindesten 1 Zeile herunter geschoben hat, und kann mit "u"-Taste an und aus
geschaltet werden. (Beachten: bei Batteriebetrieb durch den laufenden
Bild-Update evtl mehr CPU/Akkuverbrauch)
Das Aktivieren des Monitors ist, bis eine selbsterklaerende Menue-Struktur
erfunden ist, noch wie zuvor unter Config / Rf-Ports / Monitor Frames.
+ Linux: F11-Taste (bei "seltsamen" Fenstermachern die selber kein Maximieren
oder dann wieder kleiner machen koennen) toggelt Fullscreen/Normal.
+ Win: Kein extra Textfenster mehr da Listings eingebaut.
20. 1. 2014 (Ver 0.32)
+ Funkport (Soundmodem / udpflex) Kommandozeile in Config / Rf Ports /
Serial Interface
Task wird automatisch gestartet.
+ Monitor Ports off/raw/decoded einzeln mit Klick schaltbar Tools/List/Monitor.
3. 2. 2014 (Ver 0.32)
+ Message Rx: Schalter fuer Pop-up Fenster
Schalter fuer zeigen von Messages an andere SSID
Schalter fuer Messages an sich selber weg filtern (default on)
h264 in mpeg4 Container:
Linux: 1 mal machen: mknod map.y4m p
fuer jedes Video starten: x264 -o film.mp4 --muxer mp4 --crf 22 map.y4m
<Make Video>
win: File / Make Video gibt unkomprimiertes Videofile map.y4m
(.y4m sollten mplayer oder vlc abspielen koennen)
klein packen mit x264.exe "x264 -o film.mp4 --muxer mp4 --crf 22 map.y4m"
(crf=22..27 qualitaet gut bis sparsam)
vorher mit Animate und auf Map klicken passende Geschwindigkeit einstellen
files/dirs:
aprsmap programm
aprsmap.cfg beispiel config, wenn nicht vorhanden werden default werte erzeugt
hints.txt tipps beim verweilen mit der maus auf buttons
help.txt Hyperlink-Hilfetext unter Help > Helptext
gm.sh shell script zum osm karten holen
(geht nun auch mit der busybox am tinycore) ./gm.sh
(darf/soll verbessert werden HI)
symbols.png icons
font.png buchstaben
gettiles vom aprsmap erzeugte liste fehlender map tiles
rawlog timestamp+aprsis format wenn vorhanden beim start eingelesen
bei connect zu aprs server kommts neue dazu
dargestellt werden die eingestellten minuten vom ende des logs
mit connect zu server eingestellte minuten von jetzt
file darf editiert, beschnitten, gefiltert werden
wird nach timestamp sortiert eingelesen
(langes file einlesen geht mit serverconnect schneller
da erst ab "jetzt-darstellzeit" decodiert wird)
osm/tiles/ karten im osm format
osm/tiles_sat/
osm/tiles_topo/
udpflex axudp<->kiss/smack/flexkiss interface fuer TNC, TMx7xx ...
kisson.txt kiss initialisierung fuer TMD72 mit udpflex
getosm.exe Win: Schneller Maplader von OE5KRN
oe5dxl

45
src/README 100644
Wyświetl plik

@ -0,0 +1,45 @@
compiling hints for C-Sources by OE5HPM@OE5XBL.#OE5.AUT.EU
build for X86 with i386 (32-bit) host system
or
build on some native ARM machine (like raspbian on rpi)
================================================================================
install following packages:
- build-essential (sudo apt-get install build-essential)
- libX11-dev (sudo apt-get install libX11-dev)
- libXext-dev (sudo apt-get install libXext-dev)
- libpng-dev (sudo apt-get install libpng-dev)
- libjpeg-dev (sudo apt-get install libjpeg-dev)
make all
build for X86 with i686 (64-bit) host system
================================================================================
install following packages:
- build-essential (sudo apt-get install build-essential)
- libX11-dev (sudo apt-get install libX11-dev)
- libXext-dev (sudo apt-get install libXext-dev)
- zlib1g-dev
- libjpeg-dev (sudo apt-get install libjpeg-dev)
make all
cross-build for ARMV6 (raspberry pi) on x86 host system
================================================================================
install following packages:
- build-essential (sudo apt-get install build-essential)
- lib32z1 (sudo apt-get install lib32z1)
- rpi-tools (git clone https://github.com/raspberrypi/tools.git ~/rpi-tools)
PLATFORM=armv6 CROSS_COMPILE=~/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi- make all
cross-build for ARMV7hf (bur am335x pp, bananapi, beaglebone) on x86 host system
================================================================================
install following packages:
- build-essential (sudo apt-get install build-essential)
- linaro-toolchain
cd ~/
wget https://releases.linaro.org/components/toolchain/binaries/latest-5.1/arm-linux-gnueabihf/gcc-linaro-5.1-2015.08-x86_64_arm-linux-gnueabihf.tar.xz
tar -xf gcc-linaro-5.1-2015.08-x86_64_arm-linux-gnueabihf.tar.xz
PLATFORM=armv7hf CROSS_COMPILE=/opt/gcc-linaro-5.1-2015.08-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- make all

126
src/Select.c 100644
Wyświetl plik

@ -0,0 +1,126 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
static fd_set rset, wset;
static unsigned maxfd;
int selectrw(long sec, long usec)
{
struct timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
return select(maxfd+1, &rset, &wset, NULL, &tv);
}
int selectr(long sec, long usec)
{
struct timeval tv;
tv.tv_sec = sec;
tv.tv_usec = usec;
return select(maxfd+1, &rset, NULL, NULL, (usec == 0 && sec == 0) ? NULL : &tv);
}
void fdclr()
{
FD_ZERO(&rset);
FD_ZERO(&wset);
maxfd = 0;
}
void fdsetr(long n)
{
if (n>maxfd) maxfd = n;
FD_SET(n, &rset);
}
void fdsetw(long n)
{
if (n>maxfd) maxfd = n;
FD_SET(n, &wset);
}
unsigned issetr(long n)
{
if (FD_ISSET(n, &rset)) return 1;
return 0;
}
unsigned issetw(long n)
{
if (FD_ISSET(n, &wset)) return 1;
return 0;
}
int selectrwt(long *sec, long *usec)
{
struct timeval tv;
int ret;
#ifdef MACOS
struct timeval spec1, spec2;
time_t s;
long us;
gettimeofday(&spec1, NULL);
#endif
tv.tv_sec = *sec;
tv.tv_usec = *usec;
ret=select(maxfd+1, &rset, &wset, NULL, &tv);
#ifdef MACOS
/* MacOS does not update tv value in select */
gettimeofday(&spec2, NULL);
s = spec2.tv_sec-spec1.tv_sec;
us = spec2.tv_usec - spec1.tv_usec;
if (us < 0) {
us += 1000000;
s -= 1;
}
*sec -= s;
*usec -= us;
if (*usec < 0) {
*usec += 1000000;
*sec -= 1;
}
if (*sec < 0) {
*sec = 0;
*usec = 0;
}
#else
*sec = tv.tv_sec;
*usec= tv.tv_usec;
#endif
return ret;
}
/*
void Usleep(long microseconds)
{
usleep(microseconds);
}
*/
/*
unsigned Systime()
{
struct timespec tv;
clock_gettime(CLOCK_REALTIME, &tv);
return tv.tv_sec;
}
unsigned monotonictime()
{
struct timespec tv;
clock_gettime(CLOCK_MONOTONIC, &tv);
return tv.tv_sec;
}
*/

29
src/Select.h 100644
Wyświetl plik

@ -0,0 +1,29 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef Select_H_
#define Select_H_
#include "X2C.h"
extern long selectrw(unsigned long, unsigned long);
extern long selectr(unsigned long, unsigned long);
extern void fdclr(void);
extern void fdsetr(unsigned long);
extern char issetr(unsigned long);
extern void fdsetw(unsigned long);
extern char issetw(unsigned long);
extern long selectrwt(unsigned long *, unsigned long *);
#endif /* Select_H_ */

66
src/X2C.h 100644
Wyświetl plik

@ -0,0 +1,66 @@
/*
* Copyright (C) Hannes Schmelzer <oe5hpm@oevsv.at>
*
* this files substitutes the absolute minimum of the original XDS lib
* for our project.
*/
#ifndef X2C_H_
#define X2C_H_
#include <ctype.h>
#include <unistd.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <float.h>
#include <assert.h>
#define X2C_ADDRESS char *
#define X2C_pCHAR char *
#define X2C_LSET_SIZE (sizeof(uint32_t) * 8)
#define X2C_max_longint 0x7FFFFFFFL
#define X2C_min_longint (-0x7FFFFFFFL-1)
#define X2C_max_longcard 0xFFFFFFFFUL
#define X2C_max_real ((float)FLT_MAX)
#define X2C_min_real (-((float)FLT_MAX))
#define X2C_max_longreal ((double)DBL_MAX)
#define X2C_min_longreal (-((double)DBL_MAX))
#define X2C_max_longdouble ((X2C_LONGDOUBLE)LDBL_MAX)
#define X2C_min_longdouble (-((X2C_LONGDOUBLE)LDBL_MAX))
#define X2C_ASSERT(x) assert(x)
#define X2C_TRAP(x) assert(0)
#define X2C_CASE_TRAP 0
#define X2C_ABORT(void) exit(-1)
#define X2C_EXIT(void) exit(0)
#define X2C_HALT(x) (exit(x))
#define X2C_CAP(x) toupper(x)
#define X2C_DIVL(a, b) ((a)/(b))
#define X2C_DIVR(a, b) ((b) != 0.0f ? (a)/(b) : (a))
#define X2C_EXPRI(a, b) (pow(a,b))
#define X2C_PFREE(p) (free(p))
#define X2C_COPY(src, src_len, dst, dst_len) \
memcpy(dst, src, src_len <= dst_len ? src_len : dst_len)
#define X2C_MOVE(source, dest, size) memcpy(dest, source, size)
#define X2C_STRCMP(a, alen, b, blen) strncmp(a, b, alen < blen ? alen : blen)
#define X2C_CHKNIL(T, p) ((T)(osic_chkptr((void *)(p))))
#define X2C_CHKPROC(T, p) ((T)(osic_chkptr((void *)(p))))
#define X2C_CAST(val, fr, to, to_ref) \
((sizeof(fr) < sizeof(to)) ? (assert(0), (to_ref)0) : (to_ref)(val))
#define X2C_MAIN_DEFINITION
#define X2C_STACK_LIMIT(x)
#endif

648
src/adsb2aprs.c 100644
Wyświetl plik

@ -0,0 +1,648 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#define X2C_int32
#define X2C_index32
#ifndef X2C_H_
#include "X2C.h"
#endif
#define adsb2aprs_C_
#ifndef osi_H_
#include "osi.h"
#endif
#include <osic.h>
#ifndef mlib_H_
#include "mlib.h"
#endif
#ifndef tcp_H_
#include "tcp.h"
#endif
#ifndef udp_H_
#include "udp.h"
#endif
#ifndef aprsstr_H_
#include "aprsstr.h"
#endif
#ifndef tcpb_H_
#include "tcpb.h"
#endif
/* dump1090 tcp output to aprs beacon by OE5DXL */
#define adsb2aprs_TIMETOL 20
/* max seconds between dir/speed and pos */
#define adsb2aprs_PURGETIME 120
/* seconds keep context */
#define adsb2aprs_DEFAULTBEACONTIME 20
#define adsb2aprs_SYMBOL "/^"
#define adsb2aprs_KNOTS 1.852
/* nautic miles */
#define adsb2aprs_FEET 0.3048
typedef char CSV[100][21];
struct FLY;
typedef struct FLY * pFLY;
struct FLY {
pFLY next;
char hex[6];
char name[21];
float lat;
float long0;
float alt;
float speed;
float dir;
uint32_t speedtime;
uint32_t postime;
uint32_t lasttime;
uint32_t lastbeacon;
char newpos;
};
static char url[1001];
static char port[1001];
static char reconn;
static char verb;
static char verb2;
static int32_t fd;
static pFLY dbase;
static uint32_t btime;
static char mycall[10];
static char symbol[2];
static int32_t udpsock;
static uint32_t ipnum;
static uint32_t toport;
static void Error(char text[], uint32_t text_len)
{
X2C_PCOPY((void **)&text,text_len);
osi_Werr(text, text_len);
osi_WerrLn(" error abort", 13ul);
X2C_ABORT();
X2C_PFREE(text);
} /* end Error() */
static char GetNum(const char h[], uint32_t h_len, char eot,
uint32_t * p, uint32_t * n)
{
*n = 0UL;
while ((uint8_t)h[*p]>='0' && (uint8_t)h[*p]<='9') {
*n = ( *n*10UL+(uint32_t)(uint8_t)h[*p])-48UL;
++*p;
}
return h[*p]==eot;
} /* end GetNum() */
static uint32_t truncc(double r)
{
if (r<=0.0) return 0UL;
else if (r>=2.147483647E+9) return 2147483647UL;
else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard);
return 0;
} /* end truncc() */
static uint32_t truncr(float r)
{
if (r<=0.0f) return 0UL;
else if (r>=2.147483647E+9f) return 2147483647UL;
else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard);
return 0;
} /* end truncr() */
static int32_t GetIp(char h[], uint32_t h_len, uint32_t * p,
uint32_t * ip0, uint32_t * port0)
{
uint32_t n;
uint32_t i;
char ok0;
int32_t GetIp_ret;
X2C_PCOPY((void **)&h,h_len);
*p = 0UL;
h[h_len-1] = 0;
*ip0 = 0UL;
for (i = 0UL; i<=4UL; i++) {
n = 0UL;
ok0 = 0;
while ((uint8_t)h[*p]>='0' && (uint8_t)h[*p]<='9') {
ok0 = 1;
n = (n*10UL+(uint32_t)(uint8_t)h[*p])-48UL;
++*p;
}
if (!ok0) {
GetIp_ret = -1L;
goto label;
}
if (i<3UL) {
if (h[*p]!='.' || n>255UL) {
GetIp_ret = -1L;
goto label;
}
*ip0 = *ip0*256UL+n;
}
else if (i==3UL) {
*ip0 = *ip0*256UL+n;
if (h[*p]!=':' || n>255UL) {
GetIp_ret = -1L;
goto label;
}
}
else if (n>65535UL) {
GetIp_ret = -1L;
goto label;
}
*port0 = n;
++*p;
} /* end for */
GetIp_ret = 0L;
label:;
X2C_PFREE(h);
return GetIp_ret;
} /* end GetIp() */
static void Parms(void)
{
char s[1001];
uint32_t n;
uint32_t m;
reconn = 0;
verb = 0;
verb2 = 0;
strncpy(url,"127.0.0.1",1001u);
strncpy(port,"30003",1001u);
mycall[0] = 0;
btime = 20UL;
strncpy(symbol,"/^",2u);
for (;;) {
osi_NextArg(s, 1001ul);
if (s[0U]==0) break;
if ((s[0U]=='-' && s[1U]) && s[2U]==0) {
if (s[1U]=='t') {
osi_NextArg(s, 1001ul); /* url */
n = 0UL;
while ((n<1000UL && s[n]) && s[n]!=':') {
if (n<1000UL) url[n] = s[n];
++n;
}
if (n>1000UL) n = 1000UL;
url[n] = 0;
if (s[n]==':') {
m = 0UL;
++n;
while ((n<1000UL && s[n]) && m<1000UL) {
port[m] = s[n];
++n;
++m;
}
if (m>1000UL) m = 1000UL;
port[m] = 0;
}
}
else if (s[1U]=='k') reconn = 1;
else if (s[1U]=='b') {
osi_NextArg(s, 1001ul);
n = 0UL;
if (!GetNum(s, 1001ul, 0, &n, &btime)) Error("-b <s>", 7ul);
}
else if (s[1U]=='I') {
osi_NextArg(mycall, 10ul);
if (aprsstr_Length(mycall, 10ul)<3UL || aprsstr_Length(mycall,
10ul)>9UL) Error("-I <callsign>", 14ul);
}
else if (s[1U]=='s') {
osi_NextArg(symbol, 2ul);
if (aprsstr_Length(symbol, 2ul)!=2UL || symbol[0U]=='-') {
Error("-s <symbol>", 12ul);
}
}
else if (s[1U]=='u') {
osi_NextArg(s, 1001ul);
n = 0UL;
if (GetIp(s, 1001ul, &n, &ipnum, &toport)<0L) {
Error("-u ip:port number", 18ul);
}
udpsock = openudp();
if (udpsock<0L) Error("cannot open udp socket", 23ul);
}
else if (s[1U]=='v') verb = 1;
else if (s[1U]=='V') {
verb = 1;
verb2 = 1;
}
else if (s[1U]=='h') {
osi_WrStrLn("", 1ul);
osi_WrStrLn("dump1090 basestation format tcp output to aprs objec\
t beacon", 61ul);
osi_WrStrLn("", 1ul);
osi_WrStrLn(" -b <seconds> aprs minimum send intervall -b \
10 (20)", 60ul);
osi_WrStrLn(" -h help", 26ul);
osi_WrStrLn(" -I <mycall> Sender of Object Callsign -I OE\
0AAA", 57ul);
osi_WrStrLn(" -k keep tcp connection", 41ul);
osi_WrStrLn(" -s <symbol> aprs symbol (/^)", 38ul);
osi_WrStrLn(" -t <url:port> connect dump1090 tcp server (12\
7.0.0.1:30003)", 67ul);
osi_WrStrLn(" -u <ip>:<port> send AXUDP -u 127.0.0.1:9001 us\
e udpgate4 or aprsmap as receiver", 86ul);
osi_WrStrLn(" -v verbous", 29ul);
osi_WrStrLn("example: -t 127.0.0.1:30003 -I YOURCALL-11 -u 127.0.\
0.1:9002 -k -v", 67ul);
osi_WrStrLn("before this start \"dump1090 --net\"", 35ul);
osi_WrStrLn("", 1ul);
X2C_ABORT();
}
else Error("-h", 3ul);
}
else Error("-h", 3ul);
}
} /* end Parms() */
static void decodeline(const char line0[], uint32_t line_len,
CSV csv0)
{
uint32_t j;
uint32_t w;
uint32_t i;
memset((char *)csv0,(char)0,2100UL);
i = 0UL;
j = 0UL;
w = 0UL;
while (i<=line_len-1 && (uint8_t)line0[i]>=' ') {
if (line0[i]!=',') {
if (w<=99UL && j<=20UL) {
csv0[w][j] = line0[i];
++j;
}
}
else {
++w;
j = 0UL;
}
++i;
}
} /* end decodeline() */
static char num(uint32_t n)
{
return (char)(n%10UL+48UL);
} /* end num() */
static uint32_t dao91(double x)
/* radix91(xx/1.1) of dddmm.mmxx */
{
double a;
a = fabs(x);
return ((truncc((a-(double)(float)truncc(a))*6.E+5)%100UL)
*20UL+11UL)/22UL;
} /* end dao91() */
static void sendaprs(char dao, uint32_t time0, char mycall0[],
uint32_t mycall_len, char destcall[],
uint32_t destcall_len, char via[], uint32_t via_len,
char sym[], uint32_t sym_len, char obj[],
uint32_t obj_len, double lat, double long0,
double alt, double course, double speed,
char comm[], uint32_t comm_len)
{
char ds[201];
char h[201];
char b[201];
char raw[361];
int32_t rp;
uint32_t n;
uint32_t i;
float a;
X2C_PCOPY((void **)&mycall0,mycall_len);
X2C_PCOPY((void **)&destcall,destcall_len);
X2C_PCOPY((void **)&via,via_len);
X2C_PCOPY((void **)&sym,sym_len);
X2C_PCOPY((void **)&obj,obj_len);
X2C_PCOPY((void **)&comm,comm_len);
b[0] = 0;
aprsstr_Append(b, 201ul, mycall0, mycall_len);
aprsstr_Append(b, 201ul, ">", 2ul);
aprsstr_Append(b, 201ul, destcall, destcall_len);
if (via[0UL]) {
aprsstr_Append(b, 201ul, ",", 2ul);
aprsstr_Append(b, 201ul, via, via_len);
}
aprsstr_Append(b, 201ul, ":;", 3ul);
aprsstr_Assign(h, 201ul, obj, obj_len);
aprsstr_Append(h, 201ul, " ", 10ul);
h[9U] = 0;
aprsstr_Append(b, 201ul, h, 201ul);
aprsstr_Append(b, 201ul, "*", 2ul);
aprsstr_DateToStr(time0, ds, 201ul);
ds[0U] = ds[11U];
ds[1U] = ds[12U];
ds[2U] = ds[14U];
ds[3U] = ds[15U];
ds[4U] = ds[17U];
ds[5U] = ds[18U];
ds[6U] = 0;
aprsstr_Append(b, 201ul, ds, 201ul);
aprsstr_Append(b, 201ul, "h", 2ul);
i = aprsstr_Length(b, 201ul);
a = (float)fabs(lat);
n = truncr(a);
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
n = truncr((a-(float)n)*6000.0f);
b[i] = num(n/1000UL);
++i;
b[i] = num(n/100UL);
++i;
b[i] = '.';
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
if (lat>=0.0) b[i] = 'N';
else b[i] = 'S';
++i;
b[i] = sym[0UL];
++i;
a = (float)fabs(long0);
n = truncr(a);
b[i] = num(n/100UL);
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
n = truncr((a-(float)n)*6000.0f);
b[i] = num(n/1000UL);
++i;
b[i] = num(n/100UL);
++i;
b[i] = '.';
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
if (lat>=0.0) b[i] = 'E';
else b[i] = 'W';
++i;
b[i] = sym[1UL];
++i;
if (speed>0.5) {
n = truncr((float)(course+1.5));
b[i] = num(n/100UL);
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
b[i] = '/';
++i;
n = truncr((float)(speed*5.3995680345572E-1+0.5));
b[i] = num(n/100UL);
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
}
if (alt>0.5) {
b[i] = '/';
++i;
b[i] = 'A';
++i;
b[i] = '=';
++i;
n = truncr((float)fabs(alt*3.2808398950131+0.5));
if (alt>=0.0) b[i] = num(n/100000UL);
else b[i] = '-';
++i;
b[i] = num(n/10000UL);
++i;
b[i] = num(n/1000UL);
++i;
b[i] = num(n/100UL);
++i;
b[i] = num(n/10UL);
++i;
b[i] = num(n);
++i;
}
if (dao) {
b[i] = '!';
++i;
b[i] = 'w';
++i;
b[i] = (char)(33UL+dao91(lat));
++i;
b[i] = (char)(33UL+dao91(long0));
++i;
b[i] = '!';
++i;
}
b[i] = 0;
aprsstr_Append(b, 201ul, comm, comm_len);
if (verb) osi_WrStrLn(b, 201ul);
aprsstr_mon2raw(b, 201ul, raw, 361ul, &rp);
rp = udpsend(udpsock, raw, rp, toport, ipnum);
X2C_PFREE(mycall0);
X2C_PFREE(destcall);
X2C_PFREE(via);
X2C_PFREE(sym);
X2C_PFREE(obj);
X2C_PFREE(comm);
} /* end sendaprs() */
static void aprs(const struct FLY f)
{
char h[31];
aprsstr_Assign(h, 31ul, f.name, 21ul);
h[9U] = 0;
while (aprsstr_Length(h, 31ul)<9UL) aprsstr_Append(h, 31ul, " ", 2ul);
sendaprs(0, f.postime, mycall, 10ul, "APLFR1", 7ul, "", 1ul, "/^", 3ul, h,
31ul, (double)f.lat, (double)f.long0,
(double)f.alt, (double)f.dir,
(double)(f.speed*1.852f), "", 1ul);
} /* end aprs() */
static void store(const CSV csv0)
{
pFLY f0;
pFLY f1;
pFLY f;
uint32_t msg;
uint32_t t;
float oalt;
float olong;
float olat;
t = osic_time();
if ((((csv0[0U][0U]=='M' && csv0[0U][1U]=='S') && csv0[0U][2U]=='G')
&& aprsstr_StrToCard(csv0[1U], 21ul,
&msg)) && ((msg==1UL || msg==3UL) || msg==4UL)) {
f = dbase;
f0 = 0;
while (f && !aprsstr_StrCmp(f->hex, 6ul, csv0[4U], 21ul)) {
f1 = f->next;
if (f->lasttime+120UL<t) {
if (f0==0) dbase = f1;
else f0->next = f1;
if (verb2) {
osi_WrStr("purge ", 7ul);
osi_WrStrLn(f->hex, 6ul);
}
osic_free((char * *) &f, sizeof(struct FLY));
}
else f0 = f;
f = f1;
}
if (f==0) {
osic_alloc((char * *) &f, sizeof(struct FLY));
if (f==0) {
osi_WerrLn("Out of Memory", 14ul);
return;
}
memset((char *)f,(char)0,sizeof(struct FLY));
f->next = dbase;
dbase = f;
aprsstr_Assign(f->hex, 6ul, csv0[4U], 21ul);
if (verb2) {
osi_WrStr("new ", 5ul);
osi_WrStrLn(f->hex, 6ul);
}
}
f->lasttime = t;
if (msg==1UL) {
if (verb2 && f->name[0U]==0) {
osi_WrStr("found name ", 12ul);
osi_WrStr(f->hex, 6ul);
osi_WrStr(" ", 2ul);
osi_WrStrLn(f->name, 21ul);
}
aprsstr_Assign(f->name, 21ul, csv0[10U], 21ul);
}
else if (msg==4UL) {
if (((aprsstr_StrToFix(&f->speed, csv0[12U],
21ul) && aprsstr_StrToFix(&f->dir, csv0[13U],
21ul)) && f->dir>=0.0f) && f->dir<=360.0f) f->speedtime = t;
}
else if (msg==3UL) {
if (((((((aprsstr_StrToFix(&oalt, csv0[11U],
21ul) && aprsstr_StrToFix(&olat, csv0[14U],
21ul)) && olat>(-90.0f)) && olat<90.0f)
&& aprsstr_StrToFix(&olong, csv0[15U],
21ul)) && olong>(-180.0f)) && olong<180.0f)
&& (olong!=f->long0 || olat!=f->lat)) {
f->postime = t;
f->newpos = 1;
f->lat = olat;
f->long0 = olong;
f->alt = oalt*0.3048f;
}
}
if (f->lastbeacon>t) f->lastbeacon = t;
if (((((((f->newpos && f->name[0U]) && f->postime+20UL>=t)
&& f->speedtime+20UL>=t) && f->speed>0.0f) && f->lat!=0.0f)
&& f->long0!=0.0f) && f->lastbeacon+btime<t) {
aprs(*f);
f->newpos = 0;
f->lastbeacon = t;
}
}
} /* end store() */
static char ibuf[201];
static char line[201];
static uint32_t ip;
static uint32_t lp;
static CSV csv;
X2C_STACK_LIMIT(100000l)
extern int main(int argc, char **argv)
{
X2C_BEGIN(&argc,argv,1,4000000l,8000000l);
if (sizeof(CSV)!=2100) X2C_ASSERT(0);
aprsstr_BEGIN();
osi_BEGIN();
Parms();
fd = -1L;
dbase = 0;
fd = connecttob(url, port);
lp = 0UL;
for (;;) {
if (fd>=0L) {
if (readsockb(fd, (char *)ibuf, 201L)<0L) {
/* connect lost */
osic_Close(fd);
fd = -1L;
}
else {
for (ip = 0UL; ip<=200UL; ip++) {
if ((uint8_t)ibuf[ip]<' ') {
if (lp<200UL) line[lp] = 0;
if (verb) osi_WrStrLn(line, 201ul);
decodeline(line, 201ul, csv);
store(csv);
lp = 0UL;
}
else if (lp<200UL) {
line[lp] = ibuf[ip];
++lp;
}
} /* end for */
}
}
else if (reconn) {
osi_WerrLn("connection lost", 16ul);
usleep(1000000UL);
fd = connecttob(url, port);
}
else break;
}
X2C_EXIT();
return 0;
}
X2C_MAIN_DEFINITION

2789
src/afskmodem.c 100644

Plik diff jest za duży Load Diff

414
src/afskmodemptt.c 100644
Wyświetl plik

@ -0,0 +1,414 @@
/*
* afskmodem-ptt.c
* This module handles PTT of several modems on different hw-interfaces
*
* Copyright (C) 2014 Hannes Petermaier <oe5hpm@oe5xbl.#oe5.aut.eu, oe5hpm@oevsv.at>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <termios.h>
#ifndef MACOS
#include <linux/ppdev.h>
#endif
#include <unistd.h>
/*#define _DEBUG*/
#ifdef _DEBUG
# define DBG(...) printf(__VA_ARGS__)
#else
# define DBG(...)
#endif
#ifndef MACOS
struct ttydev_t {
char *name; /* name of tty */
int fd; /* responsible fd of tty */
};
struct pttcmn_t {
struct ttydev_t ttydevs[16]; /* ttyDevs, since we use last
* entry for "end-detection"
* this entry always must beu
* zero
*/
};
struct ptt_t {
struct pttcmn_t *pcmn; /* pointer to common instance */
char devname[1024]; /* name of the device */
int bit; /* bit within device */
unsigned int laststate; /* last written state from modem */
unsigned int origportstate; /* Portstate on open, used to restore
* device-state upon exit
*/
int ttyrelease; /* close tty after every switch-cycle */
int fd; /* handle of ptt-device */
int (*switchfct)(struct ptt_t *pInst, int value);
int (*destroyfct)(struct ptt_t *pInst);
};
struct pttcmn_t *gpcmn = NULL;
static int tty_search_byname(struct pttcmn_t *pInst, char *name)
{
struct ttydev_t *ptty = pInst->ttydevs;
while (ptty->fd != 0) {
if (strcmp(ptty->name, name) == 0) {
return ptty->fd;
}
ptty++;
}
return -1;
}
static int tty_register(struct pttcmn_t *pInst, char *name, int fd)
{
unsigned int i;
struct ttydev_t *ptty = pInst->ttydevs;
for (i=0; i<(sizeof(pInst->ttydevs)/sizeof(pInst->ttydevs[0])-1); i++) {
if (ptty->fd == 0) {
ptty->fd = fd;
ptty->name = name;
break;
}
ptty++;
}
if (i<(sizeof(pInst->ttydevs)/sizeof(pInst->ttydevs[0]))-1)
return 0;
return -1;
}
static int ptt_parport(struct ptt_t *pInst, int value)
{
int switchval = (pInst->bit > 0 ? 0 : 1) ^ value;
int fd;
int rc = -1;
unsigned short port;
fd = open(pInst->devname, O_WRONLY);
if (fd < 0 || ioctl(fd, PPCLAIM) < 0) {
printf("cannot open %s!\n", pInst->devname);
} else {
rc = ioctl(fd, PPRDATA, &port);
if (switchval)
port |= (0x01 << abs(pInst->bit)-1);
else
port &= ~(0x01 << abs(pInst->bit)-1);
rc = ioctl(fd, PPWDATA, &port);
}
if (fd > 0) {
ioctl(fd, PPRELEASE);
close(fd);
}
return rc;
}
static int ptt_gpio(struct ptt_t *pInst, int value)
{
int switchval = (pInst->bit > 0 ? 0 : 1) ^ value;
int fd, rc;
char buf[64];
snprintf(buf, sizeof(buf),
"/sys/class/gpio/gpio%d/value", abs(pInst->bit)-1);
fd = open(buf, O_WRONLY);
if (fd > 0) {
if (switchval)
rc = write(fd, "1", 1);
else
rc = write(fd, "0", 1);
close(fd);
return rc;
} else {
return -1;
}
}
static int ptt_gpioDestroy(struct ptt_t *pInst)
{
int fd;
char buf[64];
/* turn ptt off *
* may not be the ultimative trick, because we afterwards reset the
* device into original state.
* Further kernel takes over control upon we've closed it.
*/
pInst->switchfct(pInst, 0);
/* unexport the used gpio to give them to other users */
fd = open("/sys/class/gpio/unexport", O_WRONLY);
if (fd > 0) {
snprintf(buf, sizeof(buf),
"%d", abs(pInst->bit)-1);
write(fd, buf, strlen(buf));
close(fd);
return 0;
}
return -1;
}
static int ptt_tty(struct ptt_t *pInst, int value)
{
int switchval = (pInst->bit > 0 ? 0 : 1) ^ value;
int rc, flags, first = 0;
int fd;
if (pInst->fd <= 0) {
fd = tty_search_byname(pInst->pcmn, pInst->devname);
if (fd > 0) {
pInst->fd = fd;
DBG("%s: reuse allready open fd (%d) on %s\n",
__func__, pInst->fd, pInst->devname);
} else {
DBG("%s: try to open %s ...\n",
__func__, pInst->devname);
fd = open(pInst->devname, O_RDONLY);
if (fd > 0) {
if (tty_register(pInst->pcmn,
pInst->devname,
fd) == 0
) {
pInst->fd = fd;
first = 1;
} else {
close(fd);
}
}
}
}
if (pInst->fd > 0) {
if (first) {
flags = TIOCM_RTS | TIOCM_DTR;
switchval = 0;
}
else {
flags = abs(pInst->bit)-1 == 0 ? TIOCM_RTS : TIOCM_DTR;
}
if (switchval)
rc = ioctl(pInst->fd, TIOCMBIS, &flags);
else
rc = ioctl(pInst->fd, TIOCMBIC, &flags);
if (pInst->ttyrelease || rc != 0) {
pInst->destroyfct(pInst);
pInst->fd = -1;
}
return rc;
} else {
return -1;
}
}
static int ptt_ttyDestroy(struct ptt_t *pInst)
{
struct ttydev_t *ptty = pInst->pcmn->ttydevs;
int flags = TIOCM_RTS | TIOCM_DTR;
while (ptty->fd > 0) {
ioctl(ptty->fd, TIOCMBIC, &flags);
close(ptty->fd);
ptty++;
}
return 0;
}
void *pttinit(char *devname, int bit)
{
struct ptt_t *pInst;
int fd;
char buf[64];
unsigned int tmp;
int busycnt;
if (gpcmn == NULL) {
gpcmn = (struct pttcmn_t *)malloc(sizeof(struct pttcmn_t));
if (gpcmn != NULL)
memset(gpcmn, 0, sizeof(struct pttcmn_t));
else {
printf("%s: cannot allocate memory for common instance",
__func__);
return 0;
}
}
if ( (pInst = (struct ptt_t *)malloc(sizeof(struct ptt_t))) != 0) {
memset(pInst, 0, sizeof(struct ptt_t));
pInst->bit = bit;
pInst->pcmn = gpcmn;
strncpy(pInst->devname, devname, sizeof(pInst->devname));
if (strstr(devname, "tty") != 0) {
if (pInst->bit > 2 || pInst->bit < -2) {
printf("fail: %s has only to switchable bits!\n",
pInst->devname);
goto errorExit;
}
pInst->fd = -1;
pInst->switchfct = &ptt_tty;
pInst->destroyfct = &ptt_ttyDestroy;
} else if (strcmp(devname, "gpio") == 0) {
fd = open("/sys/class/gpio/export", O_WRONLY);
if (fd > 0) {
snprintf(buf, sizeof(buf),
"%d", abs(pInst->bit)-1);
write(fd, buf, strlen(buf));
close(fd);
} else {
goto errorExit;
}
snprintf(buf, sizeof(buf),
"/sys/class/gpio/gpio%d/direction",
abs(pInst->bit)-1);
fd = open(buf, O_WRONLY);
if (fd > 0) {
write(fd, "out", 3);
close(fd);
} else {
goto errorExit;
}
pInst->switchfct = &ptt_gpio;
pInst->destroyfct = &ptt_gpioDestroy;
} else if (strstr(devname, "parport") != 0) {
if (pInst->bit > 8 || pInst->bit < -8) {
printf("fail: parport has only 8 bits!\n");
goto errorExit;
}
pInst->switchfct = &ptt_parport;
} else {
goto errorExit;
}
return pInst;
}
return 0;
errorExit:
printf("PTT setup on device %s failed.\n", pInst->devname);
if (fd > 0)
close(fd);
free(pInst);
return 0;
}
void pttDestroy(void *arg)
{
struct ptt_t *pInst = (struct ptt_t *)arg;
if (!pInst)
return;
if(pInst->destroyfct) {
pInst->destroyfct(pInst);
}
free(pInst);
}
int ptt(void *arg, unsigned int val)
{
struct ptt_t *pInst = (struct ptt_t *)arg;
if (!pInst)
return -1;
if(pInst->switchfct) {
if (val != -1) {
pInst->laststate = val;
DBG("ptt (0x%08x) switch to %d\n",
(unsigned int)pInst, val);
return pInst->switchfct(pInst, val);
} else {
DBG("ptt (0x%08x) switch to %d (cyclic)\n",
(unsigned int)pInst, pInst->laststate);
return pInst->switchfct(pInst, pInst->laststate);
}
}
return -1;
}
void pttSetclaim(void *arg, int val)
{
struct ptt_t *pInst = (struct ptt_t *)arg;
if (!pInst)
return;
pInst->ttyrelease = val;
}
void pttHelp(char *str, unsigned int maxsize)
{
char *helptext = \
" -p <devname> <pttbit> pttport and bit to switch\n" \
" * /dev/ttyXX for serial\n" \
" * /dev/parport0 for parallel\n" \
" * gpio for kernel gpio-interface\n" \
" choose value for <pttbit>:\n" \
" * tty: 0=RTS, 1=DTR\n" \
" * parport: 0...7 / -0...-7 (inverted)\n" \
" -u close ptt-tty file between switch actions, " \
"may not work on USB tty";
strncpy(str, helptext, maxsize);
}
#else /* MACOS */
static int ptt_ttyDestroy(struct ptt_t *pInst)
{
return 0;
}
void *pttinit(char *devname, int bit)
{
return NULL;
}
void pttDestroy(void *arg)
{
return;
}
int ptt(void *arg, unsigned int val)
{
return 0;
}
void pttSetclaim(void *arg, int val)
{
return;
}
void pttHelp(char *str, unsigned int maxsize) {
char *helptext = "PTT not supported yet on MacOS";
strncpy(str, helptext, maxsize);
}
#endif

16
src/afskmodemptt.h 100644
Wyświetl plik

@ -0,0 +1,16 @@
#ifndef afskmodemptt_H_
#define afskmodemptt_H_
#include "X2C.h"
extern X2C_ADDRESS pttinit(X2C_ADDRESS, long);
extern void pttDestroy(X2C_ADDRESS);
extern void pttSetclaim(X2C_ADDRESS, long);
extern void pttHelp(X2C_ADDRESS, unsigned long);
extern void ptt(X2C_ADDRESS, long);
#endif /* afskmodemptt_H_ */

6925
src/aprsdecode.c 100644

Plik diff jest za duży Load Diff

728
src/aprsdecode.h 100644
Wyświetl plik

@ -0,0 +1,728 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef aprsdecode_H_
#define aprsdecode_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#ifndef aprspos_H_
#include "aprspos.h"
#endif
#ifndef xosi_H_
#include "xosi.h"
#endif
/* connect to aprs-is gateway and decode data for archive and map by OE5DXL */
typedef uint32_t aprsdecode_SET256[8];
#define aprsdecode_CR "\015"
#define aprsdecode_LF "\012"
#define aprsdecode_DEGSYM "\177"
#define aprsdecode_DELETSYM "\001"
#define aprsdecode_WXNIL 1.E+6
#define aprsdecode_MSGSIZE 67
#define aprsdecode_ACKSIZE 5
#define aprsdecode_REPLYACK "}"
#define aprsdecode_UDPSOCKS 4
#define aprsdecode_DESTCALL "APLM01"
#define aprsdecode_SHOWTEMPWIND 3600
/* till seconds after last wx info show temp or windvane */
#define aprsdecode_MAXTEMP 99
/* ignore out of range temps */
#define aprsdecode_MINTEMP (-99)
/* ignore out of range temps */
#define aprsdecode_IGATEMAXDELAY 5
/* seconds to discard igate frames if mainloop is too slow */
#define aprsdecode_BEGINOFTIME 1388534400
/* oldest possible log date */
#define aprsdecode_MAXMULTILINES 40
/* AE5PL limits to 23 multiline elements */
extern aprsdecode_SET256 aprsdecode_SYMTABLE;
#define aprsdecode_VERS "aprsmap(cu) 0.66"
typedef char aprsdecode_MONCALL[9];
typedef char aprsdecode_FRAMEBUF[512];
typedef char aprsdecode_WWWB[1401];
typedef char aprsdecode_FILENAME[1024];
struct aprsdecode_POSCALL;
struct aprsdecode_POSCALL {
aprsdecode_MONCALL call;
char typ;
struct aprspos_POSITION pos;
};
struct aprsdecode_WWWBUF;
typedef struct aprsdecode_WWWBUF * aprsdecode_pWWWBUF;
struct aprsdecode_WWWBUF {
aprsdecode_WWWB buf;
int32_t tlen;
char push;
aprsdecode_pWWWBUF next;
};
struct aprsdecode_QWatch;
struct aprsdecode_QWatch {
uint32_t lasttb;
int32_t qsize;
int32_t lastqb;
int32_t txbyte[60];
};
struct aprsdecode_TCPSOCK;
typedef struct aprsdecode_TCPSOCK * aprsdecode_pTCPSOCK;
struct aprsdecode_TCPSOCK {
aprsdecode_pTCPSOCK next;
int32_t fd;
uint32_t watchtime;
uint32_t beacont;
uint32_t connt;
uint32_t gatepri;
char ipnum[64];
char port[6];
struct aprsdecode_POSCALL user;
uint32_t txframes;
uint32_t txbytes;
uint32_t rxframes;
uint32_t rxbytes;
int32_t rpos;
int32_t tlen;
aprsdecode_FRAMEBUF rbuf;
aprsdecode_FRAMEBUF tbuf;
struct aprsdecode_QWatch qwatch;
uint8_t waitpong;
uint32_t lastpong;
uint32_t lastping;
uint32_t windoofwatch;
};
typedef uint32_t aprsdecode_DUPETIMES[65536];
struct aprsdecode_UDPSOCK;
struct aprsdecode_UDPSOCK {
int32_t fd;
char rawread;
char checkip;
uint32_t ip;
uint32_t bindport;
uint32_t dport;
int32_t chan; /* channel number 1.. */
uint32_t lastudprx;
uint32_t lastudptx;
uint32_t starttime;
uint32_t bpstime;
uint32_t rxframes;
uint32_t rxbytes;
uint32_t txframes;
uint32_t txbytes; /* for tx bit/s limiter */
uint32_t uip;
uint32_t * pdupetimes;
};
typedef char aprsdecode_MSGTEXT[67];
typedef char aprsdecode_ACKTEXT[5];
typedef char aprsdecode_ACKREPTEXT[2];
enum aprsdecode_ERRFLAGS {aprsdecode_eDIST, aprsdecode_eSPIKE,
aprsdecode_eSYMB, aprsdecode_eDUPE, aprsdecode_eSPEED,
aprsdecode_eNODRAW, aprsdecode_eNOPOS};
typedef uint8_t aprsdecode_ERRSET;
enum aprsdecode_DRAWHINTS {aprsdecode_MIRRORSYM, aprsdecode_ISOBJECT,
aprsdecode_HIDE, aprsdecode_MARKED, aprsdecode_MOVES};
typedef uint8_t aprsdecode_sDRAWHINTS;
struct aprsdecode_SYMBOL;
struct aprsdecode_SYMBOL {
char tab;
char pic;
};
struct aprsdecode_AREASYMB;
struct aprsdecode_AREASYMB {
char typ;
uint8_t color;
struct aprspos_POSITION dpos;
};
struct aprsdecode_FRAMEHIST;
typedef struct aprsdecode_FRAMEHIST * aprsdecode_pFRAMEHIST;
struct aprsdecode_VARDAT;
typedef struct aprsdecode_VARDAT * aprsdecode_pVARDAT;
struct aprsdecode_FRAMEHIST {
aprsdecode_pFRAMEHIST next;
uint32_t time0;
aprsdecode_pVARDAT vardat;
uint8_t nodraw;
};
struct aprsdecode_VARDAT {
aprsdecode_pFRAMEHIST lastref;
struct aprspos_POSITION pos;
uint32_t refcnt; /* starts at 0 */
/* altitude :INT16;*/
uint8_t igatepos;
uint8_t igatelen;
char raw[500]; /* last part allocatet with real size */
};
struct aprsdecode_OPHIST;
typedef struct aprsdecode_OPHIST * aprsdecode_pOPHIST;
struct aprsdecode_OPHIST {
aprsdecode_pOPHIST next;
aprsdecode_pFRAMEHIST frames;
struct aprspos_POSITION margin0; /* movement frame for quick draw */
struct aprspos_POSITION margin1;
struct aprspos_POSITION lastpos;
uint32_t lasttime;
uint32_t temptime;
short lastkmh; /* drive kmh, wx kmh */
short lasttempalt; /* drive altitude, wx temp */
float framerate; /* thruput frames/s */
aprsdecode_MONCALL call;
struct aprsdecode_SYMBOL sym;
uint8_t drawhints;
signed char trackcol;
signed char textpos;
signed char valuepos;
uint8_t lastinftyp; /*0 no inf, 10..99 drive dir, 100 wx no dir 110..199 wind dir*/
char lastrxport; /* for msg routing, in future remove if port is seen in rawframes */
struct aprsdecode_AREASYMB areasymb; /* area object data */
char poligon;
};
enum aprsdecode_STORM {aprsdecode_WXNOWX, aprsdecode_WXNORMAL,
aprsdecode_WXTS, aprsdecode_WXHC, aprsdecode_WXTD};
struct aprsdecode_WX;
struct aprsdecode_WX {
float gust;
float temp;
float hygro;
float baro;
float rain1;
float rain24;
float raintoday;
float lum;
float sievert;
uint8_t storm;
float sustaind;
float radiushurr;
float radiusstorm;
float wholegale;
};
enum aprsdecode_TYPES {aprsdecode_UNKNOWN, aprsdecode_MICE, aprsdecode_POS,
aprsdecode_WETH, aprsdecode_PWETH, aprsdecode_MSG,
aprsdecode_OBJ, aprsdecode_ITEM, aprsdecode_SCAP,
aprsdecode_STAT, aprsdecode_TELE, aprsdecode_QUERY};
typedef uint16_t aprsdecode_TYPSET;
enum aprsdecode_ACKREJ {aprsdecode_MSGMSG, aprsdecode_MSGACK,
aprsdecode_MSGREJ};
struct aprsdecode_HRTPOS;
struct aprsdecode_HRTPOS {
float dlong;
float dlat;
float dalt;
uint32_t dtime;
char notinterpolated;
};
struct aprsdecode_MULTILINE;
struct aprsdecode_MULTILINE {
uint32_t size;
char linetyp;
char filltyp;
struct aprspos_POSITION vec[41];
};
typedef uint16_t aprsdecode_TELEMETRY[7];
struct aprsdecode_DAT;
struct aprsdecode_DAT {
aprsdecode_MONCALL srcall;
aprsdecode_MONCALL symcall;
aprsdecode_MONCALL dstcall;
aprsdecode_MONCALL viacalls[10];
aprsdecode_MONCALL msgto;
aprsdecode_MONCALL objectfrom;
uint32_t hbitp;
uint32_t igaterawp;
uint32_t igatelen;
uint32_t igatep;
uint32_t payload;
char postyp;
char typc;
struct aprsdecode_AREASYMB areasymb;
struct aprspos_POSITION pos;
uint32_t speed;
uint32_t course;
int32_t altitude;
char sym;
char symt;
char timestamp;
char objkill;
char lastrxport;
struct aprsdecode_WX wx;
uint8_t type;
float moved;
/*
stack : CARDINAL;
*/
aprsdecode_MSGTEXT msgtext;
aprsdecode_ACKTEXT acktext;
uint8_t ackrej;
struct aprsdecode_HRTPOS hrtposes[32];
uint32_t hrtlen;
uint32_t hrttime; /* if non zero is hrt defined */
struct aprsdecode_MULTILINE multiline;
aprsdecode_TELEMETRY tlmvalues;
/* 5 analog and if all 5 valid the sixth is bitset, 0 undef,
incremented by 1 */
char comment0[256];
};
enum aprsdecode_WXSET {aprsdecode_wTEMP, aprsdecode_wBARO, aprsdecode_wHYG,
aprsdecode_wWIND, aprsdecode_wWINDDIR, aprsdecode_wRAIN,
aprsdecode_wLUMI, aprsdecode_wSHIST, aprsdecode_wBHIST,
aprsdecode_wAHIST, aprsdecode_wSIEV};
typedef uint16_t aprsdecode_sWXSET;
enum aprsdecode_CLICKTYPS {aprsdecode_tTEXT, aprsdecode_tTRACK,
aprsdecode_tSYMBOL, aprsdecode_tMAP, aprsdecode_tOBJECT,
aprsdecode_tOBJECTTEXT, aprsdecode_tRFPATH,
aprsdecode_tKMHOBJ, aprsdecode_tKMH,
aprsdecode_tDEGREE, aprsdecode_tDEGREEOBJ, aprsdecode_tMETEOCOLOR};
struct aprsdecode_TXMESSAGE;
typedef struct aprsdecode_TXMESSAGE * aprsdecode_pTXMESSAGE;
struct aprsdecode_TXMESSAGE {
aprsdecode_pTXMESSAGE next;
uint32_t txtime;
uint32_t acktime;
uint32_t txcnt;
char port;
aprsdecode_MONCALL to;
aprsdecode_MSGTEXT msgtext;
uint32_t acknum;
char heard;
char rej;
};
struct aprsdecode_MSGFIFO;
typedef struct aprsdecode_MSGFIFO * aprsdecode_pMSGFIFO;
struct aprsdecode_MSGFIFO {
aprsdecode_pMSGFIFO next;
uint32_t time0;
char port;
aprsdecode_MONCALL itemname;
aprsdecode_MONCALL from;
aprsdecode_MONCALL to;
aprsdecode_MSGTEXT txt;
aprsdecode_ACKTEXT ack;
char query;
char deleteitem;
struct aprspos_POSITION itempos;
};
struct aprsdecode_ZOOMFRAME;
struct aprsdecode_ZOOMFRAME {
int32_t x0;
int32_t y00;
int32_t x1;
int32_t y1;
};
struct aprsdecode_COLTYP;
struct aprsdecode_COLTYP {
uint32_t r;
uint32_t g;
uint32_t b;
};
struct aprsdecode_MOUNTAIN;
typedef struct aprsdecode_MOUNTAIN * aprsdecode_pMOUNTAIN;
struct aprsdecode_MOUNTAIN {
aprsdecode_pMOUNTAIN next;
struct aprspos_POSITION pos;
short alt;
char name[32];
};
struct aprsdecode_CLICKOBJECT;
struct aprsdecode_CLICKOBJECT {
aprsdecode_pOPHIST opf;
aprsdecode_pFRAMEHIST pff;
aprsdecode_pFRAMEHIST pff0;
uint8_t typf;
};
typedef char aprsdecode_MAPNAME[41];
typedef uint32_t aprsdecode_SYMBOLSET[6];
extern uint32_t aprsdecode_systime;
extern uint32_t aprsdecode_realtime;
extern uint32_t aprsdecode_lastlooped;
extern uint32_t aprsdecode_rxidle;
extern char aprsdecode_quit;
extern char aprsdecode_verb;
struct aprsdecode__D0;
struct aprsdecode__D0 {
char dryrun;
char withradio;
char chkmaps;
char panorama;
char altimap;
char watchmhop;
char lastpoi;
char insreplaceline;
char watchlast;
int32_t x;
int32_t y;
int32_t min0;
aprsdecode_MONCALL mhop;
struct aprsdecode_SYMBOL onesymbol;
aprsdecode_SYMBOLSET onesymbolset;
aprsdecode_pOPHIST ops;
aprsdecode_pFRAMEHIST pf;
aprsdecode_pFRAMEHIST pf0;
int32_t zoomtox;
int32_t zoomtoy;
uint8_t typ;
char cmd;
char cmdatt;
struct aprspos_POSITION pullpos;
struct aprspos_POSITION clickpos;
struct aprspos_POSITION squerpos0;
struct aprspos_POSITION squerpos1;
struct aprspos_POSITION measurepos;
struct aprspos_POSITION markpos;
uint32_t markpost; /* waypoint time to markpos to make uniqe */
uint32_t marktime; /* delete marker if no set by set marker */
int32_t markalti; /* for geoprofile */
struct aprspos_POSITION sumpos; /* store last clickpos for waysum */
float waysum; /* sum up marker set distances */
uint16_t graphset; /* update graphs if marked last waypoint */
uint32_t selected;
uint32_t entries;
struct aprspos_POSITION bubblpos; /* found position of POI */
char bubblstr[50]; /* found text of POI */
struct aprsdecode_CLICKOBJECT table[10];
uint32_t polilinecursor; /* edit which edge of polinine object */
};
extern struct aprsdecode__D0 aprsdecode_click;
extern struct aprspos_POSITION aprsdecode_mappos;
extern int32_t aprsdecode_inittilex;
extern int32_t aprsdecode_inittiley;
extern int32_t aprsdecode_initxsize;
extern int32_t aprsdecode_initysize;
extern int32_t aprsdecode_parmzoom;
extern int32_t aprsdecode_initzoom;
extern float aprsdecode_finezoom;
extern float aprsdecode_parmfinezoom;
extern char aprsdecode_mapdir[1025];
extern aprsdecode_pMOUNTAIN aprsdecode_mountains;
struct aprsdecode__D1;
struct aprsdecode__D1 {
char moving;
char moded;
char errorstep;
char logmode;
char headmenuy;
aprsdecode_MAPNAME mapname;
char configfn[257];
int32_t maplumcorr;
int32_t map;
int32_t rf;
int32_t rfbri;
int32_t track;
int32_t waypoint;
int32_t sym;
int32_t obj;
int32_t text;
int32_t nomov;
int32_t centering;
int32_t fps;
int32_t actfps;
uint32_t fontysize;
char wxcol;
uint32_t movestep;
uint32_t dupemaxtime;
uint32_t kmhtime;
uint32_t purgetime;
uint32_t purgetimeobj;
uint32_t firstdim;
uint32_t maxdim;
float gamma;
char menutransp;
struct aprsdecode_COLTYP menubackcol;
struct aprsdecode_COLTYP menucol;
};
extern struct aprsdecode__D1 aprsdecode_lums;
struct aprsdecode__D2;
struct aprsdecode__D2 {
struct aprspos_POSITION winpos0;
struct aprspos_POSITION winpos1;
aprsdecode_MONCALL call;
uint32_t winevent;
char follow;
char beep;
};
extern struct aprsdecode__D2 aprsdecode_tracenew;
extern aprsdecode_pTXMESSAGE aprsdecode_txmessages;
extern aprsdecode_pMSGFIFO aprsdecode_msgfifo0;
extern float aprsdecode_spikesens;
extern float aprsdecode_maxhop;
extern aprsdecode_pOPHIST aprsdecode_ophist2;
extern aprsdecode_pOPHIST aprsdecode_ophist0;
struct aprsdecode__D3;
struct aprsdecode__D3 {
char url[256];
char port[6];
char filterst[256];
};
/*
servercall : MONCALL;
*/
extern struct aprsdecode__D3 aprsdecode_gateways[10];
extern aprsdecode_pTCPSOCK aprsdecode_tcpsocks;
extern struct aprsdecode_UDPSOCK aprsdecode_udpsocks0[4];
extern uint32_t aprsdecode_lasttcptx;
extern uint32_t aprsdecode_lastanyudprx;
extern uint32_t aprsdecode_lastpurge;
extern uint32_t aprsdecode_lasttcprx;
extern aprsdecode_FRAMEBUF aprsdecode_testbeaconbuf;
/* fill with port:time:beacon then sent once */
extern struct xosi_PROCESSHANDLE aprsdecode_serialpid;
extern struct xosi_PROCESSHANDLE aprsdecode_serialpid2;
extern struct xosi_PROCESSHANDLE aprsdecode_maploadpid;
extern int32_t aprsdecode_Decode(char [], uint32_t,
struct aprsdecode_DAT *);
extern int32_t aprsdecode_Stoframe(aprsdecode_pOPHIST *, char [],
uint32_t, uint32_t, char, uint32_t *,
struct aprsdecode_DAT);
extern void aprsdecode_Checktrack(aprsdecode_pOPHIST, aprsdecode_pFRAMEHIST);
extern void aprsdecode_purge(aprsdecode_pOPHIST *, uint32_t, uint32_t);
extern int32_t aprsdecode_knottokmh(int32_t);
extern void aprsdecode_posinval(struct aprspos_POSITION *);
extern uint32_t aprsdecode_trunc(float);
extern float aprsdecode_floor(float);
extern int32_t aprsdecode_tcpout(aprsdecode_pTCPSOCK);
extern void aprsdecode_tcpin(aprsdecode_pTCPSOCK);
extern void aprsdecode_udpin(uint32_t);
extern void aprsdecode_tcpclose(aprsdecode_pTCPSOCK, char);
extern void aprsdecode_tcpjobs(void);
extern void aprsdecode_initparms(void);
extern void aprsdecode_delwaypoint(aprsdecode_pOPHIST,
aprsdecode_pFRAMEHIST *);
extern uint32_t aprsdecode_finddup(aprsdecode_pFRAMEHIST,
aprsdecode_pFRAMEHIST);
extern void aprsdecode_savetrack(void);
extern void aprsdecode_makemsg(char);
extern void aprsdecode_deltxmsg(uint32_t, uint32_t);
extern void aprsdecode_acknumstr(char [], uint32_t, uint32_t);
extern void aprsdecode_getactack(aprsdecode_MONCALL, char [],
uint32_t);
extern void aprsdecode_objsender(aprsdecode_pOPHIST, char [],
uint32_t);
extern aprsdecode_pOPHIST aprsdecode_selop(void);
extern void aprsdecode_tcpconnstat(char [], uint32_t);
extern void aprsdecode_udpconnstat(uint32_t, char [], uint32_t);
extern void aprsdecode_beeplim(int32_t, uint32_t, uint32_t);
extern void aprsdecode_importbeacon(void);
extern void aprsdecode_extractbeacon(char [], uint32_t, char,
char);
extern void aprsdecode_getbeaconname(char [], uint32_t, char [],
uint32_t, char [], uint32_t, char *,
char *, char *);
extern void aprsdecode_drawbeacon(char [], uint32_t);
extern void aprsdecode_makelogfn(char [], uint32_t);
/*
PROCEDURE checksymb(symt, symb:CHAR):BOOLEAN;
(* true for bad symbol *)
*/
extern void aprsdecode_appendmultiline(struct aprspos_POSITION);
extern void aprsdecode_GetMultiline(char [], uint32_t, uint32_t *,
struct aprsdecode_MULTILINE *);
extern char aprsdecode_ismultiline(char);
extern void aprsdecode_modmultiline(uint32_t);
extern void aprsdecode_BEGIN(void);
#endif /* aprsdecode_H_ */

5360
src/aprsmap.c 100644

Plik diff jest za duży Load Diff

778
src/aprspos.c 100644
Wyświetl plik

@ -0,0 +1,778 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#define X2C_int32
#define X2C_index32
#ifndef aprspos_H_
#include "aprspos.h"
#endif
#define aprspos_C_
#ifndef osi_H_
#include "osi.h"
#endif
#include <osic.h>
/* get aprs position by OE5DXL */
/*CONST arccos=acos; */
/* arctan=atan; */
/* power=pow; */
extern float aprspos_rad0(float w)
{
return w*1.7453292519444E-2f;
} /* end rad() */
extern char aprspos_posvalid(struct aprspos_POSITION pos)
{
return pos.lat!=0.0f || pos.long0!=0.0f;
} /* end posvalid() */
extern float aprspos_distance(struct aprspos_POSITION home,
struct aprspos_POSITION dist)
{
float y;
float x;
x = (float)fabs(dist.long0-home.long0);
y = (float)fabs(dist.lat-home.lat);
if (x==0.0f && y==0.0f) return 0.0f;
else if (x+y<0.04f) {
/* near */
x = x*osic_cos((home.lat+dist.lat)*0.5f);
return 6370.0f*osic_sqrt(x*x+y*y);
}
else {
/* far */
if (x>6.283185307f) x = 6.283185307f-x;
x = osic_sin(dist.lat)*osic_sin(home.lat)+osic_cos(dist.lat)
*osic_cos(home.lat)*osic_cos(x);
if ((float)fabs(x)>=1.0f) return 0.0f;
return 6370.0f*osic_arccos(x);
}
return 0;
} /* end distance() */
extern float aprspos_azimuth(struct aprspos_POSITION home,
struct aprspos_POSITION dist)
{
float ldiff;
float h;
ldiff = dist.long0-home.long0;
if ((ldiff==0.0f || osic_cos(home.lat)==0.0f) || osic_cos(dist.lat)==0.0f)
{
if (home.lat<=dist.lat) return 0.0f;
else return 180.0f;
}
else {
h = 5.729577951472E+1f*osic_arctan(osic_cos(home.lat)
*(X2C_DIVR(osic_tan(home.lat)*osic_cos(ldiff)
-osic_tan(dist.lat),osic_sin(ldiff))));
if (ldiff<0.0f) return h+270.0f;
else return h+90.0f;
}
return 0;
} /* end azimuth() */
static char dig(float * s, char c, float mul)
{
if (c==' ') return 1;
/* ambiguity */
if ((uint8_t)c<'0' || (uint8_t)c>'9') return 0;
*s = *s+(float)((uint32_t)(uint8_t)c-48UL)*mul;
return 1;
} /* end dig() */
static char r91(float * s, char c, float mul)
{
if ((uint8_t)c<'!' || (uint8_t)c>'|') return 0;
*s = *s+(float)((uint32_t)(uint8_t)c-33UL)*mul;
return 1;
} /* end r91() */
static char mic(float * s, char c, float mul)
{
uint32_t n;
if ((uint8_t)c>='0' && (uint8_t)c<='9') {
n = (uint32_t)(uint8_t)c-48UL;
}
else if ((uint8_t)c>='A' && (uint8_t)c<='J') {
n = (uint32_t)(uint8_t)c-65UL;
}
else if ((c=='K' || c=='L') || c=='Z') n = 0UL;
else if ((uint8_t)c>='P' && (uint8_t)c<='Y') {
n = (uint32_t)(uint8_t)c-80UL;
}
else return 0;
*s = *s+(float)n*mul;
return 1;
} /* end mic() */
static char bit5(char c)
{
return ((uint32_t)(uint8_t)c/32UL&1) || c=='L';
} /* end bit5() */
/* L is wildcard */
static void komma(char buf[], uint32_t buf_len, uint32_t * p)
{
for (;;) {
if (*p+20UL>=buf_len-1 || (uint8_t)buf[*p]<' ') return;
if (buf[*p]==',') break;
++*p;
}
++*p;
} /* end komma() */
static char ns(char c)
{
c = X2C_CAP(c);
return c=='N' || c=='S';
} /* end ns() */
static char ew(char c)
{
c = X2C_CAP(c);
return c=='E' || c=='W';
} /* end ew() */
static char dig3(char buf[], uint32_t buf_len, uint32_t * s,
uint32_t * p)
{
uint32_t i;
char c;
*s = 0UL;
if ((buf[*p]==' ' && buf[*p+1UL]==' ')
&& buf[*p+2UL]==' ' || (buf[*p]=='.' && buf[*p+1UL]=='.')
&& buf[*p+2UL]=='.') {
*p += 3UL;
return 1;
}
for (i = 0UL; i<=2UL; i++) {
c = buf[*p];
++*p;
if ((uint8_t)c<'0' || (uint8_t)c>'9') return 0;
*s = ( *s*10UL+(uint32_t)(uint8_t)c)-48UL;
} /* end for */
return 1;
} /* end dig3() */
static char dig6(const char b[], uint32_t b_len, float * s,
uint32_t p)
{
uint32_t i;
char c;
char sig;
*s = 0.0f;
if (b[p]=='-') {
sig = 1;
i = 1UL;
}
else {
sig = 0;
i = 0UL;
}
do {
c = b[p+i];
if ((uint8_t)c<'0' || (uint8_t)c>'9') return 0;
*s = *s*10.0f+(float)((uint32_t)(uint8_t)c-48UL);
++i;
} while (i<6UL);
if (sig) *s = -*s;
return 1;
} /* end dig6() */
static char Mapsym(char c)
{
if ((uint8_t)c>='a' && (uint8_t)c<='j') {
c = (char)((uint32_t)(uint8_t)c-49UL);
}
return c;
} /* end Mapsym() */
typedef uint32_t CHSET[4];
#define aprspos_DAO10 2.9088820865741E-7
/* additional digit in lat/log */
#define aprspos_DAO91 3.1997702952315E-8
/* additional 0..90 * 1.1 digits */
#define aprspos_RND 1.454441043287E-6
static CHSET _cnst1 = {0x00000000UL,0x00000080UL,0x00000000UL,0x00000001UL};
static CHSET _cnst0 = {0x00000000UL,0x40000000UL,0x20000000UL,0x00000000UL};
static CHSET _cnst = {0x20000000UL,0x40000080UL,0x20100000UL,0x00000001UL};
extern void aprspos_GetPos(struct aprspos_POSITION * pos, uint32_t * speed,
uint32_t * course, int32_t * altitude, char * symb,
char * symbt, char buf[], uint32_t buf_len,
uint32_t micedest, uint32_t payload, char coment[],
uint32_t coment_len, char * postyp)
{
uint32_t compos;
uint32_t clen;
uint32_t na;
uint32_t nc;
uint32_t n;
uint32_t len;
uint32_t i;
char manucode;
char gpst;
char c;
char nornd;
char ok0;
float scl;
float sc;
len = payload;
nornd = 0;
while (len<buf_len-1 && (uint8_t)buf[len]>'\015') ++len;
coment[0UL] = 0;
manucode = 0;
compos = payload;
c = buf[payload];
if ((payload+8UL<len && micedest>0UL) && (((c=='\034' || c=='\035')
|| c=='\'') || c=='`')) {
/* mic-e */
pos->lat = 0.0f;
i = micedest;
ok0 = 1;
if (!mic(&pos->lat, buf[i], 1.7453292519444E-1f)) ok0 = 0;
++i;
if (!mic(&pos->lat, buf[i], 1.7453292519444E-2f)) ok0 = 0;
++i;
if (!mic(&pos->lat, buf[i], 2.9088820865741E-3f)) ok0 = 0;
++i;
if (!mic(&pos->lat, buf[i], 2.9088820865741E-4f)) ok0 = 0;
++i;
if (!mic(&pos->lat, buf[i], 2.9088820865741E-5f)) ok0 = 0;
++i;
if (!mic(&pos->lat, buf[i], 2.9088820865741E-6f)) ok0 = 0;
/* IF ok & (pos.lat<>0.0) THEN pos.lat:=pos.lat+0.005/60.0*RAD END;
(* rounding *) */
if (bit5(buf[micedest+3UL])) pos->lat = -pos->lat;
n = (uint32_t)(uint8_t)buf[payload+1UL]; /* long degrees */
if (n>=28UL && n<=127UL) {
n -= 28UL;
if (!bit5(buf[micedest+4UL])) n += 100UL;
if (n>=180UL && n<=189UL) n -= 80UL;
else if (n>=190UL && n<=199UL) n -= 190UL;
}
else ok0 = 0;
pos->long0 = (float)n*1.7453292519444E-2f;
n = (uint32_t)(uint8_t)buf[payload+2UL]; /* long min */
if (n>=28UL && n<=127UL) {
n -= 28UL;
if (n>=60UL) n -= 60UL;
}
else ok0 = 0;
pos->long0 = pos->long0+(float)n*2.9088820865741E-4f;
n = (uint32_t)(uint8_t)buf[payload+3UL]; /* long min/100 */
if (n>=28UL && n<=127UL) {
pos->long0 = pos->long0+(float)(n-28UL)*2.9088820865741E-6f;
}
else ok0 = 0;
/* IF ok & (pos.long<>0.0)
THEN pos.long:=pos.long+0.005/60.0*RAD END;
(* rounding *) */
if (!bit5(buf[micedest+5UL])) pos->long0 = -pos->long0;
*speed = 0UL;
*course = 0UL;
if (ok0) {
n = (uint32_t)(uint8_t)buf[payload+4UL];
if (n>=28UL && n<=127UL) *speed = (n-28UL)*10UL;
else ok0 = 0;
n = (uint32_t)(uint8_t)buf[payload+5UL];
if (n>=28UL && n<=127UL) {
n -= 28UL;
*speed += n/10UL;
*course = (n%10UL)*100UL;
}
else ok0 = 0;
n = (uint32_t)(uint8_t)buf[payload+6UL];
if (n>=28UL && n<=127UL) {
n -= 28UL;
*course += n;
if (*speed>=800UL) *speed -= 800UL;
if (*course>=400UL) *course -= 400UL;
if (*course>=360UL) ok0 = 0;
}
else {
/* INC(course);
(* compatible to 1..360 system *) */
ok0 = 0;
}
*symb = buf[payload+7UL];
*symbt = buf[payload+8UL];
}
compos = payload+9UL;
i = payload+9UL;
manucode = buf[i];
if (!X2C_INL((int32_t)(uint8_t)manucode,128,_cnst)) {
manucode = 0; /* no manufacturer code */
}
if (buf[i+3UL]=='}' || manucode && buf[i+4UL]=='}') {
/* altitude in meters +10000 */
if (buf[i+3UL]!='}' && manucode) ++i;
sc = 0.0f;
if ((r91(&sc, buf[i], 8281.0f) && r91(&sc, buf[i+1UL],
91.0f)) && r91(&sc, buf[i+2UL], 1.0f)) {
*altitude = (int32_t)(uint32_t)X2C_TRUNCC(sc,0UL,
X2C_max_longcard)-10000L;
compos = i+4UL;
}
else ok0 = 0;
}
*postyp = 'm';
}
else if (c=='$' && payload+30UL<buf_len-1) {
/* gps 4806.9409,N,01134.6219,E */
ok0 = 0;
if (buf[payload+1UL]=='G' && buf[payload+2UL]=='P') {
i = payload+7UL;
gpst = buf[payload+5UL];
if ((buf[payload+3UL]=='G' && buf[payload+4UL]=='G') && gpst=='A') {
komma(buf, buf_len, &i);
ok0 = 1;
}
else if ((buf[payload+3UL]=='R' && buf[payload+4UL]=='M')
&& gpst=='C') {
komma(buf, buf_len, &i);
komma(buf, buf_len, &i);
ok0 = 1;
}
else if ((buf[payload+3UL]=='G' && buf[payload+4UL]=='L')
&& gpst=='L') ok0 = 1;
pos->lat = 0.0f;
if (!dig(&pos->lat, buf[i], 1.7453292519444E-1f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 1.7453292519444E-2f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-3f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-4f)) ok0 = 0;
i += 2UL;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-5f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-6f)) ok0 = 0;
sc = 2.9088820865741E-7f;
while (i<len && dig(&pos->lat, buf[i+1UL], sc)) {
sc = sc*0.1f;
++i;
nornd = 1;
}
komma(buf, buf_len, &i);
if (buf[i]=='S') pos->lat = -pos->lat;
komma(buf, buf_len, &i);
pos->long0 = 0.0f;
if (!dig(&pos->long0, buf[i], 1.7453292519444f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 1.7453292519444E-1f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 1.7453292519444E-2f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-3f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-4f)) ok0 = 0;
i += 2UL;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-5f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-6f)) ok0 = 0;
sc = 2.9088820865741E-7f;
while (i<len && dig(&pos->long0, buf[i+1UL], sc)) {
sc = sc*0.1f;
++i;
nornd = 1;
}
komma(buf, buf_len, &i);
if (buf[i]=='W') pos->long0 = -pos->long0;
if (gpst=='C') {
/* speed and course */
komma(buf, buf_len, &i);
sc = 0.0f;
for (;;) {
sc = sc*10.0f;
if ((i>=len || sc>1.E+6f) || !dig(&sc, buf[i], 0.1f)) {
break;
}
++i;
}
*speed = (uint32_t)X2C_TRUNCC(X2C_DIVR(sc,1.852f)+0.5f,0UL,
X2C_max_longcard);
komma(buf, buf_len, &i);
sc = 0.0f;
for (;;) {
sc = sc*10.0f;
if ((i>=len || sc>360.0f) || !dig(&sc, buf[i], 0.1f)) break;
++i;
}
*course = (uint32_t)X2C_TRUNCC(sc,0UL,X2C_max_longcard);
if (i>len) ok0 = 0;
}
else if (gpst=='A') {
/* altitude */
komma(buf, buf_len, &i);
komma(buf, buf_len, &i);
komma(buf, buf_len, &i);
komma(buf, buf_len, &i);
sc = 0.0f;
c = buf[i];
if (c=='-') ++i;
for (;;) {
sc = sc*10.0f;
if ((i>=len || sc>1.E+6f) || !dig(&sc, buf[i], 0.1f)) break;
++i;
}
komma(buf, buf_len, &i);
if (c=='-') sc = -sc;
if (buf[i]=='M') {
*altitude = (int32_t)X2C_TRUNCI(sc,X2C_min_longint,
X2C_max_longint);
}
}
while (i<len && buf[i]!='*') ++i;
if (i+3UL<len) compos = i+3UL;
else compos = len;
*postyp = 'g';
}
}
else {
/* !4915.10N/01402.20E& */
/* xnnnn.nnNxnnnnn.nnEx */
ok0 = 0;
pos->lat = 0.0f;
pos->long0 = 0.0f;
i = 0UL;
if (buf[payload]=='!' || buf[payload]=='=') i = payload+1UL;
else if ((buf[payload]=='/' || buf[payload]=='@')
&& ((buf[payload+7UL]=='z' || buf[payload+7UL]=='h')
|| buf[payload+7UL]=='/')) i = payload+8UL;
else if (buf[payload]==';') i = payload+18UL;
else if (buf[payload]==')') {
/* skip item */
i = payload+4UL;
while ((i<len && buf[i]!='!') && buf[i]!='_') ++i;
++i;
}
if (i>0UL) {
if ((uint8_t)buf[i]>='0' && (uint8_t)buf[i]<='9') {
if ((((i+17UL<=len && buf[i+4UL]=='.') && buf[i+14UL]=='.')
&& ns(buf[i+7UL])) && ew(buf[i+17UL])) {
/* not compressed */
ok0 = 1;
if (!dig(&pos->lat, buf[i], 1.7453292519444E-1f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 1.7453292519444E-2f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-3f)) ok0 = 0;
if ((uint8_t)buf[i]>='6') ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-4f)) ok0 = 0;
i += 2UL;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-5f)) ok0 = 0;
++i;
if (!dig(&pos->lat, buf[i], 2.9088820865741E-6f)) ok0 = 0;
++i;
if (X2C_CAP(buf[i])=='S') pos->lat = -pos->lat;
else if (X2C_CAP(buf[i])!='N') ok0 = 0;
++i;
*symbt = buf[i];
++i;
if (!dig(&pos->long0, buf[i], 1.7453292519444f)) {
ok0 = 0;
}
++i;
if (!dig(&pos->long0, buf[i], 1.7453292519444E-1f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 1.7453292519444E-2f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-3f)) ok0 = 0;
if ((uint8_t)buf[i]>='6') ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-4f)) ok0 = 0;
i += 2UL;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-5f)) ok0 = 0;
++i;
if (!dig(&pos->long0, buf[i], 2.9088820865741E-6f)) ok0 = 0;
++i;
if (X2C_CAP(buf[i])=='W') pos->long0 = -pos->long0;
else if (X2C_CAP(buf[i])!='E') ok0 = 0;
++i;
*symb = buf[i];
++i;
compos = i;
*postyp = 'g';
if (i+7UL<=len) {
if (dig3(buf, buf_len, &nc, &i)) *course = nc;
else *course = 0UL;
/* area obj */
if (*symbt=='\\' && *symb=='l') {
/* area symbol */
c = buf[i];
if (c=='/' || c=='1') {
++i;
if (dig3(buf, buf_len, &n, &i)) {
if (c=='1') {
n += 1000UL; /* Tyy/Cxx or Tyy1Cxx */
}
if (n<=1599UL) {
/* Tyy15xx max 5 */
*speed = n;
compos = i;
*postyp = 'A';
}
}
}
}
else if (buf[i]=='/') {
/* area obj */
/* ccc/sss */
++i;
if (dig3(buf, buf_len, &n, &i)) {
*speed = n;
compos = i;
}
}
}
}
}
else if (i+11UL+2UL*(uint32_t)(buf[i+10UL]!=' ')<=len) {
/* compressed pos*/
ok0 = 1;
*symbt = Mapsym(buf[i]);
++i;
if (!r91(&pos->lat, buf[i], 7.53571E+5f)) ok0 = 0;
++i;
if (!r91(&pos->lat, buf[i], 8281.0f)) ok0 = 0;
++i;
if (!r91(&pos->lat, buf[i], 91.0f)) ok0 = 0;
++i;
if (!r91(&pos->lat, buf[i], 1.0f)) ok0 = 0;
pos->lat = 1.57079632675f-pos->lat*4.5818065764596E-8f;
++i;
if (!r91(&pos->long0, buf[i], 7.53571E+5f)) ok0 = 0;
++i;
if (!r91(&pos->long0, buf[i], 8281.0f)) ok0 = 0;
++i;
if (!r91(&pos->long0, buf[i], 91.0f)) ok0 = 0;
++i;
if (!r91(&pos->long0, buf[i], 1.0f)) ok0 = 0;
pos->long0 = pos->long0*9.1636131529192E-8f-3.1415926535f;
*symb = buf[i+1UL];
if (ok0) {
if (buf[i+2UL]=='}') {
}
else if (((uint32_t)(uint8_t)buf[i+4UL]/8UL&3UL)==2UL) {
/* radio range */
/* T byte says GGA so we have altitude */
na = (uint32_t)(uint8_t)buf[i+2UL];
/* sc is altitude */
n = (uint32_t)(uint8_t)buf[i+3UL];
if (((na>=33UL && na<=127UL) && n>=33UL) && n<=127UL) {
*altitude = (int32_t)(uint32_t)
X2C_TRUNCC(0.3048f*osic_power(1.002f,
(float)(((na-33UL)*91UL+n)-33UL)),0UL,X2C_max_longcard);
/* in feet */
}
}
else {
n = (uint32_t)(uint8_t)buf[i+2UL]; /* speed course */
if (n>=33UL && n<=127UL) {
n -= 33UL;
if (n<=89UL) {
*course = n*4UL;
n = (uint32_t)(uint8_t)buf[i+3UL];
if (n>=33UL && n<=127UL) {
*speed = (uint32_t)X2C_TRUNCC(osic_power(1.08f,
(float)(n-33UL)),0UL,X2C_max_longcard);
}
}
}
}
compos = i+5UL;
nornd = 1;
}
*postyp = 'c';
}
}
}
i = compos;
clen = 0UL;
while (clen<coment_len-1 && i<len) {
coment[clen] = buf[i];
++i;
++clen;
}
if ((clen>0UL && X2C_INL((int32_t)(uint8_t)manucode,128,
_cnst0)) && coment[clen-1UL]=='=') --clen;
else if (clen>1UL && X2C_INL((int32_t)(uint8_t)manucode,128,_cnst1)) {
clen -= 2UL; /* remove maufacturer code */
}
coment[clen] = 0;
if (clen>0UL) {
i = 0UL; /* look for altitude in comment /A= */
for (;;) {
if (i+9UL>clen) break;
if (((coment[i]=='/' && coment[i+1UL]=='A') && coment[i+2UL]=='=')
&& dig6(coment, coment_len, &sc, i+3UL)) {
*altitude = (int32_t)X2C_TRUNCI(sc*0.3048f,X2C_min_longint,
X2C_max_longint);
while (i+9UL<=clen) {
coment[i] = coment[i+9UL]; /* delete altitude */
++i;
}
clen -= 9UL;
break;
}
++i;
}
if (clen>=5UL && (pos->long0!=0.0f || pos->lat!=0.0f)) {
i = clen-5UL; /* look for !DAO! precision extension backward */
n = 0UL; /* count "|" to know if inside mice-telemetry */
for (;;) {
if (coment[i]=='!' && coment[i+4UL]=='!') {
c = coment[i+1UL];
sc = 0.0f;
scl = 0.0f;
if ((((uint8_t)c>='A' && (uint8_t)c<='Z') && dig(&sc,
coment[i+2UL], 2.9088820865741E-7f)) && dig(&scl,
coment[i+3UL], 2.9088820865741E-7f) || (((uint8_t)c>='a' && (uint8_t)c<='z') && r91(&sc,
coment[i+2UL], 3.1997702952315E-8f)) && r91(&scl,
coment[i+3UL], 3.1997702952315E-8f)) {
if (pos->lat<0.0f) pos->lat = pos->lat-sc;
else pos->lat = pos->lat+sc;
if (pos->long0<0.0f) pos->long0 = pos->long0-scl;
else pos->long0 = pos->long0+scl;
nornd = 1;
if (!(n&1)) {
/* if not possibly inside mice-telemetrty del DAO */
while (i+5UL<=clen) {
coment[i] = coment[i+5UL]; /* delete DAO */
++i;
}
clen -= 5UL;
}
}
if ((uint8_t)*postyp>0) *postyp = X2C_CAP(*postyp);
break;
}
if (coment[i+4UL]=='|') ++n;
if (i==0UL) break;
--i;
}
}
}
if (ok0 && !nornd) {
/* rounding */
if (pos->lat<0.0f) pos->lat = pos->lat-1.454441043287E-6f;
else if (pos->lat>0.0f) pos->lat = pos->lat+1.454441043287E-6f;
if (pos->long0<0.0f) pos->long0 = pos->long0-1.454441043287E-6f;
else if (pos->long0>0.0f) pos->long0 = pos->long0+1.454441043287E-6f;
}
ok0 = ((ok0 && (pos->long0!=0.0f || pos->lat!=0.0f)) && (float)
fabs(pos->long0)<3.1415926535f) && (float)fabs(pos->lat)
<1.57079632675f;
if (!ok0) {
pos->long0 = 0.0f;
pos->lat = 0.0f;
}
} /* end GetPos() */
#define aprspos_SYMT1 "BBBCBDBEBFBGBHBIBJBKBLBMBNBOBPP0P1P2P3P4P5P6P7P8P9MRMS\
MTMUMVMWMXPAPBPCPDPEPFPGPHPIPJPKPLPMPNPOPPPQPRPSPTPUPVPWPXPYPZHSHTHUHVHWHXLAL\
BLCLDLELFLGLHLILJLKLLLMLNLOLPLQLRLSLTLULVLWLXLYLZJ1J2J3J4"
#define aprspos_SYMT2 "OBOCODOEOFOGOHOIOJOKOLOMONOOOPA0A1A2A3A4A5A6A7A8A9NRNS\
NTNUNVNWNXAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZDSDTDUDVDWDXSAS\
BSCSDSESFSGSHSISJSKSLSMSNSOSPSQSRSSSTSUSVSWSXSYSZQ1Q2Q3Q4"
#define aprspos_LEN 94
extern void aprspos_GetSym(char d[], uint32_t d_len, char * symb,
char * symt)
/* symbol out of destination call */
{
uint32_t n;
if (((d[0UL]=='G' && d[1UL]=='P') && d[2UL]=='S')
&& (d[3UL]=='C' || d[3UL]=='E')) {
if ((((uint8_t)d[4UL]>='0' && (uint8_t)d[4UL]<='9') && (uint8_t)
d[5UL]>='0') && (uint8_t)d[5UL]<='9') {
n = (((uint32_t)(uint8_t)d[4UL]-48UL)*10UL+(uint32_t)
(uint8_t)d[5UL])-48UL;
if (n>=1UL && n<=94UL) {
*symb = (char)(32UL+n);
if (d[3UL]=='C') *symt = '/';
else *symt = '\\';
}
}
}
else if (((d[0UL]=='G' && d[1UL]=='P')
&& d[2UL]=='S' || (d[0UL]=='S' && d[1UL]=='P')
&& d[2UL]=='C') || (d[0UL]=='S' && d[1UL]=='Y')
&& d[2UL]=='M') {
if (d[3UL]==0) {
*symb = '/';
*symt = '/';
}
else {
n = 0UL;
for (;;) {
if (n>=94UL) break;
if (d[3UL]=="BBBCBDBEBFBGBHBIBJBKBLBMBNBOBPP0P1P2P3P4P5P6P7P8P9MR\
MSMTMUMVMWMXPAPBPCPDPEPFPGPHPIPJPKPLPMPNPOPPPQPRPSPTPUPVPWPXPYPZHSHTHUHVHWHXL\
ALBLCLDLELFLGLHLILJLKLLLMLNLOLPLQLRLSLTLULVLWLXLYLZJ1J2J3J4"[n*2UL] && d[4UL]
=="BBBCBDBEBFBGBHBIBJBKBLBMBNBOBPP0P1P2P3P4P5P6P7P8P9MRMSMTMU\
MVMWMXPAPBPCPDPEPFPGPHPIPJPKPLPMPNPOPPPQPRPSPTPUPVPWPXPYPZHSHTHUHVHWHXLALBLCL\
DLELFLGLHLILJLKLLLMLNLOLPLQLRLSLTLULVLWLXLYLZJ1J2J3J4"[n*2UL+1UL]) {
*symb = (char)(33UL+n);
*symt = '/';
break;
}
if (d[3UL]=="OBOCODOEOFOGOHOIOJOKOLOMONOOOPA0A1A2A3A4A5A6A7A8A9NR\
NSNTNUNVNWNXAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZDSDTDUDVDWDXS\
ASBSCSDSESFSGSHSISJSKSLSMSNSOSPSQSRSSSTSUSVSWSXSYSZQ1Q2Q3Q4"[n*2UL] && d[4UL]
=="OBOCODOEOFOGOHOIOJOKOLOMONOOOPA0A1A2A3A4A5A6A7A8A9NRNSNTNU\
NVNWNXAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZDSDTDUDVDWDXSASBSCS\
DSESFSGSHSISJSKSLSMSNSOSPSQSRSSSTSUSVSWSXSYSZQ1Q2Q3Q4"[n*2UL+1UL]) {
*symb = (char)(33UL+n);
*symt = '\\';
if ((uint8_t)d[5UL]>='0' && (uint8_t)
d[5UL]<='9' || (uint8_t)d[5UL]>='A' && (uint8_t)
d[5UL]<='Z') *symt = d[5UL];
break;
}
++n;
}
}
}
} /* end GetSym() */
extern void aprspos_BEGIN(void)
{
static int aprspos_init = 0;
if (aprspos_init) return;
aprspos_init = 1;
osi_BEGIN();
}

84
src/aprspos.h 100644
Wyświetl plik

@ -0,0 +1,84 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef aprspos_H_
#define aprspos_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
/* get aprs position by OE5DXL */
#define aprspos_PI2 6.283185307
#define aprspos_RAD 1.7453292519444E-2
#define aprspos_FEET 0.3048
#define aprspos_KNOTS 1.852
/* nautic miles */
#define aprspos_WKNOTS 1.609
/* wx knots */
#define aprspos_SKNOTS 1.609
/* stormdata knots */
#define aprspos_ENCODEGPS "g"
#define aprspos_ENCODEMICE "m"
#define aprspos_ENCODECOMP "c"
#define aprspos_ENCODEGPSDAO "G"
#define aprspos_ENCODEMICEDAO "M"
#define aprspos_ENCODEAREA "A"
#define aprspos_ENCODEMULTILINE "L"
#define aprspos_EARTH 6370.0
#define aprspos_AREASYMT "\\"
/* area object symbol table */
#define aprspos_AREASYM "l"
/* area object symbol */
struct aprspos_POSITION;
struct aprspos_POSITION {
float long0;
float lat;
};
extern float aprspos_rad0(float);
extern char aprspos_posvalid(struct aprspos_POSITION);
extern float aprspos_distance(struct aprspos_POSITION,
struct aprspos_POSITION);
extern float aprspos_azimuth(struct aprspos_POSITION,
struct aprspos_POSITION);
extern void aprspos_GetPos(struct aprspos_POSITION *, uint32_t *,
uint32_t *, int32_t *, char *, char *,
char [], uint32_t, uint32_t, uint32_t, char [],
uint32_t, char *);
extern void aprspos_GetSym(char [], uint32_t, char *, char *);
/* symbol out of destination call */
extern void aprspos_BEGIN(void);
#endif /* aprspos_H_ */

1171
src/aprsstr.c 100644

Plik diff jest za duży Load Diff

103
src/aprsstr.h 100644
Wyświetl plik

@ -0,0 +1,103 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef aprsstr_H_
#define aprsstr_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
/* string lib by oe5dxl */
typedef uint32_t aprsstr_TIME;
typedef uint32_t aprsstr_IPNUM;
typedef uint32_t aprsstr_UDPPORT;
typedef uint8_t aprsstr_SET8;
typedef uint32_t aprsstr_GHOSTSET[9];
#define aprsstr_CALLLEN 7
#define aprsstr_HBIT 128
extern void aprsstr_Assign(char [], uint32_t, char [], uint32_t);
extern void aprsstr_Append(char [], uint32_t, char [], uint32_t);
extern void aprsstr_Delstr(char [], uint32_t, uint32_t, uint32_t);
extern void aprsstr_Extractword(char [], uint32_t, char [],
uint32_t);
extern uint32_t aprsstr_Length(char [], uint32_t);
extern void aprsstr_IntToStr(int32_t, uint32_t, char [], uint32_t);
extern void aprsstr_CardToStr(uint32_t, uint32_t, char [],
uint32_t);
extern void aprsstr_FixToStr(float, uint32_t, char [], uint32_t);
extern char aprsstr_StrToCard(char [], uint32_t, uint32_t *);
extern char aprsstr_StrToInt(char [], uint32_t, int32_t *);
extern char aprsstr_StrToFix(float *, char [], uint32_t);
extern char aprsstr_StrCmp(char [], uint32_t, char [],
uint32_t);
extern int32_t aprsstr_InStr(char [], uint32_t, char [],
uint32_t);
extern void aprsstr_TimeToStr(uint32_t, char [], uint32_t);
extern void aprsstr_DateToStr(uint32_t, char [], uint32_t);
extern char aprsstr_StrToTime(char [], uint32_t, uint32_t *);
extern void aprsstr_CtrlHex(char [], uint32_t);
extern int32_t aprsstr_GetIp2(char [], uint32_t, uint32_t *,
uint32_t *, uint32_t *, char *);
extern void aprsstr_ipv4tostr(uint32_t, char [], uint32_t);
extern char aprsstr_Call2Str(char [], uint32_t, char [],
uint32_t, uint32_t, uint32_t *);
extern void aprsstr_mon2raw(char [], uint32_t, char [], uint32_t,
int32_t *);
extern void aprsstr_raw2mon(char [], uint32_t, char [], uint32_t,
uint32_t, uint32_t *, aprsstr_GHOSTSET);
extern void aprsstr_extrudp2(char [], uint32_t, char [],
uint32_t, int32_t *);
extern void aprsstr_AppCRC(char [], uint32_t, int32_t);
extern void aprsstr_HashCh(char, uint8_t *, uint8_t *);
extern uint32_t aprsstr_Hash(char [], uint32_t, int32_t,
int32_t);
extern void aprsstr_cleanfilename(char [], uint32_t);
extern void aprsstr_Caps(char [], uint32_t);
extern void aprsstr_rightbound(char [], uint32_t, uint32_t);
extern void aprsstr_BEGIN(void);
#endif /* aprsstr_H_ */

1513
src/aprstat.c 100644

Plik diff jest za duży Load Diff

54
src/aprstat.h 100644
Wyświetl plik

@ -0,0 +1,54 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef aprstat_H_
#define aprstat_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#ifndef aprsdecode_H_
#include "aprsdecode.h"
#endif
#ifndef maptool_H_
#include "maptool.h"
#endif
struct aprstat_LASTVAL;
struct aprstat_LASTVAL {
float temp;
float hyg;
float baro;
float winds;
float winddir;
float gust;
float rain;
float rain24;
float lumi;
float siev;
};
extern void aprstat_kmhist(maptool_pIMAGE *, aprsdecode_pOPHIST,
char *);
extern void aprstat_althist(maptool_pIMAGE *, aprsdecode_pOPHIST,
char *, float *, uint32_t *, uint32_t *,
uint32_t *, uint32_t *);
extern void aprstat_btimehist(maptool_pIMAGE *, aprsdecode_pOPHIST);
extern void aprstat_wxgraph(maptool_pIMAGE *, aprsdecode_pOPHIST, uint32_t,
uint16_t *, struct aprstat_LASTVAL *);
extern void aprstat_BEGIN(void);
#endif /* aprstat_H_ */

1855
src/aprstext.c 100644

Plik diff jest za duży Load Diff

118
src/aprstext.h 100644
Wyświetl plik

@ -0,0 +1,118 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef aprstext_H_
#define aprstext_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#ifndef aprsdecode_H_
#include "aprsdecode.h"
#endif
#ifndef aprspos_H_
#include "aprspos.h"
#endif
/* aprs tracks on osm map by oe5dxl */
#define aprstext_TEXTCOLEND "\376"
#define aprstext_TEXTCOLLGR "\367"
#define aprstext_TEXTCOLRED "\370"
#define aprstext_TEXTCOLBLU "\371"
#define aprstext_TEXTCOLYEL "\372"
#define aprstext_TEXTCOLORA "\373"
#define aprstext_TEXTCOLVIO "\374"
#define aprstext_TEXTINSERTSYMBOL "\375"
extern void aprstext_decode(char [], uint32_t, aprsdecode_pFRAMEHIST,
aprsdecode_pFRAMEHIST, aprsdecode_pVARDAT, uint32_t,
char, struct aprsdecode_DAT *);
extern void aprstext_strcp(char [], uint32_t, uint32_t, uint32_t,
char [], uint32_t);
extern void aprstext_optext(uint32_t, struct aprsdecode_CLICKOBJECT *,
char *, char [], uint32_t);
extern void aprstext_measure(struct aprspos_POSITION,
struct aprspos_POSITION, char [], uint32_t,
char);
extern void aprstext_postostr(struct aprspos_POSITION, char, char [],
uint32_t);
extern void aprstext_degtopos(char [], uint32_t,
struct aprspos_POSITION *);
extern void aprstext_deghtopos(char [], uint32_t,
struct aprspos_POSITION *);
extern void aprstext_degdeztopos(char [], uint32_t,
struct aprspos_POSITION *);
extern void aprstext_deganytopos(char [], uint32_t,
struct aprspos_POSITION *);
extern char aprstext_getmypos(struct aprspos_POSITION *);
extern void aprstext_listop(char);
extern void aprstext_listtyps(char, char, char [],
uint32_t);
extern void aprstext_listin(char [], uint32_t, char, char,
char, int32_t, int32_t, int32_t);
extern void aprstext_DateLocToStr(uint32_t, char [], uint32_t);
/* append (+localtime) to time */
extern void aprstext_encbeacon(char [], uint32_t, uint32_t *);
extern float aprstext_FtoC(float);
/* fahrenheit to celsius */
extern float aprstext_CtoF(float);
extern aprsdecode_pOPHIST aprstext_oppo(aprsdecode_MONCALL);
extern void aprstext_setmarkalti(aprsdecode_pFRAMEHIST, aprsdecode_pOPHIST,
char);
extern void aprstext_setmark1(struct aprspos_POSITION, char,
int32_t, uint32_t);
extern void aprstext_Apphex(char [], uint32_t, char [],
uint32_t);
extern char aprstext_isacall(char [], uint32_t);
extern void aprstext_logfndate(uint32_t, char [], uint32_t);
extern void aprstext_sievert2str(float, char [], uint32_t);
extern void aprstext_compressdata(struct aprspos_POSITION, uint32_t,
uint32_t, int32_t, char [], uint32_t, char [],
uint32_t);
extern void aprstext_decodelistline(char [], uint32_t, char [],
uint32_t, uint32_t);
extern char aprstext_callwrong(char [], uint32_t);
extern void aprstext_BEGIN(void);
#endif /* aprstext_H_ */

59
src/basictypes.h 100644
Wyświetl plik

@ -0,0 +1,59 @@
/**
\file basictypes.h
\brief GNSS core 'c' function library: basic types.
\author Glenn D. MacGougan (GDM)
\date 2007-11-29
\since 2006-11-10
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _C_BASICTYPES_H_
#define _C_BASICTYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
/// The 'c' boolean type is a define for (int). TRUE(0), FALSE(1).
typedef int BOOL;
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
#ifdef __cplusplus
}
#endif
#endif // _C_BASICTYPES_H_

39
src/beep.c 100644
Wyświetl plik

@ -0,0 +1,39 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <sys/ioctl.h>
#ifndef MACOS
#include <linux/kd.h>
#endif
#include <fcntl.h>
#include <unistd.h>
int cbell(int hz, int ms)
{
int fd;
int ret;
ret=-2;
fd=open("/dev/tty0", O_WRONLY);
if (fd<0) fd=open("/dev/vc/0", O_WRONLY);
if (fd<0) fd=open("/dev/console", O_WRONLY);
if (fd<0) return -1;
#ifndef MACOS
/* Not supported on MacOS */
if (ioctl(fd, KIOCSOUND, 1193180/hz)>=0)
{
usleep(ms*1000);
ioctl(fd, KIOCSOUND, 0);
ret=0;
}
#endif
close(fd);
return ret;
}

15
src/beep.h 100644
Wyświetl plik

@ -0,0 +1,15 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef beep_H_
#define beep_H_
#include "X2C.h"
extern long cbell(long, long);
#endif /* beep_H_ */

92
src/cleanup.c 100644
Wyświetl plik

@ -0,0 +1,92 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <sys/types.h>
#include <time.h>
#include <fcntl.h>
#include <utmp.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
int logout1(int pid, char *line)
{
int fd;
struct utmp ut;
if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0) return 0;
while (read(fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) {
if(ut.ut_pid!=pid) continue;
strncpy(line, ut.ut_line, UT_LINESIZE);
bzero(ut.ut_name, UT_NAMESIZE);
bzero(ut.ut_host, UT_HOSTSIZE);
time(&ut.ut_time);
lseek(fd, -(off_t)sizeof(struct utmp), L_INCR);
write(fd, &ut, sizeof(struct utmp));
close(fd);
return 1;
}
close(fd);
return 0;
}
void logwtmp(const char *line, const char *name, const char *host)
{
struct utmp ut;
struct stat buf;
int fd;
if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0) return;
if (fstat(fd, &buf) == 0) {
ut.ut_pid = getpid();
ut.ut_type = (name[0] != '\0')? USER_PROCESS : DEAD_PROCESS;
strncpy(ut.ut_id, "", 2);
strncpy(ut.ut_line, line, sizeof(ut.ut_line));
strncpy(ut.ut_name, name, sizeof(ut.ut_name));
strncpy(ut.ut_host, host, sizeof(ut.ut_host));
time(&ut.ut_time);
if (write(fd, &ut, sizeof(struct utmp)) != sizeof(struct utmp))
ftruncate(fd, buf.st_size);
}
close(fd);
}
#define DEVPATH "/dev/"
void cleanup(int sig) {
int status, pid;
char line[UT_LINESIZE+sizeof(DEVPATH)];
if(sig!=SIGCHLD) return;
while( (pid=waitpid(-1, &status, WNOHANG /* |WUNTRACED */ )) > 0 ) {
/*
if(WIFSTOPPED(status)) {
fprintf(stderr,"process %d stopped by signal %d!\n",
pid, WSTOPSIG(status));
continue;
}
*/
sprintf(line,DEVPATH);
if( logout1(pid, line+sizeof(DEVPATH)-1) ) {
logwtmp(line+sizeof(DEVPATH)-1, "", "");
chmod(line, 0666);
chown(line, 0, 0);
line[sizeof(DEVPATH)-1]='p'; /* ttyXX -> ptyXX */
chmod(line, 0666);
chown(line, 0, 0);
}
}
}

17
src/cleanup.h 100644
Wyświetl plik

@ -0,0 +1,17 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef cleanup_H_
#define cleanup_H_
#include "X2C.h"
typedef long SigNum;
extern void cleanup(long);
#endif /* cleanup_H_ */

115
src/constants.h 100644
Wyświetl plik

@ -0,0 +1,115 @@
/**
\file constants.h
\brief GNSS core 'c' function library: Contains constants.
\author Glenn D. MacGougan (GDM)
\date 2007-11-29
\since 2005-07-30
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _C_CONSTANTS_H_
#define _C_CONSTANTS_H_
#ifdef __cplusplus
extern "C" {
#endif
//#define PI (3.1415926535898) // value from GPS-ICD pp. 101 used in orbit curve fit calculations by the control segment
#ifndef PI
#define PI (3.1415926535897932384626433832795) //!< better value
#endif
#ifndef TWOPI
#define TWOPI (6.283185307179586476925286766559) //!< 2.0*PI
#endif
#ifndef HALFPI
#define HALFPI (1.5707963267948966192313216916398) //!< PI/2.0
#endif
#ifdef QUARTERPI
#define QUARTERPI (0.78539816339744830961566084581988) //!< PI/4.0
#endif
#ifndef DEG2RAD
#define DEG2RAD (0.017453292519943295769236907684886) //!< PI/180.0
#endif
#ifndef RAD2DEG
#define RAD2DEG (57.295779513082320876798154814105) //!< 180.0/PI
#endif
#ifndef SECONDS_IN_WEEK
#define SECONDS_IN_WEEK (604800.0) //!< [s]
#endif
#ifndef LIGHTSPEED
#define LIGHTSPEED (299792458.0) //!< light speed constant defined in ICD-GPS-200C p. 89 [m/s]
#endif
#ifndef ONE_MS_IN_M
#define ONE_MS_IN_M (299792.4580) //!< 1 millisecond * light speed constant defined in ICD-GPS-200C p. 89 [m/s]
#endif
#ifndef GPS_FREQUENCYL1
#define GPS_FREQUENCYL1 (1575.42e06) //!< [Hz]
#endif
#ifndef GPS_FREQUENCYL2
#define GPS_FREQUENCYL2 (1227.60e06) //!< [Hz]
#endif
#ifndef GPS_WAVELENGTHL1
#define GPS_WAVELENGTHL1 (0.19029367279836488047631742646405) //!< [m]
#endif
#ifndef GPS_WAVELENGTHL2
#define GPS_WAVELENGTHL2 (0.24421021342456825) //!< [m]
#endif
// not a constant but a very common type
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
#ifdef __cplusplus
}
#endif
#endif // _C_CONSTANTS_H_

1571
src/deflate.c 100644

Plik diff jest za duży Load Diff

98
src/deflate.h 100644
Wyświetl plik

@ -0,0 +1,98 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef deflate_H_
#define deflate_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#define deflate_BSIZE 32768
#define deflate_HASHSIZE 4096
#define deflate_CMPSIZE 257
#define deflate_CSIZE 2048
#define deflate_SWITCHTOCOMP (-32)
#define deflate_SWITCHTORAW 32
#define deflate_MAXRAWBLOCK 16384
#define deflate_ENDCOMP 256
#define deflate_FLUSHEOF "\002"
#define deflate_FLUSHQUICK "\001"
typedef uint8_t deflate_SET8;
typedef uint32_t deflate_SET32;
struct deflate_CONTEXT;
struct deflate_CONTEXT {
char ring[32768];
uint32_t fill;
uint16_t hashchain[32768];
uint32_t fill1;
uint16_t hash[4096];
uint32_t fill2;
char matchbuf[257];
uint32_t combuf[2048];
uint32_t txbitbuf;
uint32_t txbitc;
uint32_t lastidx;
uint32_t wp;
uint32_t savep;
uint32_t flen;
uint32_t fdist;
uint32_t mlen;
uint32_t rawr;
uint32_t comr;
uint32_t raww;
uint32_t rawwo;
uint32_t comw;
int32_t of;
int32_t sizedif;
char wascomp;
};
struct deflate_XCONTEXT;
struct deflate_XCONTEXT {
char ring[32768];
uint32_t wp;
uint32_t rxbitbuf;
uint32_t lencode;
uint32_t distcode;
uint32_t rxbits;
int32_t rawlen;
char compdata;
};
extern void deflate_Initexpand(struct deflate_XCONTEXT *);
extern void deflate_Initdeflate(struct deflate_CONTEXT *);
extern void deflate_Deflatbyte(struct deflate_CONTEXT *, char, char,
char [], uint32_t, int32_t *);
extern void deflate_Expandbyte(struct deflate_XCONTEXT *, char,
char [], uint32_t, int32_t *, char *);
extern void deflate_BEGIN(void);
#endif /* deflate_H_ */

408
src/frameio.c 100644
Wyświetl plik

@ -0,0 +1,408 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
/* "@(#)frameio.c May 10 23:20:08 2017" */
#define X2C_int32
#define X2C_index32
#ifndef frameio_H_
#include "frameio.h"
#endif
#define frameio_C_
#ifndef l2_H_
#include "l2.h"
#endif
#ifndef osi_H_
#include "osi.h"
#endif
#ifndef udp_H_
#include "udp.h"
#endif
#ifndef aprsstr_H_
#include "aprsstr.h"
#endif
char frameio_crcok;
struct frameio_UDPSOCK frameio_udpsocks0[15];
#define frameio_DCDRETRIES 500
static uint32_t size;
static uint32_t from;
static uint32_t udppos;
static char axv2;
static char udpbuf[1601];
struct _0 {
uint32_t lastBaud; /*insert flags if baud change*/
uint32_t oldi; /*last received frame index from hardware*/
uint32_t nextfrom; /*read next frame from hardware*/
uint32_t txakku; /*send next frame to hardware*/
char twoflags;
};
/*
VAR CRCL, CRCH:ARRAY[0..255] OF SET8;
PROCEDURE CRC(VAR frame:ARRAY OF CHAR; VAR crc:CARD16; size:CARDINAL);
VAR l,h:SET8;
b:CARD8;
i:INTEGER;
BEGIN
l:=CAST(SET8, crc);
h:=CAST(SET8, crc >> 8);
FOR i:=0 TO VAL(INTEGER, size)-1 DO
b:=CAST(CARD8, CAST(SET8, frame[i]) / l);
l:=CRCL[b] / h;
h:=CRCH[b];
END;
crc:=CAST(CARD16, l) + (CAST(CARD16, h) << 8);
END CRC;
PROCEDURE UDPCRC(frame-:ARRAY OF CHAR; size:INTEGER):CARDINAL;
VAR l,h:SET8;
b:CARD8;
i:INTEGER;
BEGIN
l:=SET8{};
h:=SET8{};
FOR i:=0 TO size-1 DO
b:=CAST(CARD8, CAST(SET8, frame[i]) / l);
l:=CRCL[b] / h;
h:=CRCH[b];
END;
RETURN ORD(CAST(CHAR, l))+256*ORD(CAST(CHAR, h))
END UDPCRC;
*/
/*
PROCEDURE opensock(num:CARDINAL; fromport, toport:UDPPORT):BOOLEAN;
BEGIN
WITH udpsocks[num] DO
fd:=openudp();
IF (CAST(INTEGER,fd)<0) OR (bindudp(fd,
fromport)<0) THEN RETURN FALSE END;
dport:=toport;
END;
RETURN TRUE
END opensock;
*/
static void rmnc(void)
{
uint32_t k;
uint32_t j;
char cmd;
l2_adress[14U] = l2_adress[7U];
l2_asize = 15U;
k = (uint32_t)(uint8_t)l2_adress[0U]*128UL+(uint32_t)(uint8_t)
l2_adress[1U]/2UL;
cmd = (char)(k&1);
k = k/2UL;
j = 12UL;
do {
l2_adress[j] = (char)((k%10UL+48UL)*2UL);
--j;
k = k/10UL;
} while (j!=6UL);
if (cmd) l2_adress[13U] = '`';
else l2_adress[13U] = '\340';
j = (uint32_t)(uint8_t)l2_adress[2U];
l2_adress[0U] = (char)((j/4UL)*2UL+64UL);
k = (uint32_t)(uint8_t)l2_adress[3U];
l2_adress[1U] = (char)(((j&3UL)*16UL+k/16UL+32UL)*2UL);
j = (uint32_t)(uint8_t)l2_adress[4U];
l2_adress[2U] = (char)(((k&15UL)*4UL+j/64UL+32UL)*2UL);
l2_adress[3U] = (char)(((j&63UL)+32UL)*2UL);
j = (uint32_t)(uint8_t)l2_adress[5U];
l2_adress[4U] = (char)((j/4UL)*2UL+64UL);
k = (uint32_t)(uint8_t)l2_adress[6U];
l2_adress[5U] = (char)(((j&3UL)*16UL+k/16UL+32UL)*2UL);
l2_adress[6U] = (char)(((k&15UL)+48UL)*2UL+(uint32_t)cmd*128UL);
} /* end rmnc() */
static char GetAField(uint32_t port)
{
uint32_t a;
uint32_t j;
uint32_t i;
char c;
uint32_t tmp;
if (size>=10UL) {
if (size>=70UL) a = 70UL;
else a = size;
udppos = 0UL;
tmp = a-1UL;
i = 0UL;
if (i<=tmp) for (;; i++) {
c = udpbuf[udppos];
++udppos;
l2_adress[i] = c;
if (((uint32_t)(uint8_t)c&1)) {
/*address end mark*/
if (i==1UL) {
for (j = 2UL; j<=6UL; j++) {
l2_adress[j] = udpbuf[udppos];
++udppos;
} /* end for */
l2_asize = 7U;
}
else l2_asize = (uint16_t)(i+1UL);
/*WrInt(asize, 4); WrStrLn("=as"); */
if ((l2_asize>=7U && l2_asize%7U==0U) && (uint32_t)
l2_asize<=size) {
l2_adress[l2_asize] = udpbuf[udppos]; /*command*/
++udppos;
++l2_asize;
size -= (uint32_t)l2_asize;
/*WrInt(size, 4); WrStrLn("=saf"); */
/*FOR j:=0 TO asize-1 DO WrInt(ORD(adress[j]), 4); END;
WrStrLn("=af"); */
return 1;
}
return 0;
}
if (i==tmp) break;
} /* end for */
}
return 0;
} /* end GetAField() */
static char GetDField(void)
{
int32_t i;
struct l2_DFIELD * anonym;
int32_t tmp;
if (size<=257UL) {
{ /* with */
struct l2_DFIELD * anonym = l2_dbuf;
anonym->len = (uint16_t)size;
/*WrInt(len, 4); WrStrLn("=ilen"); */
tmp = (int32_t)size-1L;
i = 0L;
if (i<=tmp) for (;; i++) {
anonym->info[i] = udpbuf[udppos];
++udppos;
if (i==tmp) break;
} /* end for */
/*
crc:=0;
CRC(adress,crc,asize);
IF len<>0 THEN CRC(info,crc,len) END;
crcok:=ORD(udpbuf[udppos]) + (ORD(udpbuf[udppos+1]) << 8)
= crc;
*/
frameio_crcok = 1;
if (l2_asize==8U) rmnc();
return 1;
}
}
return 0;
} /* end GetDField() */
static void getudp(uint32_t usock, char buf[], uint32_t buf_len,
int32_t * len)
{
uint32_t fromport;
uint32_t ipn;
char crc2;
char crc1;
*len = -1L;
if ((int32_t)frameio_udpsocks0[usock].fd<0L) return;
*len = udpreceive(frameio_udpsocks0[usock].fd, buf, (int32_t)(buf_len),
&fromport, &ipn);
if ((*len>2L && *len<(int32_t)(buf_len))
&& (!frameio_udpsocks0[usock]
.checkip || frameio_udpsocks0[usock].ipnum==ipn)) {
/*WrInt(udpsend(usock^.fd, buf, len, usock^.dport, usock^.ip), 1);
WrStrLn(" us"); */
*len -= 2L;
crc1 = buf[*len];
crc2 = buf[*len+1L];
aprsstr_AppCRC(buf, buf_len, *len);
if (crc1!=buf[*len] || crc2!=buf[*len+1L]) {
osi_WrStrLn(" axudp crc error", 17ul);
*len = -1L;
return;
}
if (buf[0UL]=='\001') {
aprsstr_extrudp2(buf, buf_len, l2_udp2buf, 100ul, len);
if (l2_udp2buf[1U]!='?') {
frameio_udpsocks0[usock].dcd = ((uint8_t)(uint8_t)
l2_udp2buf[1U]&0x2U)!=0U;
frameio_udpsocks0[usock].hastxdata = ((uint8_t)(uint8_t)
l2_udp2buf[1U]&0x4U)!=0U;
}
if (*len==0L) *len = -1L;
axv2 = 1;
}
else {
/*WrStr("<");WrStr(udp2buf); WrStrLn(">"); */
l2_udp2buf[0U] = 0;
frameio_udpsocks0[usock].dcd = 0;
frameio_udpsocks0[usock].hastxdata = 0;
axv2 = 0;
}
}
else *len = -1L;
} /* end getudp() */
extern char frameio_GetFrame(uint32_t port)
{
int32_t i;
if (port==0UL) return 0;
getudp(port-1UL, udpbuf, 1601ul, &i);
if (i<0L) return 0;
/*WrInt(i, 5); WrStrLn("=udpin"); */
size = (uint32_t)i;
from = 0UL;
if (GetAField(port) && GetDField()) return 1;
return 0;
} /* end GetFrame() */
extern void frameio_Modempoll(uint32_t tport)
{
char b[100];
int32_t ret;
/*WrStrLn("send ?"); */
struct frameio_UDPSOCK * anonym;
if (tport==0UL || tport>15UL) return;
b[0U] = '\001';
b[1U] = '?';
b[2U] = 0;
aprsstr_AppCRC(b, 100ul, 3L);
{ /* with */
struct frameio_UDPSOCK * anonym = &frameio_udpsocks0[tport-1UL];
ret = udpsend(anonym->fd, b, 5L, anonym->toport, anonym->ipnum);
}
} /* end Modempoll() */
extern char frameio_DCD(uint32_t port)
{
struct frameio_UDPSOCK * anonym;
if (port==0UL || port-1UL>14UL) return 0;
{ /* with */
struct frameio_UDPSOCK * anonym = &frameio_udpsocks0[port-1UL];
if (anonym->dcd) {
if (anonym->dcdretry>500UL) {
frameio_Modempoll(port);
anonym->dcdretry = 0UL;
}
else ++anonym->dcdretry;
}
else anonym->dcdretry = 0UL;
/*IF dcd THEN WrStrLn("dcd") END; */
return anonym->dcd;
}
} /* end DCD() */
extern char frameio_Sending(uint32_t port)
{
struct frameio_UDPSOCK * anonym;
if (port==0UL || port-1UL>14UL) return 0;
{ /* with */
struct frameio_UDPSOCK * anonym = &frameio_udpsocks0[port-1UL];
if (anonym->hastxdata) {
if (anonym->txbufretry>500UL) {
frameio_Modempoll(port);
anonym->txbufretry = 0UL;
}
else ++anonym->txbufretry;
}
else {
/*WrStr("txbufretry:");WrInt(txbufretry, 1);WrStrLn(""); */
anonym->txbufretry = 0UL;
}
/*IF hastxdata THEN WrStrLn("txing") END; */
return anonym->hastxdata;
}
} /* end Sending() */
extern void frameio_SendFrame(uint32_t tport, uint32_t Baud,
char Adress[], uint32_t Adress_len, uint32_t AdrLen,
l2_pDATA dp)
{
uint32_t j;
uint32_t i;
char b[351];
int32_t ret;
struct frameio_UDPSOCK * anonym;
uint32_t tmp;
if ((tport==0UL || tport>15UL) || AdrLen>=350UL) return;
--tport;
j = 0UL;
tmp = AdrLen-1UL;
i = 0UL;
if (i<=tmp) for (;; i++) {
b[j] = Adress[i];
++j;
if (i==tmp) break;
} /* end for */
if (dp) {
tmp = (uint32_t)(dp->len-1U);
i = 0UL;
if (i<=tmp) for (;; i++) {
b[j] = dp->info[i];
++j;
if (i==tmp) break;
} /* end for */
}
aprsstr_AppCRC(b, 351ul, (int32_t)j);
{ /* with */
struct frameio_UDPSOCK * anonym = &frameio_udpsocks0[tport];
ret = udpsend(anonym->fd, b, (int32_t)(j+2UL), anonym->toport,
anonym->ipnum);
anonym->hastxdata = axv2;
}
} /* end SendFrame() */
extern void frameio_Init(void)
{
axv2 = 0;
/* FILL(ADR(udpsocks), 0C, SIZE(udpsocks)); */
/* udpsocks[0].ip:=7F000001H; */
/* IF NOT opensock(0, 5603, 5602) THEN WrStrLn("socket open error");
HALT END; */
/* udpsocks[0].ip:=44<<24 + 143<<16 + 40<<8 + 90; */
/* IF NOT opensock(0, 10094, 10094) THEN WrStrLn("socket open error");
HALT END; */
/* udpsocks[0].ip:=192<<24 + 168<<16 + 1<<8 + 30; */
/* IF NOT opensock(0, 11000, 11001) THEN WrStrLn("socket open error");
HALT END; */
/* udpsocks[0].ip:=127<<24 + 0<<16 + 0<<8 + 1; */
/* IF NOT opensock(0, 2603, 2602) THEN WrStrLn("socket open error");
HALT END; */
} /* end Init() */
extern void frameio_BEGIN(void)
{
static int frameio_init = 0;
if (frameio_init) return;
frameio_init = 1;
l2_BEGIN();
aprsstr_BEGIN();
osi_BEGIN();
}

57
src/frameio.h 100644
Wyświetl plik

@ -0,0 +1,57 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef frameio_H_
#define frameio_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
#ifndef l2_H_
#include "l2.h"
#endif
#define frameio_UDPSOCKS 15
struct frameio_UDPSOCK;
struct frameio_UDPSOCK {
int32_t fd;
uint32_t ipnum;
uint32_t fromport;
uint32_t toport;
uint32_t dcdretry;
uint32_t txbufretry;
char checkip;
char dcd;
char hastxdata;
};
extern char frameio_crcok;
extern struct frameio_UDPSOCK frameio_udpsocks0[15];
extern char frameio_GetFrame(uint32_t);
extern void frameio_SendFrame(uint32_t, uint32_t, char [],
uint32_t, uint32_t, l2_pDATA);
extern char frameio_Sending(uint32_t);
extern char frameio_DCD(uint32_t);
extern void frameio_Modempoll(uint32_t);
extern void frameio_Init(void);
extern void frameio_BEGIN(void);
#endif /* frameio_H_ */

848
src/geodesy.c 100644
Wyświetl plik

@ -0,0 +1,848 @@
/**
\file geodesy.c
\brief GNSS core 'c' function library: geodesy related functions.
\author Glenn D. MacGougan (GDM)
\date 2007-11-28
\since 2005-08-14
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include <math.h>
#include "gnss_error.h"
#include "geodesy.h"
#include "constants.h"
/*************************************************************************************************/
// static function definitions (for functions used in this file only)
// static functions are functions that are only visable to other functions in the same file.
// Many functions contained herein only need a, and e2.
static BOOL GEODESY_GetReferenceEllipseParameters_A_E2(
const GEODESY_enumReferenceEllipse ellipse,
double* a, // semi-major axis of the reference ellipse [m]
double* e2 // eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
);
// Many functions contained herein only need a, b and e2.
static BOOL GEODESY_GetReferenceEllipseParameters_A_B_E2(
const GEODESY_enumReferenceEllipse ellipse,
double* a, // semi-major axis of the reference ellipse [m]
double* b, // semi-minor axis of the reference ellipse [m]
double* e2 // eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
);
// return TRUE(1) if valid, FALSE(0) otherwise.
static BOOL GEODESY_IsLatitudeValid(
const double latitude //!< expecting a value -pi/2 to pi/2 [rad]
);
/*************************************************************************************************/
BOOL GEODESY_GetReferenceEllipseParameters(
const GEODESY_enumReferenceEllipse ellipse, //!< reference ellipse enumerated []
double* a, //!< semi-major axis of the reference ellipse [m]
double* b, //!< semi-minor axis of the reference ellipse (b = a - a*f_inv) [m]
double* f_inv, //!< inverse of the flattening of the reference ellipse []
double* e2 //!< eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
)
{
switch( ellipse )
{
case GEODESY_REFERENCE_ELLIPSE_AIRY_1830:
*a = GEODESY_REFERENCE_ELLIPSE_AIRY_1830_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_AIRY_1830_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_AIRY_1830_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_AIRY_1830_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY:
*a = GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL:
*a = GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_BESSEL_1841:
*a = GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_CLARKE_1866:
*a = GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_CLARKE_1880:
*a = GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830:
*a = GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA:
*a = GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE:
*a = GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_GRS_1980:
*a = GEODESY_REFERENCE_ELLIPSE_GRS_1980_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_GRS_1980_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_GRS_1980_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_GRS_1980_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_HELMERT_1906:
*a = GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_HOUGH_1960:
*a = GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924:
*a = GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969:
*a = GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_WGS72:
*a = GEODESY_REFERENCE_ELLIPSE_WGS72_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_WGS72_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_WGS72_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_WGS72_E2;
break;
case GEODESY_REFERENCE_ELLIPSE_WGS84:
*a = GEODESY_REFERENCE_ELLIPSE_WGS84_A;
*f_inv = GEODESY_REFERENCE_ELLIPSE_WGS84_F_INV;
*b = GEODESY_REFERENCE_ELLIPSE_WGS84_B;
*e2 = GEODESY_REFERENCE_ELLIPSE_WGS84_E2;
break;
default:
GNSS_ERROR_MSG( "Unexpected default case." );
return FALSE;
break;
}
return TRUE;
}
// static
BOOL GEODESY_GetReferenceEllipseParameters_A_E2(
const GEODESY_enumReferenceEllipse ellipse,
double* a, // semi-major axis of the reference ellipse [m]
double* e2 // eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
)
{
double b;
double f_inv;
BOOL result;
result = GEODESY_GetReferenceEllipseParameters(
ellipse,
a,
&b,
&f_inv,
e2 );
return result;
}
// static
BOOL GEODESY_GetReferenceEllipseParameters_A_B_E2(
const GEODESY_enumReferenceEllipse ellipse,
double* a, // semi-major axis of the reference ellipse [m]
double* b, // semi-minor axis of the reference ellipse [m]
double* e2 // eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
)
{
double f_inv;
BOOL result;
result = GEODESY_GetReferenceEllipseParameters(
ellipse,
a,
b,
&f_inv,
e2 );
return result;
}
// static
BOOL GEODESY_IsLatitudeValid(
const double latitude //!< expecting a value -pi/2 to pi/2 [rad]
)
{
// check for valid latitude out of range
if( latitude > HALFPI || latitude < -HALFPI )
{
GNSS_ERROR_MSG( "if( latitude > HALFPI || latitude < -HALFPI )" );
return FALSE;
}
else
{
return TRUE;
}
}
BOOL GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *x, //!< earth fixed cartesian coordinate [m]
double *y, //!< earth fixed cartesian coordinate [m]
double *z //!< earth fixed cartesian coordinate [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double N; // prime vertical radius of curvature [m]
double sinlat; // sin of the latitude
double dtmp; // temp
BOOL result;
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_E2( referenceEllipse, &a, &e2 );
if( result == FALSE )
{
*x = 0.0;
*y = 0.0;
*z = 0.0;
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return FALSE;
}
// check for valid latitude out of range
result = GEODESY_IsLatitudeValid( latitude );
if( result == FALSE )
{
*x = 0.0;
*y = 0.0;
*z = 0.0;
GNSS_ERROR_MSG( "Input latitude is invalid." );
return FALSE;
}
sinlat = sin( latitude );
N = a / sqrt( 1.0 - e2 * sinlat*sinlat );
dtmp = (N + height) * cos(latitude);
*x = dtmp * cos(longitude);
*y = dtmp * sin(longitude);
*z = ( (1.0 - e2)*N + height ) * sinlat;
return TRUE;
}
BOOL GEODESY_ConvertEarthFixedCartesianToGeodeticCurvilinearCoordinates(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double x, // earth fixed cartesian coordinate [m]
const double y, // earth fixed cartesian coordinate [m]
const double z, // earth fixed cartesian coordinate [m]
double *latitude, // geodetic latitude [rad]
double *longitude, // geodetic longitude [rad]
double *height // geodetic height [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double b; // semi-minor axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double N; // prime vertical radius of curvature [m]
double p; // sqrt( x^2 + y^2 ) [m]
double dtmp; // temp
double sinlat; // sin(lat)
double lat; // temp geodetic latitude [rad]
double lon; // temp geodetic longitude [rad]
double hgt; // temp geodetic height [m]
BOOL result;
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_B_E2( referenceEllipse, &a, &b, &e2 );
if( result == FALSE )
{
*latitude = 0;
*longitude = 0;
*height = 0;
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return FALSE;
}
if( x == 0.0 && y == 0.0 )
{
// at a pole
// most likely to happen while using a simulator
// longitude is really unknown
lon = 0.0;
if( z < 0 )
{
hgt = -z - b;
lat = -HALFPI;
}
else
{
hgt = z - b;
lat = HALFPI;
}
}
else
{
p = sqrt( x*x + y*y );
// unique solution for longitude
// best formula for any longitude and applies well near the poles
// pp. 178 reference [2]
lon = 2.0 * atan2( y , ( x + p ) );
// set approximate initial latitude assuming a height of 0.0
lat = atan( z / (p * (1.0 - e2)) );
hgt = 0.0;
do
{
dtmp = hgt;
sinlat = sin(lat);
N = a / sqrt( 1.0 - e2*sinlat*sinlat );
hgt = p / cos(lat) - N;
lat = atan( z / (p * ( 1.0 - e2*N/(N + hgt) )) );
} while( fabs( hgt - dtmp ) > 0.0001 ); // 0.1 mm convergence for height
}
*latitude = lat;
*longitude = lon;
*height = hgt;
return TRUE;
}
BOOL GEODESY_ComputeNorthingEastingVertical(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< datum geodetic latitude [rad]
const double referenceLongitude, //!< datum geodetic longitude [rad]
const double referenceHeight, //!< datum geodetic height [m]
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *northing, //!< local geodetic northing [m]
double *easting, //!< local geodetic easting [m]
double *vertical //!< local geodetic vertical [m]
)
{
double x_ref;
double y_ref;
double z_ref;
double x;
double y;
double z;
double dx;
double dy;
double dz;
double A; // rotation angle [rad]
double B; // rotation angle [rad]
double cosA;
double sinA;
double cosB;
double sinB;
BOOL result;
*northing = 0;
*easting = 0;
*vertical = 0;
result = GEODESY_IsLatitudeValid( referenceLatitude );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Input reference latitude is invalid" );
return FALSE;
}
result = GEODESY_IsLatitudeValid( latitude );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Input latitude is invalid." );
return FALSE;
}
result = GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
referenceEllipse,
referenceLatitude,
referenceLongitude,
referenceHeight,
&x_ref,
&y_ref,
&z_ref );
if( result == FALSE )
{
GNSS_ERROR_MSG( "GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates return FALSE." );
return FALSE;
}
result = GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
referenceEllipse,
latitude,
longitude,
height,
&x,
&y,
&z );
if( result == FALSE )
{
GNSS_ERROR_MSG( "GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates return FALSE." );
return FALSE;
}
// A and B are rotation angles
A = referenceLatitude - HALFPI;
B = referenceLongitude - PI;
cosA = cos(A);
sinA = sin(A);
cosB = cos(B);
sinB = sin(B);
// the cartesian vector between the two points in the geodetic
// frame is rotated to the local geodetic frame
dx = x - x_ref;
dy = y - y_ref;
dz = z - z_ref;
*northing = cosA*cosB * dx + cosA*sinB * dy - sinA*dz;
*easting = sinB * dx - cosB * dy;
*vertical = sinA*cosB * dx + sinA*sinB * dy + cosA*dz;
return TRUE;
}
BOOL GEODESY_ComputePositionDifference(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< reference point geodetic latitude [rad]
const double referenceLongitude, //!< reference point geodetic longitude [rad]
const double referenceHeight, //!< reference point geodetic height [m]
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *difference_northing, //!< difference in northing [m] (+2 m, means 2 m North of the reference)
double *difference_easting, //!< difference in easting [m] (+2 m, means 2 m East of the reference)
double *difference_vertical //!< difference in vertical [m] (+2 m, means 2 m above of the reference)
)
{
BOOL result;
result = GEODESY_ComputeNorthingEastingVertical(
referenceEllipse,
referenceLatitude,
referenceLongitude,
referenceHeight,
latitude,
longitude,
height,
difference_northing,
difference_easting,
difference_vertical );
return result;
}
BOOL GEODESY_ComputeMeridianRadiusOfCurvature(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
double* M //!< computed meridian radius of curvature [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double dtmp;
BOOL result;
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_E2( referenceEllipse, &a, &e2 );
if( result == FALSE )
{
*M = 0;
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return result;
}
dtmp = sin(latitude);
dtmp = sqrt( 1.0 - e2 * dtmp * dtmp ); // W
dtmp = dtmp*dtmp*dtmp; // W^3
*M = a * ( 1.0 - e2 ) / dtmp;
return TRUE;
}
BOOL GEODESY_ComputePrimeVerticalRadiusOfCurvature(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
double* N //!< computed prime vertical radius of curvature [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double W;
BOOL result;
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_E2( referenceEllipse, &a, &e2 );
if( result == FALSE )
{
*N = 0;
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return result;
}
W = sin(latitude);
W = sqrt( 1.0 - e2 * W * W );
*N = a / W;
return TRUE;
}
BOOL GEODESY_ComputeMeridianArcBetweenTwoLatitudes(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< datum geodetic latitude [rad]
const double latitude, //!< geodetic latitude [rad]
double* arc //!< computed meridian arc, North +ve, South -ve [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double e4;
double e6;
double e8;
double dtmp;
double A;
double B;
double C;
double D;
double E;
double arc_ref; // arc from equator for the reference lat [m]
double arc_p; // arc from eqautor for point 'P' [m]
BOOL result;
*arc = 0;
result = GEODESY_IsLatitudeValid( referenceLatitude );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Reference latitude is invalid." );
return result;
}
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_E2( referenceEllipse, &a, &e2 );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return result;
}
e4 = e2*e2;
e6 = e4*e2;
e8 = e6*e2;
dtmp = a*(1.0-e2);
A = dtmp * ( 1.0 + 0.75 * e2 + 0.703125 * e4 + 0.68359375 * e6 + 0.67291259765625 * e8 ); // dtmp * (1.0 + 3.0/4.0*e2 + 45.0/64.0*e4 + 175.0/256.0*e6 + 11025.0/16384.0*e8 );
B = -dtmp * ( 0.375 * e2 + 0.46875 * e4 + 0.5126953125 * e6 + 0.538330078125 * e8 ); // -dtmp * ( 3.0/8.0*e2 + 15.0/32.0*e4 + 525.0/1024.0*e6 + 2205.0/4096.0*e8 );
C = dtmp * ( 0.05859375 * e4 + 0.1025390625 * e6 + 0.13458251953125 * e8 ); // -dtmp * ( 15.0/256.0*e4 + 105.0/1024.0*e6 + 2205.0/16384.0*e8 );
D = -dtmp * ( 0.011393229167 * e6 + 0.025634765625 * e8 ); // -dtmp * ( 35.0/3072.0*e6 + 105.0/4096.0*e8 );
E = dtmp * ( 2.4032593e-03 * e8 );
arc_ref = A*referenceLatitude + B*sin(2.0*referenceLatitude) + C*sin(4.0*referenceLatitude) + D*sin(6.0*referenceLatitude) + E*sin(8.0*referenceLatitude);
arc_p = A*latitude + B*sin(2.0*latitude) + C*sin(4.0*latitude) + D*sin(6.0*latitude) + E*sin(8.0*latitude);
*arc = arc_p - arc_ref;
return TRUE;
}
BOOL GEODESY_ComputeParallelArcBetweenTwoLongitudes(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double longitude, //!< geodetic longitude [rad]
double* arc //!< computed parallel arc, East +ve, West -ve [m]
)
{
double a; // semi-major axis of reference ellipse [m]
double e2; // first eccentricity of reference ellipse []
double N; // computed prime vertical radius of curvature [m]
BOOL result;
*arc = 0;
// get necessary reference ellipse parameters
result = GEODESY_GetReferenceEllipseParameters_A_E2( referenceEllipse, &a, &e2 );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Reference ellipse invalid." );
return result;
}
result = GEODESY_IsLatitudeValid( referenceLatitude );
if( result == FALSE )
{
GNSS_ERROR_MSG( "Reference latitude is invalid." );
return result;
}
N = sin(referenceLatitude);
N = a / sqrt( 1.0 - e2 * N * N );
*arc = N * cos(referenceLatitude) * (longitude - referenceLongitude);
return TRUE;
}
BOOL GEODESY_RotateVectorFromLocalGeodeticFrameToEarthFixedFrame(
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double dN, //!< local geodetic northing vector component [m]
const double dE, //!< local geodetic easting vector component [m]
const double dUp, //!< local geodetic vertical vector component [m]
double* dX, //!< earth centered earth fixed vector component [m]
double* dY, //!< earth centered earth fixed vector component [m]
double* dZ //!< earth centered earth fixed vector component [m]
)
{
double sinlat;
double coslat;
double sinlon;
double coslon;
BOOL result;
result = GEODESY_IsLatitudeValid( referenceLatitude );
if( result == FALSE )
{
*dX = 0;
*dY = 0;
*dZ = 0;
GNSS_ERROR_MSG( "Reference latitude is invalid." );
return result;
}
sinlat = sin(referenceLatitude);
coslat = cos(referenceLatitude);
sinlon = sin(referenceLongitude);
coslon = cos(referenceLongitude);
*dX = -sinlat*coslon * dN - sinlon * dE + coslat*coslon * dUp;
*dY = -sinlat*sinlon * dN + coslon * dE + coslat*sinlon * dUp;
*dZ = coslat * dN + sinlat * dUp;
return TRUE;
}
BOOL GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame(
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double dX, //!< earth centered earth fixed vector component [m]
const double dY, //!< earth centered earth fixed vector component [m]
const double dZ, //!< earth centered earth fixed vector component [m]
double* dN, //!< local geodetic northing vector component [m]
double* dE, //!< local geodetic easting vector component [m]
double* dUp //!< local geodetic vertical vector component [m]
)
{
double sinlat;
double coslat;
double sinlon;
double coslon;
BOOL result;
result = GEODESY_IsLatitudeValid( referenceLatitude );
if( result == FALSE )
{
*dN = 0;
*dE = 0;
*dUp = 0;
GNSS_ERROR_MSG( "Reference latitude is invalid." );
return result;
}
sinlat = sin(referenceLatitude);
coslat = cos(referenceLatitude);
sinlon = sin(referenceLongitude);
coslon = cos(referenceLongitude);
*dN = -sinlat*coslon * dX - sinlat*sinlon * dY + coslat * dZ;
*dE = -sinlon * dX + coslon * dY;
*dUp = coslat*coslon * dX + coslat*sinlon * dY + sinlat * dZ;
return TRUE;
}
BOOL GEODESY_ComputeAzimuthAndElevationAnglesBetweenToPointsInTheEarthFixedFrame(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double fromX, //!< earth centered earth fixed vector from point X component [m]
const double fromY, //!< earth centered earth fixed vector from point Y component [m]
const double fromZ, //!< earth centered earth fixed vector from point Z component [m]
const double toX, //!< earth centered earth fixed vector to point X component [m]
const double toY, //!< earth centered earth fixed vector to point Y component [m]
const double toZ, //!< earth centered earth fixed vector to point Z component [m]
double* elevation, //!< elevation angle [rad]
double* azimuth //!< azimuth angle [rad]
)
{
double lat; // reference geodetic latitude ('from' point) [rad]
double lon; // reference geodetic longitude ('from' point) [rad]
double dX; // ECEF X vector component between 'from' and 'to' point (m)
double dY; // ECEF Y vector component between 'from' and 'to' point (m)
double dZ; // ECEF Z vector component between 'from' and 'to' point (m)
double dN; // LG northing vector component between 'from' and 'to' point (m)
double dE; // LG easting vector component between 'from' and 'to' point (m)
double dUp; // LG vertical vector component between 'from' and 'to' point (m)
double tmp; // temp value
BOOL result;
*elevation = 0;
*azimuth = 0;
// get the reference geodetic curvilinear coordinates from the 'from' point
result = GEODESY_ConvertEarthFixedCartesianToGeodeticCurvilinearCoordinates(
referenceEllipse,
fromX,
fromY,
fromZ,
&lat,
&lon,
&tmp );
if( result == FALSE )
{
GNSS_ERROR_MSG( "GEODESY_ConvertEarthFixedCartesianToGeodeticCurvilinearCoordinates returned FALSE." );
return result;
}
// vector between the two points in the earth fixed frame
dX = toX - fromX;
dY = toY - fromY;
dZ = toZ - fromZ;
// rotate the vector to the local geodetic frame
result = GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame(
lat,
lon,
dX,
dY,
dZ,
&dN,
&dE,
&dUp );
if( result == FALSE )
{
GNSS_ERROR_MSG( "GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame returned FALSE." );
return result;
}
// compute the elevation
tmp = sqrt( dN*dN + dE*dE );
*elevation = atan( dUp / tmp );
// compute the azimuth
*azimuth = atan2(dE, dN);
// by convention, azimuth will be between 0 to 2 PI
if( *azimuth < 0.0 )
*azimuth += TWOPI;
return TRUE;
}

566
src/geodesy.h 100644
Wyświetl plik

@ -0,0 +1,566 @@
/**
\file geodesy.h
\brief GNSS core 'c' function library: geodesy related functions.
\author Glenn D. MacGougan (GDM)
\date 2007-11-28
\since 2005-07-30
\b REFERENCES \n
- NovAtel OEM3 reference manual (www.novatel.com). \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
- Hsu, David Y. (1992). Closed Form Solution for Geodetic Coordinate
Transformation. ION NTM 1992. pp. 397-400. \n
- Misra, Pratap & Per Enge (2004). Global Positioning System Signals
Measurements and Performance. Ganga-Jamuna Press.
ISBN 0-9709544-0-9. PP. 115-116. \n
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _C_GEODESY_H_
#define _C_GEODESY_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "basictypes.h"
/*************************************************************************************************/
// preprocessor constant definitions, any related enumerations and descriptors
/**
\enum GEODESY_enumReferenceEllipse
\brief Enumerated for various reference ellipsoids
Comma delimited data (copy data below to a text file and rename the extension to .csv for easy
viewing in an excel spreadsheet for example. \n
GEODESY_REFERENCE_ELLIPSE_AIRY, 6377563.396, 299.3249647, 6356256.9092444032, 0.00667053999776051,\n
GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY, 6377340.189, 299.3249647, 6356034.4479456525, 0.00667053999776060,\n
GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL, 6378160.0, 298.25, 6356774.7191953063, 0.00669454185458760,\n
GEODESY_REFERENCE_ELLIPSE_BESSEL_1841, 6377397.155, 299.1528128, 6356078.9628181886, 0.00667437223180205,\n
GEODESY_REFERENCE_ELLIPSE_CLARKE_1866, 6378206.4, 294.9786982, 6356583.7999989809, 0.00676865799760959,\n
GEODESY_REFERENCE_ELLIPSE_CLARKE_1880, 6378249.145, 293.465, 6356514.8695497755, 0.00680351128284912,\n
GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830, 6377276.345, 300.8017, 6356075.4131402392, 0.00663784663019987,\n
GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA, 6377298.556, 300.8017, 6356097.5503008962, 0.00663784663019965,\n
GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE, 6377304.063, 300.8017, 6356103.0389931547, 0.00663784663019970,\n
GEODESY_REFERENCE_ELLIPSE_GRS_1980, 6378137.0, 298.257222101, 6356752.3141403561, 0.00669438002290069,\n
GEODESY_REFERENCE_ELLIPSE_HELMERT_1906, 6378200.0, 298.30, 6356818.1696278909, 0.00669342162296610,\n
GEODESY_REFERENCE_ELLIPSE_HOUGH_1960, 6378270.0, 297.00, 6356794.3434343431, 0.00672267002233347,\n
GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924, 6378388.0, 297.00, 6356911.9461279465, 0.00672267002233323,\n
GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969, 6378160.0, 298.25, 6356774.7191953063, 0.00669454185458760,\n
GEODESY_REFERENCE_ELLIPSE_WGS72, 6378135.0, 298.26, 6356750.5200160937, 0.00669431777826668,\n
GEODESY_REFERENCE_ELLIPSE_WGS84, 6378137.0, 298.257223563, 6356752.3142451793, 0.00669437999014132,\n
*/
typedef enum
{
GEODESY_REFERENCE_ELLIPSE_WGS84 = 0, //!< WGS84
GEODESY_REFERENCE_ELLIPSE_AIRY_1830=1, //!< Airy 1830
GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY=2, //!< Modified Airy
GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL=3, //!< Australian National
GEODESY_REFERENCE_ELLIPSE_BESSEL_1841=4, //!< Bessel 1841
GEODESY_REFERENCE_ELLIPSE_CLARKE_1866=5, //!< Clarke 1866
GEODESY_REFERENCE_ELLIPSE_CLARKE_1880=6, //!< Clarke 1880
GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830=7, //!< Everest(India 1830)
GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA=8, //!< Everest(Brunei & E.Malaysia)
GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE=9, //!< Everest(W.Malaysia & Singapore)
GEODESY_REFERENCE_ELLIPSE_GRS_1980=10, //!< Geodetic Reference System 1980
GEODESY_REFERENCE_ELLIPSE_HELMERT_1906=11, //!< Helmert 1906
GEODESY_REFERENCE_ELLIPSE_HOUGH_1960=12, //!< Hough 1960
GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924=13, //!< International 1924
GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969=14, //!< South American 1969
GEODESY_REFERENCE_ELLIPSE_WGS72=15 //!< World Geodetic System 1972
} GEODESY_enumReferenceEllipse;
/**
\var GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION
\brief string array with text description corresponding to GEODESY_enumReferenceEllipse
\see GEODESY_enumReferenceEllipse
*/
static char *GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[64] =
{
"World Geodetic System 1984",
"Airy 1830",
"Modified Airy",
"Australian National",
"Bessel 1841",
"Clarke 1866",
"Clarke 1880",
"Everest(India 1830)",
"Everest(Brunei & E.Malaysia)",
"Everest(W.Malaysia & Singapore)",
"Geodetic Reference System 1980",
"Helmert 1906",
"Hough 1960",
"International 1924",
"South American 1969",
"World Geodetic System 1972",
};
#define GEODESY_REFERENCE_ELLIPSE_WGS84_A (6378137.0)
#define GEODESY_REFERENCE_ELLIPSE_WGS84_F_INV (298.257223563)
#define GEODESY_REFERENCE_ELLIPSE_WGS84_B (6356752.31424518)
#define GEODESY_REFERENCE_ELLIPSE_WGS84_E2 (0.00669437999014132)
#define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_A (6377563.396)
#define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_F_INV (299.3249647)
#define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_B (6356256.9092444)
#define GEODESY_REFERENCE_ELLIPSE_AIRY_1830_E2 (0.00667053999776051)
#define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_A (6377340.189)
#define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_F_INV (299.3249647)
#define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_B (356034.44794565)
#define GEODESY_REFERENCE_ELLIPSE_MODIFED_AIRY_E2 (0.0066705399977606)
#define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_A (6378160.0)
#define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_F_INV (298.25)
#define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_B (6356774.7191953063)
#define GEODESY_REFERENCE_ELLIPSE_AUSTRALIAN_NATIONAL_E2 (0.0066945418545876)
#define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_A (6377397.155)
#define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_F_INV (299.1528128)
#define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_B (6356078.9628181886)
#define GEODESY_REFERENCE_ELLIPSE_BESSEL_1841_E2 (0.00667437223180205)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_A (6378206.4)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_F_INV (294.9786982)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_B (6356583.7999989809)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1866_E2 (0.00676865799760959)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_A (6378249.145)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_F_INV (293.465)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_B (6356514.8695497755)
#define GEODESY_REFERENCE_ELLIPSE_CLARKE_1880_E2 (0.00680351128284912)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_A (6377276.345)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_F_INV (300.8017)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_B (6356075.4131402392)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_INDIA_1830_E2 (0.00663784663019987)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_A (6377298.556)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_F_INV (300.8017)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_B (6356097.5503008962)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_BRUNEI_E_MALAYSIA_E2 (0.00663784663019965)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_A (6377304.063)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_F_INV (300.8017)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_B (6356103.0389931547)
#define GEODESY_REFERENCE_ELLIPSE_EVEREST_W_MALAYSIA_SINGAPORE_E2 (0.00663784663019970)
#define GEODESY_REFERENCE_ELLIPSE_GRS_1980_A (6378137.0)
#define GEODESY_REFERENCE_ELLIPSE_GRS_1980_F_INV (298.257222101)
#define GEODESY_REFERENCE_ELLIPSE_GRS_1980_B (6356752.3141403561)
#define GEODESY_REFERENCE_ELLIPSE_GRS_1980_E2 (0.00669438002290069)
#define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_A (6378200.0)
#define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_F_INV (298.30)
#define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_B (6356818.1696278909)
#define GEODESY_REFERENCE_ELLIPSE_HELMERT_1906_E2 (0.00669342162296610)
#define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_A (6378270.0)
#define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_F_INV (297.00)
#define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_B (6356794.3434343431)
#define GEODESY_REFERENCE_ELLIPSE_HOUGH_1960_E2 (0.00672267002233347)
#define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_A (6378388.0)
#define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_F_INV (297.00)
#define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_B (6356911.9461279465)
#define GEODESY_REFERENCE_ELLIPSE_INTERNATIONAL_1924_E2 (0.00672267002233323)
#define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_A (6378160.0)
#define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_F_INV (298.25)
#define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_B (6356774.7191953063)
#define GEODESY_REFERENCE_ELLIPSE_SOUTH_AMERICAN_1969_E2 (0.00669454185458760)
#define GEODESY_REFERENCE_ELLIPSE_WGS72_A (6378135.0)
#define GEODESY_REFERENCE_ELLIPSE_WGS72_F_INV (298.26)
#define GEODESY_REFERENCE_ELLIPSE_WGS72_B (6356750.5200160937)
#define GEODESY_REFERENCE_ELLIPSE_WGS72_E2 (0.00669431777826668)
/*************************************************************************************************/
/**
\brief This is a look up table function to get reference ellipse parameters.
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b Example \n
\code
double a; //!< semi-major axis of the reference ellipse [m]
double b; //!< semi-minor axis of the reference ellipse (b = a - a*f_inv) [m]
double f_inv; //!< inverse of the flattening of the reference ellipse []
double e2; //!< eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
BOOL result;
result = GEODESY_GetReferenceEllipseParameters( GEODESY_REFERENCE_ELLIPSE_WGS84_A, &a, &b, &f_inv, &e2 );
if( result == TRUE )
{
printf( "ellipse = %s\n", GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[GEODESY_REFERENCE_ELLIPSE_WGS84_A] );
printf( "a = %20.3f\n", a );
printf( "b = %20.9f\n", b );
printf( "f_inv = %20.11f\n", f_inv );
printf( "e2 = %.15f\n\n", e2 );
}
\endcode
\b REFERENCES \n
- NovAtel OEM3 reference manual (www.novatel.com).
*/
BOOL GEODESY_GetReferenceEllipseParameters(
const GEODESY_enumReferenceEllipse ellipse, //!< reference ellipse enumerated []
double* a, //!< semi-major axis of the reference ellipse [m]
double* b, //!< semi-minor axis of the reference ellipse (b = a - a*f_inv) [m]
double* f_inv, //!< inverse of the flattening of the reference ellipse []
double* e2 //!< eccentricity of the reference ellipse (e2 = (a*a-b*b)/(a*a)) []
);
/**
\brief This function converts curvilinear geodetic coordinates from latitude, longitude,
and ellipsoidal height to cartesian geodetic coordinates x, y, and z for the
reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b Example \n
\code
double latitude=0; //!< geodetic latitude [rad]
double longitude=0; //!< geodetic longitude [rad]
double height=0; //!< geodetic height [m]
double x; //!< earth fixed cartesian coordinate [m]
double y; //!< earth fixed cartesian coordinate [m]
double z; //!< earth fixed cartesian coordinate [m]
result = GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
GEODESY_REFERENCE_ELLIPSE_WGS84_A,
latitude,
longitude,
height,
&x,
&y,
&z
);
printf( "ellipse = %s\n", GEODESY_REFERENCE_ELLIPSE_STRING_DESCRIPTION[GEODESY_REFERENCE_ELLIPSE_WGS84_A] );
printf( "latitude = %.12lf\n", latitude );
printf( "longitude = %.12lf\n", longitude );
printf( "height = %.4lf\n", height );
printf( "x = %.4lf\n", x );
printf( "y = %.4lf\n", y );
printf( "z = %.4lf\n\n", z );
\endcode
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary.\n
*/
BOOL GEODESY_ConvertGeodeticCurvilinearToEarthFixedCartesianCoordinates(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *x, //!< earth fixed cartesian coordinate [m]
double *y, //!< earth fixed cartesian coordinate [m]
double *z //!< earth fixed cartesian coordinate [m]
);
/**
\brief This function converts cartesian geodetic coordinates from x, y, and z to
curvilinear geodetic coordinates latitude, longitude, and ellipsoidal
height for the reference ellipse specified. An iterative approach is used.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\remarks
(1) Hsu (1992) shows that the iterative form is slightly faster than the closed form for 3 iterations. \n
(2) Testing by GDM for WGS84, all points lat = -90:1:90 and lon = -180:1:180 were tested
lat, lon, hgt first converted to x, y, z then converted back to lat ,lon, hgt and the number of
iterations noted. No errors observed. 2-5 iterations are needed with a mean of 4.32 iterations. \n
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
Iterative Method - Chapter 3, pp. 33-66.
Closed Form - Appendix B, pp. 178-183. \n
- Hsu, David Y. (1992). Closed Form Solution for Geodetic Coordinate
Transformation. ION NTM 1992. pp. 397-400. \n
- Misra, Pratap & Per Enge (2004). Global Positioning System Signals
Measurements and Performance. Ganga-Jamuna Press.
ISBN 0-9709544-0-9. PP. 115-116. \n
*/
BOOL GEODESY_ConvertEarthFixedCartesianToGeodeticCurvilinearCoordinates(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double x, // earth fixed cartesian coordinate [m]
const double y, // earth fixed cartesian coordinate [m]
const double z, // earth fixed cartesian coordinate [m]
double *latitude, // geodetic latitude [rad]
double *longitude, // geodetic longitude [rad]
double *height // geodetic height [m]
);
/**
\brief Given a reference point (datum) for a local geodetic coordinate system
compute northing easting and vertical of another point given its latitude,
longitude, and height for the reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
[1] Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 4, pp 79. \n
*/
BOOL GEODESY_ComputeNorthingEastingVertical(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< datum geodetic latitude [rad]
const double referenceLongitude, //!< datum geodetic longitude [rad]
const double referenceHeight, //!< datum geodetic height [m]
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *northing, //!< local geodetic northing [m]
double *easting, //!< local geodetic easting [m]
double *vertical //!< local geodetic vertical [m]
);
/**
\brief Compute the difference between two points in a local geodetic frame
using one point as the reference. Can be used to compute position error
with respect to a known reference but keep in mind a local geodetic
frame is used.
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
\see GEODESY_ComputeNorthingEastingVertical
*/
BOOL GEODESY_ComputePositionDifference(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< reference point geodetic latitude [rad]
const double referenceLongitude, //!< reference point geodetic longitude [rad]
const double referenceHeight, //!< reference point geodetic height [m]
const double latitude, //!< geodetic latitude [rad]
const double longitude, //!< geodetic longitude [rad]
const double height, //!< geodetic height [m]
double *difference_northing, //!< difference in northing [m] (+2 m, means 2 m North of the reference)
double *difference_easting, //!< difference in easting [m] (+2 m, means 2 m East of the reference)
double *difference_vertical //!< difference in vertical [m] (+2 m, means 2 m above of the reference)
);
/**
\brief Computes meridian radius of curvature for the reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_ComputeMeridianRadiusOfCurvature(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
double* M //!< computed meridian radius of curvature [m]
);
/**
\brief Computes the prime vertical radius of curvature for the reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_ComputePrimeVerticalRadiusOfCurvature(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double latitude, //!< geodetic latitude [rad]
double* N //!< computed prime vertical radius of curvature [m]
);
/**
\brief Compute the meridian arc between two latitudes for the reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_ComputeMeridianArcBetweenTwoLatitudes(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< datum geodetic latitude [rad]
const double latitude, //!< geodetic latitude [rad]
double* arc //!< computed meridian arc, North +ve, South -ve [m]
);
/**
\brief Compute the parallel arc between two longitudes for the reference ellipse specified.
(e.g. GEODESY_REFERENCE_ELLIPSE_WGS84).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_ComputeParallelArcBetweenTwoLongitudes(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double longitude, //!< geodetic longitude [rad]
double* arc //!< computed parallel arc, East +ve, West -ve [m]
);
/**
\brief Rotates a vector from a Local Geodetic Frame (LG) to and Earth Centered Earth Fixed Frame (ECEF).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_RotateVectorFromLocalGeodeticFrameToEarthFixedFrame(
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double dN, //!< local geodetic northing vector component [m]
const double dE, //!< local geodetic easting vector component [m]
const double dUp, //!< local geodetic vertical vector component [m]
double* dX, //!< earth centered earth fixed vector component [m]
double* dY, //!< earth centered earth fixed vector component [m]
double* dZ //!< earth centered earth fixed vector component [m]
);
/**
\brief Rotates a vector from a Earth Centered Earth Fixed Frame (ECEF) to a Local Geodetic Frame (LG).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
\b REFERENCES \n
- Schwartz, K. P. (1997). ENGO 421 Lecture Notes - Fundamentals of Geodesy.
Chapter 3, pp. 33-66 & Appendix B, pp. 178-183. Geomatics Engineering,
University of Calgary. \n
*/
BOOL GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame(
const double referenceLatitude, //!< reference geodetic latitude [rad]
const double referenceLongitude, //!< reference geodetic longitude [rad]
const double dX, //!< earth centered earth fixed vector component [m]
const double dY, //!< earth centered earth fixed vector component [m]
const double dZ, //!< earth centered earth fixed vector component [m]
double* dN, //!< local geodetic northing vector component [m]
double* dE, //!< local geodetic easting vector component [m]
double* dUp //!< local geodetic vertical vector component [m]
);
/**
\brief Computes the azimuth and elevation angles in the local geodetic (LG) frame between the 'from'
point to the 'to' point given these point in the earth fixed frame.
e.g. between a user gps location (from) and a satellite (to).
\author Glenn D. MacGougan (GDM)
\date 2005-07-30
\since 2005-07-30
\return TRUE(1) if successful, FALSE(0) otherwise.
*/
BOOL GEODESY_ComputeAzimuthAndElevationAnglesBetweenToPointsInTheEarthFixedFrame(
const GEODESY_enumReferenceEllipse referenceEllipse, //!< reference ellipse enumerated []
const double fromX, //!< earth centered earth fixed vector from point X component [m]
const double fromY, //!< earth centered earth fixed vector from point Y component [m]
const double fromZ, //!< earth centered earth fixed vector from point Z component [m]
const double toX, //!< earth centered earth fixed vector to point X component [m]
const double toY, //!< earth centered earth fixed vector to point Y component [m]
const double toZ, //!< earth centered earth fixed vector to point Z component [m]
double* elevation, //!< elevation angle [rad]
double* azimuth //!< azimuth angle [rad]
);
#ifdef __cplusplus
}
#endif
#endif // _C_GEODESY_H_

72
src/gnss_error.h 100644
Wyświetl plik

@ -0,0 +1,72 @@
/**
\file gnss_error.h
\brief GNSS core 'c' function library: error and warning macros.
\author Glenn D. MacGougan (GDM)
\date 2008-03-19
\since 2008-03-19
\remarks
\b "LICENSE INFORMATION" \n
Copyright (c) 2008, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _C_ERROR_H_
#define _C_ERROR_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/**
\brief Output an error message with the following format:\n
file, function, line number, msg\n
\code
char msg[128];
char fname[24];
sprintf( fname, "test.txt" );
sprintf( msg, "Unable to open %s", fname );
ERROR_MSG( msg );
\endcode
\author Glenn D. MacGougan (GDM)
\date 2008-03-19
\since 2008-03-19
*/
#define GNSS_ERROR_MSG( msg ) { const char *themsg = msg; if( themsg != NULL ){ printf( "\n%s,\n%s, %d,\n%s\n", __FILE__, __FUNCTION__, __LINE__, themsg ); }else{ printf( "\n%s,\n%s, %d,\nUnknown Error\n", __FILE__, __FUNCTION__, __LINE__ ); } }
#ifdef __cplusplus
}
#endif
#endif // _C_ERROR_H_

434
src/gnss_types.h 100644
Wyświetl plik

@ -0,0 +1,434 @@
/**
\file gnss_types.h
\brief Basic gnss types.
\author Glenn D. MacGougan (GDM)
\date 2007-12-05
\since 2006-11-13
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _GNSS_TYPES_H_
#define _GNSS_TYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
/// \brief These are the supported receiver data types.
typedef enum GNSS_enumRxDataType
{
GNSS_RXDATA_NOVATELOEM4 = 0, //!< NovAtel OEM4 data.
GNSS_RXDATA_RINEX21 = 1, //!< RINEX version 2.1
GNSS_RXDATA_RINEX211 = 2, //!< RINEX version 2.11
GNSS_RXDATA_UNKNOWN
};
/// A 32 bit bit-field for GNSS measurement associated flags (all are boolean indicators).
typedef struct
{
unsigned isActive:1; //!< This flag indicates that the channel is active for use. If this is not set, no other flags are valid for use.
unsigned isCodeLocked:1; //!< Indicates if the code tracking is locked.
unsigned isPhaseLocked:1; //!< Indicates if the phase tracking is locked.
unsigned isParityValid:1; //!< Indicates if the phase parity if valid.
unsigned isPsrValid:1; //!< Indicates if the pseudorange valid for use.
unsigned isAdrValid:1; //!< Indicates if the ADR is valid for use.
unsigned isDopplerValid:1; //!< Indicates if the Doppler if valid for use.
unsigned isGrouped:1; //!< Indicates if this channel has another associated channel. eg. L1 and L2 measurements.
unsigned isAutoAssigned:1; //!< Indicates if the channel was receiver assigned (otherwise, the user forced this channel assignment).
unsigned isCarrierSmoothed:1; //!< Indicates if the pseudorange has carrier smoothing enabled.
unsigned isEphemerisValid:1; //!< Indicates if this channel has valid associated ephemeris information.
unsigned isAlmanacValid:1; //!< Indicates if this channel has valid associated almanac information.
unsigned isAboveElevationMask:1; //!< Indicates if the satellite tracked is above the elevation mask.
unsigned isAboveCNoMask:1; //!< Indciates if the channel's C/No is above a threshold value.
unsigned isAboveLockTimeMask:1; //!< Indicates if the channel's locktime is above a treshold value.
unsigned isNotUserRejected:1; //!< Indicates if the user has not forced the rejection of this channel or PRN.
unsigned isNotPsrRejected:1; //!< Indicates if the pseudorange was not rejetced (ie Fault Detection and Exclusion).
unsigned isNotAdrRejected:1; //!< Indicates if the ADR was not rejetced (ie Fault Detection and Exclusion).
unsigned isNotDopplerRejected:1; //!< Indicates if the Doppler was not rejected (ie Fault Detection and Exclusion).
unsigned isNoCycleSlipDetected:1; //!< Indicates that no cycle slip has occurred at this epoch.
unsigned isPsrUsedInSolution:1; //!< Indicates if some part (pseudorange) of this channel's measurement was used in the position solution.
unsigned isDopplerUsedInSolution:1; //!< Indicates if some part (Doppler) of this channel's measurement was used in the velocity solution.
unsigned isAdrUsedInSolution:1; //!< Indicates if the the ADR is used in the solution.
unsigned isDifferentialPsrAvailable:1; //!< Indicates if a matching pseudrange observation is available from another receiver.
unsigned isDifferentialDopplerAvailable:1; //!< Indicates if a matching Doppler observation is available from another receiver.
unsigned isDifferentialAdrAvailable:1; //!< Indicates if a matching ADR observation is available from another receiver.
unsigned useTropoCorrection:1; //!< Indicates that the tropospheric correction should be applied.
unsigned useBroadcastIonoCorrection:1; //!< Indicates that the broadcast ionospheric correction should be applied.
unsigned isBaseSatellite:1; //!< Indicates if this channel corresponds to a base satellite used in double differencing.
unsigned isNotPsrDeweighted:1;
unsigned isNotDopplerDeweighted:1;
unsigned isNotAdrDeweighted:1;
} GNSS_structFlagsBitField;
/// \brief An enumerated for a GNSS code modulation type.
///
/// This enumerated uses the NovAtel OEM4 convention.
typedef enum
{
GNSS_CACode = 0,
GNSS_PCode = 1,
GNSS_PCodeless = 2,
GNSS_UWBCodeType = 1614,
GNSS_ReservedCodeType
} GNSS_enumCodeType;
/// \brief An enumeration for a GNSS frequency type.
///
/// This enumerated uses the NovAtel OEM4 convention.
typedef enum
{
GNSS_GPSL1 = 0,
GNSS_GPSL2 = 1,
GNSS_UWBFrequency = 1615,
GNSS_ReservedFrequency
} GNSS_enumFrequency;
/// \brief An enumeration for a GNSS system type.
///
/// This enumerated uses the NovAtel OEM4 convention.
typedef enum
{
GNSS_GPS = 0,
GNSS_GLONASS = 1,
GNSS_WAAS = 2,
GNSS_Pseudolite = 3,
GNSS_UWBSystem = 1616,
GNSS_ReservedSystem
} GNSS_enumSystem;
/// \brief An enumeration for a GNSS measurement type.
typedef enum
{
GNSS_INVALID_MEASUREMENT = 0,
GNSS_PSR_MEASUREMENT = 1,
GNSS_DOPPLER_MEASUREMENT = 2,
GNSS_ADR_MEASUREMENT = 3,
GNSS_LAT_CONSTRAINT = 4,
GNSS_LON_CONSTRAINT = 5,
GNSS_HGT_CONSTRAINT = 6,
GNSS_VN_CONSTRAINT = 7,
GNSS_VE_CONSTRAINT = 8,
GNSS_VUP_CONSTRAINT = 9,
GNSS_RESERVED_MEASUREMENT_TYPE
} GNSS_enumMeasurementType;
/// \brief Correction data associated with a single receiver measurement channel.
/// PRC is PseudRange Correction, RRC is RangeRate Correction.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
float prcTropoDry; //!< Tropospheric dry delay correction (+ve is a delay) [m].
float prcTropoWet; //!< Tropospheric wet delay correction (+ve is a delay) [m].
float prcIono; //!< Ionospheric correction (+ve is a delay) [m].
float prcSatClk; //!< The satellite clock correction (+ve is a delay) [m].
float prcReserved1; //!< A reserved range correction for the pseudorange [m].
float prcReserved2; //!< A reserved range correction for the pseudorange [m].
float rrcSatClkDrift; //!< The satellite clock drift rate correction (+ve is a rate delay) [m/s].
float rrcReserved1; //!< A reserved range rate correction [m/s].
float rrcReserved2; //!< A reserved range rate correction [m/s].
float dX; //!< This channel's associated satellite orbital correction X (ECEF) [m].
float dY; //!< This channel's associated satellite orbital correction X (ECEF) [m].
float dZ; //!< This channel's associated satellite orbital correction X (ECEF) [m].
} GNSS_structCorrections;
/// \brief Residuals data associated with a single receiver measurement channel.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
float psrResidual; //!< The pseudorange residual [m].
float adrResidual; //!< The accumulated Doppler range residual [cycles].
float dopplerResidual; //!< The Doppler residual [Hz].
float reserved; //!< Reserved value.
} GNSS_structResiduals;
/// \brief A struct for satelite data.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
int isValid; //!< This indicates if the pvt information is valid [1=valid, 0=invalid].
int ageOfEph; //!< The difference between the current measurement time and the time of ephemeris.
double x; //!< The satellite position ECEF, x [m].
double y; //!< The satellite position ECEF, y [m].
double z; //!< The satellite position ECEF, z [m].
double vx; //!< The satellite velocity ECEF, vx [m].
double vy; //!< The satellite velocity ECEF, vy [m].
double vz; //!< The satellite velocity ECEF, vz [m].
double clk; //!< The satellite clock correction [m].
double clkdrift; //!< The satellite clock drift correction [m/s].
double elevation; //!< The elevation angle between the user and the satellite [rad].
double azimuth; //!< The azimuth angle between the user and the satellite, measured clockwise positive from the true North [rad].
double doppler; //!< The satellite doppler with respect to the user position [m/s], Note: User must convert to Hz.
} GNSS_structSatellitePVT;
/// \brief A container for klobuchar sytle ionospheric parameters.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
unsigned short isValid; //!< Is this structure valid for use 1=YES, 0=NO.
unsigned short week; //!< The GPS week corresponding to the correction parameters [weeks].
unsigned tow; //!< The GPS time of week corresponding to the correction parameters [s].
double alpha0; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s]
double alpha1; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle]
double alpha2; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle^2]
double alpha3; //!< coefficients of a cubic equation representing the amplitude of the vertical delay [s/semi-circle^3]
double beta0; //!< coefficients of a cubic equation representing the period of the model [s]
double beta1; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle]
double beta2; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle^2]
double beta3; //!< coefficients of a cubic equation representing the period of the model [s/semi-circle^3]
} GNSS_structKlobuchar;
/// \brief Measurement data associated with a single receiver measurement channel.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
unsigned short channel; //!< The channel number associated with this measurement.
unsigned short id; //!< The unique id for this channel (eg PRN for GPS).
GNSS_enumSystem system; //!< The satellite system associated with this channel.
GNSS_enumCodeType codeType; //!< The code type for this channel.
GNSS_enumFrequency freqType; //!< The frequency type for this channel.
GNSS_structFlagsBitField flags; //!< The flags associated with this channel. ie Validity flags, etc.
short reserved1;
unsigned short week; //!< The measurement gps week (at 'transmit' time) [weeks].
double tow; //!< The measurement gps time of week (at 'transmit' time) [s].
// The actual measurements.
double psr; //!< The pseudorange measurement [m].
double adr; //!< The carrier phase or accumulated Doppler range measurement [cycles].
float doppler; //!< The Doppler measurement for this channel [Hz].
float cno; //!< The carrier to noise density ratio for this channel [dB-Hz]
float locktime; //!< The number of seconds of continous phase tracking (no known cycle slips) [s].
// The variance information associated with the actual measurements.
float stdev_psr; //!< The estimated pseudorange measurement standard deviation [m].
float stdev_adr; //!< The estimated accumulated Doppler range measurement standard deviation [cycles].
float stdev_doppler; //!< The estimated Doppler measurement standard deviation [Hz].
// Derived information.
double psr_misclosure; //!< The measured psr minus the computed psr estimate [m].
double doppler_misclosure; //!< The measured Doppler minus the computed Doppler estimate [m/s].
double range; //!< The best estimate of the geometric range between the antenna and the satellite [m].
double rangerate; //!< The best estimate of the geometric range rate between the antenna and the satellite [m/s].
double psr_smoothed; //!< The carrier smoothed pseudorange if available [m].
double psr_predicted; //!< The predicted pseudorange based on the satellite position, user position, and current clock offset [m].
double sd_ambiguity; //!< The estimated single difference float ambiguity [m].
double dd_ambiguity; //!< The estimated double difference float ambiguity [m].
double dd_ambiguity_fixed; //!< The estimated double difference fixed ambiguity [m].
float doppler_predicted; //!< The predicted Doppler based on user position, velocity, satellite position, velocity and clock rate [Hz].
double psr_misclosure_lsq; //!< The measured psr minus the computed psr estimate using least squares [m].
double doppler_misclosure_lsq; //!< The measured Doppler minus the computed Doppler estimate using least squares [m/s].
short index_differential; //!< The channel index of a matching differential observation. -1 means there is no matching channel.
short index_time_differential; //!< The channel index of a matching time differential observation. -1 means there is no matching channel.
short index_between_satellite_differential; //!< The channel index for between satellite difference of the satellite that is substracted from this one. -1 means there is no matching channel.
short index_ambiguity_state; //!< The index into the state vector for the float ambiguity state. -1 not estimated.
short index_ambiguity_state_dd; //!< The index into the state vector for the double difference ambiguity state. -1 not estimated.
short index_psr_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid.
short index_Doppler_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid.
short index_adr_B; //!< A very convenient index into the B matrix used in double differencing. -1 if not valid.
double adr_misclosure; //!< The measured ADR minus the computed ADR estimate [m]. This is the between receiver differential adr misclosure.
double adr_residual_sd; //!< The measured single difference ADR minus the computed single difference ADR estimate after full sequential update.
double adr_residual_dd; //!< The measured double difference ADR minus the computed double difference ADR estimate after full sequential update (float solution).
double adr_residual_dd_fixed; //!< The measured double difference ADR minus the computed double difference ADR estimate after full sequential update and ambiguity fixing.
double adr_misclosure_temp; //!< A temporary variable used to compute adr_misclosure_dd above/
double sd_doppler_covar; //!< Single difference doppler covariance.
double sd_doppler_innovation; //!< Single difference doppler innovation.
double sd_doppler_innovation_standardized; //!< A standardized single difference doppler innovation.
double sd_psr_covar; //!< Single difference psr covariance.
double sd_psr_innovation; //!< Single difference psr innovation.
double sd_psr_innovation_standardized; //!< A standardized single difference psr innovation.
double sd_adr_covar; //!< Single difference adr covariance.
double sd_adr_innovation; //!< Single difference adr innovation.
double sd_adr_innovation_standardized; //!< A standardized single difference adr innovation.
double uwb_bias;
double uwb_scale_factor;
double H_p[3]; //!< The design matrix row relating the pseudorange measurements to the position solution. dP/d(lat), dP/d(lon), dP/d(hgt).
double H_a[3]; //!< The design matrix row relating the adr measurements to the position solution. dP/d(lat), dP/d(lon), dP/d(hgt).
double H_v[3]; //!< The design matrix row relating the Doppler measurements to the velocity solution. dD/d(lat), dD/d(lon), dD/d(hgt).
GNSS_structCorrections corrections; //!< The corrections associated with this channel.
GNSS_structResiduals residuals; //!< The post-adjustment (filtering) measurement residual associated with this channel.
GNSS_structSatellitePVT satellite; //!< Each channel has an associated satellite pvt struct evaluated at the transmit time.
} GNSS_structMeasurement;
/// \brief A struct for holding dilution of precision information.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
float gdop; //!< geometric dilution of precision [].
float pdop; //!< position dilution of precision [].
float ndop; //!< northing dilution of precision [].
float edop; //!< easting dilution of precision [].
float hdop; //!< horizontal dilution of precision [].
float vdop; //!< vertical dilution of precision [].
float tdop; //!< time dilution of precision [].
float reserved; //!< reserved dilution of precision [].
} GNSS_structDOP;
/// \brief A container for time information.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
unsigned short day_of_year; //!< The number of days into the year (1-366) [days].
unsigned short utc_year; //!< Universal Time Coordinated [year]
unsigned char utc_month; //!< Universal Time Coordinated [1-12 months]
unsigned char utc_day; //!< Universal Time Coordinated [1-31 days]
unsigned char utc_hour; //!< Universal Time Coordinated [hours]
unsigned char utc_minute; //!< Universal Time Coordinated [minutes]
float utc_seconds; //!< Universal Time Coordinated [s]
unsigned int gps_week; //!< The current GPS week associated with the observations [weeks].
double gps_tow; //!< The GPS time of week (0-604800.0) (receiver time of observation) [s].
} GNSS_structReceiverTime;
/// \brief A struct for degrees, minutes, seconds, and a string.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
short degrees; //!< The degrees component [deg].
short minutes; //!< The minutes component [min].
float seconds; //!< The seconds component [s]
char dms_str[24]; //!< A DMS string e.g. dms_str = "-180'59'59.9999\""
} GNSS_structDMS;
/// \brief A struct for holding position, velocity and time.
///
/// This struct is 4 and 8 byte struct member packing compatible.
typedef struct
{
GNSS_structReceiverTime time; // The receiver time information.
double pos_apvf; //!< The a-posteriori variance factor for the position solution.
double latitude; //!< The user latitude [rad].
double longitude; //!< The user longitude [rad].
double height; //!< The user orthometric height [m].
double undulation; //!< The undulation [m].
double latitudeDegs; //!< The user latitude [degrees].
double longitudeDegs; //!< The user longitude [degrees].
GNSS_structDMS lat_dms; //!< The user latitude [dms].
GNSS_structDMS lon_dms; //!< The user longitude [dms].
double x; //!< The user's ECEF position, X [m].
double y; //!< The user's ECEF position, Y [m].
double z; //!< The user's ECEF position, Z [m].
double vel_apvf; //!< The a-posteriori variance factor for the velocity solution.
double vn; //!< The user's local geodetic velocity, velocity North [m/s].
double ve; //!< The user's local geodetic velocity, velocity East [m/s].
double vup; //!< The user's local geodetic velocity, velocity Up [m/s].
double vx; //!< The user's ECEF velocity, vx [m/s].
double vy; //!< The user's ECEF velocity, vy [m/s].
double vz; //!< The user's ECEF velocity, vz [m/s].
double clockOffset; //!< The receiver clock offset [m].
double clockDrift; //!< the receiver clock drift [m/s].
GNSS_structDOP dop; //!< All the associated DOP information for this solution.
double std_lat; //!< The standard deviation uncertainty in the latitude [m].
double std_lon; //!< The standard deviation uncertainty in the longitude [m].
double std_hgt; //!< The standard deviation uncertainty in the height [m].
double std_vn; //!< The standard deviation uncertainty in the northing velocity [m/s].
double std_ve; //!< The standard deviation uncertainty in the easting velocity [m/s].
double std_vup; //!< The standard deviation uncertainty in the up velocity [m/s].
double std_clk; //!< The standard deviation uncertainty in the clock offset [m].
double std_clkdrift; //!< The standard deviation uncertainty in the clock drift [m/s].
unsigned char didGlobalTestPassForPosition; //!< Does the position solution pass the Chi^2 goodness of fit test [TRUE(1),FALSE(0)].
unsigned char didGlobalTestPassForVelocity; //!< Does the velocity solution pass the Chi^2 goodness of fit test [TRUE(1),FALSE(0)].
unsigned char isPositionFixed; //!< Is this a position solution fully constrained to a fixed point [TRUE(1),FALSE(0)].
unsigned char isHeightConstrained; //!< Is this a height constrained solution [TRUE(1),FALSE(0)].
unsigned char isClockConstrained; //!< Is this a clock constrained solution [TRUE(1),FALSE(0)].
unsigned char isSolutionBasedOnEphemeris; //!< Is the solution based on valid ephemeris information [TRUE(1),FALSE(0)].
unsigned char nrPsrObsAvailable; //!< This indicates the number of valid pseudorange observations valid before adjustment.
unsigned char nrPsrObsUsed; //!< This indicates the number of valid pseudorange observations valid after adjustment.
unsigned char nrPsrObsRejected; //!< This indicates the number of valid pseudorange observations rejected during adjustment.
unsigned char nrAdrObsAvailable; //!< This indicates the number of valid ADR observations valid before adjustment.
unsigned char nrAdrObsUsed; //!< This indicates the number of valid ADR observations valid after adjustment.
unsigned char nrAdrObsRejected; //!< This indicates the number of valid ADR observations rejected during adjustment.
unsigned char nrDopplerObsAvailable; //!< This indicates the number of valid Doppler observations valid before adjustment.
unsigned char nrDopplerObsUsed; //!< This indicates the number of valid Doppler observations valid after adjustment.
unsigned char nrDopplerObsRejected; //!< This indicates the number of valid Doppler observations rejected during adjustment.
unsigned char reserved[1]; //!< Space for reserved flags.
} GNSS_structPVT;
#ifdef __cplusplus
}
#endif
#endif // _GNSS_TYPES_H_

1138
src/gps.c 100644

Plik diff jest za duży Load Diff

444
src/gps.h 100644
Wyświetl plik

@ -0,0 +1,444 @@
/**
\file gps.h
\brief GNSS core 'c' function library: GPS specific functions.
\author Glenn D. MacGougan (GDM)
\date 2005-08-14
\since 2005-07-31
\b "LICENSE INFORMATION" \n
Copyright (c) 2007, refer to 'author' doxygen tags \n
All rights reserved. \n
Redistribution and use in source and binary forms, with or without
modification, are permitted provided the following conditions are met: \n
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. \n
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. \n
- The name(s) of the contributor(s) may not be used to endorse or promote
products derived from this software without specific prior written
permission. \n
THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#ifndef _C_GPS_H_
#define _C_GPS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "basictypes.h"
/// \brief A set of satellite orbit parameters that is used
/// to calculate GPS satellite positions and velocities. In the ephemeris
/// structure below, the parameters for computing satellite clock corrections
/// are also included.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-14
/// \since 2005-08-14
///
/// \remarks
/// (1) struct packaging: compatible with 4 and 8 byte packing \n
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C, p. 93-102
///
typedef struct
{
unsigned toe; //!< reference time ephemeris (0-604800) [s]
unsigned toc; //!< reference time (clock) (0-604800) [s]
unsigned short prn; //!< GPS PRN number
unsigned short week; //!< 10 bit gps week 0-1023 (user must account for week rollover ) [week]
unsigned short iodc; //!< 10 bit issue of data (clock) []
unsigned short reserved1; //!< reserved bytes
unsigned char iode; //!< 8 bit issue of data (ephemeris) []
unsigned char health; //!< 6 bit health parameter, 0 if healthy, unhealth othersize [0=healthy]
unsigned char alert_flag; //!< 1 = URA may be worse than indicated [0,1]
unsigned char anti_spoof; //!< anti-spoof flag from 0=off, 1=on [0,1]
unsigned char code_on_L2; //!< 0=reserved, 1=P code on L2, 2=C/A on L2 [0,1,2]
unsigned char L2_P_data_flag; //!< flag indicating if P is on L2 1=true [0,1]
unsigned char fit_interval_flag; //!< fit interval flag (four hour interval or longer) 0=4 fours, 1=greater [0,1]
unsigned char ura; //!< User Range Accuracy lookup code, 0 is excellent, 15 is use at own risk [0-15], see p. 83 GPSICD200C
unsigned short age_of_data_offset; //!< age of data offset [s]
unsigned short tow_week; //!< The week corresponding to tow (0-1024+). Can be one week larger than week. [week]
unsigned tow; //!< The time of week derived formt the Z-count in the Hand Over Word (HOW) [s]
// clock parameters
double tgd; //!< group delay [s]
double af2; //!< polynomial clock correction coefficient (rate of clock drift) [s/s^2]
double af1; //!< polynomial clock correction coefficient (clock drift) [s/s] Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
double af0; //!< polynomial clock correction coefficient (clock bias) [s] Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
// ephemeris parameters
double m0; //!< mean anomaly at reference time [rad]
double delta_n; //!< mean motion difference from computed value [rad/s]
double ecc; //!< eccentricity []
double sqrta; //!< square root of the semi-major axis [m^(1/2)]
double omega0; //!< longitude of ascending node of orbit plane at weekly epoch [rad]
double i0; //!< inclination angle at reference time [rad]
double w; //!< argument of perigee [rad]
double omegadot; //!< rate of right ascension [rad/s]
double idot; //!< rate of inclination angle [rad/s]
double cuc; //!< amplitude of the cosine harmonic correction term to the argument of latitude [rad]
double cus; //!< amplitude of the sine harmonic correction term to the argument of latitude [rad]
double crc; //!< amplitude of the cosine harmonic correction term to the orbit radius [m]
double crs; //!< amplitude of the sine harmonic correction term to the orbit radius [m]
double cic; //!< amplitude of the cosine harmonic correction term to the angle of inclination [rad]
double cis; //!< amplitude of the sine harmonic correction term to the angle of inclination [rad]
} GPS_structEphemeris;
/// \brief A limited set of satellite orbit parameters that is used to
/// calculate rough GPS satellite positions and velocities. The parameters
/// for computing rough satellite clock corrections are also included.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-18
/// \since 2005-08-18
///
/// \remarks
/// (1) struct packaging: compatible with 4 and 8 byte packing
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C, p. 108
///
typedef struct
{
unsigned toa; //!< almanac time of applicability [s]
unsigned reserved; //!< reserved []
double ecc; //!< eccentricity []
double i0; //!< inclination angle at reference time [rad]
double omegadot; //!< rate of right ascension [rad/s]
double sqrta; //!< square root of the semi-major axis [m^(1/2)]
double omega0; //!< longitude of ascending node of orbit plane at weekly epoch [rad]
double w; //!< argument of perigee [rad]
double m0; //!< mean anomaly at reference time [rad]
double af0; //!< polynomial clock correction coefficient (clock bias) [s] Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
double af1; //!< polynomial clock correction coefficient (clock drift) [s/s] Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
} GPS_structAlmanac;
/// Computes the satellite clock and clock dirft corrections given the clock model and ephemeris
/// information.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-12
/// \since 2005-08-12
///
/// \remarks
/// (1) The clock correction parameter is sensitive to the polynomial coefficient source which is
/// either ephemeris related from subframe 1 or from the gps almanac (subframes 4,5). The
/// ephemeris parameters have higher precision 22 & 16 vs 11 & 11 bits. \n
/// (2) User must compensate for the GPS week rollover \n
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C, p. 88-101 \n
/// [2] Teunissen, P. J. G. & A. Kleusberg (editors) (1998). GPS for Geodesy, 2nd Edition. pp. 43-107
/// [3] Hofmann-Wellenhof, B. & J. Collins (1994). GPS Theory and Practice, 3rd Edition. \n
/// Springer-Verlag Wien New York, pp. 43-74 \n
/// [4] Wong, R.V.C & K.P. Schwarz (1985). Dynamic Positioning with an Integrated GPS-INS. Formulae and
/// Baseline Tests. University of Calgary. UCSE Report #30003. pp. 22 \n
///
void GPS_ComputeSatelliteClockCorrectionAndDrift(
const unsigned short transmission_gpsweek, //!< GPS week when signal was transmit (0-1024+) [weeks]
const double transmission_gpstow, //!< GPS time of week when signal was transmit [s]
const unsigned short ephem_week, //!< ephemeris: GPS week (0-1024+) [weeks]
const unsigned toe, //!< ephemeris: time of week [s]
const unsigned toc, //!< ephemeris: clock reference time of week [s]
const double af0, //!< ephemeris: polynomial clock correction coefficient [s], Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
const double af1, //!< ephemeris: polynomial clock correction coefficient [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
const double af2, //!< ephemeris: polynomial clock correction coefficient [s/s^2]
const double ecc, //!< ephemeris: eccentricity of satellite orbit []
const double sqrta, //!< ephemeris: square root of the semi-major axis of orbit [m^(1/2)]
const double delta_n, //!< ephemeris: mean motion difference from computed value [rad]
const double m0, //!< ephemeris: mean anomaly at reference time [rad]
const double tgd, //!< ephemeris: group delay differential between L1 and L2 [s]
const unsigned char mode, //!< 0=L1 only, 1=L2 only (see p. 90, ICD-GPS-200C)
double* clock_correction, //!< satellite clock correction [m]
double* clock_drift //!< satellite clock drift correction [m/s]
);
/// Computes the satellite position and velocity in WGS84 based on the supplied ephemeris/almanac
/// parameters.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-07-31
/// \since 2005-07-31
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C, p. 94-101 \n
/// [2] Teunissen, P. J. G. & A. Kleusberg (editors) (1998). GPS for Geodesy, 2nd Edition. pp. 43-107 \n
/// [3] Hofmann-Wellenhof, B. & J. Collins (1994). GPS Theory and Practice, 3rd Edition.
/// Springer-Verlag Wien New York, pp. 43-74 \n
/// [4] Wong, R.V.C & K.P. Schwarz (1985). Dynamic Positioning with an Integrated GPS-INS. Formulae and
/// Baseline Tests. University of Calgary. UCSE Report #30003. pp. 22 \n
///
void GPS_ComputeSatellitePositionAndVelocity(
const unsigned short transmission_gpsweek, //!< GPS week when signal was transmit (0-1024+) [weeks]
const double transmission_gpstow, //!< GPS time of week when signal was transmit [s]
const unsigned short ephem_week, //!< ephemeris: GPS week (0-1024+) [weeks]
const unsigned toe, //!< ephemeris: time of week [s]
const double m0, //!< ephemeris: mean anomaly at reference time [rad]
const double delta_n, //!< ephemeris: mean motion difference from computed value [rad]
const double ecc, //!< ephemeris: eccentricity []
const double sqrta, //!< ephemeris: square root of the semi-major axis [m^(1/2)]
const double omega0, //!< ephemeris: longitude of ascending node of orbit plane at weekly epoch [rad]
const double i0, //!< ephemeris: inclination angle at reference time [rad]
const double w, //!< ephemeris: argument of perigee [rad]
const double omegadot, //!< ephemeris: rate of right ascension [rad/s]
const double idot, //!< ephemeris: rate of inclination angle [rad/s]
const double cuc, //!< ephemeris: amplitude of the cosine harmonic correction term to the argument of latitude [rad]
const double cus, //!< ephemeris: amplitude of the sine harmonic correction term to the argument of latitude [rad]
const double crc, //!< ephemeris: amplitude of the cosine harmonic correction term to the orbit radius [m]
const double crs, //!< ephemeris: amplitude of the sine harmonic correction term to the orbit radius [m]
const double cic, //!< ephemeris: amplitude of the cosine harmonic correction term to the angle of inclination [rad]
const double cis, //!< ephemeris: amplitude of the sine harmonic correction term to the angle of inclination [rad]
const double estimateOfTrueRange, //!< best estimate of the signal propagation time (in m) for Sagnac effect compensation [m]
const double estimteOfRangeRate, //!< best estimate of the true signal Doppler (in m/s) for Sagnac effect compensation [m/s]
double* x, //!< satellite x [m]
double* y, //!< satellite y [m]
double* z, //!< satellite z [m]
double* vx, //!< satellite velocity x [m/s]
double* vy, //!< satellite velocity y [m/s]
double* vz //!< satellite velocity z [m/s]
);
/// Computes the user to satellite range given the user and
/// satellite position.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2006-11-23
/// \since 2006-11-23
///
void GPS_ComputeUserToSatelliteRange(
const double userX, //!< user X position WGS84 ECEF [m]
const double userY, //!< user Y position WGS84 ECEF [m]
const double userZ, //!< user Z position WGS84 ECEF [m]
const double satX, //!< satellite X position WGS84 ECEF [m]
const double satY, //!< satellite Y positoin WGS84 ECEF [m]
const double satZ, //!< satellite Z position WGS84 ECEF [m]
double* range //!< user to satellite range [m]
);
/// Computes the user to satellite range and range rate given the user and satellite
/// position and velocities.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-15
/// \since 2005-08-15
///
void GPS_ComputeUserToSatelliteRangeAndRangeRate(
const double userX, //!< user X position WGS84 ECEF [m]
const double userY, //!< user Y position WGS84 ECEF [m]
const double userZ, //!< user Z position WGS84 ECEF [m]
const double userVx, //!< user X velocity WGS84 ECEF [m/s]
const double userVy, //!< user Y velocity WGS84 ECEF [m/s]
const double userVz, //!< user Z velocity WGS84 ECEF [m/s]
const double satX, //!< satellite X position WGS84 ECEF [m]
const double satY, //!< satellite Y positoin WGS84 ECEF [m]
const double satZ, //!< satellite Z position WGS84 ECEF [m]
const double satVx, //!< satellite X velocity WGS84 ECEF [m/s]
const double satVy, //!< satellite Y velocity WGS84 ECEF [m/s]
const double satVz, //!< satellite Z velocity WGS84 ECEF [m/s]
double* range, //!< user to satellite range [m]
double* range_rate //!< user to satellite range rate [m/s]
);
/// Computes the satellite position and velocity in WGS84 based on almanac data.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-15
/// \since 2005-08-15
///
/// \remarks
/// (1) Assumes L1 for the clock correction mode \n
/// (2) This calculation solves for the satellite position at the true GPS time of week specified.
/// It includes compensation for the satellite clock correction and the Saganc effect, which
/// is a function of the user position. \n
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C
///
void GPS_ComputeSatellitePositionVelocityAzimuthElevationDoppler_BasedOnAlmanacData(
const double userX, //!< user X position WGS84 ECEF [m]
const double userY, //!< user Y position WGS84 ECEF [m]
const double userZ, //!< user Z position WGS84 ECEF [m]
const unsigned short gpsweek, //!< user gps week (0-1024+) [week]
const double gpstow, //!< user time of week [s]
const double toa, //!< time of applicability [s]
const unsigned short almanac_week, //!< gps week of almanac (0-1024+) [week]
const unsigned short prn, //!< GPS prn number []
const double ecc, //!< eccentricity []
const double i0, //!< orbital inclination at reference time [rad]
const double omegadot, //!< rate of right ascension [rad/s]
const double sqrta, //!< square root of the semi-major axis [m^(1/2)]
const double omega0, //!< longitude of ascending node of orbit plane at weekly epoch [rad]
const double w, //!< argument of perigee [rad]
const double m0, //!< mean anomaly at reference time [rad]
const double af0, //!< polynomial clock correction coefficient (clock bias) [s], Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
const double af1, //!< polynomial clock correction coefficient (clock drift) [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
double* clock_correction, //!< clock correction for this satellite for this epoch [m]
double* clock_drift, //!< clock drift correction for this satellite for this epoch [m/s]
double* satX, //!< satellite X position WGS84 ECEF [m]
double* satY, //!< satellite Y position WGS84 ECEF [m]
double* satZ, //!< satellite Z position WGS84 ECEF [m]
double* satVx, //!< satellite X velocity WGS84 ECEF [m/s]
double* satVy, //!< satellite Y velocity WGS84 ECEF [m/s]
double* satVz, //!< satellite Z velocity WGS84 ECEF [m/s]
double* azimuth, //!< satelilte azimuth [rad]
double* elevation, //!< satelilte elevation [rad]
double* doppler //!< satellite doppler with respect to the user position [m/s], Note: User must convert to Hz
);
/// Computes the satellite position and velocity in WGS84 based on ephemeris data.
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-15
/// \since 2005-08-15
///
/// \remarks
/// (1) Assumes L1 for the clock correction mode \n
/// (2) This calculation solves for the satellite position at the true GPS time of week specified.
/// It includes compensation for the satellite clock correction and the Saganc effect, which
/// is a function of the user position. \n
/// (3) This function can be called with almanac data by inputting the almanac information and
/// zero for the terms not available. toe and toc are the toa in that case. \n
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C
///
void GPS_ComputeSatellitePositionVelocityAzimuthElevationDoppler_BasedOnEphmerisData(
const double userX, //!< user X position WGS84 ECEF [m]
const double userY, //!< user Y position WGS84 ECEF [m]
const double userZ, //!< user Z position WGS84 ECEF [m]
const unsigned short gpsweek, //!< gps week of signal transmission (0-1024+) [week]
const double gpstow, //!< time of week of signal transmission (gpstow-psr/c) [s]
const unsigned short ephem_week, //!< ephemeris: GPS week (0-1024+) [weeks]
const unsigned toe, //!< ephemeris: time of week [s]
const unsigned toc, //!< ephemeris: clock reference time of week [s]
const double af0, //!< ephemeris: polynomial clock correction coefficient [s], Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
const double af1, //!< ephemeris: polynomial clock correction coefficient [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
const double af2, //!< ephemeris: polynomial clock correction coefficient [s/s^2]
const double tgd, //!< ephemeris: group delay differential between L1 and L2 [s]
const double m0, //!< ephemeris: mean anomaly at reference time [rad]
const double delta_n, //!< ephemeris: mean motion difference from computed value [rad/s]
const double ecc, //!< ephemeris: eccentricity []
const double sqrta, //!< ephemeris: square root of the semi-major axis [m^(1/2)]
const double omega0, //!< ephemeris: longitude of ascending node of orbit plane at weekly epoch [rad]
const double i0, //!< ephemeris: inclination angle at reference time [rad]
const double w, //!< ephemeris: argument of perigee [rad]
const double omegadot, //!< ephemeris: rate of right ascension [rad/s]
const double idot, //!< ephemeris: rate of inclination angle [rad/s]
const double cuc, //!< ephemeris: amplitude of the cosine harmonic correction term to the argument of latitude [rad]
const double cus, //!< ephemeris: amplitude of the sine harmonic correction term to the argument of latitude [rad]
const double crc, //!< ephemeris: amplitude of the cosine harmonic correction term to the orbit radius [m]
const double crs, //!< ephemeris: amplitude of the sine harmonic correction term to the orbit radius [m]
const double cic, //!< ephemeris: amplitude of the cosine harmonic correction term to the angle of inclination [rad]
const double cis, //!< ephemeris: amplitude of the sine harmonic correction term to the angle of inclination [rad]
double* clock_correction, //!< clock correction for this satellite for this epoch [m]
double* clock_drift, //!< clock drift correction for this satellite for this epoch [m/s]
double* satX, //!< satellite X position WGS84 ECEF [m]
double* satY, //!< satellite Y position WGS84 ECEF [m]
double* satZ, //!< satellite Z position WGS84 ECEF [m]
double* satVx, //!< satellite X velocity WGS84 ECEF [m/s]
double* satVy, //!< satellite Y velocity WGS84 ECEF [m/s]
double* satVz, //!< satellite Z velocity WGS84 ECEF [m/s]
double* azimuth, //!< satelilte azimuth [rad]
double* elevation, //!< satelilte elevation [rad]
double* doppler //!< satellite doppler with respect to the user position [m/s], Note: User must convert to Hz
);
/// Decodes the raw gps ephemeris (note, with the parity bits removed).
///
/// \author Glenn D. MacGougan (GDM)
/// \date 2005-08-15
/// \since 2005-08-15
///
/// \returns TRUE(1) if successful, FALSE(0) otherwise
///
/// \remarks
/// (1) Parity bits must be removed from the input subframe data \n
/// (2) Returns TRUE(1) if data is successfully decoded \n
/// (3) Returns FALSE(0) if the subframe id's are incorrect, i.e. must be subframe1, subframe2, subframe3 in that order \n
/// (4) Returns FALSE(0) if the iode's are not consistent for all subframes, note 8 LSB bits of the iodc should equal
/// subframe2 and subframe3 iode \n
/// (5) Uses IBM PC format byte alignment \n
///
/// \b REFERENCES \n
/// [1] ICD-GPS-200C
///
BOOL GPS_DecodeRawGPSEphemeris(
const unsigned char subframe1[30], //!< subframe 1 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
const unsigned char subframe2[30], //!< subframe 2 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
const unsigned char subframe3[30], //!< subframe 3 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
unsigned short prn, //!< GPS PRN number (helps with debugging)
unsigned* tow, //!< time of week in subframe1, the time of the leading bit edge of subframe 2 [s]
unsigned short* iodc, //!< 10 bit issue of data (clock), 8 LSB bits will match the iode []
unsigned char* iode, //!< 8 bit issue of data (ephemeris) []
unsigned* toe, //!< reference time ephemeris (0-604800) [s]
unsigned* toc, //!< reference time (clock) (0-604800) [s]
unsigned short* week, //!< 10 bit gps week 0-1023 (user must account for week rollover ) [week]
unsigned char* health, //!< 6 bit health parameter, 0 if healthy, unhealth othersize [0=healthy]
unsigned char* alert_flag, //!< 1 = URA may be worse than indicated [0,1]
unsigned char* anti_spoof, //!< anti-spoof flag from 0=off, 1=on [0,1]
unsigned char* code_on_L2, //!< 0=reserved, 1=P code on L2, 2=C/A on L2 [0,1,2]
unsigned char* ura, //!< User Range Accuracy lookup code, 0 is excellent, 15 is use at own risk [0-15], see p. 83 GPSICD200C
unsigned char* L2_P_data_flag, //!< flag indicating if P is on L2 1=true [0,1]
unsigned char* fit_interval_flag, //!< fit interval flag (four hour interval or longer) 0=4 fours, 1=greater [0,1]
unsigned short* age_of_data_offset, //!< age of data offset [s]
double* tgd, //!< group delay [s]
double* af2, //!< polynomial clock correction coefficient (rate of clock drift) [s/s^2]
double* af1, //!< polynomial clock correction coefficient (clock drift) [s/s]
double* af0, //!< polynomial clock correction coefficient (clock bias) [s]
double* m0, //!< mean anomaly at reference time [rad]
double* delta_n, //!< mean motion difference from computed value [rad/s]
double* ecc, //!< eccentricity []
double* sqrta, //!< square root of the semi-major axis [m^(1/2)]
double* omega0, //!< longitude of ascending node of orbit plane at weekly epoch [rad]
double* i0, //!< inclination angle at reference time [rad]
double* w, //!< argument of perigee [rad]
double* omegadot, //!< rate of right ascension [rad/s]
double* idot, //!< rate of inclination angle [rad/s]
double* cuc, //!< amplitude of the cosine harmonic correction term to the argument of latitude [rad]
double* cus, //!< amplitude of the sine harmonic correction term to the argument of latitude [rad]
double* crc, //!< amplitude of the cosine harmonic correction term to the orbit radius [m]
double* crs, //!< amplitude of the sine harmonic correction term to the orbit radius [m]
double* cic, //!< amplitude of the cosine harmonic correction term to the angle of inclination [rad]
double* cis //!< amplitude of the sine harmonic correction term to the angle of inclination [rad]
);
#ifdef __cplusplus
}
#endif
#endif // _C_GPS_H_

1294
src/gps2aprs.c 100644

Plik diff jest za duży Load Diff

856
src/gps2digipos.c 100644
Wyświetl plik

@ -0,0 +1,856 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#define X2C_int32
#define X2C_index32
#ifndef X2C_H_
#include "X2C.h"
#endif
#define gps2digipos_C_
#ifndef osi_H_
#include "osi.h"
#endif
#include <osic.h>
#ifndef mlib_H_
#include "mlib.h"
#endif
#ifndef aprsstr_H_
#include "aprsstr.h"
#endif
/* read serial gps and make "3704.04N/00805.14W" string to file */
#define gps2digipos_CR "\015"
#define gps2digipos_LF "\012"
#define gps2digipos_FEET 3.2808398950131
#define gps2digipos_KNOTS 1.851984
#define gps2digipos_PI 3.1415926535898
static char tbuf[1024];
static char ttynamee[1024];
static char basefilename[1024];
/* symt, symb:CHAR; */
static uint32_t baud;
static int32_t tty;
static char verb;
static char usbrobust;
static char junk;
static char sumoff;
static char withalti;
static uint32_t comptyp;
static uint32_t comintval;
static uint32_t comcnt;
static uint32_t mediantime;
static uint32_t medians;
static struct termios saved;
static double speed;
static double course;
static double lat;
static double long0;
static double alt;
static char altok;
static char posok;
struct _0;
struct _0 {
double mlat;
double mlong;
double malt;
char ok0;
};
static struct _0 median[500];
static void Error(char text[], uint32_t text_len)
{
X2C_PCOPY((void **)&text,text_len);
osi_WrStr("agps2digipos: ", 15ul);
osi_WrStr(text, text_len);
osi_WrStrLn(" error abort", 13ul);
X2C_ABORT();
X2C_PFREE(text);
} /* end Error() */
static uint32_t truncc(double r)
{
if (r<=0.0) return 0UL;
else if (r>=2.147483647E+9) return 2147483647UL;
else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard);
return 0;
} /* end truncc() */
static char SetStatLine(int32_t fd, char rts,
char dtr)
{
uint32_t arg[256];
int32_t r;
arg[0U] = 4UL;
if (rts) r = ioctl(fd, 21526L, (char *)arg);
else r = ioctl(fd, 21527L, (char *)arg);
if (r>=0L) {
arg[0U] = 2UL;
if (dtr) r = ioctl(fd, 21526L, (char *)arg);
else r = ioctl(fd, 21527L, (char *)arg);
}
return r>=0L;
} /* end SetStatLine() */
static void SetComMode(int32_t fd, uint32_t baud0)
{
struct termios term;
int32_t res;
uint32_t bd;
struct termios * anonym;
if (baud0==1200UL) bd = 9UL;
else if (baud0==2400UL) bd = 11UL;
else if (baud0==4800UL) bd = 12UL;
else if (baud0==9600UL) bd = 13UL;
else if (baud0==19200UL) bd = 14UL;
else if (baud0==38400UL) bd = 15UL;
else if (baud0==57600UL) bd = 4097UL;
else if (baud0==115200UL) bd = 4098UL;
else if (baud0==230400UL) bd = 4099UL;
else if (baud0==460800UL) bd = 4100UL;
else Error("unknown baudrate", 17ul);
res = tcgetattr(fd, &saved);
res = tcgetattr(fd, &term);
{ /* with */
struct termios * anonym = &term;
anonym->c_lflag = 0UL;
anonym->c_oflag = 0UL;
anonym->c_iflag = 0UL;
/* cfmakeraw(&termios);*/
anonym->c_cflag = 2224UL+bd; /*+CRTSCTS*/ /*0800018B2H*/
}
res = tcsetattr(fd, 2L, &term);
} /* end SetComMode() */
static void opentty(void)
{
for (;;) {
tty = osi_OpenRW(ttynamee, 1024ul);
if (tty>=0L) {
SetComMode(tty, baud);
break;
}
if (!usbrobust) Error("tty open", 9ul);
usleep(1000000UL);
}
SetStatLine(tty, 0, 0);
} /* end opentty() */
static char GetNum(const char h[], uint32_t h_len, char eot,
uint32_t * p, uint32_t * n)
{
*n = 0UL;
while ((uint8_t)h[*p]>='0' && (uint8_t)h[*p]<='9') {
*n = ( *n*10UL+(uint32_t)(uint8_t)h[*p])-48UL;
++*p;
}
return h[*p]==eot;
} /* end GetNum() */
static void Parms(void)
{
char err;
char h[1024];
uint32_t i;
err = 0;
for (;;) {
osi_NextArg(h, 1024ul);
if (h[0U]==0) break;
if ((h[0U]=='-' && h[1U]) && h[2U]==0) {
if (h[1U]=='u') usbrobust = 0;
else if (h[1U]=='s') sumoff = 1;
else if (h[1U]=='a') withalti = 1;
else if (h[1U]=='f') {
/*
ELSIF h[1]="i" THEN
NextArg(h);
IF h[0]>" " THEN
symt:=h[0];
IF h[1]>" " THEN symb:=h[1] ELSE symb:=0C END;
ELSE Error("-i <icon> (house /-)") END;
*/
osi_NextArg(basefilename, 1024ul);
if (basefilename[0U]==0) Error("-f filename", 12ul);
}
else if (h[1U]=='t') {
osi_NextArg(h, 1024ul);
i = 0UL;
while ((h[i] && h[i]!=':') && i<1023UL) {
ttynamee[i] = h[i];
++i;
}
ttynamee[i] = 0;
if (h[i]) {
++i;
if (!GetNum(h, 1024ul, 0, &i, &baud)) {
Error("need ttydevice:baud", 20ul);
}
}
}
else if (h[1U]=='m') {
osi_NextArg(h, 1024ul);
i = 0UL;
if (!GetNum(h, 1024ul, 0, &i, &mediantime)) {
Error("-m <seconds>", 13ul);
}
if (mediantime>499UL) {
aprsstr_IntToStr(499L, 1UL, h, 1024ul);
aprsstr_Append(h, 1024ul, " maximum -m", 12ul);
Error(h, 1024ul);
}
}
else if (h[1U]=='f') {
osi_NextArg(h, 1024ul);
i = 0UL;
if (!GetNum(h, 1024ul, 0, &i, &comptyp) || comptyp>2UL) {
Error("-f <format> 0=uncomp, 1=comp, 2=mic-e", 38ul);
}
}
else if (h[1U]=='v') verb = 1;
else {
if (h[1U]=='h') {
osic_WrLn();
osi_WrStrLn("Read serial GPS and make position string to inser\
t into APRS-beacon", 68ul);
osi_WrStrLn(" -a altitude on",
47ul);
osi_WrStrLn(" -f <filename> writes <fn.lat\
> <fn.long> and <filename.alt>", 80ul);
osi_WrStrLn(" -h this", 40ul);
/* WrStrLn('
-i <icon> 2 Icon chars "/-" (House),
"/>" (Car)...'); */
osi_WrStrLn(" -m <seconds> time to read g\
ps to make median position", 76ul);
osi_WrStrLn(" -s GPS Checksum c\
heck OFF", 58ul);
osi_WrStrLn(" -t <tty>:<baud> default /dev/t\
tyS0:9600", 59ul);
osi_WrStrLn(" -u not retry unti\
l open removable USB tty", 74ul);
osi_WrStrLn(" -v verbous",
43ul);
osi_WrStrLn(" example: -t /dev/ttyS0:9600 -u -f test -i \"/-\\
" -a -m 30 -v", 61ul);
osic_WrLn();
X2C_ABORT();
}
err = 1;
}
}
else {
/*
h[0]:=0C;
*/
err = 1;
}
if (err) break;
}
if (err) {
osi_WrStr(">", 2ul);
osi_WrStr(h, 1024ul);
osi_WrStrLn("< use -h", 9ul);
X2C_ABORT();
}
} /* end Parms() */
static void skip(const char b[], uint32_t b_len, uint32_t * p,
uint32_t len0)
{
while (*p<len0 && b[*p]!=',') ++*p;
if (*p<len0) ++*p;
} /* end skip() */
static char getnum(const char b[], uint32_t b_len,
uint32_t * p, uint32_t len0, uint32_t * n)
{
if ((*p<len0 && (uint8_t)b[*p]>='0') && (uint8_t)b[*p]<='9') {
*n = (uint32_t)(uint8_t)b[*p]-48UL;
++*p;
return 1;
}
*n = 0UL;
return 0;
} /* end getnum() */
static void decodeline(const char b[], uint32_t b_len,
uint32_t len0)
{
uint32_t n;
uint32_t i;
double div0;
char sign;
if ((b[0UL]=='$' && b[1UL]=='G') && b[2UL]=='P') {
if ((b[3UL]=='R' && b[4UL]=='M') && b[5UL]=='C') {
/* $GPRMC,141333.593,A,8915.1000,N,01300.2000,E,0.00,00.00,140410,0,
,A*7C */
/* $GPRMC,112430.00,A,8912.41130,N,01300.61995,E,0.039,,200513,,,
A*77 */
i = 7UL;
skip(b, b_len, &i, len0);
if (b[i]!='A') return;
skip(b, b_len, &i, len0);
if (getnum(b, b_len, &i, len0, &n)) {
lat = (double)(float)(n*10UL);
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(float)n;
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,6.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,60.0f));
}
else return;
if (b[i]=='.') ++i;
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,600.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,6000.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,60000.0f));
}
if (getnum(b, b_len, &i, len0, &n)) {
lat = lat+(double)(X2C_DIVR((float)n,6.E+5f));
}
skip(b, b_len, &i, len0);
if (b[i]=='S') lat = -lat;
else if (b[i]!='N') return;
skip(b, b_len, &i, len0);
if (getnum(b, b_len, &i, len0, &n)) {
long0 = (double)(float)(n*100UL);
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(float)(n*10UL);
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(float)n;
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,6.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,60.0f));
}
else return;
if (b[i]=='.') ++i;
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,600.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,6000.0f));
}
else return;
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,60000.0f));
}
if (getnum(b, b_len, &i, len0, &n)) {
long0 = long0+(double)(X2C_DIVR((float)n,6.E+5f));
}
skip(b, b_len, &i, len0);
if (b[i]=='W') long0 = -long0;
else if (b[i]!='E') return;
skip(b, b_len, &i, len0);
speed = 0.0;
while (getnum(b, b_len, &i, len0, &n)) {
speed = speed*10.0+(double)(float)n;
}
if (b[i]=='.') {
++i;
div0 = 0.1;
while (getnum(b, b_len, &i, len0, &n)) {
speed = speed+(double)(float)n*div0;
div0 = div0*0.1;
}
}
speed = speed*1.851984; /* knots to km/h */
skip(b, b_len, &i, len0);
course = 0.0;
while (getnum(b, b_len, &i, len0, &n)) {
course = course*10.0+(double)(float)n;
}
if (b[i]=='.') {
++i;
div0 = 0.1;
while (getnum(b, b_len, &i, len0, &n)) {
course = course+(double)(float)n*div0;
div0 = div0*0.1;
}
}
posok = 1;
}
else if ((b[3UL]=='G' && b[4UL]=='G') && b[5UL]=='A') {
/* $GPGGA,152554,3938.5665,N,10346.2039,W,1,08,1.7,12382.7,M,-22.3,
M,,*7B */
/* $GPGGA,112435.00,4812.41112,N,01305.61998,E,1,08,1.04,398.3,M,
44.9,M,,*59 */
i = 7UL;
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
skip(b, b_len, &i, len0);
alt = 0.0;
if (b[i]=='-') {
sign = 1;
++i;
}
else sign = 0;
while (getnum(b, b_len, &i, len0, &n)) {
altok = 1;
alt = alt*10.0+(double)(float)n;
}
if (b[i]=='.') {
++i;
div0 = 0.1;
while (getnum(b, b_len, &i, len0, &n)) {
alt = alt+(double)(float)n*div0;
div0 = div0*0.1;
}
}
if (sign) alt = -alt;
}
}
} /* end decodeline() */
static char Hex(uint32_t d)
{
d = d&15UL;
if (d>9UL) d += 7UL;
return (char)(d+48UL);
} /* end Hex() */
static char checksum(const char b[], uint32_t b_len,
uint32_t len0)
{
uint32_t i;
uint8_t cs;
char ok0;
ok0 = 1;
i = 1UL;
cs = 0U;
while (i<len0 && b[i]!='*') {
cs = cs^(uint8_t)(uint8_t)b[i];
++i;
}
if (i+2UL>=len0) ok0 = 0;
if (ok0) {
if (b[i+1UL]!=Hex((uint32_t)cs/16UL) || b[i+2UL]!=Hex((uint32_t)
cs&15UL)) ok0 = 0;
}
if (verb && !ok0) osi_WrStrLn("GPS Checksum Error", 19ul);
return ok0;
} /* end checksum() */
static void showline(const char b[], uint32_t b_len, uint32_t len0)
{
uint32_t i;
i = 0UL;
while (i<len0) {
if ((uint8_t)b[i]<' ') {
if (b[i]=='\012') osic_WrLn();
else osi_WrStr(".", 2ul);
}
else osi_WrStr((char *) &b[i], 1u/1u);
++i;
}
osic_WrLn();
} /* end showline() */
static void wrfile(char b[], uint32_t b_len, uint32_t len0,
char ext[], uint32_t ext_len)
{
char s[2001];
int32_t f;
X2C_PCOPY((void **)&b,b_len);
X2C_PCOPY((void **)&ext,ext_len);
aprsstr_Assign(s, 2001ul, basefilename, 1024ul);
aprsstr_Append(s, 2001ul, ext, ext_len);
f = osi_OpenWrite(s, 2001ul);
if (f>=0L) {
if (len0>0UL) osi_WrBin(f, (char *)b, (b_len)/1u, len0);
osic_Close(f);
}
X2C_PFREE(b);
X2C_PFREE(ext);
} /* end wrfile() */
static char num(uint32_t n)
{
return (char)(n%10UL+48UL);
} /* end num() */
static void wrpos(double lat0, double long1, double alt0,
char withalt)
{
char b[201];
uint32_t n;
uint32_t i;
double a;
/* "4805.44N" "01333.64E" "/A=000000"*/
i = 0UL;
a = fabs(lat0);
n = truncc(a);
b[0U] = num(n/10UL);
++i;
b[1U] = num(n);
++i;
n = truncc((a-(double)(float)n)*6000.0);
b[2U] = num(n/1000UL);
++i;
b[3U] = num(n/100UL);
++i;
b[4U] = '.';
++i;
b[5U] = num(n/10UL);
++i;
b[6U] = num(n);
++i;
if (lat0>=0.0) b[7U] = 'N';
else b[7U] = 'S';
++i;
/* b[i]:=symt; INC(i); */
wrfile(b, 201ul, 8UL, ".lat", 5ul);
i = 0UL;
a = fabs(long1);
n = truncc(a);
b[0U] = num(n/100UL);
++i;
b[1U] = num(n/10UL);
++i;
b[2U] = num(n);
++i;
n = truncc((a-(double)(float)n)*6000.0);
b[3U] = num(n/1000UL);
++i;
b[4U] = num(n/100UL);
++i;
b[5U] = '.';
++i;
b[6U] = num(n/10UL);
++i;
b[7U] = num(n);
++i;
if (lat0>=0.0) b[8U] = 'E';
else b[8U] = 'W';
++i;
/* IF symb>" " THEN b[i]:=symb; INC(i) END; */
wrfile(b, 201ul, 9UL, ".long", 6ul);
if (withalt) {
i = 0UL;
if (alt0>0.0) {
b[0U] = '/';
++i;
b[1U] = 'A';
++i;
b[2U] = '=';
++i;
n = truncc(fabs(alt0*3.2808398950131+0.5));
if (alt0>=0.0) b[3U] = num(n/100000UL);
else b[3U] = '-';
++i;
b[4U] = num(n/10000UL);
++i;
b[5U] = num(n/1000UL);
++i;
b[6U] = num(n/100UL);
++i;
b[7U] = num(n/10UL);
++i;
b[8U] = num(n);
++i;
}
wrfile(b, 201ul, i, ".alt", 5ul);
}
} /* end wrpos() */
static void medianpos(double lat0, double long1,
double alt0)
{
struct _0 * anonym;
if (medians<=499UL) {
{ /* with */
struct _0 * anonym = &median[medians];
anonym->mlat = lat0;
anonym->mlong = long1;
anonym->malt = alt0;
}
++medians;
}
} /* end medianpos() */
static void getmedian(double * lat0, double * long1,
double * alt0)
{
uint32_t by;
uint32_t ay;
uint32_t bx;
uint32_t ax;
uint32_t j;
uint32_t i;
double maxy;
double miny;
double maxx;
double minx;
struct _0 * anonym;
struct _0 * anonym0;
struct _0 * anonym1;
uint32_t tmp;
if (medians==0UL) Error("no positions got", 17ul);
j = medians/10UL;
tmp = medians-1UL;
i = 0UL;
if (i<=tmp) for (;; i++) {
median[i].ok0 = 1;
if (i==tmp) break;
} /* end for */
for (;;) {
/* kill extrem values */
minx = (double)X2C_max_real;
maxx = (double)X2C_min_real;
ax = 0UL;
bx = 0UL;
miny = (double)X2C_max_real;
maxy = (double)X2C_min_real;
ay = 0UL;
by = 0UL;
j = 0UL;
tmp = medians-1UL;
i = 0UL;
if (i<=tmp) for (;; i++) {
if (median[i].ok0) {
{ /* with */
struct _0 * anonym = &median[i];
if (anonym->mlat<minx) {
minx = anonym->mlat;
ax = i;
}
if (anonym->mlat>maxx) {
maxx = anonym->mlat;
bx = i;
}
if (anonym->mlong<miny) {
miny = anonym->mlong;
ay = i;
}
if (anonym->mlong>maxy) {
maxy = anonym->mlong;
by = i;
}
}
++j;
}
if (i==tmp) break;
} /* end for */
if (j<=medians/2UL+5UL) break;
median[ax].ok0 = 0;
median[bx].ok0 = 0;
median[ay].ok0 = 0;
median[by].ok0 = 0;
}
j = 0UL;
*lat0 = 0.0;
*long1 = 0.0;
*alt0 = 0.0;
if (verb) {
osi_WrStrLn(" lat long alt ok", 45ul);
}
tmp = medians-1UL;
i = 0UL;
if (i<=tmp) for (;; i++) {
/* make mean valus */
if (median[i].ok0) {
{ /* with */
struct _0 * anonym0 = &median[i];
*lat0 = *lat0+anonym0->mlat;
*long1 = *long1+anonym0->mlong;
*alt0 = *alt0+anonym0->malt;
++j;
}
}
if (verb) {
{ /* with */
struct _0 * anonym1 = &median[i];
osic_WrFixed((float)anonym1->mlat, 8L, 14UL);
osic_WrFixed((float)anonym1->mlong, 8L, 14UL);
osic_WrFixed((float)anonym1->malt, 1L, 14UL);
osic_WrINT32((uint32_t)anonym1->ok0, 2UL);
osi_WrStrLn("", 1ul);
}
}
if (i==tmp) break;
} /* end for */
if (j==0UL) Error("no positions got", 17ul);
*lat0 = X2C_DIVL(*lat0,(double)j);
*long1 = X2C_DIVL(*long1,(double)j);
*alt0 = X2C_DIVL(*alt0,(double)j);
} /* end getmedian() */
static char c;
static int32_t len;
static int32_t rp;
static uint32_t gpsp;
static char gpsb[100];
X2C_STACK_LIMIT(100000l)
extern int main(int argc, char **argv)
{
int32_t tmp;
X2C_BEGIN(&argc,argv,1,4000000l,8000000l);
aprsstr_BEGIN();
osi_BEGIN();
sumoff = 0;
junk = 1;
posok = 0;
altok = 0;
verb = 0;
usbrobust = 1;
medians = 0UL;
mediantime = 30UL;
baud = 9600UL;
strncpy(ttynamee,"/dev/ttyS0",1024u);
strncpy(basefilename,"gpspos",1024u);
gpsp = 0UL;
/* symt:="/"; */
/* symb:="U"; */
comptyp = 0UL;
withalti = 0;
comintval = 5UL;
comcnt = 0UL;
Parms();
opentty();
for (;;) {
len = osi_RdBin(tty, (char *)tbuf, 1024u/1u, 1024UL);
if (len<=0L) {
osic_Close(tty);
usleep(1000000UL);
opentty();
junk = 1;
}
if (!junk) {
tmp = len-1L;
rp = 0L;
if (rp<=tmp) for (;; rp++) {
c = tbuf[rp];
if (c=='\015' || c=='\012') {
if (gpsp>0UL) {
if (sumoff || checksum(gpsb, 100ul, gpsp)) {
decodeline(gpsb, 100ul, gpsp);
}
else {
altok = 0;
posok = 0;
}
if (verb) showline(gpsb, 100ul, gpsp);
if (posok && (altok || !withalti)) {
medianpos(lat, long0, alt);
if (mediantime>0UL) {
--mediantime;
if (verb) {
osic_WrINT32(mediantime, 4UL);
osi_WrStrLn(" mediantime", 12ul);
}
}
else {
getmedian(&lat, &long0, &alt);
wrpos(lat, long0, alt, withalti && altok);
goto loop_exit;
}
altok = 0;
posok = 0;
}
}
gpsp = 0UL;
}
else if ((uint8_t)c>' ' && gpsp<99UL) {
gpsb[gpsp] = c;
++gpsp;
}
if (rp==tmp) break;
} /* end for */
}
junk = 0;
}
loop_exit:;
X2C_EXIT();
return 0;
}
X2C_MAIN_DEFINITION

1520
src/gpspos.c 100644

Plik diff jest za duży Load Diff

49
src/gpspos.h 100644
Wyświetl plik

@ -0,0 +1,49 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef gpspos_H_
#define gpspos_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
struct gpspos_SAT;
struct gpspos_SAT {
uint32_t prn;
uint32_t almidx;
int32_t rang;
int32_t rang1;
int32_t rang3;
int32_t rangabs;
int32_t lastd;
int32_t lastd1;
int32_t freq0;
double userspeed;
char badspeed;
};
typedef struct gpspos_SAT gpspos_SATS[12];
extern int32_t gpspos_getposit(uint32_t, uint32_t *, gpspos_SATS,
double, double, double, double *,
double *, double *, double *,
double *, double *, float *, float *,
uint32_t *);
extern char gpspos_readalmanach(char [], uint32_t, char [],
uint32_t, char [], uint32_t, uint32_t,
uint32_t *, char);
extern void gpspos_BEGIN(void);
#endif /* gpspos_H_ */

1039
src/help.txt 100644

Plik diff jest za duży Load Diff

989
src/hints.txt 100644
Wyświetl plik

@ -0,0 +1,989 @@
|101 If a Click hits more than 1 User, you may
select the desired with this button or
simply click again on the same Position
and the Calls will rotate to the
preselected top position
|102 If a Click hits more than 1 User, you may
select the desired with this button or
simply click again on the same Position
and the Calls will rotate to the
preselected top position
|104 Show additional Infos of the selected User
|106 Zoom the Map to fit this User with Track
into the Window
|107 Zoom the Map to fit this User with Track
and the Igates which heared it direct
to the Window. If info avaliable, white
Lines show the Radio Paths of each Beacon
|108 If Call is Igate, Zoom Map to fit the
Stations and Tracks heared direct to
the Window. The thicker the white
Lines, the more Beacons took this way
|109 Compose a Message to this User
or a Query to a Machine
|110 Go to normal Mode and Show all Users
|111 Remove Marker 1 and 2, the Measure
Line and QTH Locator Area
|113 Config what to do when Click
on Symbols/Text/Tracks
|114 Shift-Leftclick to Store View, Leftclick
or "1" Key to jump to this View
View 1 is used at Start
|115 Shift-Leftclick to Store View, Leftclick
or "2" Key to jump to this View
|116 Shift-Leftclick to Store View, Leftclick
or "3" Key to jump to this View
|117 Shift-Leftclick to Store View, Leftclick
or "4" Key to jump to this View
|130 Zoom Out, with SHIFT in
configurable Stepwidth
|131 Move Map, with SHIFT in 1/10 Steps
|133 Move Map, with SHIFT in 1/10 Steps
|135 Move Map, with SHIFT in 1/10 Steps
|137 Move Map, with SHIFT in 1/10 Steps
|132 Zoom In, with SHIFT in
configurable Stepwidth
|134 Center before Leftclicked Position on Map
|136 Step back in Zoom/Pan History, same
as "b" BACKSPACE or Rightlick
|138 close this menu
|200 Log, Screenshot, Video, Quit
|201 Config Map, Timers, Internet, Rf...
|202 Move/Zoom Map, You can invert moving directions
and store map positions/zooms to "views"
view 1 is used at start
|203 Change/Get Maps, Behaviour of Clicks, Send Messages ...
|204 List Shortcuts
|300 Quit Program
|301 Generate a Video file/stream in YUV4MPEG2 format
in File/Pipe map.y4m. Adjust all parameters before
with the "Animate" function. The File/Stream may
be viewed with VLC, Mplayer or packt by x264
eg. x264 -o film.mp4 --muxer mp4 --crf 22 map.y4m
|302 Save screen Image (without menues) to File
%t insert date-time in filename
%n insert counter
|303 For viewing historical/downloaded data
|304 Load/Edit/Save Program Parameters
|400 List Objects/Items
for highlighting keywords
enter word in Tools / Find
|401 List Objects/Items decoded
entries may be sortet by Call or Time
click on a Line shows position on map
|405 List Weather Stations
for highlighting keyword
enter word in Tools / Find
|406 List Weather Stations decoded
entries may be sortet by Call or Time
click on a Line shows position on map
|410 List Moveing Beacons
for highlighting keyword
enter word in Tools / Find
|411 List Moveing Beacons decoded
entries may be sortet by Call or Time
click on a Line shows position on map
|415 List Stations sending no Position
for highlighting keyword
enter word in Tools / Find
|416 List Stations sending no Position decoded
entries may be sortet by Call or Time
|420 Toggle Net Data off/raw/decoded
|421 Toggle Rf Port1 Data off/raw/decoded
|422 Toggle Rf Port2 Data off/raw/decoded
|423 Toggle Rf Port3 Data off/raw/decoded
|424 Toggle Rf Port4 Data off/raw/decoded
|425 Open Monitor Window for watching in/out
going Frames.
If line contains a position a click on the
line shows position on map.
For highlighting keyword enter word in
Tools / Find or "F".
Srolling stops if text is not on top or
bottom.
"u" key for quick toggle window on/off.
Clr clears content.
Use cursor keys and copy/paste(out)
|430 List Messages
|435 List Bulletins
|440 Show program internal infos
|500 Find Object/Call and Zoom to or Enter
QTH-Locator to see its Area on Map or
Enter Lat/Long to set a Marker on Map
(Shortcut F)
|505 Animation start Time is when first Object begins
to move, Stop when last stops, change Speed by
Menu with Leftclick to Map, "no move phases"
are automatic shortened by larger timesteps.
Modify Start time with "Time full Bright" Knob
(Shortcut a)
|515 Remove Marker 1 and 2, the Measure
Line and QTH Locator Area
|520 Blue for Rain 24h and red for Rain last hour
(Shortcut W)
|525 Make a Color Image out of Temperatures
of WX Stations (on/off), Map is converted
to B/W, Topo-Maps are nice here (Shortcut w)
|530 To see moving stations (Shortcut m)
|535 Manage Send Messages (Shortcut M)
|536 Enter Root directory path of Map-Cache
where the Map Downoad Task writes Map
Files into or where You have a set of
downloaded Maps
|538 Manage Map Types.
The Lines are typnames like "tiles_topo -128"
the optional value is a brightness correction
(range -255 to 255), darker with - values.
The names use subdirectories in "map directory"
and are passed to the map downloader where URLs
to the names are associatet. First entry is used
at program start. Sort entries by "Edit" and "Add".
Use first 3 lines by shortcut "7" "8" "9" else
"Tools > Choose Map"
|540 Choose Maptype, Reload Map You see
or Prepare offline Map Collections
|545 Listings
|550 Config what to do when Click
on Symbols/Text/Tracks
|555 Switch off Static Toolbar and
Open as Popup on Click to Map
|560 List Shortcuts
|565 Preferences
|570 Files Stuff and Quit
|575 Switch on Static Toolbar
|700 Define Area and Resolution for Downloading
a Complete OSM Map Collection for Offline usage.
Higher Zoom gives more Details but Storage/Network
consumption is 4x every next Level.
Level 13 for outside Town Streets
15 inside Town, 16 Houses, Oneways....
|701 Reload the Map-part You see.
Do if newer maps may be avaliable
or something is wrong.
If download failes, the
old Maps will come back
|710 Shortcut "7" "8" "9" are last 3 Lines
Last Line will be used at Program Start
Resort Lines in "Add Maps" with "Edit"
and "Add"
|900 What to do on a Click to Map
"Center" if You prefere Map movement
by Centering clicked Point
"Clear Menus" to get rid of this junk
ESC key Clears too
|901 What to do on a Click to Text
"Heard" for Igates
"Set Marker 2" if Marker 1
set by Symbol Click for
fast distance measurements
|902 What to do on a Click to (not WX) Symbol
"Raw+Decoded" for Text Info
"Set Marker 1" for measurements
|903 You may enable as many WX graphics
as fit into Your Window
|904 What to do on a Click to Track
"Zoom to" does good job
"Raw+Decoded" for debug
|1310 Show driving speed over time as data
avaliable, out of sense values are not shown
|1311 Show Altitude over km
|1312 Pop up a Menu for actions with this Object
|1450 Count Sent Messages, Acks, Rejects in Fullbright Time
|1445 Cycle through avaliable Track Colours incl Invisable
|1440 Delete the first Waypoint nearest to Click
continued Hits to this Button deletes
Waypoints with error markers. If clicked
to Symbol or Text the whole User will be
deleted (only in RAM not in Logfile)
|1438 Show Objects of this Sender on Map
|1435 Append this User to Watchlist
so get a Popup Window with a Message
if the User is active and (if not in
Single User Mode) the Map is shifted
to fit last position into sight.
In Config, Map Moveing, Center Watchcall
you define how near to Center of Window.
Next Hit to this Button will switch off
watching this Call.
|1430 Switch off watching this Call.
May be enabled again in Configs Watchlist
or another hit to this Button
|1425 Write (or Append if exists) Track and
all Info to this Call to a file with
name of the Call and so may be viewed
later by Importing the logfile.
|1420 Count Beacons and view it in a Histogramm
|1415 Sum driven Distance and if info avaliable,
show an Altitude over Distance Diagramm.
Trackfilter on/off may repair wrong values
or manual delete wrong waypoints before.
The Cursor line shows a marked waypoint.
|1410 If info avaliable show a Speed over Time Diagramm
Trackfilter on/off may repair wrong values
or manual delete wrong waypoints before.
The Cursor line shows a marked waypoint.
|1405 List raw Data of this User
on the Monitor text Window
|1406 List raw and decoded Data of this User
on the Monitor text Window
|1400 Show info to Waypoint or Beacon and go back in time
|1402 Show info to Waypoint or Beacon and go forward in time
|1401 Toggle show All or Waypoints with Error Flags
|1501 Brightness of Objects/Items. This are things
not transmitting at this position but set there
from another Station. Dimm to 0 to switch off.
|1503 Dimm to 1% to show waypoints only
|1504 Fit image output to Your Monitor,
normal value is 2.2, this does not
affect Screenshot or Video function
|1506 Text at Symbols on map not in menues
Item/Object Text may be dimmed additional
Toggle on/off with "L" shortcut
|1507 This are the white dots in tracks with
transmitted position joined by track lines
|1508 Remove timed out Things from Image,
data will stay in RAM until
"Keep Data im Memory" in Config
|1509 Give Objects/Tracks time to dissapear
after "Full Bright Time"
|1700 AprsIs Connect Status
Start/Stop Connection
Shift-Leftclick to Config
if no data received, change to red
Configure in Config, Online
|1701 UDP Port 1 Status
Switch AXUDP Interface to TNC or Soundmodem on/off
Shift-Leftclick to Config
if no data received, change to red
Configure in Config, Rf-Ports
|1702 UDP Port 2 Status
Switch AXUDP Interface to TNC or Soundmodem on/off
Shift-Leftclick to Config
if no data received, change to red
Configure in Config, Rf-Ports
|1703 UDP Port 3 Status
Switch AXUDP Interface to TNC or Soundmodem on/off
Shift-Leftclick to Config
if no data received, change to red
Configure in Config, Rf-Ports
|1704 UDP Port 4 Status
Switch AXUDP Interface to TNC or Soundmodem on/off
Shift-Leftclick to Config
if no data received, change to red
Configure in Config, Rf-Ports
|1705 (End) Viewing data from logfile
|1706 (View) Messages stored
Shift-Leftclick to Compose Message
|1707 Red: Expanded parts of Map on Screen
Green: allow Expand else Expand off
"D" Download Task Runs
Shift-Leftclick to Config
|1708 Trackfilter on
|1709 (End) Single User shown
|1800 path and filename, %t inserts time, %n is 000..999
.bmp at end writes filetype BMP else PPM
|1900 Animation Speed, 1 is Realtime if played with 25Hz
This Value is used for Generating a Video File too
|1905 Stop Animation
|1910 Go On Animation with new Speed
|1990 Enter Call (with ? Wildcard and * for rest
"oe?xbl*") or Locator "jn68pc". If no wildcards,
it is case sensitive and needs full word length.
or lat/long ddmm.mm dddmm.mm"4806.09N 01318.67E"
|2300 Stop map download, download may be continued
later
|2301 Enter Zoomlevel 1..18 and calculate quantity
of map parts to be downloaded for a complete map with
all zoomlevels for the visable area. Start with lower
levels until testing of having map parts takes a while.
If value fits, press download button by moveing mouse
not over other menus. To stop download press this button
again, download may be continued any time later.
|6700 Importing log until this date/time.Start time
is at "Time Fullbright" + "Time Fade Out" earlier.
Received actual Data is stored to memory and
writelog and is displayed again on "Exit Logview"
|6705 Find Call in Logfile, exact match,
and import it.
|6710 Read data from this path/filename.
The format is Timestamp in Seconds since 1.1.1970
followed by AprsIs Line. The data is sorted at
import by Time, indexed and all waypoints compared
to each other for removing dupes for fast rendering
images and stored in compressed form in RAM
|6715
|6716 Reload Data from Writelog
|6720 Go to Realtime Mode
|6721 Reload Data from Writelog
|6730 Go to Start of Logfile
|6731 Go "Time Fullbright" back in Logfile
|6732 Go "Time Fullbright" forward in Logfile
|6733 Go to End of Logfile
|6800 Send Message with Acknowledge, If
Message arrived Destination, "AckTime"
will get filled. On TCP, the Msg is sent
once and, if not acked, resent as the next
Beacon of the Destination arrives.
Modern Igates, gating msg to Rf, will
take care of efficient resening to mobile
destinations.
|6801 Send Message with no Acknowledge
Used for Querys like "?APRSH" "?HELP"
sent to Igates. The Msg is sent one time
and may be resent manual with "Kick" Button
|6802 Reopen with Shift-Click to "M" button
or "M"-Shortcut or Tools / Send Message
|6804 A Message Line if Dimmed it is Done
if --:--:-- in Acktime it is not Acked
if Red Acktime, a later Message to same
User will not be sent until this Line
is acked deleted or switched to "Hold"
"Ret" is the retry Counter
"AckTxt" an automatic generated unique
Code sent back for ack
|6810 Message Text up to 67 Char
|6815 Destination Call with SSID
|6820 Send Message on all Open Ports
|6821 Send Message to Net
|6822 Send Message to Radio Port
|6823 Send Message to Radio Port
|6824 Send Message to Radio Port
|6825 Send Message to Radio Port
|6905 Delete this Message
|6904 Send this Message once now
|6903 Reset Send Timer an Counter
|6902 Do not go on (re)sending Message
until Kick or Restart
|6901 Redirect the Message to the
Port set in die Ports Line
|6900 Edit the Message and requeue
|7000 Toggle automatic Save of Config at
Program Quit
|7001 Save Config now
|7005 Loosing all Entries not Saved before
|7010 Enter Calls You want to be told they
are active. If in "Show All" Mode, the Map
will follow the user. Wildcards ? or *
at End
|7015 Filter out unwanted things
by name, object owner, igate or comment
(no wildcards yet and exact case match)
|7020 How to Move/Zoom Maps and what to
do if they are not downloaded yet
|7025 For Things Drawn on the Map
|7030 except Rf Beacon Times they
are at each Beacon entry
|7035 Configure Radio Ports
|7040 Things we need to get Online
|7045 Quick Config Timers/Brightness/Map
|7300 Filter out Destination Call often
used as sender software identifier
|7305 Filter out data with keyword in Comment
from polluteing the Map. Data is stored
in logfile for reimport with filter off
|7310 Filter out Objects from source
|7315 Filter out all received from Igate
|7320 Filter out Object/Call seen on Map
|7400 Enter Your Callsign, it is not necessary
to receive data from servers but would
be nice to show the makers of servers
who is online. If You run more active
Aprs tools, each should have a different
SSID at Your Call like -1 -2 ...
|7405 If You want overay Symbols Choose the
Symbol and then click to edit and change
the \ to the desired overlay character
|7406 choose a Symbol on the
Table and click to enter
|7410 Click to open Editor, Move and Zoom Map
(zoomlevel 15 or more) to Your Position
and Shift-Leftclick to the Map. You get
a Position that may be Edited before Add.
Do not move delete or add characters.
|7415 Net Beacon needs only the Comment like
Name, QRV on 145.500Mhz
\\h \\z \\v \\<file> for inserting time,
program version or a file eg. with Wx-Data
|7420 Enter a valid Passcode and enable if You
want to send Data to AprsIs Network
(beacons/objects/messages/acks)
|7425 enter AprsIs-Server-URLs like
"nuremberg.aprs2.net:14580" or
IP-number and if not default
port 14580 append ":port".
IF more Servers are entered and
enabled they will be tried until
one is working.
|7430 Enter a filter for receive data from AprsIs Network
m/200 or center/radius or a lot of call filters a possible
|7435 Enable or Disable Connection
|7440 Sending Net Beacons or Send and Ack Messages
makes sense with a valid passcode
|7445 Enable Igate
Function disabled in Win-Version due to TCP-System
is not able to report DELAY time on transmission
and can not stop a delaying link without trying to
send the timed out Data, known as "sending data into
a hole in wall problem". This would draw disrupted-
and ghost-tracks on Maps.
|7450 Enable/Disable Appending Data to Logfile
|7451 Click and enter a Filename for received
and sent Data. On next Programm start Data
will be read to RAM and have same state as
at programm termination. The logfile may be
deleted, renamed, changed any time even it
is write enabled.
|7500 Enable/Disable Rf Port 1
|7501 Enter an UDP-IP-number with Port
Pair to Send and Receive Data from
a (kiss/smack) TNC (with udpflex as
interface) or a Soundmodem.
127.0.0.1:9000:9001 with IP:tx:rx
a 0 port will disable this direction.
If not want to Listen to other IP-numbers
as send to, write tx/rx instead of tx:rx
|7505 Same as Port 1
|7506 Same as Port 1
|7510 Same as Port 1
|7511 Same as Port 1
|7515 Same as Port 1
|7516 Same as Port 1
|7520 Start/Stop Serial Interface/Soundmodem Task
|7521 Enter Name and Parameters of a Program for interface
UDP ports to Serial Ports or Soundmodem.
example (unix/win): (or use a ".BAT" file for more ports)
tnc2/tf/smack:
udpflex -c -U 127.0.0.1:9002:9001 -k -s -t com1:9600 -V
tmd710/th-d72/kiss/USB:
udpflex -c -U 127.0.0.1:9002:9001 -i kiss.txt -u -t com3:9600 -V
example (unix):
afskmodem -t /dev/ttyS0 -M 0 -U 127.0.0.1:9002:9001 -m 0
|7525 Same as Serial 1
|7526 Same as Serial 1
|7530 If enabled, all frames with not a valid
"callsign" as sender will be discarded
|7531 If enabled, all frames with not a valid
"callsign" as sender will be discarded
|7535 Switch On/Off showing a Ticker Headline
of received and sent Callsigns
|7536 Number of shown Callsigns in Headline
|7540 Beacon/Object editor
|7545 If two Beacons (especially with same Text) are
sent in the Time, the Igate delete dupes, You
will never see the Beacon in AprsIs Network
even if sent on different Frequecys.
To avoid this, the Shift Time is used
to spread Transmissions over the Time.
|7550 What to do if a Message arrives
|8200 Enter Keywords : and what to reply if a Query arrives
?VER:VERSION \\v \\v inserts Version
?APRST:PATH= \\p \\p inserts Path of Sender
?APRSP:\\l \\l inserts Lat/Long
TALK:\\>filename<Message Sayd writes a File
?WX:\\<filename> Time \\h sends a File and Time
?HELP:?VER,?APRST,?APRSP,TALK,?WX
do not edit this lines, disable and make new entries
|8205 if stay on Rf use "RFONLY" or "NOGATE" else the
software-ID "APLM01" or some other valid string.
On Net always software-ID is used.
|8210 Empty string for direkt
number for SSID-Routing "2" makes -2 to destination call
or some old chunk like "RELAY" "WIDE"...
|8215 Toggle On/Off a popup window if a msg arrives
|8220 Show (not ack) Messages to My Call but other SSID too
|8225 Show Messages from/to same Call and
same SSID (Telemetry Headlines)
|7695 Enable/Disable the Line. Disabled lines do
nothing but wait for being reenable later
|7696 Delete Line, the text is copied to
edit line for changes and Add
|7706 Enter beacon time in seconds (600 is widely used)
or 0 to send Netbeacon only at start of connection.
Sending 1 Netbeacon makes sense even with no
Passcode to tell the Server Your position
for usage of m/... filters
|7701 Minutes to Hold Objects and Items in RAM then Purge
except with WX-Data to have fulltime WX-Graphs
|7700 Minutes hold any Data in RAM then Purge
This is the maximum "Show Fullbright" Time too
|7705 Minutes Show Symbols an Tracks on Screen
|7704 Minutes Fading out Symbols and Tracks
after Full Bright Time on Screen
|7703 Seconds Show km/h after last move
|7702 Minutes back from now try to detect
double received waypoints and filter
out if Trackfilter is enabled
|7707 Initial animation speed in multiples
of realtime if played with 25hz
change by click to map
|7708 delay in animation/video bevore
speedup if no one moves
|7709 Shift System Time by up to +-24h in
shown times. Log times are not affected.
|7745 After moving and zooming the Map, wait this
Time befor starting missing Map Download if
not want to Load fine zoomed strips along a
Map moving way.
|7860 If enabled show Lat/Long and QTH-Locator of Mouse Position
|7855 Enable Trackfilter to remove possibly wrong waypoints
of tracks. This does not affect stored data.
|7850 If enabled, missing map-parts are tried to be
downloaded by writing "gettiles" file. A task
that reads this file may get the parts of map
from internet in background. What arrives
within 30s will be updated on screen otherwise
updates by next activity in map
|7851 Program Name and Parameters to be started
if Map Download is requested. The Program
reads "gettiles" file, loads maps and if
done, deletes "gettiles" file.
|7845 Show a Scaler on the map. A small
Zoomlevel would distort distances
so Scaler will not be shown.
|7840 If enabled, and data avaliable,
show a driving direction arrow.
|7835 If enabled, and data avaliable,
show a windvane at WX-Symbols
|7830 If enabled, and data avaliable,
show Temperature
|7825 If enabled, and data avaliable,
show driving speed
|7826 edit text for driving speed "km/h"
or shorter "km" to save place on map
|7820 if data avaliable and above this
value, show higth in m
|7815 Brightness of notmovers if dimm notmovers is on
|7810 Brightness of white Lines showing Rf-Paths
in "Heard" and "+Rf" Mode
|7807 Enter Fontsize, Range 8..18 Pixel
|7805 0 Disables Transparency, 20 looks nice,
else try for best readability
|7945 Zoom steps for Shift-Click to +- or mouse-wheel
|7940 Map move step width
|7935 Limit Zoom Level to avoid download
of maps with no more infos on
|7930 Limit zoomlevel for autozoom to
small objects to avoid download
of maps not really needed
|7925 % of screen to center hold watched objects in
0: the object moves to margin bevore map is shifted
100: the object is alway centered
|7920 window size used on next program start
updated as window size is changed
|7917 Design and switch on/off event sounds
|7915 "move Map" or "move Window over Map"
according to Cursor Key Arrows
|7910 If a part of Map is not in the Map-Cache, allow to
double size of yet avaliable lower resolution part until
the part is loaded from a Map server. You will see a
red Button during this Mode
|7905 If a selected object gets to be zoomed to
fit in screen, zooming is done as far as
Maps in full resolution are in Cash else
You get a black map and download starts
|7900 Enable to get a message if an object
approaches and is in the configured
radius. A file "proxwarn" contains call
an distance for an external program
|7901 Enter Radius for Approxymation Message
If a Station moves toward You, a File
"proxwarn" will be generated with Call
and Distance for a Speech Program
|8010 Toggle Approximation Sound On/Off
|8011 Approximation Sound (in Hz and milliseconds)
first value pair at entering configured Warn Radius,
changing to second pair until zero distance to You
|8015 Toggle Watchcall Sound On/Off
|8016 Watchcall Sound (in Hz and milliseconds)
|8020 Toggle Message Sound On/Off
|8021 Message Sound (in Hz and milliseconds)
first value pair for receiving new Message
second pair for acknowledged a sent Message
|8100 Append edited Beacon to the Schedule Table.
Objects/Items with same Name will be deleted.
|8101 Draw on local Map for testing. Hold Shift
and click to Map to change Position. Delete
on Map with click to symbol and DEL-Key.
|8102 Send edited Beacon immediately to Rf or
Net Port as configured. Use for sending
"Delete Objects" one time on Net
|8103 Cancel edit window to see more Lines
of Schedule Table.
|8104 Exit Beacon editor
|8110 Make default (mostly empty) edit Lines
With click to a Symbol on map the Data
will be cloned and may be edited to make
your own beacon out of.
|8111 Close Beacon editor
|8115 For "Beacons" this should be one of your
Calls + ssid. The Position is fixed as
configured in Config > Online > My Position
For Items an Objects this is the Name
seen by the Symbol on Map. This need not
be a Callsign.
|8120 Position for Items and Objects in DDMM.MMM
or simply hold SHIFT Key and click on the Map.
To quick reposit Objects: "B" to open Beacon
Edit, Click to Symbol on Map, "DEL" to remove,
SHIFT-Click to new position, "Draw" or "Send"
|8122 Text with Macros
|8124 Time between 2 beacons in Seconds.
Additional each Beacon in scheduler is shiftet
from each other by
Config > Rf-Ports > Beacon Shift Time
because same beacons will be deleted by Igates
if seen before at less than 27s to 1 minute.
If sending beacons to Net and same time to rf,
you will never see who received it.
|8126 Radio Path, like WIDE2-2 or, if the Digis
in Your area are configured correct, simpley
use -1 or -2 which will be appended to the
Destination Call to do same es WIDE but with
zero bytes overhead.
|8128 Enter Altitude in m over NN or negative
for below. Only positive values in
Commpressed Mode. This will take some
Bytes more except in Compressed Mode
with no speed/direction.
|8130 Speed in km/h
|8132 Course in 0..359 degrees
|8134 Choose Symbol and if You know what
You do enter overlay Symbols here.
|8136 Destination "Call" is generated automatic
in Mic-e Mode else is used as hint to which
hard/software is used.
|8138 Click at a Symbol in the Thumbnail Picture
|8140 Set Type "Beacon", to send Symbol and Info
with your Position and Call with SSID. The
Symbol has the Call as Label and possibly
Altitute and Speed or Wx Data.
|8141 Set Type "Object" with HHMMSS Timestamp.
Send Object to set Symbol and object Name
to other as your Position. The Symbol shows
the Object Name (need not be a Callsign) as
label.
|8142 Set Type "Object" with DDHHMM Timestamp.
|8143 Set Type "Item". This is like "Object"
but witout Timestamp and needs less bytes
with short Name and compressed position.
On Rf prefer this if no Time info needed.
|8144 Set Type "Delete Item". This wipes out
Items with This Name on all Maps.
Important: Tx only once on Net or manual
a view times on Rf Ports.
|8145 Set Type "Delete Object". Depending on
Viewer should delete Items too.
|8150 Send normal DDMM.MM format, long, only
18m resolution but man-readable. May
be extendet with DAO to 20cm resolution
with "Lat/Long+" and 5 bytes more.
|8151 Send Mic-e format, this is compressed to
minimal size with 18m resolution and no
extra bytes for speed and course. May
contain not-printable characters so be
carefull by copy/edit raw data. May be
extendet with DAO to 20cm resolution
with "Mic-e+" and 5 Bytes more.
|8152 Send "Compressed" format, this is fixed size
and may contain speed/course OR (positive)
altitude but not both. If needs both, the
long /A=...... extention will be appended.
Resolution is 30cm
|8153 Same as "Lat/Long" but with DAO extention
if you need finer resolution than 18m.
|8154 Same as "Mic-e" but with DAO extention
if you need finer resolution than 18m.
|8160 Sent Beacon to AprsIs on TCPIP Net.
"Via Path" is not needed here.
|8161 Send Beacon to Radio Port 1 as configured
and enabled in "Config > Rf-Ports"
|8162 Send Beacon to Radio Port 2 as configured
and enabled in "Config > Rf-Ports"
|8163 Send Beacon to Radio Port 3 as configured
and enabled in "Config > Rf-Ports"
|8164 Send Beacon to Radio Port 4 as configured
and enabled in "Config > Rf-Ports"
|8170 Port:Time:rawtext
Yellow Field is a "delete object" so if sent
i will wipe out the object/item on all maps.
Red Field contains any error and should not
be transmitted.
Dimmed Text is if line is opened in editor.
Green Dot makes beacon active, toggle with
On/off
|8180 Move this Beacon to Editor
|8182 Send this Beacon once immediately
|8184 Send this Beacon to local View on Map
Delete on Map with click to symbol and
DEL-Key.
|8186 Raw Line Edit (not implemented now)
|8188 Delete Beacon
|8190 Copy this Beacon to Editor
|8192 Toggle On/Off Switch of this Beacon
Important: Check repeat Time to avoid
too much Tx, 3600s for static Beacons
1200s to 1800s for Wx on Rf Ports.
|10005 Tipp: Move and Zoom Map to Your Home Area
then open "Zoom" and SHIFT+Leftclick to "P1"
to Store View for next Programm Start
|10006 Tipp: To get Data from Internet Configure "Config>Online>"
|10007 Tipp: Usage of "m/" Filters needs configured
MyPosition and "Allow Tx to Net"
|10010 Tipp: If problem with map download
check network and map download program
|10016 Tipp: Don't like black or expanded Maps?
switch on "Config>Map Moving>Zoom as have Maps"
set "Config>Map Moving>Expand Map" as wantet
|10015 Tipp: Zoom to Objects even if Maps are not downloaded
yet, switch off "Config>Mapmoving>Zoom as have Maps"

84
src/jpgdec.c 100644
Wyświetl plik

@ -0,0 +1,84 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include "X2C.h"
#include <stdio.h>
#include "jpeglib.h"
#include <setjmp.h>
#include <string.h>
struct my_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
};
typedef struct my_error_mgr * my_error_ptr;
METHODDEF(void) my_error_exit (j_common_ptr cinfo)
{
/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
my_error_ptr myerr = (my_error_ptr) cinfo->err;
/* Always display the message. */
/* We could postpone this until after returning, if we chose. */
(*cinfo->err->output_message) (cinfo);
/* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer, 1);
}
int32_t readjpg(char *fn, JSAMPARRAY *row_pointers, int32_t *maxx, int32_t *maxy, int32_t *maxxbyte)
{
struct jpeg_decompress_struct cinfo;
struct my_error_mgr jerr;
FILE * infile; /* source file */
int ret;
int linec;
JSAMPARRAY buffer; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
if ((infile = fopen(fn, "rb")) == NULL) {
/*
fprintf(stderr, "can't open %s\n", fn);
*/
return -1;
}
cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
if (setjmp(jerr.setjmp_buffer)) {
jpeg_destroy_decompress(&cinfo);
fclose(infile);
return -2;
}
ret=0;
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
(void) jpeg_read_header(&cinfo, TRUE);
(void) jpeg_start_decompress(&cinfo);
if (cinfo.output_height > *maxy || cinfo.output_width > *maxx || cinfo.output_components != 3)
ret=-3;
row_stride = cinfo.output_width * cinfo.output_components;
buffer = (*cinfo.mem->alloc_sarray) ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
linec=0;
while (cinfo.output_scanline < cinfo.output_height)
{
(void) jpeg_read_scanlines(&cinfo, (JSAMPARRAY) buffer, 1);
if (linec < *maxy)
memcpy(row_pointers[linec++], buffer[0], *maxxbyte);
}
(void) jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(infile);
return ret;
}

15
src/jpgdec.h 100644
Wyświetl plik

@ -0,0 +1,15 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef jpgdec_H_
#define jpgdec_H_
#include "X2C.h"
extern int32_t readjpg(char [], char * [], int32_t *, int32_t *, int32_t *);
#endif /* jpgdec_H_ */

2816
src/l2.c 100644

Plik diff jest za duży Load Diff

298
src/l2.h 100644
Wyświetl plik

@ -0,0 +1,298 @@
/*
* dxlAPRS toolchain
*
* Copyright (C) Christian Rabler <oe5dxl@oevsv.at>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef l2_H_
#define l2_H_
#ifndef X2C_H_
#include "X2C.h"
#endif
typedef uint16_t l2_SET16;
typedef uint8_t l2_SET8;
extern uint16_t l2_UA;
extern uint16_t l2_DM;
extern uint16_t l2_SABM;
extern uint16_t l2_DISC;
extern uint16_t l2_FRMR;
extern uint16_t l2_UI;
extern uint16_t l2_RR;
extern uint16_t l2_REJ;
extern uint16_t l2_RNR;
#define l2_PORTS 15
/* portset is SET16 */
#define l2_MYCALLS 16
typedef char l2_CALLTYP[7];
typedef char * l2_pSTRING;
struct l2_DFIELD;
typedef struct l2_DFIELD * l2_pDATA;
struct l2_DFIELD {
l2_pDATA next;
uint16_t len;
char info[257]; /*incl PID*/
};
typedef void *l2_pLINK;
typedef char l2_AFIELD[71];
enum l2_EVENT {l2_eCONNECTED, l2_eDISCONNECTED, l2_eBUSY, l2_eTXFREE,
l2_eRXDATA, l2_eMONITOR,
l2_eLISTEN, l2_eIDLE, l2_eCONNREQ, l2_eFLEXDATA};
extern char l2_L2Lock; /*disable interrupt starting L2*/
extern uint16_t l2_LostINT;
extern l2_pDATA l2_dbuf; /*must be new allocated after use*/
extern l2_AFIELD l2_adress; /*static adress field*/
extern uint16_t l2_asize; /*length of static adress*/
extern char l2_udp2buf[100]; /* axudp2 header after Getframe */
struct l2__D0;
struct l2__D1;
struct l2__D1 {
uint16_t Isent; /*I-frames sent, without I.P*/
uint16_t Iack; /*therefrom ackowledged*/
uint16_t Igot; /*I-frames got and accepted*/
uint32_t Bytesent; /*all frames + FCS + 1 flag*/
uint32_t Bytegot; /*all frames + FCS + 1 flag*/
};
struct l2__D0 {
uint16_t Links; /*statistics: links, including inactives*/
uint16_t MaxLinks;
struct l2__D1 Flows[13];
};
extern struct l2__D0 l2_PortSt[16];
struct l2__D2;
struct l2__D2 {
union {
/* (*c*) = rangecheck necessary*/
uint16_t card[17];
struct {
uint16_t SendPort; /*c*/ /*associated send port to that uplinkport*/
uint16_t Diversity; /*c*/ /*accept frames to existing links from ports with same numbers*/
uint16_t DCDlevel;
uint16_t TXwait; /*wait after sending before sending again*/
uint16_t TXtail; /*for fullduplex*/
uint16_t TXdel; /*txdelay*/
uint16_t DCDwait; /*wait after dcd before sending*/
uint16_t BaudSwBytes; /*c*/ /*number of flags sent after baud-switch*/
uint16_t txDelByte; /*bit pattern sent for sync*/
uint16_t MaxFrames; /*c*/ /*send windowsize*/
uint16_t T1;
uint16_t T3;
uint16_t IPoll; /*max info length for I.Poll*/
uint16_t Retries;
uint16_t MhTime; /*0 = mh off*/
uint16_t DCDIGNOR; /*ignore dcd longer than this time/dama slave off*/
} _0;
} _;
char monitor;
char passall;
char DamaMaster;
char HalfDuplex;
char Digipeat;
char Echo;
char SendBauds[17]; /*relation mycall <-> baud*/
};
extern struct l2__D2 l2_Parms[15];
typedef uint16_t l2_CMD;
enum l2_CONNTYP {l2_cNORMAL, l2_cCONNAK, l2_cFLEXback, l2_cFLEXbusy,
l2_cTEST};
struct l2_CONNECT;
typedef struct l2_CONNECT * l2_pCONNECT;
struct l2_CONNECT {
/* cmd:CARD16;*/
uint16_t handle;
uint16_t port; /*the port number of uplink port*/
uint16_t baud; /*baud is the index of sendbaud-table*/
uint16_t cpid; /*PID*/
l2_pSTRING l2adr; /*0-terminated unshifted raw ax.25 adress*/
l2_pSTRING l3adr; /*0-terminated SABM-with-info text for routing
unused if points to NIL*/
uint8_t typ; /*TEST returns an existing link with same adress*/
};
struct l2_SENDUI;
typedef struct l2_SENDUI * l2_pSENDUI;
struct l2_SENDUI {
char cmd; /* frame cmd */
uint16_t port;
uint16_t baud;
l2_pSTRING path; /*0-terminated, raw, unshifted ax.25 adress-field*/
uint16_t datalen;
l2_pSTRING data; /* PID is part of data */
};
struct l2_GETADRESS;
typedef struct l2_GETADRESS * l2_pGETADRESS;
struct l2_GETADRESS {
uint16_t cmd;
uint16_t port; /*number of uplink port*/
uint16_t my; /*number of mycall*/
uint16_t cpid; /*65535 if not known*/
char adress[72]; /*0-terminated, raw ax.25 adress*/
};
struct l2_GETSTAT;
typedef struct l2_GETSTAT * l2_pGETSTAT;
struct l2_GETSTAT {
uint16_t cmd;
l2_pLINK l;
uint16_t n;
uint16_t st;
uint16_t port;
uint16_t my;
uint16_t txbu;
uint16_t ret;
char bsy;
char remb;
l2_pLINK nudl;
char adress[72];
uint32_t sent;
uint32_t ack;
uint32_t rcvd;
uint32_t since;
};
typedef uint32_t l2_SUMMS[7];
struct l2_PORTSTAT;
typedef struct l2_PORTSTAT * l2_pPORTSTAT;
struct l2_PORTSTAT {
uint16_t cmd;
uint16_t port;
uint16_t minits5;
l2_SUMMS sums;
uint16_t mem;
uint32_t time0;
};
struct l2_PARMS0;
typedef struct l2_PARMS0 * l2_pPARMS;
struct l2_PARMS0 {
uint16_t cmd;
uint16_t port;
uint16_t parm;
char test; /* get instead of set parm */
uint32_t val; /* for numeric values */
l2_pSTRING str; /* for string values */
};
typedef void ( *l2_CALLBACKPROC)(char * *, l2_pLINK, uint8_t);
extern l2_pLINK l2_Connect0(char *, l2_pCONNECT);
/* NIL if no link */
/*mp: adress that is enclosed in all messages from L2 to
the host and may point to host-task-context*/
extern void l2_Disconnect(l2_pLINK *, char);
/*if dealloc, the owner of the link will be l2, else owner stays
the host and it must send a disconnect with dealloc later to
release memory and timers*/
extern void l2_Circuit(l2_pLINK *, l2_pLINK *, char, char,
uint16_t);
/*links streams of l1 and l2, if not reconn, then
the link will then belong to L2 again
reconn: if the other link disconnects, this links
datastream will be switched back to host
exitchar: if first char in l1-input-stream equals exitchar
the stream of l1 will be switched to host*/
extern void l2_GetAdress0(l2_pLINK, l2_pGETADRESS);
extern void l2_Getudp2info(l2_pLINK, char [], uint32_t);
extern char l2_GetChar(l2_pLINK, char, char *);
/*returns false if buffer is empty
delete: delete char from buffer after get*/
extern uint16_t l2_GetStr(l2_pLINK, uint16_t, l2_pSTRING);
/*return is length of data */
extern char l2_SendStr(l2_pLINK, uint16_t, l2_pSTRING);
/* max 256 byte, false if data not sent (sendbuffer full) */
extern void l2_SendRaw(l2_pSENDUI);
/* pid >255 send no pid */
extern void l2_GetStat0(l2_pGETSTAT);
extern char l2_PortStat0(l2_pPORTSTAT);
/* true if port is enabled */
extern void l2_Parm(l2_pPARMS);
extern l2_pLINK l2_GetMon(void);
extern void l2_Layer2(void);
/*started by 10ms interrupt-ticker if not L2Lock*/
extern void l2_L2Init(uint16_t, uint16_t, l2_CALLBACKPROC);
extern void l2_BEGIN(void);
#endif /* l2_H_ */

1960
src/l2cat.c 100644

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,717 @@
/* Definitions for the X window system likely to be used by applications */
#ifndef X_H
#define X_H
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#define X_PROTOCOL 11 /* current protocol version */
#define X_PROTOCOL_REVISION 0 /* current minor version */
/* Resources */
/*
* _XSERVER64 must ONLY be defined when compiling X server sources on
* systems where unsigned long is not 32 bits, must NOT be used in
* client or library code.
*/
#ifndef _XSERVER64
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef unsigned long XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef unsigned long Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef unsigned long Atom; /* Also in Xdefs.h */
# endif
typedef unsigned long VisualID;
typedef unsigned long Time;
#else
# include <X11/Xmd.h>
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
typedef CARD32 XID;
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
typedef CARD32 Mask;
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
typedef CARD32 Atom;
# endif
typedef CARD32 VisualID;
typedef CARD32 Time;
#endif
typedef XID Window;
typedef XID Drawable;
#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
typedef XID Font;
#endif
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
typedef XID GContext;
typedef XID KeySym;
typedef unsigned char KeyCode;
/*****************************************************************
* RESERVED RESOURCE AND CONSTANT DEFINITIONS
*****************************************************************/
#ifndef None
#define None 0L /* universal null resource or null atom */
#endif
#define ParentRelative 1L /* background pixmap in CreateWindow
and ChangeWindowAttributes */
#define CopyFromParent 0L /* border pixmap in CreateWindow
and ChangeWindowAttributes
special VisualID and special window
class passed to CreateWindow */
#define PointerWindow 0L /* destination window in SendEvent */
#define InputFocus 1L /* destination window in SendEvent */
#define PointerRoot 1L /* focus window in SetInputFocus */
#define AnyPropertyType 0L /* special Atom, passed to GetProperty */
#define AnyKey 0L /* special Key Code, passed to GrabKey */
#define AnyButton 0L /* special Button Code, passed to GrabButton */
#define AllTemporary 0L /* special Resource ID passed to KillClient */
#define CurrentTime 0L /* special Time */
#define NoSymbol 0L /* special KeySym */
/*****************************************************************
* EVENT DEFINITIONS
*****************************************************************/
/* Input Event Masks. Used as event-mask window attribute and as arguments
to Grab requests. Not to be confused with event names. */
#define NoEventMask 0L
#define KeyPressMask (1L<<0)
#define KeyReleaseMask (1L<<1)
#define ButtonPressMask (1L<<2)
#define ButtonReleaseMask (1L<<3)
#define EnterWindowMask (1L<<4)
#define LeaveWindowMask (1L<<5)
#define PointerMotionMask (1L<<6)
#define PointerMotionHintMask (1L<<7)
#define Button1MotionMask (1L<<8)
#define Button2MotionMask (1L<<9)
#define Button3MotionMask (1L<<10)
#define Button4MotionMask (1L<<11)
#define Button5MotionMask (1L<<12)
#define ButtonMotionMask (1L<<13)
#define KeymapStateMask (1L<<14)
#define ExposureMask (1L<<15)
#define VisibilityChangeMask (1L<<16)
#define StructureNotifyMask (1L<<17)
#define ResizeRedirectMask (1L<<18)
#define SubstructureNotifyMask (1L<<19)
#define SubstructureRedirectMask (1L<<20)
#define FocusChangeMask (1L<<21)
#define PropertyChangeMask (1L<<22)
#define ColormapChangeMask (1L<<23)
#define OwnerGrabButtonMask (1L<<24)
/* Event names. Used in "type" field in XEvent structures. Not to be
confused with event masks above. They start from 2 because 0 and 1
are reserved in the protocol for errors and replies. */
#define KeyPress 2
#define KeyRelease 3
#define ButtonPress 4
#define ButtonRelease 5
#define MotionNotify 6
#define EnterNotify 7
#define LeaveNotify 8
#define FocusIn 9
#define FocusOut 10
#define KeymapNotify 11
#define Expose 12
#define GraphicsExpose 13
#define NoExpose 14
#define VisibilityNotify 15
#define CreateNotify 16
#define DestroyNotify 17
#define UnmapNotify 18
#define MapNotify 19
#define MapRequest 20
#define ReparentNotify 21
#define ConfigureNotify 22
#define ConfigureRequest 23
#define GravityNotify 24
#define ResizeRequest 25
#define CirculateNotify 26
#define CirculateRequest 27
#define PropertyNotify 28
#define SelectionClear 29
#define SelectionRequest 30
#define SelectionNotify 31
#define ColormapNotify 32
#define ClientMessage 33
#define MappingNotify 34
#define GenericEvent 35
#define LASTEvent 36 /* must be bigger than any event # */
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
state in various key-, mouse-, and button-related events. */
#define ShiftMask (1<<0)
#define LockMask (1<<1)
#define ControlMask (1<<2)
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
#define Mod4Mask (1<<6)
#define Mod5Mask (1<<7)
/* modifier names. Used to build a SetModifierMapping request or
to read a GetModifierMapping request. These correspond to the
masks defined above. */
#define ShiftMapIndex 0
#define LockMapIndex 1
#define ControlMapIndex 2
#define Mod1MapIndex 3
#define Mod2MapIndex 4
#define Mod3MapIndex 5
#define Mod4MapIndex 6
#define Mod5MapIndex 7
/* button masks. Used in same manner as Key masks above. Not to be confused
with button names below. */
#define Button1Mask (1<<8)
#define Button2Mask (1<<9)
#define Button3Mask (1<<10)
#define Button4Mask (1<<11)
#define Button5Mask (1<<12)
#define AnyModifier (1<<15) /* used in GrabButton, GrabKey */
/* button names. Used as arguments to GrabButton and as detail in ButtonPress
and ButtonRelease events. Not to be confused with button masks above.
Note that 0 is already defined above as "AnyButton". */
#define Button1 1
#define Button2 2
#define Button3 3
#define Button4 4
#define Button5 5
/* Notify modes */
#define NotifyNormal 0
#define NotifyGrab 1
#define NotifyUngrab 2
#define NotifyWhileGrabbed 3
#define NotifyHint 1 /* for MotionNotify events */
/* Notify detail */
#define NotifyAncestor 0
#define NotifyVirtual 1
#define NotifyInferior 2
#define NotifyNonlinear 3
#define NotifyNonlinearVirtual 4
#define NotifyPointer 5
#define NotifyPointerRoot 6
#define NotifyDetailNone 7
/* Visibility notify */
#define VisibilityUnobscured 0
#define VisibilityPartiallyObscured 1
#define VisibilityFullyObscured 2
/* Circulation request */
#define PlaceOnTop 0
#define PlaceOnBottom 1
/* protocol families */
#define FamilyInternet 0 /* IPv4 */
#define FamilyDECnet 1
#define FamilyChaos 2
#define FamilyInternet6 6 /* IPv6 */
/* authentication families not tied to a specific protocol */
#define FamilyServerInterpreted 5
/* Property notification */
#define PropertyNewValue 0
#define PropertyDelete 1
/* Color Map notification */
#define ColormapUninstalled 0
#define ColormapInstalled 1
/* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
#define GrabModeSync 0
#define GrabModeAsync 1
/* GrabPointer, GrabKeyboard reply status */
#define GrabSuccess 0
#define AlreadyGrabbed 1
#define GrabInvalidTime 2
#define GrabNotViewable 3
#define GrabFrozen 4
/* AllowEvents modes */
#define AsyncPointer 0
#define SyncPointer 1
#define ReplayPointer 2
#define AsyncKeyboard 3
#define SyncKeyboard 4
#define ReplayKeyboard 5
#define AsyncBoth 6
#define SyncBoth 7
/* Used in SetInputFocus, GetInputFocus */
#define RevertToNone (int)None
#define RevertToPointerRoot (int)PointerRoot
#define RevertToParent 2
/*****************************************************************
* ERROR CODES
*****************************************************************/
#define Success 0 /* everything's okay */
#define BadRequest 1 /* bad request code */
#define BadValue 2 /* int parameter out of range */
#define BadWindow 3 /* parameter not a Window */
#define BadPixmap 4 /* parameter not a Pixmap */
#define BadAtom 5 /* parameter not an Atom */
#define BadCursor 6 /* parameter not a Cursor */
#define BadFont 7 /* parameter not a Font */
#define BadMatch 8 /* parameter mismatch */
#define BadDrawable 9 /* parameter not a Pixmap or Window */
#define BadAccess 10 /* depending on context:
- key/button already grabbed
- attempt to free an illegal
cmap entry
- attempt to store into a read-only
color map entry.
- attempt to modify the access control
list from other than the local host.
*/
#define BadAlloc 11 /* insufficient resources */
#define BadColor 12 /* no such colormap */
#define BadGC 13 /* parameter not a GC */
#define BadIDChoice 14 /* choice not in range or already used */
#define BadName 15 /* font or color name doesn't exist */
#define BadLength 16 /* Request length incorrect */
#define BadImplementation 17 /* server is defective */
#define FirstExtensionError 128
#define LastExtensionError 255
/*****************************************************************
* WINDOW DEFINITIONS
*****************************************************************/
/* Window classes used by CreateWindow */
/* Note that CopyFromParent is already defined as 0 above */
#define InputOutput 1
#define InputOnly 2
/* Window attributes for CreateWindow and ChangeWindowAttributes */
#define CWBackPixmap (1L<<0)
#define CWBackPixel (1L<<1)
#define CWBorderPixmap (1L<<2)
#define CWBorderPixel (1L<<3)
#define CWBitGravity (1L<<4)
#define CWWinGravity (1L<<5)
#define CWBackingStore (1L<<6)
#define CWBackingPlanes (1L<<7)
#define CWBackingPixel (1L<<8)
#define CWOverrideRedirect (1L<<9)
#define CWSaveUnder (1L<<10)
#define CWEventMask (1L<<11)
#define CWDontPropagate (1L<<12)
#define CWColormap (1L<<13)
#define CWCursor (1L<<14)
/* ConfigureWindow structure */
#define CWX (1<<0)
#define CWY (1<<1)
#define CWWidth (1<<2)
#define CWHeight (1<<3)
#define CWBorderWidth (1<<4)
#define CWSibling (1<<5)
#define CWStackMode (1<<6)
/* Bit Gravity */
#define ForgetGravity 0
#define NorthWestGravity 1
#define NorthGravity 2
#define NorthEastGravity 3
#define WestGravity 4
#define CenterGravity 5
#define EastGravity 6
#define SouthWestGravity 7
#define SouthGravity 8
#define SouthEastGravity 9
#define StaticGravity 10
/* Window gravity + bit gravity above */
#define UnmapGravity 0
/* Used in CreateWindow for backing-store hint */
#define NotUseful 0
#define WhenMapped 1
#define Always 2
/* Used in GetWindowAttributes reply */
#define IsUnmapped 0
#define IsUnviewable 1
#define IsViewable 2
/* Used in ChangeSaveSet */
#define SetModeInsert 0
#define SetModeDelete 1
/* Used in ChangeCloseDownMode */
#define DestroyAll 0
#define RetainPermanent 1
#define RetainTemporary 2
/* Window stacking method (in configureWindow) */
#define Above 0
#define Below 1
#define TopIf 2
#define BottomIf 3
#define Opposite 4
/* Circulation direction */
#define RaiseLowest 0
#define LowerHighest 1
/* Property modes */
#define PropModeReplace 0
#define PropModePrepend 1
#define PropModeAppend 2
/*****************************************************************
* GRAPHICS DEFINITIONS
*****************************************************************/
/* graphics functions, as in GC.alu */
#define GXclear 0x0 /* 0 */
#define GXand 0x1 /* src AND dst */
#define GXandReverse 0x2 /* src AND NOT dst */
#define GXcopy 0x3 /* src */
#define GXandInverted 0x4 /* NOT src AND dst */
#define GXnoop 0x5 /* dst */
#define GXxor 0x6 /* src XOR dst */
#define GXor 0x7 /* src OR dst */
#define GXnor 0x8 /* NOT src AND NOT dst */
#define GXequiv 0x9 /* NOT src XOR dst */
#define GXinvert 0xa /* NOT dst */
#define GXorReverse 0xb /* src OR NOT dst */
#define GXcopyInverted 0xc /* NOT src */
#define GXorInverted 0xd /* NOT src OR dst */
#define GXnand 0xe /* NOT src OR NOT dst */
#define GXset 0xf /* 1 */
/* LineStyle */
#define LineSolid 0
#define LineOnOffDash 1
#define LineDoubleDash 2
/* capStyle */
#define CapNotLast 0
#define CapButt 1
#define CapRound 2
#define CapProjecting 3
/* joinStyle */
#define JoinMiter 0
#define JoinRound 1
#define JoinBevel 2
/* fillStyle */
#define FillSolid 0
#define FillTiled 1
#define FillStippled 2
#define FillOpaqueStippled 3
/* fillRule */
#define EvenOddRule 0
#define WindingRule 1
/* subwindow mode */
#define ClipByChildren 0
#define IncludeInferiors 1
/* SetClipRectangles ordering */
#define Unsorted 0
#define YSorted 1
#define YXSorted 2
#define YXBanded 3
/* CoordinateMode for drawing routines */
#define CoordModeOrigin 0 /* relative to the origin */
#define CoordModePrevious 1 /* relative to previous point */
/* Polygon shapes */
#define Complex 0 /* paths may intersect */
#define Nonconvex 1 /* no paths intersect, but not convex */
#define Convex 2 /* wholly convex */
/* Arc modes for PolyFillArc */
#define ArcChord 0 /* join endpoints of arc */
#define ArcPieSlice 1 /* join endpoints to center of arc */
/* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
GC.stateChanges */
#define GCFunction (1L<<0)
#define GCPlaneMask (1L<<1)
#define GCForeground (1L<<2)
#define GCBackground (1L<<3)
#define GCLineWidth (1L<<4)
#define GCLineStyle (1L<<5)
#define GCCapStyle (1L<<6)
#define GCJoinStyle (1L<<7)
#define GCFillStyle (1L<<8)
#define GCFillRule (1L<<9)
#define GCTile (1L<<10)
#define GCStipple (1L<<11)
#define GCTileStipXOrigin (1L<<12)
#define GCTileStipYOrigin (1L<<13)
#define GCFont (1L<<14)
#define GCSubwindowMode (1L<<15)
#define GCGraphicsExposures (1L<<16)
#define GCClipXOrigin (1L<<17)
#define GCClipYOrigin (1L<<18)
#define GCClipMask (1L<<19)
#define GCDashOffset (1L<<20)
#define GCDashList (1L<<21)
#define GCArcMode (1L<<22)
#define GCLastBit 22
/*****************************************************************
* FONTS
*****************************************************************/
/* used in QueryFont -- draw direction */
#define FontLeftToRight 0
#define FontRightToLeft 1
#define FontChange 255
/*****************************************************************
* IMAGING
*****************************************************************/
/* ImageFormat -- PutImage, GetImage */
#define XYBitmap 0 /* depth 1, XYFormat */
#define XYPixmap 1 /* depth == drawable depth */
#define ZPixmap 2 /* depth == drawable depth */
/*****************************************************************
* COLOR MAP STUFF
*****************************************************************/
/* For CreateColormap */
#define AllocNone 0 /* create map with no entries */
#define AllocAll 1 /* allocate entire map writeable */
/* Flags used in StoreNamedColor, StoreColors */
#define DoRed (1<<0)
#define DoGreen (1<<1)
#define DoBlue (1<<2)
/*****************************************************************
* CURSOR STUFF
*****************************************************************/
/* QueryBestSize Class */
#define CursorShape 0 /* largest size that can be displayed */
#define TileShape 1 /* size tiled fastest */
#define StippleShape 2 /* size stippled fastest */
/*****************************************************************
* KEYBOARD/POINTER STUFF
*****************************************************************/
#define AutoRepeatModeOff 0
#define AutoRepeatModeOn 1
#define AutoRepeatModeDefault 2
#define LedModeOff 0
#define LedModeOn 1
/* masks for ChangeKeyboardControl */
#define KBKeyClickPercent (1L<<0)
#define KBBellPercent (1L<<1)
#define KBBellPitch (1L<<2)
#define KBBellDuration (1L<<3)
#define KBLed (1L<<4)
#define KBLedMode (1L<<5)
#define KBKey (1L<<6)
#define KBAutoRepeatMode (1L<<7)
#define MappingSuccess 0
#define MappingBusy 1
#define MappingFailed 2
#define MappingModifier 0
#define MappingKeyboard 1
#define MappingPointer 2
/*****************************************************************
* SCREEN SAVER STUFF
*****************************************************************/
#define DontPreferBlanking 0
#define PreferBlanking 1
#define DefaultBlanking 2
#define DisableScreenSaver 0
#define DisableScreenInterval 0
#define DontAllowExposures 0
#define AllowExposures 1
#define DefaultExposures 2
/* for ForceScreenSaver */
#define ScreenSaverReset 0
#define ScreenSaverActive 1
/*****************************************************************
* HOSTS AND CONNECTIONS
*****************************************************************/
/* for ChangeHosts */
#define HostInsert 0
#define HostDelete 1
/* for ChangeAccessControl */
#define EnableAccess 1
#define DisableAccess 0
/* Display classes used in opening the connection
* Note that the statically allocated ones are even numbered and the
* dynamically changeable ones are odd numbered */
#define StaticGray 0
#define GrayScale 1
#define StaticColor 2
#define PseudoColor 3
#define TrueColor 4
#define DirectColor 5
/* Byte order used in imageByteOrder and bitmapBitOrder */
#define LSBFirst 0
#define MSBFirst 1
#endif /* X_H */

Wyświetl plik

@ -0,0 +1,184 @@
/* Xfuncproto.h. Generated from Xfuncproto.h.in by configure. */
/*
*
Copyright 1989, 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*
*/
/* Definitions to make function prototypes manageable */
#ifndef _XFUNCPROTO_H_
#define _XFUNCPROTO_H_
#ifndef NeedFunctionPrototypes
#define NeedFunctionPrototypes 1
#endif /* NeedFunctionPrototypes */
#ifndef NeedVarargsPrototypes
#define NeedVarargsPrototypes 1
#endif /* NeedVarargsPrototypes */
#if NeedFunctionPrototypes
#ifndef NeedNestedPrototypes
#define NeedNestedPrototypes 1
#endif /* NeedNestedPrototypes */
#ifndef _Xconst
#define _Xconst const
#endif /* _Xconst */
/* Function prototype configuration (see configure for more info) */
#ifndef NARROWPROTO
#define NARROWPROTO /**/
#endif
#ifndef FUNCPROTO
#define FUNCPROTO 15
#endif
#ifndef NeedWidePrototypes
#ifdef NARROWPROTO
#define NeedWidePrototypes 0
#else
#define NeedWidePrototypes 1 /* default to make interropt. easier */
#endif
#endif /* NeedWidePrototypes */
#endif /* NeedFunctionPrototypes */
#ifndef _XFUNCPROTOBEGIN
#if defined(__cplusplus) || defined(c_plusplus) /* for C++ V2.0 */
#define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */
#define _XFUNCPROTOEND }
#else
#define _XFUNCPROTOBEGIN
#define _XFUNCPROTOEND
#endif
#endif /* _XFUNCPROTOBEGIN */
/* Added in X11R6.9, so available in any version of modular xproto */
#if defined(__GNUC__) && (__GNUC__ >= 4)
# define _X_SENTINEL(x) __attribute__ ((__sentinel__(x)))
#else
# define _X_SENTINEL(x)
#endif /* GNUC >= 4 */
/* Added in X11R6.9, so available in any version of modular xproto */
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define _X_EXPORT __attribute__((visibility("default")))
# define _X_HIDDEN __attribute__((visibility("hidden")))
# define _X_INTERNAL __attribute__((visibility("internal")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define _X_EXPORT __global
# define _X_HIDDEN __hidden
# define _X_INTERNAL __hidden
#else /* not gcc >= 4 and not Sun Studio >= 8 */
# define _X_EXPORT
# define _X_HIDDEN
# define _X_INTERNAL
#endif /* GNUC >= 4 */
/* Branch prediction hints for individual conditionals */
/* requires xproto >= 7.0.9 */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
# define _X_LIKELY(x) __builtin_expect(!!(x), 1)
# define _X_UNLIKELY(x) __builtin_expect(!!(x), 0)
#else /* not gcc >= 3.3 */
# define _X_LIKELY(x) (x)
# define _X_UNLIKELY(x) (x)
#endif
/* Bulk branch prediction hints via marking error path functions as "cold" */
/* requires xproto >= 7.0.25 */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */
# define _X_COLD __attribute__((__cold__))
#else
# define _X_COLD /* nothing */
#endif
/* Added in X11R6.9, so available in any version of modular xproto */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 301)
# define _X_DEPRECATED __attribute__((deprecated))
#else /* not gcc >= 3.1 */
# define _X_DEPRECATED
#endif
/* requires xproto >= 7.0.17 */
#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)) \
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define _X_NORETURN __attribute((noreturn))
#else
# define _X_NORETURN
#endif /* GNUC */
/* Added in X11R6.9, so available in any version of modular xproto */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
# define _X_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
#else /* not gcc >= 2.3 */
# define _X_ATTRIBUTE_PRINTF(x,y)
#endif
/* requires xproto >= 7.0.22 - since this uses either gcc or C99 variable
argument macros, must be only used inside #ifdef _X_NONNULL guards, as
many legacy X clients are compiled in C89 mode still. */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 303)
#define _X_NONNULL(args...) __attribute__((nonnull(args)))
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */
#define _X_NONNULL(...) /* */
#endif
/* requires xproto >= 7.0.22 */
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 205)
#define _X_UNUSED __attribute__((__unused__))
#else
#define _X_UNUSED /* */
#endif
/* C99 keyword "inline" or equivalent extensions in pre-C99 compilers */
/* requires xproto >= 7.0.9
(introduced in 7.0.8 but didn't support all compilers until 7.0.9) */
#if defined(inline) /* assume autoconf set it correctly */ || \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L)) /* C99 */ || \
(defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550))
# define _X_INLINE inline
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
# define _X_INLINE __inline__
#else
# define _X_INLINE
#endif
/* C99 keyword "restrict" or equivalent extensions in pre-C99 compilers */
/* requires xproto >= 7.0.21 */
#ifndef _X_RESTRICT_KYWD
# if defined(restrict) /* assume autoconf set it correctly */ || \
(defined(__STDC_VERSION__) && (__STDC_VERSION__ - 0 >= 199901L) /* C99 */ \
&& !defined(__cplusplus)) /* Workaround g++ issue on Solaris */
# define _X_RESTRICT_KYWD restrict
# elif defined(__GNUC__) && !defined(__STRICT_ANSI__) /* gcc w/C89+extensions */
# define _X_RESTRICT_KYWD __restrict__
# else
# define _X_RESTRICT_KYWD
# endif
#endif
#endif /* _XFUNCPROTO_H_ */

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,116 @@
/*
* O/S-dependent (mis)feature macro definitions
*
Copyright 1991, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
#ifndef _XOSDEFS_H_
# define _XOSDEFS_H_
/*
* X_NOT_POSIX means does not have POSIX header files. Lack of this
* symbol does NOT mean that the POSIX environment is the default.
* You may still have to define _POSIX_SOURCE to get it.
*/
# ifdef _SCO_DS
# ifndef __SCO__
# define __SCO__
# endif
# endif
# ifdef __i386__
# ifdef SYSV
# if !defined(__SCO__) && \
!defined(__UNIXWARE__) && !defined(__sun)
# if !defined(_POSIX_SOURCE)
# define X_NOT_POSIX
# endif
# endif
# endif
# endif
# ifdef __sun
/* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4
* This check allows non-Imake configured programs to build correctly.
*/
# if defined(__SVR4) && !defined(SVR4)
# define SVR4 1
# endif
# ifdef SVR4
/* define this to whatever it needs to be */
# define X_POSIX_C_SOURCE 199300L
# endif
# endif
# ifdef WIN32
# ifndef _POSIX_
# define X_NOT_POSIX
# endif
# endif
# ifdef __APPLE__
# define NULL_NOT_ZERO
/* Defining any of these will sanitize the namespace to JUST want is defined by
* that particular standard. If that happens, we don't get some expected
* prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to
* loosen our belts a tad.
*/
# if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE)
# ifndef _DARWIN_C_SOURCE
# define _DARWIN_C_SOURCE
# endif
# endif
# endif
# ifdef __GNU__
# ifndef PATH_MAX
# define PATH_MAX 4096
# endif
# ifndef MAXPATHLEN
# define MAXPATHLEN 4096
# endif
# endif
# if defined(__SCO__) || defined(__UNIXWARE__)
# ifndef PATH_MAX
# define PATH_MAX 1024
# endif
# ifndef MAXPATHLEN
# define MAXPATHLEN 1024
# endif
# endif
# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \
|| defined(__APPLE__) || defined(__DragonFly__)
# ifndef CSRG_BASED
# define CSRG_BASED
# endif
# endif
#endif /* _XOSDEFS_H_ */

Wyświetl plik

@ -0,0 +1,838 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
#ifndef _X11_XUTIL_H_
#define _X11_XUTIL_H_
/* You must include <X11/Xlib.h> before including this file */
#include <X11/Xlib.h>
#include <X11/keysym.h>
/* The Xlib structs are full of implicit padding to properly align members.
We can't clean that up without breaking ABI, so tell clang not to bother
complaining about it. */
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
/*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
*/
#define NoValue 0x0000
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
#define AllValues 0x000F
#define XNegative 0x0010
#define YNegative 0x0020
/*
* new version containing base_width, base_height, and win_gravity fields;
* used with WM_NORMAL_HINTS.
*/
typedef struct {
long flags; /* marks which fields in this structure are defined */
int x, y; /* obsolete for new window mgrs, but clients */
int width, height; /* should set so old wm's don't mess up */
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct {
int x; /* numerator */
int y; /* denominator */
} min_aspect, max_aspect;
int base_width, base_height; /* added by ICCCM version 1 */
int win_gravity; /* added by ICCCM version 1 */
} XSizeHints;
/*
* The next block of definitions are for window manager properties that
* clients and applications use for communication.
*/
/* flags argument in size hints */
#define USPosition (1L << 0) /* user specified x, y */
#define USSize (1L << 1) /* user specified width, height */
#define PPosition (1L << 2) /* program specified position */
#define PSize (1L << 3) /* program specified size */
#define PMinSize (1L << 4) /* program specified minimum size */
#define PMaxSize (1L << 5) /* program specified maximum size */
#define PResizeInc (1L << 6) /* program specified resize increments */
#define PAspect (1L << 7) /* program specified min and max aspect ratios */
#define PBaseSize (1L << 8) /* program specified base for incrementing */
#define PWinGravity (1L << 9) /* program specified window gravity */
/* obsolete */
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
typedef struct {
long flags; /* marks which fields in this structure are defined */
Bool input; /* does this application rely on the window manager to
get keyboard input? */
int initial_state; /* see below */
Pixmap icon_pixmap; /* pixmap to be used as icon */
Window icon_window; /* window to be used as icon */
int icon_x, icon_y; /* initial position of icon */
Pixmap icon_mask; /* icon mask bitmap */
XID window_group; /* id of related window group */
/* this structure may be extended in the future */
} XWMHints;
/* definition for flags of XWMHints */
#define InputHint (1L << 0)
#define StateHint (1L << 1)
#define IconPixmapHint (1L << 2)
#define IconWindowHint (1L << 3)
#define IconPositionHint (1L << 4)
#define IconMaskHint (1L << 5)
#define WindowGroupHint (1L << 6)
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
IconPositionHint|IconMaskHint|WindowGroupHint)
#define XUrgencyHint (1L << 8)
/* definitions for initial window state */
#define WithdrawnState 0 /* for windows that are not mapped */
#define NormalState 1 /* most applications want to start this way */
#define IconicState 3 /* application wants to start as an icon */
/*
* Obsolete states no longer defined by ICCCM
*/
#define DontCareState 0 /* don't know or care */
#define ZoomState 2 /* application wants to start zoomed */
#define InactiveState 4 /* application believes it is seldom used; */
/* some wm's may put it on inactive menu */
/*
* new structure for manipulating TEXT properties; used with WM_NAME,
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
*/
typedef struct {
unsigned char *value; /* same as Property routines */
Atom encoding; /* prop type */
int format; /* prop data format: 8, 16, or 32 */
unsigned long nitems; /* number of data items in value */
} XTextProperty;
#define XNoMemory -1
#define XLocaleNotSupported -2
#define XConverterNotFound -3
typedef enum {
XStringStyle, /* STRING */
XCompoundTextStyle, /* COMPOUND_TEXT */
XTextStyle, /* text in owner's encoding (current locale)*/
XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
/* The following is an XFree86 extension, introduced in November 2000 */
XUTF8StringStyle /* UTF8_STRING */
} XICCEncodingStyle;
typedef struct {
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
} XIconSize;
typedef struct {
char *res_name;
char *res_class;
} XClassHint;
#ifdef XUTIL_DEFINE_FUNCTIONS
extern int XDestroyImage(
XImage *ximage);
extern unsigned long XGetPixel(
XImage *ximage,
int x, int y);
extern int XPutPixel(
XImage *ximage,
int x, int y,
unsigned long pixel);
extern XImage *XSubImage(
XImage *ximage,
int x, int y,
unsigned int width, unsigned int height);
extern int XAddPixel(
XImage *ximage,
long value);
#else
/*
* These macros are used to give some sugar to the image routines so that
* naive people are more comfortable with them.
*/
#define XDestroyImage(ximage) \
((*((ximage)->f.destroy_image))((ximage)))
#define XGetPixel(ximage, x, y) \
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
#define XPutPixel(ximage, x, y, pixel) \
((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
#define XSubImage(ximage, x, y, width, height) \
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
#define XAddPixel(ximage, value) \
((*((ximage)->f.add_pixel))((ximage), (value)))
#endif
/*
* Compose sequence status structure, used in calling XLookupString.
*/
typedef struct _XComposeStatus {
XPointer compose_ptr; /* state table pointer */
int chars_matched; /* match state */
} XComposeStatus;
/*
* Keysym macros, used on Keysyms to test for classes of symbols
*/
#define IsKeypadKey(keysym) \
(((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
#define IsPrivateKeypadKey(keysym) \
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#define IsCursorKey(keysym) \
(((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
#define IsPFKey(keysym) \
(((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
#define IsFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
#define IsMiscFunctionKey(keysym) \
(((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
#ifdef XK_XKB_KEYS
#define IsModifierKey(keysym) \
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
|| (((KeySym)(keysym) >= XK_ISO_Lock) && \
((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
|| ((KeySym)(keysym) == XK_Mode_switch) \
|| ((KeySym)(keysym) == XK_Num_Lock))
#else
#define IsModifierKey(keysym) \
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
|| ((KeySym)(keysym) == XK_Mode_switch) \
|| ((KeySym)(keysym) == XK_Num_Lock))
#endif
/*
* opaque reference to Region data type
*/
typedef struct _XRegion *Region;
/* Return values from XRectInRegion() */
#define RectangleOut 0
#define RectangleIn 1
#define RectanglePart 2
/*
* Information used by the visual utility routines to find desired visual
* type from the many visuals a display may support.
*/
typedef struct {
Visual *visual;
VisualID visualid;
int screen;
int depth;
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ */
#else
int class;
#endif
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
int colormap_size;
int bits_per_rgb;
} XVisualInfo;
#define VisualNoMask 0x0
#define VisualIDMask 0x1
#define VisualScreenMask 0x2
#define VisualDepthMask 0x4
#define VisualClassMask 0x8
#define VisualRedMaskMask 0x10
#define VisualGreenMaskMask 0x20
#define VisualBlueMaskMask 0x40
#define VisualColormapSizeMask 0x80
#define VisualBitsPerRGBMask 0x100
#define VisualAllMask 0x1FF
/*
* This defines a window manager property that clients may use to
* share standard color maps of type RGB_COLOR_MAP:
*/
typedef struct {
Colormap colormap;
unsigned long red_max;
unsigned long red_mult;
unsigned long green_max;
unsigned long green_mult;
unsigned long blue_max;
unsigned long blue_mult;
unsigned long base_pixel;
VisualID visualid; /* added by ICCCM version 1 */
XID killid; /* added by ICCCM version 1 */
} XStandardColormap;
#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
/*
* return codes for XReadBitmapFile and XWriteBitmapFile
*/
#define BitmapSuccess 0
#define BitmapOpenFailed 1
#define BitmapFileInvalid 2
#define BitmapNoMemory 3
/****************************************************************
*
* Context Management
*
****************************************************************/
/* Associative lookup table return codes */
#define XCSUCCESS 0 /* No error. */
#define XCNOMEM 1 /* Out of memory */
#define XCNOENT 2 /* No entry in table */
typedef int XContext;
#define XUniqueContext() ((XContext) XrmUniqueQuark())
#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
_XFUNCPROTOBEGIN
/* The following declarations are alphabetized. */
extern XClassHint *XAllocClassHint (
void
);
extern XIconSize *XAllocIconSize (
void
);
extern XSizeHints *XAllocSizeHints (
void
);
extern XStandardColormap *XAllocStandardColormap (
void
);
extern XWMHints *XAllocWMHints (
void
);
extern int XClipBox(
Region /* r */,
XRectangle* /* rect_return */
);
extern Region XCreateRegion(
void
);
extern const char *XDefaultString (void);
extern int XDeleteContext(
Display* /* display */,
XID /* rid */,
XContext /* context */
);
extern int XDestroyRegion(
Region /* r */
);
extern int XEmptyRegion(
Region /* r */
);
extern int XEqualRegion(
Region /* r1 */,
Region /* r2 */
);
extern int XFindContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
XPointer* /* data_return */
);
extern Status XGetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints_return */
);
extern Status XGetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize** /* size_list_return */,
int* /* count_return */
);
extern Status XGetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */
);
extern Status XGetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap** /* stdcmap_return */,
int* /* count_return */,
Atom /* property */
);
extern Status XGetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
Atom /* property */
);
extern Status XGetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap_return */,
Atom /* property */
);
extern Status XGetTextProperty(
Display* /* display */,
Window /* window */,
XTextProperty* /* text_prop_return */,
Atom /* property */
);
extern XVisualInfo *XGetVisualInfo(
Display* /* display */,
long /* vinfo_mask */,
XVisualInfo* /* vinfo_template */,
int* /* nitems_return */
);
extern Status XGetWMClientMachine(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern XWMHints *XGetWMHints(
Display* /* display */,
Window /* w */
);
extern Status XGetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern Status XGetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop_return */
);
extern Status XGetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */
);
extern Status XGetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints_return */,
long* /* supplied_return */,
Atom /* property */
);
extern Status XGetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints_return */
);
extern int XIntersectRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern void XConvertCase(
KeySym /* sym */,
KeySym* /* lower */,
KeySym* /* upper */
);
extern int XLookupString(
XKeyEvent* /* event_struct */,
char* /* buffer_return */,
int /* bytes_buffer */,
KeySym* /* keysym_return */,
XComposeStatus* /* status_in_out */
);
extern Status XMatchVisualInfo(
Display* /* display */,
int /* screen */,
int /* depth */,
int /* class */,
XVisualInfo* /* vinfo_return */
);
extern int XOffsetRegion(
Region /* r */,
int /* dx */,
int /* dy */
);
extern Bool XPointInRegion(
Region /* r */,
int /* x */,
int /* y */
);
extern Region XPolygonRegion(
XPoint* /* points */,
int /* n */,
int /* fill_rule */
);
extern int XRectInRegion(
Region /* r */,
int /* x */,
int /* y */,
unsigned int /* width */,
unsigned int /* height */
);
extern int XSaveContext(
Display* /* display */,
XID /* rid */,
XContext /* context */,
_Xconst char* /* data */
);
extern int XSetClassHint(
Display* /* display */,
Window /* w */,
XClassHint* /* class_hints */
);
extern int XSetIconSizes(
Display* /* display */,
Window /* w */,
XIconSize* /* size_list */,
int /* count */
);
extern int XSetNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
);
extern void XSetRGBColormaps(
Display* /* display */,
Window /* w */,
XStandardColormap* /* stdcmaps */,
int /* count */,
Atom /* property */
);
extern int XSetSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
);
extern int XSetStandardProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
Pixmap /* icon_pixmap */,
char** /* argv */,
int /* argc */,
XSizeHints* /* hints */
);
extern void XSetTextProperty(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */,
Atom /* property */
);
extern void XSetWMClientMachine(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern int XSetWMHints(
Display* /* display */,
Window /* w */,
XWMHints* /* wm_hints */
);
extern void XSetWMIconName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern void XSetWMName(
Display* /* display */,
Window /* w */,
XTextProperty* /* text_prop */
);
extern void XSetWMNormalHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */
);
extern void XSetWMProperties(
Display* /* display */,
Window /* w */,
XTextProperty* /* window_name */,
XTextProperty* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void XmbSetWMProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void Xutf8SetWMProperties(
Display* /* display */,
Window /* w */,
_Xconst char* /* window_name */,
_Xconst char* /* icon_name */,
char** /* argv */,
int /* argc */,
XSizeHints* /* normal_hints */,
XWMHints* /* wm_hints */,
XClassHint* /* class_hints */
);
extern void XSetWMSizeHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* hints */,
Atom /* property */
);
extern int XSetRegion(
Display* /* display */,
GC /* gc */,
Region /* r */
);
extern void XSetStandardColormap(
Display* /* display */,
Window /* w */,
XStandardColormap* /* colormap */,
Atom /* property */
);
extern int XSetZoomHints(
Display* /* display */,
Window /* w */,
XSizeHints* /* zhints */
);
extern int XShrinkRegion(
Region /* r */,
int /* dx */,
int /* dy */
);
extern Status XStringListToTextProperty(
char** /* list */,
int /* count */,
XTextProperty* /* text_prop_return */
);
extern int XSubtractRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern int XmbTextListToTextProperty(
Display* display,
char** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern int XwcTextListToTextProperty(
Display* display,
wchar_t** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern int Xutf8TextListToTextProperty(
Display* display,
char** list,
int count,
XICCEncodingStyle style,
XTextProperty* text_prop_return
);
extern void XwcFreeStringList(
wchar_t** list
);
extern Status XTextPropertyToStringList(
XTextProperty* /* text_prop */,
char*** /* list_return */,
int* /* count_return */
);
extern int XmbTextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
char*** list_return,
int* count_return
);
extern int XwcTextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
wchar_t*** list_return,
int* count_return
);
extern int Xutf8TextPropertyToTextList(
Display* display,
const XTextProperty* text_prop,
char*** list_return,
int* count_return
);
extern int XUnionRectWithRegion(
XRectangle* /* rectangle */,
Region /* src_region */,
Region /* dest_region_return */
);
extern int XUnionRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
extern int XWMGeometry(
Display* /* display */,
int /* screen_number */,
_Xconst char* /* user_geometry */,
_Xconst char* /* default_geometry */,
unsigned int /* border_width */,
XSizeHints* /* hints */,
int* /* x_return */,
int* /* y_return */,
int* /* width_return */,
int* /* height_return */,
int* /* gravity_return */
);
extern int XXorRegion(
Region /* sra */,
Region /* srb */,
Region /* dr_return */
);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
_XFUNCPROTOEND
#endif /* _X11_XUTIL_H_ */

Wyświetl plik

@ -0,0 +1,74 @@
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* default keysyms */
#define XK_MISCELLANY
#define XK_XKB_KEYS
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
#define XK_LATIN8
#define XK_LATIN9
#define XK_CAUCASUS
#define XK_GREEK
#define XK_KATAKANA
#define XK_ARABIC
#define XK_CYRILLIC
#define XK_HEBREW
#define XK_THAI
#define XK_KOREAN
#define XK_ARMENIAN
#define XK_GEORGIAN
#define XK_VIETNAMESE
#define XK_CURRENCY
#define XK_MATHEMATICAL
#define XK_BRAILLE
#define XK_SINHALA
#include <X11/keysymdef.h>

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1,34 @@
#!/bin/bash
# architecture prefix
ARCH="arm-bcm2708hardfp-linux-gnueabi"
# path to the toolchain and kernel base
TOOL_PATH=/home/petermaierh/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/
# path to the toolchain base
BASE_PATH=$TOOL_PATH
# cumulative toolchain prefix
PREFIX=$BASE_PATH/bin/$ARCH
export CC=$PREFIX-gcc
export CXX=$PREFIX-g++
export LD=$PREFIX-ld
export NM="$PREFIX-nm -B"
export AR=$PREFIX-ar
export RANLIB=$PREFIX-ranlib
export STRIP=$PREFIX-strip
export OBJCOPY=$PREFIX-objcopy
export LN_S="ln -s"
export CFLAGS="-Wall -O3 -funroll-loops -I$BASE_PATH/include -I../zlib-1.2.8 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s"
export CPPFLAGS="-I$BASE_PATH/include"
export CXXFLAGS=""
export LDFLAGS="-L$BASE_PATH/lib -L$BASE_PATH/$ARCH/lib -L$BASE_PATH/lib/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1 -L../zlib-1.2.8"
./configure --host=$ARCH --prefix=$BASE_PATH --libdir=/home/petermaierh/work/dxlAPRS/src/lib_armv6/
make
make install

Wyświetl plik

@ -0,0 +1,34 @@
#!/bin/bash
# architecture prefix
ARCH="arm-bcm2708hardfp-linux-gnueabi"
# path to the toolchain and kernel base
TOOL_PATH=/home/petermaierh/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/
# path to the toolchain base
BASE_PATH=$TOOL_PATH
# cumulative toolchain prefix
PREFIX=$BASE_PATH/bin/$ARCH
export CC=$PREFIX-gcc
export CXX=$PREFIX-g++
export LD=$PREFIX-ld
export NM="$PREFIX-nm -B"
export AR=$PREFIX-ar
export RANLIB=$PREFIX-ranlib
export STRIP=$PREFIX-strip
export OBJCOPY=$PREFIX-objcopy
export LN_S="ln -s"
export CFLAGS="-Wall -O3 -funroll-loops -I$BASE_PATH/include -I../zlib-1.2.8 -march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s"
export CPPFLAGS="-I$BASE_PATH/include"
export CXXFLAGS=""
export LDFLAGS="-L$BASE_PATH/lib -L$BASE_PATH/$ARCH/lib -L$BASE_PATH/lib/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1 -L../zlib-1.2.8"
./configure --host=$ARCH --prefix=$BASE_PATH --libdir=/home/petermaierh/work/dxlAPRS/src/lib_armv6/libpng15 --includedir=/home/petermaierh/work/dxlAPRS/src/lib_armv6/libpng15
make
make install

Wyświetl plik

@ -0,0 +1,4 @@
#!/bin/sh
CC=../src/arm-linux-rpi-gcc CFLAGS="-march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s" ./configure
CC=../src/arm-linux-rpi-gcc CFLAGS="-march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s" make

Wyświetl plik

@ -0,0 +1,54 @@
/* jconfig.h. Generated from jconfig.cfg by configure. */
/* jconfig.cfg --- source file edited by configure script */
/* see jconfig.txt for explanations */
#define HAVE_PROTOTYPES 1
#define HAVE_UNSIGNED_CHAR 1
#define HAVE_UNSIGNED_SHORT 1
/* #undef void */
/* #undef const */
/* #undef CHAR_IS_UNSIGNED */
#define HAVE_STDDEF_H 1
#define HAVE_STDLIB_H 1
#define HAVE_LOCALE_H 1
/* #undef NEED_BSD_STRINGS */
/* #undef NEED_SYS_TYPES_H */
/* #undef NEED_FAR_POINTERS */
/* #undef NEED_SHORT_EXTERNAL_NAMES */
/* Define this if you get warnings about undefined structures. */
/* #undef INCOMPLETE_TYPES_BROKEN */
/* Define "boolean" as unsigned char, not int, on Windows systems. */
#ifdef _WIN32
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif
#ifdef JPEG_INTERNALS
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
#define INLINE __inline__
/* These are for configuring the JPEG memory manager. */
/* #undef DEFAULT_MAX_MEM */
/* #undef NO_MKTEMP */
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
/* #undef RLE_SUPPORTED */
#define TARGA_SUPPORTED /* Targa image file format */
/* #undef TWO_FILE_COMMANDLINE */
/* #undef NEED_SIGNAL_CATCHER */
/* #undef DONT_USE_B_MODE */
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
/* #undef PROGRESS_REPORT */
#endif /* JPEG_CJPEG_DJPEG */

Wyświetl plik

@ -0,0 +1,304 @@
/*
* jerror.h
*
* Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 1997-2012 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file defines the error and message codes for the JPEG library.
* Edit this file to add new codes, or to translate the message strings to
* some other language.
* A set of error-reporting macros are defined too. Some applications using
* the JPEG library may wish to include this file to get the error codes
* and/or the macros.
*/
/*
* To define the enum list of message codes, include this file without
* defining macro JMESSAGE. To create a message string table, include it
* again with a suitable JMESSAGE definition (see jerror.c for an example).
*/
#ifndef JMESSAGE
#ifndef JERROR_H
/* First time through, define the enum list */
#define JMAKE_ENUM_LIST
#else
/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */
#define JMESSAGE(code,string)
#endif /* JERROR_H */
#endif /* JMESSAGE */
#ifdef JMAKE_ENUM_LIST
typedef enum {
#define JMESSAGE(code,string) code ,
#endif /* JMAKE_ENUM_LIST */
JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
JMESSAGE(JERR_BAD_DROP_SAMPLING,
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length")
JMESSAGE(JERR_BAD_LIB_VERSION,
"Wrong JPEG library version: library is %d, caller expects %d")
JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan")
JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d")
JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d")
JMESSAGE(JERR_BAD_PROGRESSION,
"Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d")
JMESSAGE(JERR_BAD_PROG_SCRIPT,
"Invalid progressive parameters at scan script entry %d")
JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors")
JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d")
JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d")
JMESSAGE(JERR_BAD_STRUCT_SIZE,
"JPEG parameter struct mismatch: library thinks size is %u, caller expects %u")
JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access")
JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small")
JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here")
JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet")
JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d")
JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request")
JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d")
JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x")
JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d")
JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d")
JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)")
JMESSAGE(JERR_EMS_READ, "Read from EMS failed")
JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed")
JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
JMESSAGE(JERR_FILE_READ, "Input file read error")
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
JMESSAGE(JERR_INPUT_EOF, "Premature end of input file")
JMESSAGE(JERR_MISMATCHED_QUANT_TABLE,
"Cannot transcode due to multiple use of quantization table %d")
JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data")
JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined")
JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x")
JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)")
JMESSAGE(JERR_QUANT_COMPONENTS,
"Cannot quantize more than %d color components")
JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors")
JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors")
JMESSAGE(JERR_SOF_BEFORE, "Invalid JPEG file structure: %s before SOF")
JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers")
JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker")
JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x")
JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers")
JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s")
JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file")
JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file")
JMESSAGE(JERR_TFILE_WRITE,
"Write failed on temporary file --- out of disk space?")
JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines")
JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x")
JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up")
JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation")
JMESSAGE(JERR_XMS_READ, "Read from XMS failed")
JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed")
JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT)
JMESSAGE(JMSG_VERSION, JVERSION)
JMESSAGE(JTRC_16BIT_TABLES,
"Caution: quantization tables are too coarse for baseline JPEG")
JMESSAGE(JTRC_ADOBE,
"Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d")
JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u")
JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u")
JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x")
JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x")
JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d")
JMESSAGE(JTRC_DRI, "Define Restart Interval %u")
JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u")
JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u")
JMESSAGE(JTRC_EOI, "End Of Image")
JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u")
JMESSAGE(JTRC_JFIF_EXTENSION,
"JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u")
JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors")
JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors")
JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization")
JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d")
JMESSAGE(JTRC_RST, "RST%d")
JMESSAGE(JTRC_SMOOTH_NOTIMPL,
"Smoothing not supported with nonstandard sampling ratios")
JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d")
JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d")
JMESSAGE(JTRC_SOI, "Start of Image")
JMESSAGE(JTRC_SOS, "Start Of Scan: %d components")
JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d")
JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d")
JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s")
JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s")
JMESSAGE(JTRC_THUMB_JPEG,
"JFIF extension marker: JPEG-compressed thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_PALETTE,
"JFIF extension marker: palette thumbnail image, length %u")
JMESSAGE(JTRC_THUMB_RGB,
"JFIF extension marker: RGB thumbnail image, length %u")
JMESSAGE(JTRC_UNKNOWN_IDS,
"Unrecognized component IDs %d %d %d, assuming YCbCr")
JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
JMESSAGE(JWRN_BOGUS_PROGRESSION,
"Inconsistent progression sequence for component %d coefficient %d")
JMESSAGE(JWRN_EXTRANEOUS_DATA,
"Corrupt JPEG data: %u extraneous bytes before marker 0x%02x")
JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment")
JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code")
JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d")
JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file")
JMESSAGE(JWRN_MUST_RESYNC,
"Corrupt JPEG data: found marker 0x%02x instead of RST%d")
JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG")
JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines")
#ifdef JMAKE_ENUM_LIST
JMSG_LASTMSGCODE
} J_MESSAGE_CODE;
#undef JMAKE_ENUM_LIST
#endif /* JMAKE_ENUM_LIST */
/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */
#undef JMESSAGE
#ifndef JERROR_H
#define JERROR_H
/* Macros to simplify using the error and trace message stuff */
/* The first parameter is either type of cinfo pointer */
/* Fatal errors (print message and exit) */
#define ERREXIT(cinfo,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT1(cinfo,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT2(cinfo,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT3(cinfo,code,p1,p2,p3) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(cinfo)->err->msg_parm.i[4] = (p5), \
(cinfo)->err->msg_parm.i[5] = (p6), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define ERREXITS(cinfo,code,str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
#define MAKESTMT(stuff) do { stuff } while (0)
/* Nonfatal errors (we can keep going, but the data is probably corrupt) */
#define WARNMS(cinfo,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS1(cinfo,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
#define WARNMS2(cinfo,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1))
/* Informational/debugging messages */
#define TRACEMS(cinfo,lvl,code) \
((cinfo)->err->msg_code = (code), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS1(cinfo,lvl,code,p1) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS2(cinfo,lvl,code,p1,p2) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \
MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \
_mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \
_mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \
(cinfo)->err->msg_code = (code); \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); )
#define TRACEMSS(cinfo,lvl,code,str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
(*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)))
#endif /* JERROR_H */

Wyświetl plik

@ -0,0 +1,390 @@
/*
* jmorecfg.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2012 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains additional configuration options that customize the
* JPEG software for special applications or support machine-dependent
* optimizations. Most users will not need to touch this file.
*/
/*
* Define BITS_IN_JSAMPLE as either
* 8 for 8-bit sample values (the usual setting)
* 12 for 12-bit sample values
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
* JPEG standard, and the IJG code does not support anything else!
* We do not support run-time selection of data precision, sorry.
*/
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
/*
* Maximum number of components (color channels) allowed in JPEG image.
* To meet the letter of the JPEG spec, set this to 255. However, darn
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.)
*/
#define MAX_COMPONENTS 10 /* maximum number of image components */
/*
* Basic data types.
* You may need to change these if you have a machine with unusual data
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
* but it had better be at least 16.
*/
/* Representation of a single sample (pixel element value).
* We frequently allocate large arrays of these, so it's important to keep
* them small. But if you have memory to burn and access to char or short
* arrays is very slow on your hardware, you might want to change these.
*/
#if BITS_IN_JSAMPLE == 8
/* JSAMPLE should be the smallest type that will hold the values 0..255.
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JSAMPLE;
#ifdef CHAR_IS_UNSIGNED
#define GETJSAMPLE(value) ((int) (value))
#else
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
#endif /* BITS_IN_JSAMPLE == 8 */
#if BITS_IN_JSAMPLE == 12
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
* On nearly all machines "short" will do nicely.
*/
typedef short JSAMPLE;
#define GETJSAMPLE(value) ((int) (value))
#define MAXJSAMPLE 4095
#define CENTERJSAMPLE 2048
#endif /* BITS_IN_JSAMPLE == 12 */
/* Representation of a DCT frequency coefficient.
* This should be a signed value of at least 16 bits; "short" is usually OK.
* Again, we allocate large arrays of these, but you can change to int
* if you have memory to burn and "short" is really slow.
*/
typedef short JCOEF;
/* Compressed datastreams are represented as arrays of JOCTET.
* These must be EXACTLY 8 bits wide, at least once they are written to
* external storage. Note that when using the stdio data source/destination
* managers, this is also the data type passed to fread/fwrite.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JOCTET;
#define GETJOCTET(value) (value)
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JOCTET;
#ifdef CHAR_IS_UNSIGNED
#define GETJOCTET(value) (value)
#else
#define GETJOCTET(value) ((value) & 0xFF)
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* These typedefs are used for various table entries and so forth.
* They must be at least as wide as specified; but making them too big
* won't cost a huge amount of memory, so we don't provide special
* extraction code like we did for JSAMPLE. (In other words, these
* typedefs live at a different point on the speed/space tradeoff curve.)
*/
/* UINT8 must hold at least the values 0..255. */
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char UINT8;
#else /* not CHAR_IS_UNSIGNED */
typedef short UINT8;
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* UINT16 must hold at least the values 0..65535. */
#ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */
/* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */
#ifndef _BASETSD_H /* MinGW is slightly different */
#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */
typedef long INT32;
#endif
#endif
#endif
#endif
/* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
* "unsigned int" is sufficient on all machines. However, if you need to
* handle larger images and you don't mind deviating from the spec, you
* can change this datatype.
*/
typedef unsigned int JDIMENSION;
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
/* These macros are used in all function definitions and extern declarations.
* You could modify them if you need to change function linkage conventions;
* in particular, you'll need to do that to make the library a Windows DLL.
* Another application is to make all functions global for use with debuggers
* or code profilers that require it.
*/
/* a function called through method pointers: */
#define METHODDEF(type) static type
/* a function used only in its module: */
#define LOCAL(type) static type
/* a function referenced thru EXTERNs: */
#define GLOBAL(type) type
/* a reference to a GLOBAL function: */
#define EXTERN(type) extern type
/* This macro is used to declare a "method", that is, a function pointer.
* We want to supply prototype parameters if the compiler can cope.
* Note that the arglist parameter must be parenthesized!
* Again, you can customize this if you need special linkage keywords.
*/
#ifdef HAVE_PROTOTYPES
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
#else
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
#endif
/* The noreturn type identifier is used to declare functions
* which cannot return.
* Compilers can thus create more optimized code and perform
* better checks for warnings and errors.
* Static analyzer tools can make improved inferences about
* execution paths and are prevented from giving false alerts.
*
* Unfortunately, the proposed specifications of corresponding
* extensions in the Dec 2011 ISO C standard revision (C11),
* GCC, MSVC, etc. are not viable.
* Thus we introduce a user defined type to declare noreturn
* functions at least for clarity. A proper compiler would
* have a suitable noreturn type to match in place of void.
*/
#ifndef HAVE_NORETURN_T
typedef void noreturn_t;
#endif
/* Here is the pseudo-keyword for declaring pointers that must be "far"
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
* by just saying "FAR *" where such a pointer is needed. In a few places
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
*/
#ifndef FAR
#ifdef NEED_FAR_POINTERS
#define FAR far
#else
#define FAR
#endif
#endif
/*
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
* in standard header files. Or you may have conflicts with application-
* specific header files that you want to include together with these files.
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/
#ifdef HAVE_BOOLEAN
#ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#else
typedef enum { FALSE = 0, TRUE = 1 } boolean;
#endif
/*
* The remaining options affect code selection within the JPEG library,
* but they don't need to be visible to most applications using the library.
* To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
*/
#ifdef JPEG_INTERNALS
#define JPEG_INTERNAL_OPTIONS
#endif
#ifdef JPEG_INTERNAL_OPTIONS
/*
* These defines indicate whether to include various optional functions.
* Undefining some of these symbols will produce a smaller but less capable
* library. Note that you can leave certain source files out of the
* compilation/linking process if you've #undef'd the corresponding symbols.
* (You may HAVE to do that if your compiler doesn't like null source files.)
*/
/* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
/* Encoder capability options: */
#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
* precision, so jchuff.c normally uses entropy optimization to compute
* usable tables for higher precision. If you don't want to do optimization,
* you'll have to supply different default Huffman tables.
* The exact same statements apply for progressive JPEG: the default tables
* don't work for progressive mode. (This may get fixed, however.)
*/
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
/* Decoder capability options: */
#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
/* more capability options later, no doubt */
/*
* Ordering of RGB data in scanlines passed to or from the application.
* If your application wants to deal with data in the order B,G,R, just
* change these macros. You can also deal with formats such as R,G,B,X
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
* the offsets will also change the order in which colormap data is organized.
* RESTRICTIONS:
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
* 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
* is not 3 (they don't understand about dummy color components!). So you
* can't use color quantization if you change that value.
*/
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
#define RGB_GREEN 1 /* Offset of Green */
#define RGB_BLUE 2 /* Offset of Blue */
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
/* Definitions for speed-related optimizations. */
/* If your compiler supports inline functions, define INLINE
* as the inline keyword; otherwise define it as empty.
*/
#ifndef INLINE
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
#define INLINE __inline__
#endif
#ifndef INLINE
#define INLINE /* default is to define it as empty */
#endif
#endif
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
*/
#ifndef MULTIPLIER
#define MULTIPLIER int /* type for fastest integer multiply */
#endif
/* FAST_FLOAT should be either float or double, whichever is done faster
* by your compiler. (Note that this type is only used in the floating point
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
* Typically, float is faster in ANSI C compilers, while double is faster in
* pre-ANSI compilers (because they insist on converting to double anyway).
* The code below therefore chooses float if we have ANSI-style prototypes.
*/
#ifndef FAST_FLOAT
#ifdef HAVE_PROTOTYPES
#define FAST_FLOAT float
#else
#define FAST_FLOAT double
#endif
#endif
#endif /* JPEG_INTERNAL_OPTIONS */

Plik diff jest za duży Load Diff

Wyświetl plik

@ -0,0 +1 @@
libX11.so.6.3.0

Wyświetl plik

@ -0,0 +1 @@
libX11.so.6.3.0

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1 @@
libXau.so.6.0.0

Wyświetl plik

@ -0,0 +1 @@
libXau.so.6.0.0

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1 @@
libXdmcp.so.6.0.0

Wyświetl plik

@ -0,0 +1 @@
libXdmcp.so.6.0.0

Some files were not shown because too many files have changed in this diff Show More