blob: b19280f7692558eb7b74734f11137681dec44de6 [file] [log] [blame]
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -04001#ifndef OPENOLT_STATE_H_
2#define OPENOLT_STATE_H_
3
Shad Ansariedef2132018-08-10 22:14:50 +00004class State {
5 public:
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -04006
Shad Ansariedef2132018-08-10 22:14:50 +00007 bool is_connected() {
8 return connected_to_voltha;
9 }
10
11 bool is_activated() {
12 return activated;
13 }
14
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040015 bool previsouly_connected() {
16 return connected_once;
17 }
18
Shad Ansariedef2132018-08-10 22:14:50 +000019 void connect() {
20 connected_to_voltha = true;
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040021 connected_once = true;
Shad Ansariedef2132018-08-10 22:14:50 +000022 }
23
24 void disconnect() {
25 connected_to_voltha = false;
26 }
27
28 void activate() {
29 activated = true;
30 }
31
32 void deactivate() {
33 activated = false;
34 }
35
36 private:
37 bool connected_to_voltha = false;
38 bool activated = false;
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040039 bool connected_once = false;
Shad Ansariedef2132018-08-10 22:14:50 +000040};
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040041#endif