wangjianyu3 d94aa77e19 uORB/sensor: Add GNSS Geofence, Measurement & Clock.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:42:31 +08:00

87 lines
3.9 KiB
C

/****************************************************************************
* apps/system/uorb/sensor/gnss.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sensor/gnss.h>
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_DEBUG_UORB
#define UORB_DEBUG_FORMAT_SENSOR_GNSS \
"timestamp:%" PRIu64 ",time_utc:%" PRIu64 ",latitude:%hf,longitude:%hf," \
"altitude:%hf,altitude_ellipsoid:%hf,eph:%hf,epv:%hf,hdop:%hf,pdop:%hf," \
"vdop:%hf,ground_speed:%hf,course:%hf,satellites_used:%" PRIu32 ""
static const char sensor_gnss_format[] =
UORB_DEBUG_FORMAT_SENSOR_GNSS;
static const char sensor_gnss_clock_format[] =
"flags:%" PRIx32 ",leap_second:%" PRId32 ",time_ns:%" PRId64 ","
"time_uncertainty_ns:%hf,hw_clock_discontinuity_count:%" PRIu32 ","
"full_bias_ns:%" PRId64 ",bias_ns:%hf,bias_uncertainty_ns:%hf,"
"drift_nsps:%hf,drift_uncertainty_nsps:%hf";
static const char sensor_gnss_geofence_event_format[] =
"type:%" PRId32 ",geofence_id:%" PRId32 ","
UORB_DEBUG_FORMAT_SENSOR_GNSS ","
"timestamp:%" PRId64 ",status:%" PRId32 ",transition:%" PRId32 "";
static const char sensor_gnss_measurement_format[] =
"flags:%" PRIx32 ",svid:%" PRId32 ",constellation:%" PRIu32 ","
"time_offset_ns:%hf,received_sv_time_in_ns:%" PRId64 ","
"received_sv_time_uncertainty_in_ns:%" PRId64 ",state:%" PRIu32 ","
"c_n0_dbhz:%hf,pseudorange_rate_mps:%hf,"
"pseudorange_rate_uncertainty_mps:%hf,"
"accumulated_delta_range_state:%" PRIu32 ",accumulated_delta_range_m:%hf,"
"accumulated_delta_range_uncertainty_m:%hf,"
"carrier_frequency_hz:%hf,carrier_cycles:%" PRId64 ",carrier_phase:%hf,"
"carrier_phase_uncertainty:%hf,multipath_indicator:%" PRIu32 ","
"snr:%" PRIu32 "";
static const char sensor_gnss_satellite_format[] =
"timestamp:%" PRIu64 ",count:%" PRIu32 ",satellites:%" PRIu32 ","
"constellation:%" PRIu32 ","
"svid0:%" PRIu32 ",elevation0:%" PRIu32 ",azimuth0:%" PRIu32 ","
"snr0:%" PRIu32 ",svid1:%" PRIu32 ",elevation1:%" PRIu32 ","
"azimuth1:%" PRIu32 ",snr1:%" PRIu32 ",svid2:%" PRIu32 ","
"elevation2:%" PRIu32 ",azimuth2:%" PRIu32 ",snr2:%" PRIu32 ","
"svid3:%" PRIu32 ",elevation3:%" PRIu32 ",azimuth3:%" PRIu32 ","
"snr3:%" PRIu32 "";
#endif
/****************************************************************************
* Public Data
****************************************************************************/
ORB_DEFINE(sensor_gnss, struct sensor_gnss, sensor_gnss_format);
ORB_DEFINE(sensor_gnss_clock, struct sensor_gnss_clock,
sensor_gnss_clock_format);
ORB_DEFINE(sensor_gnss_geofence_event, struct sensor_gnss_geofence_event,
sensor_gnss_geofence_event_format);
ORB_DEFINE(sensor_gnss_measurement, struct sensor_gnss_measurement,
sensor_gnss_measurement_format);
ORB_DEFINE(sensor_gnss_satellite, struct sensor_gnss_satellite,
sensor_gnss_satellite_format);