Browse Source

Vehicle: Add missing const in member functions

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
QGC4.4
Patrick José Pereira 4 years ago committed by Don Gagne
parent
commit
b21020a332
  1. 2
      src/Vehicle/Vehicle.cc
  2. 60
      src/Vehicle/Vehicle.h

2
src/Vehicle/Vehicle.cc

@ -1869,7 +1869,7 @@ void Vehicle::_saveSettings()
} }
} }
bool Vehicle::joystickEnabled() bool Vehicle::joystickEnabled() const
{ {
return _joystickEnabled; return _joystickEnabled;
} }

60
src/Vehicle/Vehicle.h

@ -433,12 +433,12 @@ public:
void updateFlightDistance(double distance); void updateFlightDistance(double distance);
bool joystickEnabled (); bool joystickEnabled () const;
void setJoystickEnabled (bool enabled); void setJoystickEnabled (bool enabled);
void sendJoystickDataThreadSafe (float roll, float pitch, float yaw, float thrust, quint16 buttons); void sendJoystickDataThreadSafe (float roll, float pitch, float yaw, float thrust, quint16 buttons);
// Property accesors // Property accesors
int id() { return _id; } int id() const{ return _id; }
MAV_AUTOPILOT firmwareType() const { return _firmwareType; } MAV_AUTOPILOT firmwareType() const { return _firmwareType; }
MAV_TYPE vehicleType() const { return _vehicleType; } MAV_TYPE vehicleType() const { return _vehicleType; }
Q_INVOKABLE QString vehicleTypeName() const; Q_INVOKABLE QString vehicleTypeName() const;
@ -463,7 +463,7 @@ public:
QGeoCoordinate homePosition(); QGeoCoordinate homePosition();
bool armed () { return _armed; } bool armed () const{ return _armed; }
void setArmed (bool armed, bool showError); void setArmed (bool armed, bool showError);
void setArmedShowError (bool armed) { setArmed(armed, true); } void setArmedShowError (bool armed) { setArmed(armed, true); }
@ -494,7 +494,7 @@ public:
QmlObjectListModel* cameraTriggerPoints () { return &_cameraTriggerPoints; } QmlObjectListModel* cameraTriggerPoints () { return &_cameraTriggerPoints; }
int flowImageIndex() { return _flowImageIndex; } int flowImageIndex() const{ return _flowImageIndex; }
//-- Mavlink Logging //-- Mavlink Logging
void startMavlinkLog(); void startMavlinkLog();
@ -521,20 +521,20 @@ public:
bool messageTypeNormal () { return _currentMessageType == MessageNormal; } bool messageTypeNormal () { return _currentMessageType == MessageNormal; }
bool messageTypeWarning () { return _currentMessageType == MessageWarning; } bool messageTypeWarning () { return _currentMessageType == MessageWarning; }
bool messageTypeError () { return _currentMessageType == MessageError; } bool messageTypeError () { return _currentMessageType == MessageError; }
int newMessageCount () { return _currentMessageCount; } int newMessageCount () const{ return _currentMessageCount; }
int messageCount () { return _messageCount; } int messageCount () const{ return _messageCount; }
QString formattedMessages (); QString formattedMessages ();
QString latestError () { return _latestError; } QString latestError () { return _latestError; }
float latitude () { return static_cast<float>(_coordinate.latitude()); } float latitude () { return static_cast<float>(_coordinate.latitude()); }
float longitude () { return static_cast<float>(_coordinate.longitude()); } float longitude () { return static_cast<float>(_coordinate.longitude()); }
bool mavPresent () { return _mav != nullptr; } bool mavPresent () { return _mav != nullptr; }
int rcRSSI () { return _rcRSSI; } int rcRSSI () const{ return _rcRSSI; }
bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; } bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; }
bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; } bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; }
bool genericFirmware () const { return !px4Firmware() && !apmFirmware(); } bool genericFirmware () const { return !px4Firmware() && !apmFirmware(); }
uint messagesReceived () { return _messagesReceived; } uint messagesReceived () const{ return _messagesReceived; }
uint messagesSent () { return _messagesSent; } uint messagesSent () const{ return _messagesSent; }
uint messagesLost () { return _messagesLost; } uint messagesLost () const{ return _messagesLost; }
bool flying () const { return _flying; } bool flying () const { return _flying; }
bool landing () const { return _landing; } bool landing () const { return _landing; }
bool guidedMode () const; bool guidedMode () const;
@ -560,19 +560,19 @@ public:
double defaultHoverSpeed () const { return _defaultHoverSpeed; } double defaultHoverSpeed () const { return _defaultHoverSpeed; }
QString firmwareTypeString () const; QString firmwareTypeString () const;
QString vehicleTypeString () const; QString vehicleTypeString () const;
int telemetryRRSSI () { return _telemetryRRSSI; } int telemetryRRSSI () const{ return _telemetryRRSSI; }
int telemetryLRSSI () { return _telemetryLRSSI; } int telemetryLRSSI () const{ return _telemetryLRSSI; }
unsigned int telemetryRXErrors () { return _telemetryRXErrors; } unsigned int telemetryRXErrors () const{ return _telemetryRXErrors; }
unsigned int telemetryFixed () { return _telemetryFixed; } unsigned int telemetryFixed () const{ return _telemetryFixed; }
unsigned int telemetryTXBuffer () { return _telemetryTXBuffer; } unsigned int telemetryTXBuffer () const{ return _telemetryTXBuffer; }
int telemetryLNoise () { return _telemetryLNoise; } int telemetryLNoise () const{ return _telemetryLNoise; }
int telemetryRNoise () { return _telemetryRNoise; } int telemetryRNoise () const{ return _telemetryRNoise; }
bool autoDisarm (); bool autoDisarm ();
bool orbitActive () const { return _orbitActive; } bool orbitActive () const { return _orbitActive; }
QGCMapCircle* orbitMapCircle () { return &_orbitMapCircle; } QGCMapCircle* orbitMapCircle () { return &_orbitMapCircle; }
bool readyToFlyAvailable () { return _readyToFlyAvailable; } bool readyToFlyAvailable () const{ return _readyToFlyAvailable; }
bool readyToFly () { return _readyToFly; } bool readyToFly () const{ return _readyToFly; }
bool allSensorsHealthy () { return _allSensorsHealthy; } bool allSensorsHealthy () const{ return _allSensorsHealthy; }
QObject* sysStatusSensorInfo () { return &_sysStatusSensorInfo; } QObject* sysStatusSensorInfo () { return &_sysStatusSensorInfo; }
bool requiresGpsFix () const { return static_cast<bool>(_onboardControlSensorsPresent & SysStatusSensorGPS); } bool requiresGpsFix () const { return static_cast<bool>(_onboardControlSensorsPresent & SysStatusSensorGPS); }
@ -719,7 +719,7 @@ public:
bool soloFirmware() const { return _soloFirmware; } bool soloFirmware() const { return _soloFirmware; }
void setSoloFirmware(bool soloFirmware); void setSoloFirmware(bool soloFirmware);
int defaultComponentId() { return _defaultComponentId; } int defaultComponentId() const{ return _defaultComponentId; }
/// Sets the default component id for an offline editing vehicle /// Sets the default component id for an offline editing vehicle
void setOfflineEditingDefaultComponentId(int defaultComponentId); void setOfflineEditingDefaultComponentId(int defaultComponentId);
@ -769,16 +769,16 @@ public:
/// Vehicle is about to be deleted /// Vehicle is about to be deleted
void prepareDelete(); void prepareDelete();
quint64 mavlinkSentCount () { return _mavlinkSentCount; } /// Calculated total number of messages sent to us quint64 mavlinkSentCount () const{ return _mavlinkSentCount; } /// Calculated total number of messages sent to us
quint64 mavlinkReceivedCount () { return _mavlinkReceivedCount; } /// Total number of sucessful messages received quint64 mavlinkReceivedCount () const{ return _mavlinkReceivedCount; } /// Total number of sucessful messages received
quint64 mavlinkLossCount () { return _mavlinkLossCount; } /// Total number of lost messages quint64 mavlinkLossCount () const{ return _mavlinkLossCount; } /// Total number of lost messages
float mavlinkLossPercent () { return _mavlinkLossPercent; } /// Running loss rate float mavlinkLossPercent () const{ return _mavlinkLossPercent; } /// Running loss rate
qreal gimbalRoll () { return static_cast<qreal>(_curGimbalRoll);} qreal gimbalRoll () const{ return static_cast<qreal>(_curGimbalRoll);}
qreal gimbalPitch () { return static_cast<qreal>(_curGimbalPitch); } qreal gimbalPitch () const{ return static_cast<qreal>(_curGimbalPitch); }
qreal gimbalYaw () { return static_cast<qreal>(_curGinmbalYaw); } qreal gimbalYaw () const{ return static_cast<qreal>(_curGinmbalYaw); }
bool gimbalData () { return _haveGimbalData; } bool gimbalData () const{ return _haveGimbalData; }
bool isROIEnabled () { return _isROIEnabled; } bool isROIEnabled () const{ return _isROIEnabled; }
CheckList checkListState () { return _checkListState; } CheckList checkListState () { return _checkListState; }
void setCheckListState (CheckList cl) { _checkListState = cl; emit checkListStateChanged(); } void setCheckListState (CheckList cl) { _checkListState = cl; emit checkListStateChanged(); }

Loading…
Cancel
Save