File tree Expand file tree Collapse file tree 14 files changed +54
-11
lines changed
Expand file tree Collapse file tree 14 files changed +54
-11
lines changed Original file line number Diff line number Diff line change 11Folding@home Client Changelog
22=============================
33
4+ ## v8.3.2
5+ - Added folding on battery option
6+ - Added keep awake option
7+
48## v8.3.1
59 - Updated copyrights.
610
Original file line number Diff line number Diff line change 11{
22 "name" : " fah-client" ,
3- "version" : " 8.3.1 " ,
3+ "version" : " 8.3.2 " ,
44 "bin" : {
55 "fah-client" : " ./fah-client"
66 },
Original file line number Diff line number Diff line change @@ -286,6 +286,7 @@ void App::setState(const string &state) {
286286
287287
288288bool App::getPaused () const {return getGroups ()->getPaused ();}
289+ bool App::keepAwake () const {return getGroups ()->keepAwake ();}
289290
290291
291292void App::validate (const Certificate &cert,
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ namespace FAH {
128128 void setState (const cb::JSON::Value &msg);
129129 void setState (const std::string &state);
130130 bool getPaused () const ;
131+ bool keepAwake () const ;
131132
132133 const cb::KeyPair &getKey () const {return key;}
133134 void validate (const cb::Certificate &cert,
Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ void Config::setState(const JSON::Value &msg) {
8585}
8686
8787
88- bool Config::getOnIdle () const {return getBoolean (" on_idle" );}
88+ bool Config::getOnIdle () const {return getBoolean (" on_idle" );}
89+ bool Config::getOnBattery () const {return getBoolean (" on_battery" );}
90+ bool Config::getKeepAwake () const {return getBoolean (" keep_awake" );}
8991
9092
9193void Config::setPaused (bool paused) {
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ namespace FAH {
5252 void setState (const cb::JSON::Value &msg);
5353
5454 bool getOnIdle () const ;
55+ bool getOnBattery () const ;
56+ bool getKeepAwake () const ;
5557 void setPaused (bool paused);
5658 bool getPaused () const ;
5759 bool getFinish () const ;
Original file line number Diff line number Diff line change @@ -82,6 +82,14 @@ bool Group::waitForIdle() const {
8282}
8383
8484
85+ bool Group::waitOnBattery () const {
86+ return !config->getOnBattery () && app.getOS ().isOnBattery ();
87+ }
88+
89+
90+ bool Group::keepAwake () const {return config->getKeepAwake () && isActive ();}
91+
92+
8593bool Group::isActive () const {
8694 for (auto unit: units ())
8795 if (!unit->isPaused ()) return true ;
Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ namespace FAH {
4444 cb::SmartPointer<Config> config;
4545
4646 cb::Event::EventPtr event;
47- uint32_t failures = 0 ;
48- uint64_t waitUntil = 0 ;
47+ uint32_t failures = 0 ;
48+ uint64_t waitUntil = 0 ;
4949
5050 std::function<void ()> shutdownCB;
5151
@@ -103,6 +103,8 @@ namespace FAH {
103103 void setState (const cb::JSON::Value &msg);
104104
105105 bool waitForIdle () const ;
106+ bool waitOnBattery () const ;
107+ bool keepAwake () const ;
106108 bool isActive () const ;
107109 bool hasUnrunWUs () const ;
108110 void triggerUpdate ();
Original file line number Diff line number Diff line change @@ -130,3 +130,12 @@ bool Groups::getPaused() const {
130130
131131 return true ;
132132}
133+
134+
135+ bool Groups::keepAwake () const {
136+ for (auto &name: keys ())
137+ if (getGroup (name).keepAwake ())
138+ return true ;
139+
140+ return false ;
141+ }
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ namespace FAH {
5050 void triggerUpdate ();
5151 void setState (const cb::JSON::Value &msg);
5252 bool getPaused () const ;
53+ bool keepAwake () const ;
5354 };
5455 }
5556}
You can’t perform that action at this time.
0 commit comments