• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef BATTERY_LED_H
17 #define BATTERY_LED_H
18 
19 #include "v1_0/ilight_interface.h"
20 #include "v1_0/light_types.h"
21 #include "battery_config.h"
22 #include "power_supply_provider.h"
23 
24 namespace OHOS {
25 namespace HDI {
26 namespace Battery {
27 namespace V1_1 {
28 class BatteryLed {
29 public:
30     BatteryLed() = default;
31     ~BatteryLed() = default;
32 
33     void InitLight();
34     void TurnOff();
35     void TurnOn(uint32_t color = 0);
36     bool UpdateColor(int32_t chargeState, int32_t capacity);
37     bool IsAvailable() const;
38     uint32_t GetLightColor() const;
39 
40 private:
41     sptr<OHOS::HDI::Light::V1_0::ILightInterface> batteryLight_ {nullptr};
42     bool available_ {false};
43     uint32_t lightColor_ {0};
44 };
45 }  // namespace V1_1
46 }  // namespace Battery
47 }  // namespace HDI
48 }  // namespace OHOS
49 #endif
50