SDL standard library
SDL_power.h@0:dda4f4550403, 2016-09-07 (annotated)
- Committer:
- miruga27
- Date:
- Wed Sep 07 18:46:53 2016 +0000
- Revision:
- 0:dda4f4550403
7/09/2016;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
miruga27 | 0:dda4f4550403 | 1 | /* |
miruga27 | 0:dda4f4550403 | 2 | Simple DirectMedia Layer |
miruga27 | 0:dda4f4550403 | 3 | Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> |
miruga27 | 0:dda4f4550403 | 4 | |
miruga27 | 0:dda4f4550403 | 5 | This software is provided 'as-is', without any express or implied |
miruga27 | 0:dda4f4550403 | 6 | warranty. In no event will the authors be held liable for any damages |
miruga27 | 0:dda4f4550403 | 7 | arising from the use of this software. |
miruga27 | 0:dda4f4550403 | 8 | |
miruga27 | 0:dda4f4550403 | 9 | Permission is granted to anyone to use this software for any purpose, |
miruga27 | 0:dda4f4550403 | 10 | including commercial applications, and to alter it and redistribute it |
miruga27 | 0:dda4f4550403 | 11 | freely, subject to the following restrictions: |
miruga27 | 0:dda4f4550403 | 12 | |
miruga27 | 0:dda4f4550403 | 13 | 1. The origin of this software must not be misrepresented; you must not |
miruga27 | 0:dda4f4550403 | 14 | claim that you wrote the original software. If you use this software |
miruga27 | 0:dda4f4550403 | 15 | in a product, an acknowledgment in the product documentation would be |
miruga27 | 0:dda4f4550403 | 16 | appreciated but is not required. |
miruga27 | 0:dda4f4550403 | 17 | 2. Altered source versions must be plainly marked as such, and must not be |
miruga27 | 0:dda4f4550403 | 18 | misrepresented as being the original software. |
miruga27 | 0:dda4f4550403 | 19 | 3. This notice may not be removed or altered from any source distribution. |
miruga27 | 0:dda4f4550403 | 20 | */ |
miruga27 | 0:dda4f4550403 | 21 | |
miruga27 | 0:dda4f4550403 | 22 | #ifndef _SDL_power_h |
miruga27 | 0:dda4f4550403 | 23 | #define _SDL_power_h |
miruga27 | 0:dda4f4550403 | 24 | |
miruga27 | 0:dda4f4550403 | 25 | /** |
miruga27 | 0:dda4f4550403 | 26 | * \file SDL_power.h |
miruga27 | 0:dda4f4550403 | 27 | * |
miruga27 | 0:dda4f4550403 | 28 | * Header for the SDL power management routines. |
miruga27 | 0:dda4f4550403 | 29 | */ |
miruga27 | 0:dda4f4550403 | 30 | |
miruga27 | 0:dda4f4550403 | 31 | #include "SDL_stdinc.h" |
miruga27 | 0:dda4f4550403 | 32 | |
miruga27 | 0:dda4f4550403 | 33 | #include "begin_code.h" |
miruga27 | 0:dda4f4550403 | 34 | /* Set up for C function definitions, even when using C++ */ |
miruga27 | 0:dda4f4550403 | 35 | #ifdef __cplusplus |
miruga27 | 0:dda4f4550403 | 36 | extern "C" { |
miruga27 | 0:dda4f4550403 | 37 | #endif |
miruga27 | 0:dda4f4550403 | 38 | |
miruga27 | 0:dda4f4550403 | 39 | /** |
miruga27 | 0:dda4f4550403 | 40 | * \brief The basic state for the system's power supply. |
miruga27 | 0:dda4f4550403 | 41 | */ |
miruga27 | 0:dda4f4550403 | 42 | typedef enum |
miruga27 | 0:dda4f4550403 | 43 | { |
miruga27 | 0:dda4f4550403 | 44 | SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ |
miruga27 | 0:dda4f4550403 | 45 | SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ |
miruga27 | 0:dda4f4550403 | 46 | SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ |
miruga27 | 0:dda4f4550403 | 47 | SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ |
miruga27 | 0:dda4f4550403 | 48 | SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ |
miruga27 | 0:dda4f4550403 | 49 | } SDL_PowerState; |
miruga27 | 0:dda4f4550403 | 50 | |
miruga27 | 0:dda4f4550403 | 51 | |
miruga27 | 0:dda4f4550403 | 52 | /** |
miruga27 | 0:dda4f4550403 | 53 | * \brief Get the current power supply details. |
miruga27 | 0:dda4f4550403 | 54 | * |
miruga27 | 0:dda4f4550403 | 55 | * \param secs Seconds of battery life left. You can pass a NULL here if |
miruga27 | 0:dda4f4550403 | 56 | * you don't care. Will return -1 if we can't determine a |
miruga27 | 0:dda4f4550403 | 57 | * value, or we're not running on a battery. |
miruga27 | 0:dda4f4550403 | 58 | * |
miruga27 | 0:dda4f4550403 | 59 | * \param pct Percentage of battery life left, between 0 and 100. You can |
miruga27 | 0:dda4f4550403 | 60 | * pass a NULL here if you don't care. Will return -1 if we |
miruga27 | 0:dda4f4550403 | 61 | * can't determine a value, or we're not running on a battery. |
miruga27 | 0:dda4f4550403 | 62 | * |
miruga27 | 0:dda4f4550403 | 63 | * \return The state of the battery (if any). |
miruga27 | 0:dda4f4550403 | 64 | */ |
miruga27 | 0:dda4f4550403 | 65 | extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); |
miruga27 | 0:dda4f4550403 | 66 | |
miruga27 | 0:dda4f4550403 | 67 | /* Ends C function definitions when using C++ */ |
miruga27 | 0:dda4f4550403 | 68 | #ifdef __cplusplus |
miruga27 | 0:dda4f4550403 | 69 | } |
miruga27 | 0:dda4f4550403 | 70 | #endif |
miruga27 | 0:dda4f4550403 | 71 | #include "close_code.h" |
miruga27 | 0:dda4f4550403 | 72 | |
miruga27 | 0:dda4f4550403 | 73 | #endif /* _SDL_power_h */ |
miruga27 | 0:dda4f4550403 | 74 | |
miruga27 | 0:dda4f4550403 | 75 | /* vi: set ts=4 sw=4 expandtab: */ |