blob: 3573c4b4cdebaf08686cbe328a9377d175101787 [file] [log] [blame]
Zack Williams477ba092018-10-17 10:50:06 -07001/*
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 Palpacuer3cad49d2018-07-02 14:03:24 -040018#ifndef OPENOLT_STATE_H_
19#define OPENOLT_STATE_H_
20
Shad Ansariedef2132018-08-10 22:14:50 +000021class State {
22 public:
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040023
Shad Ansariedef2132018-08-10 22:14:50 +000024 bool is_connected() {
25 return connected_to_voltha;
26 }
27
28 bool is_activated() {
29 return activated;
30 }
31
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040032 bool previsouly_connected() {
33 return connected_once;
34 }
35
Shad Ansariedef2132018-08-10 22:14:50 +000036 void connect() {
37 connected_to_voltha = true;
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040038 connected_once = true;
Shad Ansariedef2132018-08-10 22:14:50 +000039 }
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 Palpacuerfbc0d7d2018-08-23 14:46:42 -040056 bool connected_once = false;
Shad Ansariedef2132018-08-10 22:14:50 +000057};
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040058#endif