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