Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2018 Open Networking Foundation |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 18 | #ifndef OPENOLT_STATE_H_ |
| 19 | #define OPENOLT_STATE_H_ |
| 20 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 21 | class State { |
| 22 | public: |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 23 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 24 | bool is_connected() { |
| 25 | return connected_to_voltha; |
| 26 | } |
| 27 | |
| 28 | bool is_activated() { |
| 29 | return activated; |
| 30 | } |
| 31 | |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 32 | bool previsouly_connected() { |
| 33 | return connected_once; |
| 34 | } |
| 35 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 36 | void connect() { |
| 37 | connected_to_voltha = true; |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 38 | connected_once = true; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | void disconnect() { |
| 42 | connected_to_voltha = false; |
| 43 | } |
| 44 | |
| 45 | void activate() { |
| 46 | activated = true; |
| 47 | } |
| 48 | |
| 49 | void deactivate() { |
| 50 | activated = false; |
| 51 | } |
| 52 | |
| 53 | private: |
| 54 | bool connected_to_voltha = false; |
| 55 | bool activated = false; |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 56 | bool connected_once = false; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 57 | }; |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 58 | #endif |