Commit df4043b5 authored by Tomaz Canabrava's avatar Tomaz Canabrava

Simplify creation of Plugin Members

Signed-off-by: 's avatarTomaz Canabrava <tomaz.canabrava@intel.com>
parent d13f930e
...@@ -70,64 +70,36 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -70,64 +70,36 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
if (parametersReady()) { if (parametersReady()) {
_airframeComponent = new APMAirframeComponent(_vehicle, this); _airframeComponent = new APMAirframeComponent(_vehicle, this);
if(_airframeComponent) {
_airframeComponent->setupTriggerSignals(); _airframeComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent));
} else {
qWarning() << "new APMAirframeComponent failed";
}
_cameraComponent = new APMCameraComponent(_vehicle, this); _cameraComponent = new APMCameraComponent(_vehicle, this);
_cameraComponent->setupTriggerSignals(); _cameraComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent));
_flightModesComponent = new APMFlightModesComponent(_vehicle, this); _flightModesComponent = new APMFlightModesComponent(_vehicle, this);
if (_flightModesComponent) {
_flightModesComponent->setupTriggerSignals(); _flightModesComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent));
} else {
qWarning() << "new APMFlightModesComponent failed";
}
_powerComponent = new APMPowerComponent(_vehicle, this); _powerComponent = new APMPowerComponent(_vehicle, this);
if (_powerComponent) {
_powerComponent->setupTriggerSignals(); _powerComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent));
} else {
qWarning() << "new APMPowerComponent failed";
}
_radioComponent = new APMRadioComponent(_vehicle, this); _radioComponent = new APMRadioComponent(_vehicle, this);
if (_radioComponent) {
_radioComponent->setupTriggerSignals(); _radioComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_radioComponent));
} else {
qWarning() << "new APMRadioComponent failed";
}
_sensorsComponent = new APMSensorsComponent(_vehicle, this); _sensorsComponent = new APMSensorsComponent(_vehicle, this);
if (_sensorsComponent) {
_sensorsComponent->setupTriggerSignals(); _sensorsComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent));
} else {
qWarning() << "new APMSensorsComponent failed";
}
_safetyComponent = new APMSafetyComponent(_vehicle, this); _safetyComponent = new APMSafetyComponent(_vehicle, this);
if (_safetyComponent) {
_safetyComponent->setupTriggerSignals(); _safetyComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent));
} else {
qWarning() << "new APMSafetyComponent failed";
}
_tuningComponent = new APMTuningComponent(_vehicle, this); _tuningComponent = new APMTuningComponent(_vehicle, this);
if (_tuningComponent) {
_tuningComponent->setupTriggerSignals(); _tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
} else {
qWarning() << "new APMTuningComponent failed";
}
} else { } else {
qWarning() << "Call to vehicleCompenents prior to parametersReady"; qWarning() << "Call to vehicleCompenents prior to parametersReady";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment