QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VehicleGPSAggregateFactGroup.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4
*
5
* QGroundControl is licensed according to the terms in the file
6
* COPYING.md in the root of the source code directory.
7
*
8
****************************************************************************/
9
10
#pragma once
11
12
#include "
FactGroup.h
"
13
#include <QtCore/QTimer>
14
#include <QtCore/QVector>
15
#include <QtCore/QMetaObject>
16
17
class
VehicleGPSFactGroup
;
18
19
class
VehicleGPSAggregateFactGroup
:
public
FactGroup
20
{
21
Q_OBJECT
22
Q_PROPERTY(
Fact
*
spoofingState
READ
spoofingState
CONSTANT)
23
Q_PROPERTY(
Fact
*
jammingState
READ
jammingState
CONSTANT)
24
Q_PROPERTY(
Fact
*
authenticationState
READ
authenticationState
CONSTANT)
25
Q_PROPERTY(
Fact
*
isStale
READ
isStale
CONSTANT)
26
public
:
27
enum
AuthState
{
28
AUTH_UNKNOWN
= 0,
29
AUTH_INITIALIZING
= 1,
30
AUTH_ERROR
= 2,
31
AUTH_OK
= 3,
32
AUTH_DISABLED
= 4,
33
AUTH_INVALID
= -1
34
};
35
36
explicit
VehicleGPSAggregateFactGroup
(QObject *parent =
nullptr
);
37
38
Fact
*
spoofingState
() {
return
&_spoofingStateFact; }
39
Fact
*
jammingState
() {
return
&_jammingStateFact; }
40
Fact
*
authenticationState
() {
return
&_authenticationStateFact; }
41
Fact
*
isStale
() {
return
&_isStaleFact; }
42
43
void
updateFromGps
(
VehicleGPSFactGroup
* gps1,
VehicleGPSFactGroup
* gps2);
44
void
bindToGps
(
VehicleGPSFactGroup
* gps1,
VehicleGPSFactGroup
* gps2);
45
46
private
slots:
47
void
_updateAggregates();
48
void
_onIntegrityUpdated();
49
void
_onStaleTimeout();
50
51
private
:
52
static
constexpr
int
GNSS_INTEGRITY_STALE_TIMEOUT_MS = 5000;
53
54
static
int
_mergeWorst(
int
a,
int
b);
55
static
int
_mergeAuthentication(
int
a,
int
b);
56
static
int
_valueOrInvalid(
Fact
* fact);
57
void
_clearConnections();
58
59
VehicleGPSFactGroup
* _gps1 =
nullptr
;
60
VehicleGPSFactGroup
* _gps2 =
nullptr
;
61
QTimer _staleTimer;
62
QVector<QMetaObject::Connection> _connections;
63
64
Fact
_spoofingStateFact =
Fact
(0, QStringLiteral(
"spoofingState"
),
FactMetaData::valueTypeUint8
);
65
Fact
_jammingStateFact =
Fact
(0, QStringLiteral(
"jammingState"
),
FactMetaData::valueTypeUint8
);
66
Fact
_authenticationStateFact =
Fact
(0, QStringLiteral(
"authenticationState"
),
FactMetaData::valueTypeUint8
);
67
Fact
_isStaleFact =
Fact
(0, QStringLiteral(
"isStale"
),
FactMetaData::valueTypeBool
);
68
};
FactGroup.h
FactGroup
Used to group Facts together into an object hierarachy.
Definition
FactGroup.h:16
FactMetaData::valueTypeUint8
@ valueTypeUint8
Definition
FactMetaData.h:25
FactMetaData::valueTypeBool
@ valueTypeBool
Definition
FactMetaData.h:36
Fact
A Fact is used to hold a single value within the system.
Definition
Fact.h:17
VehicleGPSAggregateFactGroup
Definition
VehicleGPSAggregateFactGroup.h:20
VehicleGPSAggregateFactGroup::jammingState
Fact * jammingState()
Definition
VehicleGPSAggregateFactGroup.h:39
VehicleGPSAggregateFactGroup::updateFromGps
void updateFromGps(VehicleGPSFactGroup *gps1, VehicleGPSFactGroup *gps2)
Definition
VehicleGPSAggregateFactGroup.cc:116
VehicleGPSAggregateFactGroup::authenticationState
Fact * authenticationState()
Definition
VehicleGPSAggregateFactGroup.h:40
VehicleGPSAggregateFactGroup::isStale
Fact * isStale()
Definition
VehicleGPSAggregateFactGroup.h:41
VehicleGPSAggregateFactGroup::AuthState
AuthState
Definition
VehicleGPSAggregateFactGroup.h:27
VehicleGPSAggregateFactGroup::AUTH_INVALID
@ AUTH_INVALID
Definition
VehicleGPSAggregateFactGroup.h:33
VehicleGPSAggregateFactGroup::AUTH_DISABLED
@ AUTH_DISABLED
Definition
VehicleGPSAggregateFactGroup.h:32
VehicleGPSAggregateFactGroup::AUTH_OK
@ AUTH_OK
Definition
VehicleGPSAggregateFactGroup.h:31
VehicleGPSAggregateFactGroup::AUTH_ERROR
@ AUTH_ERROR
Definition
VehicleGPSAggregateFactGroup.h:30
VehicleGPSAggregateFactGroup::AUTH_INITIALIZING
@ AUTH_INITIALIZING
Definition
VehicleGPSAggregateFactGroup.h:29
VehicleGPSAggregateFactGroup::AUTH_UNKNOWN
@ AUTH_UNKNOWN
Definition
VehicleGPSAggregateFactGroup.h:28
VehicleGPSAggregateFactGroup::bindToGps
void bindToGps(VehicleGPSFactGroup *gps1, VehicleGPSFactGroup *gps2)
Definition
VehicleGPSAggregateFactGroup.cc:33
VehicleGPSAggregateFactGroup::spoofingState
Fact * spoofingState()
Definition
VehicleGPSAggregateFactGroup.h:38
VehicleGPSFactGroup
Definition
VehicleGPSFactGroup.h:6
src
Vehicle
FactGroups
VehicleGPSAggregateFactGroup.h
Generated by
1.9.8