Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 1 | /* |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 3 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 4 | * 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 Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 7 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Zack Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 9 | |
Girish Gowdra | a707e7c | 2019-11-07 11:36:13 +0530 | [diff] [blame] | 10 | * 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 Williams | 477ba09 | 2018-10-17 10:50:06 -0700 | [diff] [blame] | 16 | |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 17 | #ifndef OPENOLT_STATE_H_ |
| 18 | #define OPENOLT_STATE_H_ |
| 19 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 20 | class State { |
| 21 | public: |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 22 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 23 | bool is_connected() { |
| 24 | return connected_to_voltha; |
| 25 | } |
| 26 | |
| 27 | bool is_activated() { |
| 28 | return activated; |
| 29 | } |
| 30 | |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 31 | bool previsouly_connected() { |
| 32 | return connected_once; |
| 33 | } |
| 34 | |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 35 | void connect() { |
| 36 | connected_to_voltha = true; |
Nicolas Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 37 | connected_once = true; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 38 | } |
| 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 Palpacuer | fbc0d7d | 2018-08-23 14:46:42 -0400 | [diff] [blame] | 55 | bool connected_once = false; |
Shad Ansari | edef213 | 2018-08-10 22:14:50 +0000 | [diff] [blame] | 56 | }; |
Nicolas Palpacuer | 3cad49d | 2018-07-02 14:03:24 -0400 | [diff] [blame] | 57 | #endif |