MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / ProcessPanelStreamMessage

Method ProcessPanelStreamMessage

src/render/plugins/plugin_event_router.cpp:263–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261 }
262
263 void PluginEventRouter::ProcessPanelStreamMessage(const std::shared_ptr<GrPluginPanelStreamMessage>& event) {
264 if (!event->body_) {
265 return;
266 }
267
268 try {
269 LOGI("ProcessPanelStreamMessage: {}", event->body_->AsString());
270 json obj = json::parse(event->body_->AsString());
271 auto event = obj["event"].get<std::string>();
272 auto from_device = obj["from_device"].get<std::string>();
273 if (event == "restart_render") {
274 app_->SendAppMessage(MsgPanelStreamRestartRender {
275 .from_device_ = from_device,
276 });
277 }
278 else if (event == "lock_screen") {
279 app_->SendAppMessage(MsgPanelStreamLockScreen {
280 .from_device_ = from_device,
281 });
282 }
283 else if (event == "restart_device") {
284 app_->SendAppMessage(MsgPanelStreamRestartDevice {
285 .from_device_ = from_device,
286 });
287 }
288 else if (event == "shutdown_device") {
289 app_->SendAppMessage(MsgPanelStreamShutdownDevice {
290 .from_device_ = from_device,
291 });
292 }
293 }
294 catch(const std::exception& e) {
295 LOGE("ProcessPanelStreamMessage failed: {}, body: {}", e.what(), event->body_->AsString());
296 }
297 }
298
299 void PluginEventRouter::ReportRelayAlive(const std::string& device_id, int64_t timestamp) {
300 app_->PostGlobalTask([=, this]() {

Callers

nothing calls this directly

Calls 2

AsStringMethod · 0.45
SendAppMessageMethod · 0.45

Tested by

no test coverage detected