• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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  */
16 
17 #ifndef DEVICE_GOOGLE_BONITO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
18 #define DEVICE_GOOGLE_BONITO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
19 
20 #include <android-base/file.h>
21 #include <android-base/logging.h>
22 #include <android-base/strings.h>
23 #include <string>
24 
25 namespace device {
26 namespace google {
27 namespace bonito {
28 namespace health {
29 
30 class LearnedCapacityBackupRestore {
31   public:
32     LearnedCapacityBackupRestore();
33     void Restore();
34     void Backup();
35 
36   private:
37     int sw_cap_;
38     int hw_cap_;
39     int nom_cap_;
40 
41     void ReadPersistData();
42     void SaveToStorage();
43     void ReadNominalCapacity();
44     void ReadCapacity();
45     void SaveToSRAM();
46     void UpdateAndSave();
47 };
48 
49 }  // namespace health
50 }  // namespace bonito
51 }  // namespace google
52 }  // namespace device
53 
54 #endif  // #ifndef DEVICE_GOOGLE_BONITO_HEALTH_LEARNEDCAPACITYBACKUPRESTORE_H
55