1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16export class PowerDetailsEnergy {
17  constructor(eventName: string) {
18    this.event = eventName;
19  }
20
21  event: string;
22  charge: number = 0;
23  background_time: number = 0;
24  screen_on_time: number = 0;
25  screen_off_time: number = 0;
26  load: string = '-';
27  usage: number = 0;
28  duration: number = 0;
29  camera_id: number = 0;
30  foreground_count: number = 0;
31  background_count: number = 0;
32  screen_on_count: number = 0;
33  screen_off_count: number = 0;
34  count: number = 0;
35  appName: string = '';
36  uid: number = 0;
37  foreground_duration: number = 0;
38  foreground_energy: number = 0;
39  background_duration: number = 0;
40  background_energy: number = 0;
41  screen_on_duration: number = 0;
42  screen_on_energy: number = 0;
43  screen_off_duration: number = 0;
44  screen_off_energy: number = 0;
45  energy: number = 0;
46  energyConsumptionRatio: string = '';
47
48  getTotalEnergy(isSimpleEnergy: boolean): number {
49    if (isSimpleEnergy) {
50      return this.energy;
51    }
52    return this.foreground_energy + this.background_energy + this.screen_on_energy + this.screen_off_energy;
53  }
54}
55
56export class SystemDetailsEnergy {
57  ts: number = 0;
58  eventName: string = '';
59  type: string = '';
60  pid: number = -1;
61  uid: number = -1;
62  state: number = -1;
63  workId: string = '';
64  name: string = '';
65  interval: number = -1;
66  level: number = -1;
67  tag: string = '';
68  message: string = '';
69  log_level: string = '';
70}
71