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