From 508418917ea822bf3a5b8bdbda59f032ca9dcf20 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Thu, 24 Jul 2025 19:54:29 +0800 Subject: [PATCH] drivers/sensor: Add flags for GNSS satellite Some applications require satellite information for positioning using the flag USED_IN_FIX. Signed-off-by: wangjianyu3 --- include/nuttx/uorb.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/include/nuttx/uorb.h b/include/nuttx/uorb.h index 2cb324eaf3e..4b74ddfbedb 100644 --- a/include/nuttx/uorb.h +++ b/include/nuttx/uorb.h @@ -526,6 +526,17 @@ #define SENSOR_GNSS_SAT_INFO_MAX 4 +/* GNSS satellite status flags, see `flags` of `struct sensor_gnss_satellite` + * Refs: https://android.googlesource.com/platform/hardware/libhardware/+/ + * refs/heads/android14-release/include/hardware/gnss-base.h#134 + */ + +#define SENSOR_GNSS_SV_FLAGS_NONE (0) +#define SENSOR_GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA (1 << 0) +#define SENSOR_GNSS_SV_FLAGS_HAS_ALMANAC_DATA (1 << 1) +#define SENSOR_GNSS_SV_FLAGS_USED_IN_FIX (1 << 2) +#define SENSOR_GNSS_SV_FLAGS_HAS_CARRIER_FREQUENCY (1 << 3) + /* Maximum length of sensor device information name and path name. */ #define SENSOR_INFO_NAME_SIZE 32 @@ -951,7 +962,11 @@ struct sensor_gnss_satellite uint32_t constellation; - float cf; /* Carrier Frequency(Hz), GSV.signal_id */ + /* Carrier Frequency(Hz), GSV.signal_id. + * Flag: SENSOR_GNSS_SV_FLAGS_HAS_CARRIER_FREQUENCY + */ + + float cf; struct satellite { @@ -972,6 +987,10 @@ struct sensor_gnss_satellite */ uint32_t snr; + + /* Indicating what fields are valid. */ + + uint32_t flags; } info[SENSOR_GNSS_SAT_INFO_MAX]; };