summaryrefslogtreecommitdiff
path: root/platform/bb10
diff options
context:
space:
mode:
Diffstat (limited to 'platform/bb10')
-rw-r--r--platform/bb10/os_bb10.cpp14
-rw-r--r--platform/bb10/os_bb10.h6
-rw-r--r--platform/bb10/power_bb10.cpp76
-rw-r--r--platform/bb10/power_bb10.h49
4 files changed, 145 insertions, 0 deletions
diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp
index 728707628b..bf7bfb6909 100644
--- a/platform/bb10/os_bb10.cpp
+++ b/platform/bb10/os_bb10.cpp
@@ -146,6 +146,8 @@ void OSBB10::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
+
+ power_manager = memnew( PowerBB10 );
#ifdef PAYMENT_SERVICE_ENABLED
payment_service = memnew(PaymentService);
@@ -587,6 +589,18 @@ Size2 OSBB10::get_window_size() const {
return Vector2(default_videomode.width, default_videomode.height);
}
+PowerState OSBB10::get_power_state() {
+ return power_manager->get_power_state();
+}
+
+int OSBB10::get_power_seconds_left() {
+ return power_manager->get_power_seconds_left();
+}
+
+int OSBB10::get_power_percent_left() {
+ return power_manager->get_power_percent_left();
+}
+
OSBB10::OSBB10() {
main_loop=NULL;
diff --git a/platform/bb10/os_bb10.h b/platform/bb10/os_bb10.h
index 9cf2091d49..678b8c9fc2 100644
--- a/platform/bb10/os_bb10.h
+++ b/platform/bb10/os_bb10.h
@@ -39,6 +39,7 @@
#include "servers/visual/rasterizer.h"
#include "audio_driver_bb10.h"
#include "payment_service.h"
+#include "power_bb10.h"
#include <screen/screen.h>
#include <sys/platform.h>
@@ -58,6 +59,7 @@ class OSBB10 : public OS_Unix {
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
AudioDriverBB10* audio_driver;
+ PowerBB10 *power_manager;
#ifdef PAYMENT_SERVICE_ENABLED
PaymentService* payment_service;
@@ -142,6 +144,10 @@ public:
void run();
+ virtual PowerState get_power_state();
+ virtual int get_power_seconds_left();
+ virtual int get_power_percent_left();
+
OSBB10();
~OSBB10();
diff --git a/platform/bb10/power_bb10.cpp b/platform/bb10/power_bb10.cpp
new file mode 100644
index 0000000000..ef4a59d5d0
--- /dev/null
+++ b/platform/bb10/power_bb10.cpp
@@ -0,0 +1,76 @@
+/*************************************************************************/
+/* power_bb10.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "power_bb10.h"
+
+#include "core/error_macros.h"
+
+
+bool PowerBB10::UpdatePowerInfo() {
+
+ return false;
+}
+
+PowerState PowerBB10::get_power_state() {
+ if (UpdatePowerInfo()) {
+ return power_state;
+ }
+ else {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
+ return POWERSTATE_UNKNOWN;
+ }
+}
+
+int PowerBB10::get_power_seconds_left() {
+ if (UpdatePowerInfo()) {
+ return nsecs_left;
+ }
+ else {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
+ return -1;
+ }
+}
+
+int PowerBB10::get_power_percent_left() {
+ if (UpdatePowerInfo()) {
+ return percent_left;
+ }
+ else {
+ WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
+ return -1;
+ }
+}
+
+PowerBB10::PowerBB10() : nsecs_left(-1), percent_left(-1), power_state(POWERSTATE_UNKNOWN) {
+
+}
+
+PowerBB10::~PowerBB10() {
+}
+
diff --git a/platform/bb10/power_bb10.h b/platform/bb10/power_bb10.h
new file mode 100644
index 0000000000..156dd31df7
--- /dev/null
+++ b/platform/bb10/power_bb10.h
@@ -0,0 +1,49 @@
+/*************************************************************************/
+/* power_bb10.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef PLATFORM_BB10_POWER_BB10_H_
+#define PLATFORM_BB10_POWER_BB10_H_
+
+class PowerBB10 {
+private:
+ int nsecs_left;
+ int percent_left;
+ PowerState power_state;
+
+ bool UpdatePowerInfo();
+public:
+ PowerBB10();
+ virtual ~PowerBB10();
+
+ PowerState get_power_state();
+ int get_power_seconds_left();
+ int get_power_percent_left();
+};
+
+#endif /* PLATFORM_BB10_POWER_BB10_H_ */ \ No newline at end of file