Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 1 | #ifndef OPENOLT_STATE_H_ |
| 2 | #define OPENOLT_STATE_H_ |
| 3 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 4 | class State { |
| 5 | public: |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 6 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 7 | bool is_connected() { |
| 8 | return connected_to_voltha; |
| 9 | } |
| 10 | |
| 11 | bool is_activated() { |
| 12 | return activated; |
| 13 | } |
| 14 | |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 15 | bool previsouly_connected() { |
| 16 | return connected_once; |
| 17 | } |
| 18 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 19 | void connect() { |
| 20 | connected_to_voltha = true; |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 21 | connected_once = true; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 22 | } |
| 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 Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 39 | bool connected_once = false; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 40 | }; |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 41 | #endif |