summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-05-22 21:33:40 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-22 21:39:38 +0200
commite6a534227292072fd4a7d079b60596c81b7175fa (patch)
treecc346cab3f0af05f5a8d1fd55b93939f93c17db3 /src
parent808998c3f8e8f46f2feacc52c6581684b5b449ab (diff)
layer23: Fix 'make distcheck'
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/common/Makefile.am2
-rw-r--r--src/host/layer23/include/osmocom/bb/misc/Makefile.am2
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/Makefile.am3
-rw-r--r--src/host/layer23/src/misc/Makefile.am5
-rw-r--r--src/host/layer23/src/misc/geo.c47
-rw-r--r--src/host/layer23/src/misc/geo.h12
6 files changed, 65 insertions, 6 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/Makefile.am b/src/host/layer23/include/osmocom/bb/common/Makefile.am
index d66be98a..f9364cd9 100644
--- a/src/host/layer23/include/osmocom/bb/common/Makefile.am
+++ b/src/host/layer23/include/osmocom/bb/common/Makefile.am
@@ -1,3 +1,3 @@
noinst_HEADERS = l1ctl.h l1l2_interface.h l23_app.h logging.h \
networks.h gps.h sysinfo.h osmocom_data.h utils.h \
- sap_proto.h sap_fsm.h sap_interface.h
+ sap_proto.h sap_fsm.h sap_interface.h sim.h
diff --git a/src/host/layer23/include/osmocom/bb/misc/Makefile.am b/src/host/layer23/include/osmocom/bb/misc/Makefile.am
index 71c9d389..59760906 100644
--- a/src/host/layer23/include/osmocom/bb/misc/Makefile.am
+++ b/src/host/layer23/include/osmocom/bb/misc/Makefile.am
@@ -1 +1 @@
-noinst_HEADERS = layer3.h rslms.h
+noinst_HEADERS = layer3.h rslms.h cell_log.h
diff --git a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am
index 8e4be1ac..623964fd 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/Makefile.am
+++ b/src/host/layer23/include/osmocom/bb/mobile/Makefile.am
@@ -1,3 +1,4 @@
noinst_HEADERS = gsm322.h gsm480_ss.h gsm411_sms.h gsm48_cc.h gsm48_mm.h \
gsm48_rr.h mncc.h settings.h subscriber.h support.h \
- transaction.h vty.h mncc_sock.h mncc_ms.h primitives.h
+ transaction.h vty.h mncc_sock.h mncc_ms.h primitives.h \
+ app_mobile.h voice.h
diff --git a/src/host/layer23/src/misc/Makefile.am b/src/host/layer23/src/misc/Makefile.am
index f3d7e953..78ab962f 100644
--- a/src/host/layer23/src/misc/Makefile.am
+++ b/src/host/layer23/src/misc/Makefile.am
@@ -4,12 +4,11 @@ LDADD = ../common/liblayer23.a $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOC
bin_PROGRAMS = bcch_scan ccch_scan echo_test cell_log cbch_sniff
-noinst_HEADERS = bcch_scan.h
+noinst_HEADERS = bcch_scan.h geo.h
bcch_scan_SOURCES = ../common/main.c app_bcch_scan.c bcch_scan.c
ccch_scan_SOURCES = ../common/main.c app_ccch_scan.c rslms.c
echo_test_SOURCES = ../common/main.c app_echo_test.c
cell_log_LDADD = $(LDADD) -lm
-cell_log_SOURCES = ../common/main.c app_cell_log.c cell_log.c \
- ../../../gsmmap/geo.c
+cell_log_SOURCES = ../common/main.c app_cell_log.c cell_log.c geo.c
cbch_sniff_SOURCES = ../common/main.c app_cbch_sniff.c
diff --git a/src/host/layer23/src/misc/geo.c b/src/host/layer23/src/misc/geo.c
new file mode 100644
index 00000000..65633d2c
--- /dev/null
+++ b/src/host/layer23/src/misc/geo.c
@@ -0,0 +1,47 @@
+#include <math.h>
+#include "geo.h"
+
+void geo2space(double *x, double *y, double *z, double lon, double lat)
+{
+ *z = sin(lat / 180.0 * PI) * POLE_RADIUS;
+ *x = sin(lon / 180.0 * PI) * cos(lat / 180.0 * PI) * EQUATOR_RADIUS;
+ *y = -cos(lon / 180.0 * PI) * cos(lat / 180.0 * PI) * EQUATOR_RADIUS;
+}
+
+void space2geo(double *lon, double *lat, double x, double y, double z)
+{
+ double r;
+
+ /* bring geoid to 1m radius */
+ z = z / POLE_RADIUS;
+ x = x / EQUATOR_RADIUS;
+ y = y / EQUATOR_RADIUS;
+
+ /* normalize */
+ r = sqrt(x * x + y * y + z * z);
+ z = z / r;
+ x = x / r;
+ y = y / r;
+
+ *lat = asin(z) / PI * 180;
+ *lon = atan2(x, -y) / PI * 180;
+}
+
+double distinspace(double x1, double y1, double z1, double x2, double y2,
+ double z2)
+{
+ double x = x1 - x2;
+ double y = y1 - y2;
+ double z = z1 - z2;
+
+ return sqrt(x * x + y * y + z * z);
+}
+
+double distonplane(double x1, double y1, double x2, double y2)
+{
+ double x = x1 - x2;
+ double y = y1 - y2;
+
+ return sqrt(x * x + y * y);
+}
+
diff --git a/src/host/layer23/src/misc/geo.h b/src/host/layer23/src/misc/geo.h
new file mode 100644
index 00000000..25e26cba
--- /dev/null
+++ b/src/host/layer23/src/misc/geo.h
@@ -0,0 +1,12 @@
+/* WGS 84 */
+#define EQUATOR_RADIUS 6378137.0
+#define POLE_RADIUS 6356752.314
+
+#define PI 3.1415926536
+
+void geo2space(double *x, double *y, double *z, double lat, double lon);
+void space2geo(double *lat, double *lon, double x, double y, double z);
+double distinspace(double x1, double y1, double z1, double x2, double y2,
+ double z2);
+double distonplane(double x1, double y1, double x2, double y2);
+