Clean up error cases on boot or when app restarted
- Detect when no or duplicate masters are found (force reset)
- Prevent sending commands to OCC when OCC is disabled
- Detect OCC state changes to SAFE (after 60 sec force reset)
Tested on Everest and Rainier hardware
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
Change-Id: I490f182405e11da207b42a0607a532566479bfd9
diff --git a/occ_manager.hpp b/occ_manager.hpp
index a137363..97bf2b1 100644
--- a/occ_manager.hpp
+++ b/occ_manager.hpp
@@ -101,7 +101,11 @@
discoverTimer(
std::make_unique<
sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
- sdpEvent, std::bind(&Manager::findAndCreateObjects, this)))
+ sdpEvent, std::bind(&Manager::findAndCreateObjects, this))),
+ waitForAllOccsTimer(
+ std::make_unique<
+ sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>(
+ sdpEvent, std::bind(&Manager::occsNotAllRunning, this)))
#endif
{
#ifdef I2C_OCC
@@ -295,6 +299,19 @@
* any were added since the last check.
*/
std::vector<int> prevOCCSearch;
+
+ /**
+ * @brief Timer used when waiting for OCCs to go active.
+ */
+ std::unique_ptr<
+ sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>>
+ waitForAllOccsTimer;
+
+ /** @brief Called when code times out waiting for all OCCs to be running or
+ * after the app is restarted (Status does not callback into
+ * Manager).
+ */
+ void occsNotAllRunning();
#endif
/**
@@ -380,6 +397,11 @@
* @param[in] msg - Data associated with subscribed signal
*/
void ambientCallback(sdbusplus::message::message& msg);
+
+ /** @brief Confirm that a single OCC master was found and start presence
+ * monitoring
+ */
+ void validateOccMaster();
};
} // namespace occ