blob: 6092aa8827dd67e978ce0d8996c4afc17bec379b [file] [log] [blame]
Zack Williams477ba092018-10-17 10:50:06 -07001/*
Girish Gowdraa707e7c2019-11-07 11:36:13 +05302 * Copyright 2018-present Open Networking Foundation
Zack Williams477ba092018-10-17 10:50:06 -07003
Girish Gowdraa707e7c2019-11-07 11:36:13 +05304 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Zack Williams477ba092018-10-17 10:50:06 -07007
Girish Gowdraa707e7c2019-11-07 11:36:13 +05308 * http://www.apache.org/licenses/LICENSE-2.0
Zack Williams477ba092018-10-17 10:50:06 -07009
Girish Gowdraa707e7c2019-11-07 11:36:13 +053010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Zack Williams477ba092018-10-17 10:50:06 -070016
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040017#ifndef OPENOLT_STATE_H_
18#define OPENOLT_STATE_H_
19
Shad Ansariedef2132018-08-10 22:14:50 +000020class State {
21 public:
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040022
Shad Ansariedef2132018-08-10 22:14:50 +000023 bool is_connected() {
24 return connected_to_voltha;
25 }
26
27 bool is_activated() {
28 return activated;
29 }
30
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040031 bool previsouly_connected() {
32 return connected_once;
33 }
34
Shad Ansariedef2132018-08-10 22:14:50 +000035 void connect() {
36 connected_to_voltha = true;
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040037 connected_once = true;
Shad Ansariedef2132018-08-10 22:14:50 +000038 }
39
40 void disconnect() {
41 connected_to_voltha = false;
42 }
43
44 void activate() {
45 activated = true;
46 }
47
48 void deactivate() {
49 activated = false;
50 }
51
52 private:
53 bool connected_to_voltha = false;
54 bool activated = false;
Nicolas Palpacuerfbc0d7d2018-08-23 14:46:42 -040055 bool connected_once = false;
Shad Ansariedef2132018-08-10 22:14:50 +000056};
Nicolas Palpacuer3cad49d2018-07-02 14:03:24 -040057#endif