mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-21 16:02:37 +00:00
fix: shift camera signaling channel to network agent
This commit is contained in:
@@ -389,7 +389,7 @@ void MediaPlayCtrl::Play()
|
||||
if (is_webrtc) {
|
||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::Play webrtc: last_state=" << m_last_state << " failed_retry=" << m_failed_retry
|
||||
<< " shown=" << IsShownOnScreen();
|
||||
auto channel = agent ? agent->create_camera_signaling_channel(m_machine) : nullptr;
|
||||
auto channel = agent ? agent->create_camera_signaling_channel(m_machine, wxGetApp().get_printer_cloud_provider()) : nullptr;
|
||||
if (!channel) {
|
||||
Stop(_L("Sign in to OrcaCloud to view the camera."));
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __I_CLOUD_SERVICE_AGENT_HPP__
|
||||
#define __I_CLOUD_SERVICE_AGENT_HPP__
|
||||
|
||||
#include "ICameraSignalingChannel.hpp"
|
||||
#include "bambu_networking.hpp"
|
||||
#include "CloudProvider.hpp"
|
||||
#include "../../libslic3r/ProjectTask.hpp"
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
@@ -328,6 +328,17 @@ public:
|
||||
*/
|
||||
virtual int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) = 0;
|
||||
|
||||
/**
|
||||
* Create a camera signaling channel object for P2P camera streaming over WebRTC.
|
||||
*
|
||||
*/
|
||||
virtual std::unique_ptr<ICameraSignalingChannel>
|
||||
create_camera_signaling_channel(const std::string& dev_id)
|
||||
{
|
||||
(void) dev_id;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch staff-picked designs from model mall.
|
||||
*/
|
||||
|
||||
@@ -445,15 +445,6 @@ public:
|
||||
* Only meaningful when get_camera_stream_mode() returns an HTTP, HTTPS, or RTSP mode.
|
||||
*/
|
||||
virtual std::string get_camera_url() const { return {}; }
|
||||
|
||||
// Optional native camera signaling. Plugin agents retain the default
|
||||
// nullptr until a plugin-facing WebRTC contract is defined.
|
||||
virtual std::unique_ptr<ICameraSignalingChannel>
|
||||
create_camera_signaling_channel(const std::string& dev_id)
|
||||
{
|
||||
(void) dev_id;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -535,6 +535,15 @@ int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(std::str
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<ICameraSignalingChannel>
|
||||
NetworkAgent::create_camera_signaling_channel(const std::string& dev_id, const std::string& provider)
|
||||
{
|
||||
const auto cloud_agent = get_cloud_agent(provider);
|
||||
if (cloud_agent)
|
||||
return cloud_agent->create_camera_signaling_channel(dev_id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int NetworkAgent::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback, const std::string& provider)
|
||||
{
|
||||
const auto cloud_agent = get_cloud_agent(provider);
|
||||
@@ -1073,14 +1082,6 @@ std::string NetworkAgent::get_local_camera_stream_url() const
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<ICameraSignalingChannel>
|
||||
NetworkAgent::create_camera_signaling_channel(const std::string& dev_id)
|
||||
{
|
||||
if (m_printer_agent)
|
||||
return m_printer_agent->create_camera_signaling_channel(dev_id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int NetworkAgent::request_bind_ticket(std::string* ticket)
|
||||
{
|
||||
if (m_printer_agent)
|
||||
|
||||
@@ -116,6 +116,7 @@ public:
|
||||
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
int modify_printer_name(std::string dev_id, std::string dev_name, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
std::unique_ptr<ICameraSignalingChannel> create_camera_signaling_channel(const std::string& dev_id, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
int get_model_publish_url(std::string* url, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||
@@ -186,7 +187,6 @@ public:
|
||||
bool fetch_filament_info(std::string dev_id, FilamentSyncMode sync_mode = FilamentSyncMode::pull);
|
||||
CameraStreamMode get_camera_stream_mode() const;
|
||||
std::string get_local_camera_stream_url() const;
|
||||
std::unique_ptr<ICameraSignalingChannel> create_camera_signaling_channel(const std::string& dev_id);
|
||||
std::string to_orca_filament_id(const std::string& printer_filament_id) const;
|
||||
std::string from_orca_filament_id(const std::string& orca_filament_id) const;
|
||||
int request_bind_ticket(std::string* ticket);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __ORCA_CLOUD_SERVICE_AGENT_HPP__
|
||||
#define __ORCA_CLOUD_SERVICE_AGENT_HPP__
|
||||
|
||||
#include "ICameraSignalingChannel.hpp"
|
||||
#include "ICloudServiceAgent.hpp"
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
@@ -241,6 +242,7 @@ public:
|
||||
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
|
||||
// ========================================================================
|
||||
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
|
||||
// std::unique_ptr<ICameraSignalingChannel> create_camera_signaling_channel(const std::string& dev_id) override;
|
||||
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback) override;
|
||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
||||
int get_model_publish_url(std::string* url) override;
|
||||
|
||||
Reference in New Issue
Block a user