1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2010 by Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
27 extern JNIEnv
*env_ptr
;
28 extern jclass RockboxService_class
;
29 extern jobject RockboxService_instance
;
31 static jfieldID _battery_level
;
33 void powermgmt_init_target(void)
35 jmethodID initBatteryMonitor
= (*env_ptr
)->GetMethodID(env_ptr
,
39 /* start the monitor */
40 (*env_ptr
)->CallVoidMethod(env_ptr
,
41 RockboxService_instance
,
44 /* cache the battery level field id */
45 _battery_level
= (*env_ptr
)->GetFieldID(env_ptr
,
51 int battery_level(void)
53 return (*env_ptr
)->GetIntField(env_ptr
, RockboxService_instance
, _battery_level
);
56 int battery_time(void)
57 { /* cannot calculate yet */
61 /* should always be safe on android targets, the host shuts us down before */
62 bool battery_level_safe(void)
68 unsigned battery_voltage(void)