-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simulator: no more static storage for sensor data
- Loading branch information
Showing
15 changed files
with
242 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2024 | ||
* Jean-Luc Barriere <jlbarriere68@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "globalazimuth.h" | ||
|
||
void GlobalAzimuth::resetData(qreal azimuth) | ||
{ | ||
std::lock_guard<std::mutex> g(_mutex); | ||
_azimuth = azimuth; | ||
} | ||
|
||
qreal GlobalAzimuth::data() const | ||
{ | ||
std::lock_guard<std::mutex> g(_mutex); | ||
return _azimuth; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 2024 | ||
* Jean-Luc Barriere <jlbarriere68@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef GLOBALAZIMUTH_H | ||
#define GLOBALAZIMUTH_H | ||
|
||
#include <mutex> | ||
#include <QCompassReading> | ||
|
||
class GlobalAzimuth | ||
{ | ||
public: | ||
GlobalAzimuth() { } | ||
~GlobalAzimuth() = default; | ||
|
||
void resetData(qreal azimuth); | ||
qreal data() const; | ||
|
||
private: | ||
mutable std::mutex _mutex; | ||
qreal _azimuth = 0.0; | ||
}; | ||
|
||
#endif // GLOBALAZIMUTH_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2024 | ||
* Jean-Luc Barriere <jlbarriere68@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "globalposition.h" | ||
|
||
void GlobalPosition::resetData(double lat, double lon, double alt) | ||
{ | ||
{ | ||
QGeoCoordinate coord(lat, lon, alt); | ||
std::lock_guard<std::mutex> g(_mutex); | ||
_info = QGeoPositionInfo(coord, QDateTime::currentDateTime()); | ||
} | ||
emit dataUpdated(); | ||
} | ||
|
||
QGeoPositionInfo GlobalPosition::data() const | ||
{ | ||
std::lock_guard<std::mutex> g(_mutex); | ||
return _info; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2024 | ||
* Jean-Luc Barriere <jlbarriere68@gmail.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef GLOBALPOSITION_H | ||
#define GLOBALPOSITION_H | ||
|
||
#include <mutex> | ||
#include <QObject> | ||
#include <QtPositioning/QGeoPositionInfoSource> | ||
|
||
class GlobalPosition : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
GlobalPosition() { } | ||
~GlobalPosition() = default; | ||
|
||
void resetData(double lat, double lon, double alt); | ||
QGeoPositionInfo data() const; | ||
|
||
signals: | ||
void dataUpdated(); | ||
|
||
private: | ||
mutable std::mutex _mutex; | ||
QGeoPositionInfo _info; | ||
}; | ||
|
||
#endif // GLOBALPOSITION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.