|
|
|
@ -7,6 +7,9 @@
@@ -7,6 +7,9 @@
|
|
|
|
|
* |
|
|
|
|
****************************************************************************/ |
|
|
|
|
|
|
|
|
|
#include <QTime> |
|
|
|
|
#include <QDateTime> |
|
|
|
|
#include <QLocale> |
|
|
|
|
|
|
|
|
|
#include "Vehicle.h" |
|
|
|
|
#include "MAVLinkProtocol.h" |
|
|
|
@ -66,6 +69,7 @@ const char* Vehicle::_batteryFactGroupName = "battery";
@@ -66,6 +69,7 @@ const char* Vehicle::_batteryFactGroupName = "battery";
|
|
|
|
|
const char* Vehicle::_windFactGroupName = "wind"; |
|
|
|
|
const char* Vehicle::_vibrationFactGroupName = "vibration"; |
|
|
|
|
const char* Vehicle::_temperatureFactGroupName = "temperature"; |
|
|
|
|
const char* Vehicle::_clockFactGroupName = "clock"; |
|
|
|
|
|
|
|
|
|
Vehicle::Vehicle(LinkInterface* link, |
|
|
|
|
int vehicleId, |
|
|
|
@ -174,6 +178,7 @@ Vehicle::Vehicle(LinkInterface* link,
@@ -174,6 +178,7 @@ Vehicle::Vehicle(LinkInterface* link,
|
|
|
|
|
, _windFactGroup(this) |
|
|
|
|
, _vibrationFactGroup(this) |
|
|
|
|
, _temperatureFactGroup(this) |
|
|
|
|
, _clockFactGroup(this) |
|
|
|
|
{ |
|
|
|
|
_addLink(link); |
|
|
|
|
|
|
|
|
@ -348,6 +353,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
@@ -348,6 +353,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
|
|
|
|
|
, _batteryFactGroup(this) |
|
|
|
|
, _windFactGroup(this) |
|
|
|
|
, _vibrationFactGroup(this) |
|
|
|
|
, _clockFactGroup(this) |
|
|
|
|
{ |
|
|
|
|
_commonInit(); |
|
|
|
|
_firmwarePlugin->initializeVehicle(this); |
|
|
|
@ -411,6 +417,7 @@ void Vehicle::_commonInit(void)
@@ -411,6 +417,7 @@ void Vehicle::_commonInit(void)
|
|
|
|
|
_addFactGroup(&_windFactGroup, _windFactGroupName); |
|
|
|
|
_addFactGroup(&_vibrationFactGroup, _vibrationFactGroupName); |
|
|
|
|
_addFactGroup(&_temperatureFactGroup, _temperatureFactGroupName); |
|
|
|
|
_addFactGroup(&_clockFactGroup, _clockFactGroupName); |
|
|
|
|
|
|
|
|
|
// Add firmware-specific fact groups, if provided
|
|
|
|
|
QMap<QString, FactGroup*>* fwFactGroups = _firmwarePlugin->factGroups(); |
|
|
|
@ -3046,3 +3053,27 @@ VehicleTemperatureFactGroup::VehicleTemperatureFactGroup(QObject* parent)
@@ -3046,3 +3053,27 @@ VehicleTemperatureFactGroup::VehicleTemperatureFactGroup(QObject* parent)
|
|
|
|
|
_temperature2Fact.setRawValue (std::numeric_limits<float>::quiet_NaN()); |
|
|
|
|
_temperature3Fact.setRawValue (std::numeric_limits<float>::quiet_NaN()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const char* VehicleClockFactGroup::_currentTimeFactName = "currentTime"; |
|
|
|
|
const char* VehicleClockFactGroup::_currentDateFactName = "currentDate"; |
|
|
|
|
|
|
|
|
|
VehicleClockFactGroup::VehicleClockFactGroup(QObject* parent) |
|
|
|
|
: FactGroup(1000, ":/json/Vehicle/ClockFact.json", parent) |
|
|
|
|
, _currentTimeFact (0, _currentTimeFactName, FactMetaData::valueTypeString) |
|
|
|
|
, _currentDateFact (0, _currentDateFactName, FactMetaData::valueTypeString) |
|
|
|
|
{ |
|
|
|
|
_addFact(&_currentTimeFact, _currentTimeFactName); |
|
|
|
|
_addFact(&_currentDateFact, _currentDateFactName); |
|
|
|
|
|
|
|
|
|
// Start out as not available "--.--"
|
|
|
|
|
_currentTimeFact.setRawValue (std::numeric_limits<float>::quiet_NaN()); |
|
|
|
|
_currentDateFact.setRawValue (std::numeric_limits<float>::quiet_NaN()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void VehicleClockFactGroup::_updateAllValues(void) |
|
|
|
|
{ |
|
|
|
|
_currentTimeFact.setRawValue(QTime::currentTime().toString()); |
|
|
|
|
_currentDateFact.setRawValue(QDateTime::currentDateTime().toString(QLocale::system().dateFormat(QLocale::ShortFormat))); |
|
|
|
|
|
|
|
|
|
FactGroup::_updateAllValues(); |
|
|
|
|
} |
|
|
|
|