Add packets to list applications

This commit is contained in:
Patrick Nicolas
2025-07-26 19:35:26 +02:00
parent ec63c8a395
commit 93a2f1c10b
6 changed files with 65 additions and 2 deletions
+9
View File
@@ -311,6 +311,15 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
}
}
{
const auto & info = application::get_messages_info();
self->network_session->send_control(from_headset::get_application_list{
.language = info.language,
.country = info.country,
.variant = info.variant,
});
}
{
const auto & config = application::get_config();
self->override_foveation_enable = config.override_foveation_enable;
+5
View File
@@ -25,6 +25,7 @@
#include "scene.h"
#include "scenes/input_profile.h"
#include "stream_reprojection.h"
#include "utils/thread_safe.h"
#include "wifi_lock.h"
#include "wivrn_client.h"
#include "wivrn_packets.h"
@@ -174,6 +175,9 @@ private:
// Keep a reference to the resources needed to blit the images until vkWaitForFences
std::vector<std::shared_ptr<wivrn::shard_accumulator::blit_handle>> current_blit_handles;
// Last application list received from server
thread_safe<to_headset::application_list> applications;
stream();
public:
@@ -197,6 +201,7 @@ public:
void operator()(to_headset::audio_stream_description &&);
void operator()(to_headset::video_stream_description &&);
void operator()(to_headset::refresh_rate_change &&);
void operator()(to_headset::application_list &&);
void operator()(audio_data &&);
void push_blit_handle(wivrn::shard_accumulator * decoder, std::shared_ptr<wivrn::shard_accumulator::blit_handle> handle);
+8
View File
@@ -19,7 +19,9 @@
#include "stream.h"
#ifdef __ANDROID__
#include "application.h"
#endif
#include "utils/named_thread.h"
#include <spdlog/spdlog.h>
@@ -99,3 +101,9 @@ void scenes::stream::send_feedback(const wivrn::from_headset::feedback & feedbac
spdlog::warn("Exception while sending feedback packet: {}", e.what());
}
}
void scenes::stream::operator()(to_headset::application_list && apps)
{
auto locked = applications.lock();
*locked = std::move(apps);
}
+24 -2
View File
@@ -443,6 +443,13 @@ struct override_foveation_center
float distance;
};
struct get_application_list
{
std::string language;
std::string country;
std::string variant;
};
using packets = std::variant<
crypto_handshake,
pin_check_1,
@@ -463,7 +470,8 @@ using packets = std::variant<
refresh_rate_changed,
session_state_changed,
user_presence_changed,
override_foveation_center>;
override_foveation_center,
get_application_list>;
} // namespace from_headset
namespace to_headset
@@ -652,6 +660,19 @@ struct refresh_rate_change
float fps;
};
struct application_list
{
std::string language;
std::string country;
std::string variant;
struct application
{
std::string id;
std::string name;
};
std::vector<application> applications;
};
using packets = std::variant<
crypto_handshake,
pin_check_2,
@@ -664,6 +685,7 @@ using packets = std::variant<
haptics,
timesync_query,
tracking_control,
refresh_rate_change>;
refresh_rate_change,
application_list>;
} // namespace to_headset
} // namespace wivrn
+18
View File
@@ -20,6 +20,7 @@
#include "wivrn_session.h"
#include "accept_connection.h"
#include "application.h"
#include "driver/app_pacer.h"
#include "main/comp_compositor.h"
#include "main/comp_main_interface.h"
@@ -724,6 +725,23 @@ void wivrn_session::operator()(from_headset::refresh_rate_changed && event)
});
}
void wivrn_session::operator()(from_headset::get_application_list && request)
{
to_headset::application_list response{
.language = std::move(request.language),
.country = std::move(request.country),
.variant = std::move(request.variant),
};
for (auto && [id, app]: list_applications())
{
response.applications.emplace_back(
std::move(id),
// FIXME: use locale
app.name.at(""));
}
send_control(std::move(response));
}
void wivrn_session::operator()(audio_data && data)
{
if (audio_handle)
+1
View File
@@ -190,6 +190,7 @@ public:
void operator()(from_headset::user_presence_changed &&);
void operator()(from_headset::refresh_rate_changed &&);
void operator()(from_headset::override_foveation_center &&);
void operator()(from_headset::get_application_list &&);
void operator()(audio_data &&);
void operator()(to_monado::disconnect &&);