1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

OP-349 CC-32: Added a Completed operation that is returned after successful

save or load

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3093 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-03-28 19:16:50 +00:00 committed by peabody124
parent 687d4f7cc8
commit 48c20d37a9
3 changed files with 23 additions and 16 deletions

View File

@ -162,6 +162,7 @@ static void objectUpdatedCb(UAVObjEvent * ev)
// Get object data
ObjectPersistenceGet(&objper);
int retval = -1;
// Execute action
if (objper.Operation == OBJECTPERSISTENCE_OPERATION_LOAD) {
if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) {
@ -171,13 +172,13 @@ static void objectUpdatedCb(UAVObjEvent * ev)
return;
}
// Load selected instance
UAVObjLoad(obj, objper.InstanceID);
retval = UAVObjLoad(obj, objper.InstanceID);
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLSETTINGS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjLoadSettings();
retval = UAVObjLoadSettings();
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLMETAOBJECTS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjLoadMetaobjects();
retval = UAVObjLoadMetaobjects();
}
} else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_SAVE) {
if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) {
@ -187,13 +188,13 @@ static void objectUpdatedCb(UAVObjEvent * ev)
return;
}
// Save selected instance
UAVObjSave(obj, objper.InstanceID);
retval = UAVObjSave(obj, objper.InstanceID);
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLSETTINGS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjSaveSettings();
retval = UAVObjSaveSettings();
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLMETAOBJECTS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjSaveMetaobjects();
retval = UAVObjSaveMetaobjects();
}
} else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_DELETE) {
if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) {
@ -203,15 +204,19 @@ static void objectUpdatedCb(UAVObjEvent * ev)
return;
}
// Delete selected instance
UAVObjDelete(obj, objper.InstanceID);
retval = UAVObjDelete(obj, objper.InstanceID);
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLSETTINGS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjDeleteSettings();
retval = UAVObjDeleteSettings();
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLMETAOBJECTS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
UAVObjDeleteMetaobjects();
retval = UAVObjDeleteMetaobjects();
}
}
if(retval == 0) {
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
ObjectPersistenceSet(&objper);
}
}
}

View File

@ -74,11 +74,13 @@ void ConfigTaskWidget::saveNextObject()
void ConfigTaskWidget::transactionCompleted(UAVObject* obj, bool success)
{
Q_UNUSED(success);
// Disconnect from sending object
obj->disconnect(this);
queue.dequeue(); // We can now remove the object, it's done.
saveNextObject();
if(success &&
obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0 ) {
// Disconnect from sending object
obj->disconnect(this);
queue.dequeue(); // We can now remove the object, it's done.
saveNextObject();
}
}
void ConfigTaskWidget::updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj)

View File

@ -1,13 +1,13 @@
<xml>
<object name="ObjectPersistence" singleinstance="true" settings="false">
<description>Someone who knows please enter this</description>
<field name="Operation" units="" type="enum" elements="1" options="Load,Save,Delete"/>
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,Completed"/>
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
<field name="ObjectID" units="" type="uint32" elements="1"/>
<field name="InstanceID" units="" type="uint32" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="manual" period="0"/>
<telemetryflight acked="true" updatemode="manual" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>