task: add fwupdate support

This adds firmware update task service support. It adds
a match and updates the task value when the interface
changes.

Tested: On successful fwupdate task was created and
updated correctly. On failed fwupdate the status went
to failed.

Change-Id: Id12cc5d5270e8e45498b665e78601c5c30775323
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 12425c1..e95eb2e 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -30,6 +30,8 @@
 
 static std::deque<std::shared_ptr<struct TaskData>> tasks;
 
+constexpr bool completed = true;
+
 struct TaskData : std::enable_shared_from_this<TaskData>
 {
   private:
@@ -120,13 +122,9 @@
             [self = shared_from_this()](sdbusplus::message::message &message) {
                 boost::system::error_code ec;
 
-                // set to complete before callback incase user wants a different
-                // status
-                self->state = "Completed";
-
                 // callback to return True if callback is done, callback needs
                 // to update status itself if needed
-                if (self->callback(ec, message, self))
+                if (self->callback(ec, message, self) == task::completed)
                 {
                     self->timer.cancel();
                     self->finishTask();
@@ -136,10 +134,6 @@
                         [self] { self->match.reset(); });
                     return;
                 }
-
-                // set back to running if callback returns false to keep
-                // callback alive
-                self->state = "Running";
             });
         timer.expires_after(timeout);
         timer.async_wait(