NDEVR
API Documentation
MainGPSManager.h
1#pragma once
2#include "NDEVR/Headers/OrientationOperationsWidget.h"
3#include <NDEVR/PointWidget.h>
4#include <NDEVR/Connection.h>
5#include <NDEVR/GNSSManager.h>
6#include "GPSInterface/Headers/GPSSensor.h"
7#include "GPSInterface/Headers/GPSWidget.h"
8#include "Base/Headers/INIInterface.h"
9#include "Base/Headers/FileResource.h"
10#include "Base/Headers/Exception.hpp"
11namespace NDEVR
12{
20
23 {
27 uint04 take_reading_sample_count = Constant<uint04>::Invalid;
28 TimeSpan take_reading_sample_time = Constant<TimeSpan>::Invalid;
29 RGBColor color = Constant<RGBColor>::Invalid;
30 bool allow_take_reading = true;
31 };
32
35 class GPS_INTERFACE_API MainGPSManager : public QObject, public GNSSInterface, public INIInterface
36 {
37 Q_OBJECT
38 public:
43 UUID uuid() const override { return m_id; };
47 PositionSensor* getGNSSDevice(const UUID& id) override;
69 virtual void getINI(INIFactory& factory) override;
72 void finishReadingINI(INIFactory& factory) override;
79 void setActiveSensor(UUID active_id, QPointer<GPSSensor> gps);
83 void setActiveSensor(UUID active_id, const ConnectionInfo& connection);
108 bool shouldAutoConnect(GPSSensor* gps) const;
111 InfoPipe* log() const;
123 bool hasActiveSensor(UUID active_id) const;
128 public:
132 signals:
138 protected:
143 InfoPipe* m_log = nullptr;
145 };
146
161
178}
The default object to store data of any type that should persist through sessions of the application.
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
A GNSS interface provides logic for finding available GNSS devices.
Definition GNSSManager.h:25
A GPS sensor implementation that receives NMEA data from serial connections, files,...
Definition GPSSensor.h:61
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:107
INIInterface()
Constructs an INIInterface with no default INI file.
A light-weight base class for Log that allows processes to update, without the need for additional in...
void settingsModifiedSignal()
Emitted when GNSS settings are modified.
const GNSSQualitySettings & positionQualitySettings(GNSSQuality quality) const
Returns position quality settings for the given quality level.
bool shouldAutoConnect(GPSSensor *gps) const
Returns whether the given sensor should auto-connect.
PositionSensor * getGNSSDevice(const UUID &id) override
Returns the GNSS device with the given UUID.
InfoPipe * log() const
Returns the log info pipe.
ActiveGPSSensor * createActiveGPSSensor(ConnectionInfo connection_info)
Creates an active GPS sensor from a connection.
GNSSQualitySettings m_position_quality_settings[cast< uint04 >(GNSSQuality::e_size)]
Position quality settings array indexed by GNSSQuality.
void setInfoPipe(InfoPipe *info)
Sets the info pipe for log output.
void setActiveSensor(UUID active_id, const ConnectionInfo &connection)
Registers an active sensor by UUID and connection info.
void activeGNSSSensorChangedSignal(UUID active_id)
Emitted when the active GNSS sensor changes for a role.
void setPositionQualitySettings(GNSSQuality quality, const GNSSQualitySettings &settings)
Sets position quality settings for the given quality level.
String connectionString(GPSSensor *sensor) const
Returns the connection string for the given sensor.
InfoPipe * m_log
The log info pipe.
void setActiveSensor(UUID active_id, QPointer< GPSSensor > gps)
Registers an active sensor by UUID and sensor pointer.
ActiveGPSSensor * activeSensor(UUID active_id) const
Returns the active sensor descriptor for the given role UUID.
static ApplicationOption< bool > use_single_gnss_device
Whether to enforce a single GNSS device.
MainGPSManager()
Constructs the main GPS manager.
ActiveGPSSensor * createActiveGPSSensor(const File &file)
Creates an active GPS sensor from a file source.
Dictionary< UUID, ActiveGPSSensor * > m_gps_definitions
Maps role UUIDs to active sensor descriptors.
void setToDefaults()
Resets all quality settings to their defaults.
const GNSSQualitySettings & orientationQualitySettings(GNSSQuality quality) const
Returns orientation quality settings for the given quality level.
static RGBColor SNRToColor(fltp08 srn)
Converts a signal-to-noise ratio to a display color.
static ApplicationOption< bool > autoconnect_gnss_device
Whether to auto-connect GNSS on startup.
bool hasActiveSensor(UUID active_id) const
Checks whether a sensor with the given role UUID is active.
static MainGPSManager & DefaultInstance()
Returns the global singleton instance.
void setOrientationQualitySettings(GNSSQuality quality, const GNSSQualitySettings &settings)
Sets orientation quality settings for the given quality level.
virtual void getINI(INIFactory &factory) override
Serializes settings to an INI factory.
GNSSQualitySettings m_orientation_quality_settings[cast< uint04 >(GNSSQuality::e_size)]
Orientation quality settings array indexed by GNSSQuality.
TranslatedString connectionName(GPSSensor *sensor) const
Returns the display name of the connection for the given sensor.
UUID uuid() const override
Returns the unique identifier for this manager.
static RGBColor ConstellationToColor(GNSSConstellation constellation_type)
Returns the display color for a given satellite constellation type.
static ApplicationOption< bool > log_raw_nmea_streams
Whether to log raw NMEA data streams.
UUID m_id
This manager's unique identifier.
Dictionary< String, ActiveGPSSensor * > m_gps_sensors
Maps connection strings to active sensor descriptors.
void finishReadingINI(INIFactory &factory) override
Completes reading settings from an INI factory.
virtual Buffer< PositionSensor * > availableGNSSDevices() const override
Returns all available GNSS devices.
Abstract callback interface for creating GNSS orientation widgets.
OrientationWidgetGNSSMainCallback()
Constructs the callback.
static OrientationWidgetGNSSMainCallback * MainGNSSCallback()
Returns the singleton callback instance.
virtual QWidget * createGNSSWidget(UUID gps_name, QCustomLineEdit *orientation_edit, uint01 axis) override
Creates a GNSS widget for orientation input.
virtual QWidget * createGNSSWidget(UUID gps_name, PointWidget *widget) override
Creates a GNSS widget for position input within a PointWidget.
PointWidgetGNSSMainCallback()
Constructs the callback.
static PointWidgetGNSSMainCallback * MainGNSSCallback()
Returns the singleton callback instance.
Abstract callback interface for creating GNSS take-reading widgets.
Definition PointWidget.h:67
Allows the user to input an N-dimensional point (up to 4 dimensions) with an optional unit.
Definition PointWidget.h:58
Forward declaration for distance encoder device.
A line edit allows users to enter and edit a single line of plain text with useful editing functions,...
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
The core String class for the NDEVR API.
Definition String.h:95
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
GNSSQuality
Describes the quality level of a GNSS position fix.
Definition GPSPoint.h:16
@ e_size
Number of entries in this enum; used for iteration.
Definition GPSPoint.h:26
GNSSConstellation
Identifies the satellite constellation system providing GNSS data.
Definition GNSSEnums.h:16
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408
Describes an active GPS sensor with its connection details and sensor pointer.
TranslatedString connection_name
The display name of the connection.
QPointer< GPSSensor > gps
Pointer to the GPS sensor instance.
String connection_string
The connection identifier string.
A structure designed to store information about a specific Connection.
Definition Connection.h:90
Configures quality-dependent settings for GNSS readings, including sample counts, timing,...
bool allow_take_reading
Whether taking a reading is allowed at this quality.
uint04 take_reading_sample_count
Number of samples required for a reading.
RGBColor color
Display color for this quality level.
TimeSpan take_reading_sample_time
Time duration required for a reading.
void setToDefaults(GNSSQuality quality)
Sets all settings to defaults appropriate for the given quality level.