mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 11:21:30 +00:00
fix: camera signaling API
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#include "OrcaCloudServiceAgent.hpp"
|
#include "OrcaCloudServiceAgent.hpp"
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
|
#include "ICameraSignalingChannel.hpp"
|
||||||
|
#include "OrcaCloudSignalingChannel.hpp"
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
#include "libslic3r/AppConfig.hpp"
|
#include "libslic3r/AppConfig.hpp"
|
||||||
@@ -3023,6 +3025,9 @@ int OrcaCloudServiceAgent::get_camera_url(std::string dev_id, std::function<void
|
|||||||
return BAMBU_NETWORK_SUCCESS;
|
return BAMBU_NETWORK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ICameraSignalingChannel> OrcaCloudServiceAgent::create_camera_signaling_channel(const std::string& dev_id)
|
||||||
|
{ return std::make_unique<OrcaCloudSignalingChannel>(this, dev_id); }
|
||||||
|
|
||||||
int OrcaCloudServiceAgent::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback)
|
int OrcaCloudServiceAgent::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: get_design_staffpick (stub)";
|
BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: get_design_staffpick (stub)";
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public:
|
|||||||
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
|
// ICloudServiceAgent Interface Implementation - Model Mall & Publishing
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback) override;
|
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;
|
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 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 start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out) override;
|
||||||
int get_model_publish_url(std::string* url) override;
|
int get_model_publish_url(std::string* url) override;
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
OrcaCloudSignalingChannel::OrcaCloudSignalingChannel(std::shared_ptr<ICloudServiceAgent> cloud, std::string dev_id)
|
OrcaCloudSignalingChannel::OrcaCloudSignalingChannel(OrcaCloudServiceAgent* cloud, std::string dev_id)
|
||||||
: m_cloud(std::move(cloud))
|
: m_cloud(cloud)
|
||||||
, m_dev_id(std::move(dev_id))
|
, m_dev_id(std::move(dev_id))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "ICameraSignalingChannel.hpp"
|
#include "ICameraSignalingChannel.hpp"
|
||||||
#include "ICloudServiceAgent.hpp"
|
#include "ICloudServiceAgent.hpp"
|
||||||
|
#include "OrcaCloudServiceAgent.hpp"
|
||||||
|
|
||||||
#include <boost/asio/io_context.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
@@ -21,7 +22,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
class OrcaCloudSignalingChannel : public ICameraSignalingChannel {
|
class OrcaCloudSignalingChannel : public ICameraSignalingChannel {
|
||||||
public:
|
public:
|
||||||
OrcaCloudSignalingChannel(std::shared_ptr<ICloudServiceAgent> cloud, std::string dev_id);
|
OrcaCloudSignalingChannel(OrcaCloudServiceAgent* cloud, std::string dev_id);
|
||||||
~OrcaCloudSignalingChannel() override;
|
~OrcaCloudSignalingChannel() override;
|
||||||
|
|
||||||
void open() override;
|
void open() override;
|
||||||
@@ -51,7 +52,7 @@ private:
|
|||||||
static std::string encode_path_component(const std::string& value);
|
static std::string encode_path_component(const std::string& value);
|
||||||
static std::string host_without_scheme(std::string value);
|
static std::string host_without_scheme(std::string value);
|
||||||
|
|
||||||
std::shared_ptr<ICloudServiceAgent> m_cloud;
|
OrcaCloudServiceAgent* m_cloud;
|
||||||
std::string m_dev_id;
|
std::string m_dev_id;
|
||||||
std::atomic<bool> m_stop{false};
|
std::atomic<bool> m_stop{false};
|
||||||
std::atomic<bool> m_open{false};
|
std::atomic<bool> m_open{false};
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "OrcaPrinterAgent.hpp"
|
#include "OrcaPrinterAgent.hpp"
|
||||||
#include "OrcaCloudSignalingChannel.hpp"
|
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
#include "IPrinterAgent.hpp"
|
#include "IPrinterAgent.hpp"
|
||||||
#include "NetworkAgentFactory.hpp"
|
#include "NetworkAgentFactory.hpp"
|
||||||
@@ -696,14 +695,6 @@ void OrcaPrinterAgent::set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud
|
|||||||
BOOST_LOG_TRIVIAL(info) << "OrcaPrinterAgent::set_cloud_agent: status callback result=" << callback_result;
|
BOOST_LOG_TRIVIAL(info) << "OrcaPrinterAgent::set_cloud_agent: status callback result=" << callback_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ICameraSignalingChannel> OrcaPrinterAgent::create_camera_signaling_channel(const std::string& dev_id)
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(state_mutex);
|
|
||||||
if (!m_cloud_agent)
|
|
||||||
return nullptr;
|
|
||||||
return std::make_unique<OrcaCloudSignalingChannel>(m_cloud_agent, dev_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Communication
|
// Communication
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public:
|
|||||||
void set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud) override;
|
void set_cloud_agent(std::shared_ptr<ICloudServiceAgent> cloud) override;
|
||||||
CameraStreamMode get_camera_stream_mode() const override;
|
CameraStreamMode get_camera_stream_mode() const override;
|
||||||
std::string get_camera_url() const override;
|
std::string get_camera_url() const override;
|
||||||
std::unique_ptr<ICameraSignalingChannel>
|
|
||||||
create_camera_signaling_channel(const std::string& dev_id) override;
|
|
||||||
|
|
||||||
// Communication
|
// Communication
|
||||||
int send_message(std::string dev_id, std::string json_str, int qos, int flag) override;
|
int send_message(std::string dev_id, std::string json_str, int qos, int flag) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user