linux client: add battery reporting
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "gui_common.h"
|
||||
|
||||
#include "android/battery.h"
|
||||
#include "battery.h"
|
||||
#include "render/ui_theme.h"
|
||||
#include "render/ui_widgets.h"
|
||||
|
||||
@@ -37,7 +37,6 @@ float toggle_width()
|
||||
|
||||
std::optional<battery_indicator> battery_status_indicator(XrTime now)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
const auto battery = get_battery_status();
|
||||
if (not battery.charge)
|
||||
return std::nullopt;
|
||||
@@ -82,9 +81,5 @@ std::optional<battery_indicator> battery_status_indicator(XrTime now)
|
||||
.label = fmt::format("{} {}%", icon, (int)std::round(*battery.charge * 100)),
|
||||
.style = style,
|
||||
};
|
||||
#else
|
||||
(void)now;
|
||||
return std::nullopt;
|
||||
#endif
|
||||
}
|
||||
} // namespace wivrn::gui
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "application.h"
|
||||
#include "battery.h"
|
||||
#include "stream.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "wivrn_packets.h"
|
||||
@@ -31,10 +32,6 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <thread>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/battery.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -233,10 +230,10 @@ void scenes::stream::tracking()
|
||||
#ifdef __ANDROID__
|
||||
// Runtime may use JNI and needs the thread to be attached
|
||||
application::instance().setup_jni();
|
||||
#endif
|
||||
|
||||
XrTime next_battery_check = 0;
|
||||
const XrDuration battery_check_interval = 30'000'000'000; // 30s
|
||||
#endif
|
||||
|
||||
magic_enum::containers::array<device_id, XrSpace> spaces{};
|
||||
|
||||
@@ -550,7 +547,6 @@ void scenes::stream::tracking()
|
||||
throw;
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
// FIXME: switch to event based
|
||||
if (next_battery_check < now)
|
||||
{
|
||||
@@ -563,7 +559,6 @@ void scenes::stream::tracking()
|
||||
|
||||
next_battery_check = now + battery_check_interval;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (auto fb = std::get_if<xr::fb_body_tracker>(&body_tracker); fb and fb->should_send_skeleton())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user