summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp88
-rw-r--r--android/gps_maskdump.c18
-rw-r--r--android/gpsd_config.in (renamed from android/gpsd_config.h)1
-rw-r--r--android/packet_names.h246
-rw-r--r--android/revision.h6
-rw-r--r--android/timebase.h12
6 files changed, 81 insertions, 290 deletions
diff --git a/Android.bp b/Android.bp
index 3ffe478e..96c3a95f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,7 +1,6 @@
cc_binary {
name: "gps_test",
vendor: true,
- local_include_dirs: ["android"],
srcs: [
"android/gps_test.c"
],
@@ -23,7 +22,12 @@ cc_binary {
cc_binary {
name: "gpsd",
vendor: true,
- local_include_dirs: ["android"],
+ generated_headers: [
+ "gpsd_timebase_h",
+ "gpsd_revision_h",
+ "gpsd_config_h",
+ "gpsd_packet_names_h"
+ ],
srcs: [
"dbusexport.c",
"gpsd.c",
@@ -44,13 +48,18 @@ cc_binary {
cc_library_shared {
name: "libgps",
vendor: true,
- local_include_dirs: ["android"],
export_include_dirs: ["."],
+ generated_headers: [
+ "gpsd_timebase_h",
+ "gpsd_revision_h",
+ "gpsd_config_h",
+ "gpsd_packet_names_h"
+ ],
+ generated_sources: ["gps_maskdump_c"],
srcs: [
"bits.c",
"gpsdclient.c",
"gpsutils.c",
- "android/gps_maskdump.c",
"hex.c",
"json.c",
"libgps_core.c",
@@ -74,13 +83,18 @@ cc_library_shared {
cc_library_static {
name: "libgps_static",
vendor: true,
- local_include_dirs: ["android"],
export_include_dirs: ["."],
+ generated_headers: [
+ "gpsd_timebase_h",
+ "gpsd_revision_h",
+ "gpsd_config_h",
+ "gpsd_packet_names_h"
+ ],
+ generated_sources: ["gps_maskdump_c"],
srcs: [
"bits.c",
"gpsdclient.c",
"gpsutils.c",
- "android/gps_maskdump.c",
"hex.c",
"json.c",
"libgps_core.c",
@@ -101,11 +115,71 @@ cc_library_static {
],
}
+genrule {
+ name: "gpsd_packet_names_h",
+ cmd: "rm -f $(out); sed -e '/^ *\\([A-Z][A-Z0-9_]*\\)," +
+ "/s// \"\\1\",/' < $(in) > $(out)",
+ srcs: ["packet_states.h"],
+ out: ["packet_names.h"]
+}
+
+genrule {
+ name: "gpsd_config_h",
+ cmd: "cat $(in)/android/gpsd_config.in > $(out);" +
+ "grep \"^gpsd_version\" $(in)/SConstruct | " +
+ "cut -d\\= -f2 | sed -e 's/^/#define VERSION/'" +
+ ">> $(out)",
+ srcs: [""],
+ out: ["gpsd_config.h"]
+}
+
+genrule {
+ name: "gpsd_revision_h",
+ cmd: "grep \"^gpsd_version\" $(in) | cut -d\\= -f2 " +
+ "| sed -e 's/^/#define REVISION/' > $(out)",
+ srcs: ["SConstruct"],
+ out: ["revision.h"]
+}
+
+python_binary_host {
+ name: "leapsecond",
+ main: "leapsecond.py",
+ srcs: ["leapsecond.py"],
+}
+
+genrule {
+ name: "gpsd_timebase_h",
+ tools: ["leapsecond"],
+ cmd: "$(location leapsecond) -H $(in) > $(out)",
+ srcs: ["leapseconds.cache"],
+ out: ["timebase.h"]
+}
+
+python_binary_host {
+ name: "maskaudit",
+ main: "maskaudit.py",
+ srcs: ["maskaudit.py"]
+}
+
+genrule {
+ name: "gps_maskdump_c",
+ tools: ["maskaudit"],
+ cmd: "cp $(in)/gps.h ./; cp $(in)/gpsd.h ./;" +
+ " $(location maskaudit) -c > $(out)",
+ out: ["gps_maskdump.c"],
+ srcs: [""]
+}
+
cc_library_static {
name: "libgpsd",
vendor: true,
- local_include_dirs: ["android"],
export_include_dirs: ["."],
+ generated_headers: [
+ "gpsd_timebase_h",
+ "gpsd_revision_h",
+ "gpsd_config_h",
+ "gpsd_packet_names_h"
+ ],
srcs: [
"bsd_base64.c",
"crc24q.c",
diff --git a/android/gps_maskdump.c b/android/gps_maskdump.c
deleted file mode 100644
index cac822fd..00000000
--- a/android/gps_maskdump.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* This is the hand-written Android version, since Android
- * cannot make use of scons.
- *
- * This file is Copyright (c) 2019 by the GPSD project
- * SPDX-License-Identifier: BSD-2-clause
- */
-
-#include <stdio.h>
-
-#include "gpsd.h"
-
-const char *gps_maskdump(gps_mask_t set)
-{
- static char buf[222];
- snprintf(buf, sizeof(buf), "{ 0x%llX }", (unsigned long long) set);
- return buf;
-}
-
diff --git a/android/gpsd_config.h b/android/gpsd_config.in
index b02694d6..cb8f1047 100644
--- a/android/gpsd_config.h
+++ b/android/gpsd_config.in
@@ -6,7 +6,6 @@
* SPDX-License-Identifier: BSD-2-clause
*/
-#define VERSION "3.18.1"
#define GPSD_URL "http://catb.org/gpsd"
#define HAVE_LIBRT 1
#define HAVE_LINUX_CAN_H 1
diff --git a/android/packet_names.h b/android/packet_names.h
deleted file mode 100644
index 23ea6e66..00000000
--- a/android/packet_names.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * This file is Copyright (c) 2019 by the GPSD project
- * SPDX-License-Identifier: BSD-2-clause
- */
-
-/* edit packet_states.h to add new packet types. */
- "GROUND_STATE", /* we don't know what packet type to expect */
-
- "COMMENT_BODY", /* pound comment for a test load */
- "COMMENT_RECOGNIZED", /* comment recognized */
-
-#ifdef NMEA0183_ENABLE
- "NMEA_DOLLAR", /* we've seen first character of NMEA leader */
- "NMEA_BANG", /* we've seen first character of an AIS message '!' */
- "NMEA_PUB_LEAD", /* seen second character of NMEA G leader */
- "NMEA_VENDOR_LEAD", /* seen second character of NMEA P leader */
- "NMEA_LEADER_END", /* seen end char of NMEA leader, in body */
- "NMEA_PASHR_A", /* grind through recognizing $PASHR */
- "NMEA_PASHR_S", /* grind through recognizing $PASHR */
- "NMEA_PASHR_H", /* grind through recognizing $PASHR */
- "NMEA_BINARY_BODY", /* Ashtech-style binary packet body, skip until \r\n */
- "NMEA_BINARY_CR", /* \r on end of Ashtech-style binary packet */
- "NMEA_BINARY_NL", /* \n on end of Ashtech-style binary packet */
- "NMEA_CR", /* seen terminating \r of NMEA packet */
- "NMEA_RECOGNIZED", /* saw trailing \n of NMEA packet */
-
- "SIRF_ACK_LEAD_1", /* seen A of possible SiRF Ack */
- "SIRF_ACK_LEAD_2", /* seen c of possible SiRF Ack */
- "AIS_LEAD_1", /* seen initial A of possible AIS message */
- "AIS_LEAD_2", /* seen second I/B/N/X of possible AIS message */
- "AIS_LEAD_ALT1", /* seen initial B of possible AIS message */
- "AIS_LEAD_ALT2", /* seen second S of possible AIS message */
- "AIS_LEAD_ALT3", /* seen initial S of possible AIS message */
- "AIS_LEAD_ALT4", /* seen second A of possible AIS message */
-
- "SEATALK_LEAD_1", /* SeaTalk/Garmin packet leader 'I' */
- "WEATHER_LEAD_1", /* Weather instrument packet leader 'W' */
- "HEADCOMP_LEAD_1", /* Heading/compass packet leader 'H' */
- "TURN_LEAD_1", /* Turn indicator packet leader 'T' */
- "ECDIS_LEAD_1", /* ECDIS packet leader 'E' */
- "SOUNDER_LEAD_1", /* Depth sounder packet leader 'S' */
- "TRANSDUCER_LEAD_1", /* Generic transducer packet leader 'Y' */
- "BEIDOU_LEAD_1", /* Beidou leader */
- "QZSS_LEAD_1", /* Quasi-Zenith Satellite System leader */
-#endif /* NMEA0183_ENABLE */
-
- "DLE_LEADER", /* we've seen the TSIP/EverMore leader (DLE) */
-
-#ifdef TRIPMATE_ENABLE
- "ASTRAL_1", /* ASTRAL leader A */
- "ASTRAL_2", /* ASTRAL leader S */
- "ASTRAL_3", /* ASTRAL leader T */
- "ASTRAL_4", /* ASTRAL leader R */
- "ASTRAL_5", /* ASTRAL leader A */
-#endif /* TRIPMATE_ENABLE */
-
-#ifdef EARTHMATE_ENABLE
- "EARTHA_1", /* EARTHA leader E */
- "EARTHA_2", /* EARTHA leader A */
- "EARTHA_3", /* EARTHA leader R */
- "EARTHA_4", /* EARTHA leader T */
- "EARTHA_5", /* EARTHA leader H */
-#endif /* EARTHMATE_ENABLE */
-
-#if defined(SIRF_ENABLE) || defined(SKYTRAQ_ENABLE)
- "SIRF_LEADER_1", /* seen first character of SiRF/Skytraq leader <0x0A> */
-#endif /* SIRF_ENABLE || SKYTRAQ_ENABLE */
-#ifdef SIRF_ENABLE
- "SIRF_LEADER_2", /* seen second character of SiRF leader */
- "SIRF_LENGTH_1", /* seen first byte of SiRF length */
- "SIRF_PAYLOAD", /* we're in a SiRF payload part */
- "SIRF_DELIVERED", /* saw last byte of SiRF payload/checksum */
- "SIRF_TRAILER_1", /* saw first byte of SiRF trailer */
- "SIRF_RECOGNIZED", /* saw second byte of SiRF trailer */
-#endif /* SIRF_ENABLE */
-
-#ifdef SKYTRAQ_ENABLE
- /* <0xA0,0xA1><Len><Message ID><Message Body><csum><0x0D,0x0A> */
- /* Len is two bytes, is the length of Message ID and Message Body */
- /* Skytraq leader 1 same as SIRF_LEADER_1 */
- "SKY_LEADER_2", /* saw leader 2 <0xA1> */
- "SKY_LENGTH_1", /* saw first byte of packet length */
- "SKY_LENGTH_2", /* saw second byte of packet length */
- "SKY_PAYLOAD", /* we're in a Skytraq payload */
- "SKY_DELIVERED", /* saw last byte of Skytraq payload */
- "SKY_CSUM", /* saw Skytraq checksum */
- "SKY_TRAILER_1", /* saw first byte of Skytraq trailer <0x0D> */
- "SKY_RECOGNIZED", /* found end of the Skytraq packet */
-#endif /* SKYTRAQ_ENABLE */
-
-#ifdef ZODIAC_ENABLE
- "ZODIAC_EXPECTED", /* expecting Zodiac packet */
- "ZODIAC_LEADER_1", /* saw leading 0xff */
- "ZODIAC_LEADER_2", /* saw leading 0x81 */
- "ZODIAC_ID_1", /* saw first byte of ID */
- "ZODIAC_ID_2", /* saw second byte of ID */
- "ZODIAC_LENGTH_1", /* saw first byte of Zodiac packet length */
- "ZODIAC_LENGTH_2", /* saw second byte of Zodiac packet length */
- "ZODIAC_FLAGS_1", /* saw first byte of FLAGS */
- "ZODIAC_FLAGS_2", /* saw second byte of FLAGS */
- "ZODIAC_HSUM_1", /* saw first byte of Header sum */
- "ZODIAC_PAYLOAD", /* we're in a Zodiac payload */
- "ZODIAC_RECOGNIZED", /* found end of the Zodiac packet */
-#endif /* ZODIAC_ENABLE */
-
-#if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) || defined(ONCORE_ENABLE)
- "AT1_LEADER", /* saw True North status leader '@' */
- /* Garmin Simple Text starts with @ leader */
- /* Oncore starts with @ leader */
- "GTXT_RECOGNIZED", /* */
-#endif
-
-#ifdef EVERMORE_ENABLE
- "EVERMORE_LEADER_1", /* a DLE after having seen EverMore data */
- "EVERMORE_LEADER_2", /* seen opening STX of EverMore packet */
- "EVERMORE_PAYLOAD", /* in payload part of EverMore packet */
- "EVERMORE_PAYLOAD_DLE",/* DLE in payload part of EverMore packet */
- "EVERMORE_RECOGNIZED", /* found end of EverMore packet */
-#endif /* EVERMORE_ENABLE */
-
-#ifdef ITRAX_ENABLE
- "ITALK_LEADER_1", /* saw leading < of iTalk packet */
- "ITALK_LEADER_2", /* saw leading ! of iTalk packet */
- "ITALK_LENGTH", /* saw packet length */
- "ITALK_PAYLOAD", /* in payload part of iTalk Packet */
- "ITALK_DELIVERED", /* seen end of payload */
- "ITALK_TRAILER", /* saw iTalk trailer byte */
- "ITALK_RECOGNIZED", /* found end of the iTalk packet */
-#endif /* ITRAX_ENABLE */
-
-#ifdef NAVCOM_ENABLE
- "NAVCOM_EXPECTED", /* expecting Navcom NCT packet */
- "NAVCOM_LEADER_1", /* saw leading 0x02 */
- "NAVCOM_LEADER_2", /* saw leading 0x99 */
- "NAVCOM_LEADER_3", /* saw leading 0x66 */
- "NAVCOM_ID", /* saw message ID */
- "NAVCOM_LENGTH_1", /* saw first byte of Navcom packet length */
- "NAVCOM_LENGTH_2", /* saw second byte of Navcom packet length */
- "NAVCOM_PAYLOAD", /* we're in a Navcom payload */
- "NAVCOM_CSUM", /* saw checksum */
- "NAVCOM_RECOGNIZED", /* found end of the Navcom packet */
-#endif /* NAVCOM_ENABLE */
-
-#ifdef UBLOX_ENABLE
- "UBX_LEADER_1", /* first constant leader byte found */
- "UBX_LEADER_2", /* second constant leader byte found */
- "UBX_CLASS_ID", /* classid read */
- "UBX_MESSAGE_ID", /* message id read */
- "UBX_LENGTH_1", /* first length byte read (le) */
- "UBX_LENGTH_2", /* second length byte read (le) */
- "UBX_PAYLOAD", /* payload eating */
- "UBX_CHECKSUM_A", /* checksum A byte (tcp checksum) */
- "UBX_RECOGNIZED", /* this is also UBX_CHECKSUM_B */
-#endif
-
-#ifdef SUPERSTAR2_ENABLE
- "SUPERSTAR2_LEADER", /* leading SOH */
- "SUPERSTAR2_ID1", /* message type */
- "SUPERSTAR2_ID2", /* message type xor 0xff */
- "SUPERSTAR2_PAYLOAD", /* length of the actual packet data */
- "SUPERSTAR2_CKSUM1",
- "SUPERSTAR2_CKSUM2",
- "SUPERSTAR2_RECOGNIZED",
-#endif
-
-#ifdef ONCORE_ENABLE
- "ONCORE_AT2", /* second @ */
- "ONCORE_ID1", /* first character of command type */
- "ONCORE_PAYLOAD", /* payload eating */
- "ONCORE_CHECKSUM", /* checksum byte */
- "ONCORE_CR", /* closing CR */
- "ONCORE_RECOGNIZED", /* closing LF */
-#endif
-
-#ifdef GEOSTAR_ENABLE
- "GEOSTAR_LEADER_1", /* first constant leader byte found */
- "GEOSTAR_LEADER_2", /* second constant leader byte found */
- "GEOSTAR_LEADER_3", /* third constant leader byte found */
- "GEOSTAR_LEADER_4", /* forth constant leader byte found */
- "GEOSTAR_MESSAGE_ID_1", /* first message id read */
- "GEOSTAR_MESSAGE_ID_2", /* second message id read */
- "GEOSTAR_LENGTH_1", /* first length byte read */
- "GEOSTAR_LENGTH_2", /* second length byte read */
- "GEOSTAR_PAYLOAD", /* payload eating */
- "GEOSTAR_CHECKSUM_A", /* checksum A byte (xor checksum) */
- "GEOSTAR_CHECKSUM_B", /* checksum B byte (xor checksum) */
- "GEOSTAR_CHECKSUM_C", /* checksum C byte (xor checksum) */
- "GEOSTAR_RECOGNIZED", /* this is also GEOSTAR_CHECKSUM_D */
-#endif
-
-#ifdef GREIS_ENABLE
- "GREIS_EXPECTED", /* expecting GREIS packet */
- "GREIS_REPLY_1", /* saw first byte of a reply */
- "GREIS_REPLY_2", /* saw second byte of a reply */
- "GREIS_ID_1", /* saw first byte of ID */
- "GREIS_ID_2", /* saw second byte of ID */
- "GREIS_LENGTH_1", /* saw first length byte */
- "GREIS_LENGTH_2", /* saw second length byte */
- "GREIS_PAYLOAD", /* we're in a GREIS payload */
- "GREIS_RECOGNIZED", /* found end of the GREIS packet */
-#endif
-
-/*
- * Packet formats without checksums start here. We list them last so
- * that if a format with a conflicting structure *and* a checksum can
- * be recognized, that will be preferred.
- */
-
-#if defined(TSIP_ENABLE) || defined(GARMIN_ENABLE)
- "TSIP_LEADER", /* a DLE after having seen TSIP data */
- "TSIP_PAYLOAD", /* we're in TSIP payload */
- "TSIP_DLE", /* we've seen a DLE in TSIP payload */
- "TSIP_RECOGNIZED", /* found end of the TSIP packet */
- "GARMIN_RECOGNIZED", /* found end of Garmin packet */
-#endif /* TSIP_ENABLE GARMIN_ENABLE */
-
-#ifdef RTCM104V2_ENABLE
- "RTCM2_SYNC_STATE", /* we have sync lock */
- "RTCM2_SKIP_STATE", /* we have sync lock, but this character is bad */
- "RTCM2_RECOGNIZED", /* we have an RTCM packet */
-#endif /* RTCM104V2_ENABLE */
-
-#ifdef RTCM104V3_ENABLE
- "RTCM3_LEADER_1", /* constant leader byte found */
- "RTCM3_LEADER_2", /* second leader byte found (high 6 bits zero) */
- "RTCM3_PAYLOAD", /* gathering payload */
- "RTCM3_RECOGNIZED", /* RTCM3 packet recognized */
-#endif
-
-#ifdef PASSTHROUGH_ENABLE
- "JSON_LEADER", /* JSON leading { found */
- "JSON_STRINGLITERAL", /* start of JSON string literal seen */
- "JSON_STRING_SOLIDUS", /* backslash in string */
- "JSON_END_ATTRIBUTE", /* end of JSON attribute */
- "JSON_EXPECT_VALUE", /* just after colon */
- "JSON_END_VALUE", /* end of JSON value */
- "JSON_NUMBER", /* inside a JSON numeric literal */
- "JSON_SPECIAL", /* inside a JSON special literal (true,false,null) */
- "JSON_RECOGNIZED", /* JSON packet recognized */
-#endif
-
-#ifdef STASH_ENABLE
- "STASH_RECOGNIZED", /* stashable prefix recognized */
-#endif
-
-/* end of packet_states.h */
diff --git a/android/revision.h b/android/revision.h
deleted file mode 100644
index b915dcf1..00000000
--- a/android/revision.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * This file is Copyright (c) 2019 by the GPSD project
- * SPDX-License-Identifier: BSD-2-clause
- */
-
-#define REVISION "android-3.19-dev"
diff --git a/android/timebase.h b/android/timebase.h
deleted file mode 100644
index 9e1ecc99..00000000
--- a/android/timebase.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Constants used for GPS time detection and rollover correction.
- *
- * Correct for week beginning 2019-04-18T00:00:00
- *
- * This file is Copyright (c) 2019 by the GPSD project
- * SPDX-License-Identifier: BSD-2-clause
- */
-#define BUILD_CENTURY 2000
-#define BUILD_WEEK 2 # Assumes 10-bit week counter
-#define BUILD_LEAPSECONDS 19
-#define BUILD_ROLLOVERS 2 # Assumes 10-bit week counter