Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/powerManager.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 namespace fb2k { | |
| 4 //! \since 2.0 | |
| 5 class powerManager : public service_base { | |
| 6 public: | |
| 7 enum { | |
| 8 flagStrong = 1 << 0, | |
| 9 flagPlayback = 1 << 1, | |
| 10 | |
| 11 flagDisplay = flagStrong | |
| 12 }; | |
| 13 | |
| 14 //! Blocks device sleep for the duration of returned object's lifetime. \n | |
| 15 //! By default we ask politely but can be still put to sleep by the OS. Specify flagStrong to force the device into awake state (possibly at cost of keeping the screen up). \n | |
| 16 //! Thread safety: OK to call from any thread. | |
| 17 virtual objRef makeTask(const char* name, unsigned flags) = 0; | |
| 18 | |
| 19 //! Returns whether we're running on AC power (not on battery). \n | |
| 20 //! Thread safety: OK to call from any thread. | |
| 21 virtual bool haveACPower() = 0; | |
| 22 | |
| 23 objRef makeTaskWeak(const char* name) { return makeTask(name, 0); } | |
| 24 objRef makeTaskStrong(const char* name) { return makeTask(name, flagStrong); } | |
| 25 objRef makePlaybackTask() { return makeTask("Playback", flagPlayback); } | |
| 26 | |
| 27 FB2K_MAKE_SERVICE_COREAPI(powerManager) | |
| 28 }; | |
| 29 } |
