37 lines
746 B
C++
37 lines
746 B
C++
/*
|
|||
|
|
* ChargeDetect.h
|
||
|
|
*
|
||
|
|
* Copyright (C) 2017 Spreadtrum Communications Inc.
|
||
|
|
*/
|
||
|
|
#ifndef CHARGEDETECT_H_
|
||
|
|
#define CHARGEDETECT_H_
|
||
|
|
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace android {
|
||
|
|
|
||
|
|
class ThermalManager;
|
||
|
|
|
||
|
|
class ChargeDetect {
|
||
|
|
public:
|
||
|
|
ChargeDetect(ThermalManager* handler);
|
||
|
|
~ChargeDetect();
|
||
|
|
static void* chargeMonitor(void* ptr);
|
||
|
|
int enableCharge(bool en);
|
||
|
|
bool getChargeEn(void);
|
||
|
|
|
||
|
|
private:
|
||
|
|
const char* STAT_PATH = "/sys/class/power_supply/battery/status";
|
||
|
|
const char* GOVERNOR_CHARGE_ENABLE = "persist.vendor.thermal.chggoven";
|
||
|
|
bool getChargeStatus(void);
|
||
|
|
int chargeEvent(void);
|
||
|
|
ThermalManager* mManager;
|
||
|
|
int mIsCharging;
|
||
|
|
bool mChargeEn;
|
||
|
|
bool mChgActionEn;
|
||
|
|
int mUeventFd;
|
||
|
|
};
|
||
|
|
}; // namespace android
|
||
|
|
|
||
|
|
#endif // CHARGEDETECT_H_
|