6#include "dawn/io/gnss.hxx"
11#include <nuttx/uorb.h>
13#include "dawn/debug.hxx"
14#include "dawn/porting/sensors.hxx"
18int CIOSensorGnss::validateDtype()
31 DAWNERR(
"GNSS IO unsupported dtype %d\n",
getDtype());
38 struct sensor_gnss gnss;
50 ret = sensor_read(
fd, &gnss,
sizeof(gnss));
53 DAWNERR(
"sensor_read failed %d\n", ret);
65 float *o =
static_cast<float *
>(data.
getDataPtr());
67 o[1] = gnss.longitude;
69 o[3] = gnss.ground_speed;
78 *
static_cast<uint64_t *
>(data.
getDataPtr()) = gnss.time_utc;
84 float *o =
static_cast<float *
>(data.
getDataPtr());
94 *
static_cast<uint32_t *
>(data.
getDataPtr()) = gnss.satellites_used;
101#ifdef CONFIG_DAWN_IO_TIMESTAMP
bool isTimestamp() const
Check if I/O supports timestamp.
@ IO_CLASS_SENSOR_GNSS_TIME
GNSS UTC time (seconds since epoch)
@ IO_CLASS_SENSOR_GNSS_INFO
GNSS accuracy + DOP (eph/epv/hdop/pdop/vdop)
@ IO_CLASS_SENSOR_GNSS
GNSS position+velocity (lat/lon/alt/speed/course)
@ IO_CLASS_SENSOR_GNSS_SATELLITES
GNSS satellites used in fix.
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
int fd
File descriptor for sensor device.
size_t dsize
Sensor data size in bytes.
uint16_t getCls() const
Get object class field.
uint8_t getDtype() const
Get data type field.
Out-of-tree user-extension hooks for Dawn.
uint64_t io_ts_t
Timestamp data type (uint64_t, typically microseconds since boot).
Base interface for I/O data buffers (static and dynamic).
virtual void * getDataPtr(size_t batch=0)=0
Get pointer to data only (skips timestamp if present).
virtual uint64_t & getTs(size_t batch=0)=0
Get timestamp reference for batch.
EObjectDataType
Data types supported by Dawn framework.
@ DTYPE_FLOAT
IEEE 754 single-precision floating point (32-bit).
@ DTYPE_UINT64
Unsigned 64-bit integer.
@ DTYPE_UINT32
Unsigned 32-bit integer (0 to 4294967295).
static int getDtypeSize_(const EObjectDataType dtype)
Get byte size for a specific data type.