xref: /openbmc/openpower-occ-control/occ_status.cpp (revision ee4d83dfc7b6cf3b5979541ab5b1918b68e6bbdb)
1 #include "occ_status.hpp"
2 namespace open_power
3 {
4 namespace occ
5 {
6 
7 // Handles updates to occActive property
8 bool Status::occActive(bool value)
9 {
10     if (value != this->occActive())
11     {
12         if (value)
13         {
14             // Bind the device
15             device.bind();
16 
17             // And watch for errors
18             device.addErrorWatch();
19         }
20         else
21         {
22             // Stop watching for errors
23             device.removeErrorWatch();
24 
25             // Do the unbind.
26             device.unBind();
27         }
28     }
29     return Base::Status::occActive(value);
30 }
31 
32 // Callback handler when a device error is reported.
33 void Status::deviceErrorHandler()
34 {
35     // This would deem OCC inactive
36     this->occActive(false);
37 }
38 
39 } // namespace occ
40 } // namespace open_power
41