summaryrefslogtreecommitdiffstats
path: root/occ_status.cpp
blob: 83825c5031e6072aed3545ea320ea3893eda4123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "occ_status.hpp"
namespace open_power
{
namespace occ
{

// Handles updates to occActive property
bool Status::occActive(bool value)
{
    if (value != this->occActive())
    {
        if (value)
        {
            // Bind the device
            device.bind();

            // And watch for errors
            device.addErrorWatch();
        }
        else
        {
            // Stop watching for errors
            device.removeErrorWatch();

            // Do the unbind.
            device.unBind();
        }
    }
    return Base::Status::occActive(value);
}

// Callback handler when a device error is reported.
void Status::deviceErrorHandler()
{
    // This would deem OCC inactive
    this->occActive(false);
}

} // namespace occ
} // namespace open_power
OpenPOWER on IntegriCloud