mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 20:45:31 -04:00
universal7885: parts-aidl: Run clang-format on smartcharge impl
This commit is contained in:
parent
5aab0c64ed
commit
f2228a093e
2 changed files with 13 additions and 9 deletions
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
#include "SmartCharge.h"
|
#include "SmartCharge.h"
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <FileIO.h>
|
|
||||||
#include "BatteryConstants.h"
|
#include "BatteryConstants.h"
|
||||||
|
#include <FileIO.h>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
namespace aidl::vendor::eureka::hardware::parts {
|
namespace aidl::vendor::eureka::hardware::parts {
|
||||||
|
|
||||||
|
|
@ -24,20 +24,23 @@ void SmartCharge::battery_monitor(void) {
|
||||||
while (kShouldRun) {
|
while (kShouldRun) {
|
||||||
auto batt = FileIO::readline(BATTERY_CAPACITY_CURRENT);
|
auto batt = FileIO::readline(BATTERY_CAPACITY_CURRENT);
|
||||||
if (batt >= limit) {
|
if (batt >= limit) {
|
||||||
if (kTookAction) goto sleep;
|
if (kTookAction)
|
||||||
|
goto sleep;
|
||||||
FileIO::writeline(BATTERY_CHARGE, 1);
|
FileIO::writeline(BATTERY_CHARGE, 1);
|
||||||
kTookAction = true;
|
kTookAction = true;
|
||||||
limit_stat += 1;
|
limit_stat += 1;
|
||||||
} else if (batt <= restart) {
|
} else if (batt <= restart) {
|
||||||
if (kTookAction) goto sleep;
|
if (kTookAction)
|
||||||
|
goto sleep;
|
||||||
FileIO::writeline(BATTERY_CHARGE, 0);
|
FileIO::writeline(BATTERY_CHARGE, 0);
|
||||||
kTookAction = true;
|
kTookAction = true;
|
||||||
restart_stat += 1;
|
restart_stat += 1;
|
||||||
} else {
|
} else {
|
||||||
if (!kTookAction) goto sleep;
|
if (!kTookAction)
|
||||||
|
goto sleep;
|
||||||
kTookAction = false;
|
kTookAction = false;
|
||||||
}
|
}
|
||||||
sleep:
|
sleep:
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +51,7 @@ sleep:
|
||||||
EX_ILLEGAL_ARGUMENT, "Start called without configuring.");
|
EX_ILLEGAL_ARGUMENT, "Start called without configuring.");
|
||||||
|
|
||||||
kShouldRun = true;
|
kShouldRun = true;
|
||||||
monitor_th = new std::thread([this] {battery_monitor();});
|
monitor_th = new std::thread([this] { battery_monitor(); });
|
||||||
return ::ndk::ScopedAStatus::ok();
|
return ::ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
namespace aidl::vendor::eureka::hardware::parts {
|
namespace aidl::vendor::eureka::hardware::parts {
|
||||||
|
|
||||||
struct SmartCharge : public BnSmartCharge {
|
struct SmartCharge : public BnSmartCharge {
|
||||||
public:
|
public:
|
||||||
// Methods from ::aidl::vendor::eureka::hardware::parts::ISmartCharge
|
// Methods from ::aidl::vendor::eureka::hardware::parts::ISmartCharge
|
||||||
// follow.
|
// follow.
|
||||||
::ndk::ScopedAStatus start(void);
|
::ndk::ScopedAStatus start(void);
|
||||||
|
|
@ -28,7 +28,8 @@ struct SmartCharge : public BnSmartCharge {
|
||||||
::ndk::ScopedAStatus setConfig(int32_t limit, int32_t restart);
|
::ndk::ScopedAStatus setConfig(int32_t limit, int32_t restart);
|
||||||
::ndk::ScopedAStatus getLimitCnt(int32_t *_aidl_return);
|
::ndk::ScopedAStatus getLimitCnt(int32_t *_aidl_return);
|
||||||
::ndk::ScopedAStatus getRestartCnt(int32_t *_aidl_return);
|
::ndk::ScopedAStatus getRestartCnt(int32_t *_aidl_return);
|
||||||
private:
|
|
||||||
|
private:
|
||||||
int limit;
|
int limit;
|
||||||
int restart;
|
int restart;
|
||||||
int limit_stat;
|
int limit_stat;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue