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