1/* 2 * Copyright (c) 2021-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 function mockBatteryinfo() { 17 const BatteryPluggedType = { 18 NONE: 0, 19 AC: 1, 20 USB: 2, 21 WIRELESS: 3 22 } 23 const BatteryChargeState = { 24 NONE: 0, 25 ENABLE: 1, 26 DISABLE: 2, 27 FULL: 3 28 } 29 const BatteryHealthState = { 30 UNKNOWN: 0, 31 GOOD: 1, 32 OVERHEAT: 2, 33 OVERVOLTAGE: 3, 34 COLD: 4, 35 DEAD: 5 36 } 37 const BatteryCapacityLevel = { 38 LEVEL_NONE: 0, 39 LEVEL_FULL: 1, 40 LEVEL_HIGH: 2, 41 LEVEL_NORMAL: 3, 42 LEVEL_LOW: 4, 43 LEVEL_CRITICAL: 5 44 } 45 const CommonEventBatteryChangedCode = { 46 EXTRA_SOC: 0, 47 EXTRA_VOLTAGE: 1, 48 EXTRA_TEMPERATURE: 2, 49 EXTRA_HEALTH_STATE: 3, 50 EXTRA_PLUGGED_TYPE: 4, 51 EXTRA_MAX_CURRENT: 5, 52 EXTRA_MAX_VOLTAGE: 6, 53 EXTRA_CHARGE_STATE: 7, 54 EXTRA_CHARGE_COUNTER: 8, 55 EXTRA_PRESENT: 9, 56 EXTRA_TECHNOLOGY: 10, 57 } 58 const batteryInfo = { 59 BatteryPluggedType, 60 BatteryChargeState, 61 BatteryHealthState, 62 BatteryCapacityLevel, 63 CommonEventBatteryChangedCode, 64 batterySOC: "[PC Preview] unknow batterySOC", 65 chargingStatus: BatteryChargeState, 66 healthStatus: BatteryHealthState, 67 pluggedType: BatteryPluggedType, 68 voltage: "[PC Preview] unknow voltage", 69 technology: "[PC Preview] unknow technology", 70 batteryTemperature: "[PC Preview] unknow batteryTemperature", 71 isBatteryPresent: "[PC Preview] unknow isBatteryPresent", 72 batteryCapacityLevel: BatteryCapacityLevel, 73 estimatedRemainingChargeTime: "[PC Preview] unknow estimatedRemainingChargeTime", 74 totalEnergy: "[PC Preview] unknow totalEnergy", 75 nowCurrent: "[PC Preview] unknow nowCurrent", 76 remainingEnergy: "[PC Preview] unknow remainingEnergy" 77 } 78 return batteryInfo 79} 80