control: action to override a single fan in a zone - ability to lock Fan

This change modifies Fan to accept one or more override targets which
prevent Fan from accepting regular target updates until all locks have
been cleared using unlockTarget().

Multiple locks are supported, however only the higest locked target will
ever be active. For instance, if targets are locked at 9000 and 10000
(in either order), the 10000 lock will be active until it is cleared, at
which point the 2nd lowest lock (9000) will become active. When it is
cleared, Fan will become unlocked and resume its target from temperature
control. If the first locked target happens to be lower than its current
target, the lock will take precedence even though it's lower.

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: Iba73aa06eed25452117eb138768ed300bc45b0d9
diff --git a/control/json/fan.hpp b/control/json/fan.hpp
index 55cb167..2a10846 100644
--- a/control/json/fan.hpp
+++ b/control/json/fan.hpp
@@ -1,5 +1,5 @@
 /**
- * Copyright © 2020 IBM Corporation
+ * Copyright © 2022 IBM Corporation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -109,6 +109,22 @@
     void setTarget(uint64_t target);
 
   private:
+    /**
+     * Forces all contained sensors to the target (if this target is the
+     * highest. May be overridden by existing or subsequent higher values),
+     * ignoring subsequent setTarget() commands
+     *
+     * @param[in] target - The target lock to set/add
+     */
+    void lockTarget(uint64_t target);
+
+    /**
+     * Removes the provided target lock from the list of locks. Fan will unlock
+     * (become eligible for setTarget()) when all locks are removed from the
+     * list.
+     */
+    void unlockTarget(uint64_t target);
+
     /* The sdbusplus bus object */
     sdbusplus::bus::bus& _bus;
 
@@ -121,6 +137,9 @@
     /* Target for this fan */
     uint64_t _target;
 
+    /* list of locked targets active on this fan */
+    std::vector<uint64_t> _lockedTargets;
+
     /**
      * Map of sensors containing the `Target` property on
      * dbus to the service providing them that make up the fan