修复问题
This commit is contained in:
@@ -186,14 +186,12 @@ public:
|
||||
return ret;
|
||||
}
|
||||
virtual Psc::JSON to_json() {
|
||||
return With_Loop_Coro::to_base_json() += settings.snapshot().to_base_json();
|
||||
return With_Loop_Coro::to_base_json() += settings.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
virtual void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) {
|
||||
With_Loop_Coro::from_base_json(that_json, not_exist_use_default_value);
|
||||
auto value = settings.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
settings.write([&](auto& target) {
|
||||
target = value;
|
||||
settings.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
});
|
||||
}
|
||||
std::string buffer;
|
||||
@@ -233,7 +231,7 @@ public:
|
||||
type = "TCP_Client_Data_Source";
|
||||
}
|
||||
asio::awaitable<void> _open() override {
|
||||
const auto value = specific.snapshot();
|
||||
const auto value = specific.read([](const auto& value) { return value; });
|
||||
Psc::asio_socket::Sockaddr_In addr;
|
||||
addr.ip = value.ip;
|
||||
addr.port = value.port;
|
||||
@@ -247,14 +245,12 @@ public:
|
||||
co_return;
|
||||
}
|
||||
Psc::JSON to_json() override {
|
||||
return Data_Source::to_json() += specific.snapshot().to_base_json();
|
||||
return Data_Source::to_json() += specific.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) override {
|
||||
Data_Source::from_json(that_json, not_exist_use_default_value);
|
||||
auto value = specific.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
specific.write([&](auto& target) {
|
||||
target = value;
|
||||
specific.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
});
|
||||
}
|
||||
asio::awaitable<std::string> read_coro() override {
|
||||
@@ -288,7 +284,7 @@ public:
|
||||
type = "Serial_Data_Source";
|
||||
}
|
||||
asio::awaitable<void> _open() override {
|
||||
const auto value = specific.snapshot();
|
||||
const auto value = specific.read([](const auto& value) { return value; });
|
||||
serial = std::make_unique<Psc::serial::Serial_Coro>();
|
||||
serial->set_serial_name(value.port_name);
|
||||
serial->set_baud_rate(value.baud_rate);
|
||||
@@ -317,14 +313,12 @@ public:
|
||||
co_return co_await serial->read_coro();
|
||||
}
|
||||
Psc::JSON to_json() override {
|
||||
return Data_Source::to_json() += specific.snapshot().to_base_json();
|
||||
return Data_Source::to_json() += specific.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) override {
|
||||
Data_Source::from_json(that_json, not_exist_use_default_value);
|
||||
auto value = specific.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
specific.write([&](auto& target) {
|
||||
target = value;
|
||||
specific.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
});
|
||||
}
|
||||
std::unique_ptr<Psc::serial::Serial_Coro> serial{};
|
||||
@@ -392,21 +386,19 @@ public:
|
||||
std::shared_ptr<Cache_Msg> pre_cache = nullptr;
|
||||
std::deque<std::shared_ptr<Cache_Msg>> cache_list;
|
||||
std::string get_true_file_path() const {
|
||||
return Psc::get_abs_path(specific.member<&File_Data_Source_Data::file_path>().snapshot());
|
||||
return Psc::get_abs_path(specific.member<&File_Data_Source_Data::file_path>().read([](const auto& value) { return value; }));
|
||||
}
|
||||
asio::awaitable<void> _close() override;
|
||||
asio::awaitable<void> _open() override;
|
||||
std::vector<std::string> readBinaryFileAsString(std::string_view filepath, size_t part_size);
|
||||
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) override {
|
||||
Data_Source::from_json(that_json, not_exist_use_default_value);
|
||||
auto value = specific.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
specific.write([&](auto& target) {
|
||||
target = value;
|
||||
specific.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
});
|
||||
}
|
||||
Psc::JSON to_json() override {
|
||||
return Data_Source::to_json() += specific.snapshot().to_base_json();
|
||||
return Data_Source::to_json() += specific.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
void origin_data_transform_mode_data(std::string& data) override;
|
||||
void handle_mode_s(std::shared_ptr<SSR::Mode_S_Msg>& msg) override;
|
||||
@@ -453,15 +445,14 @@ public:
|
||||
std::vector<std::uint8_t> buffer;
|
||||
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) override {
|
||||
Data_Source::from_json(that_json, not_exist_use_default_value);
|
||||
auto value = specific.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
specific.write([&](auto& target) {
|
||||
target = value;
|
||||
const auto buffer_size = specific.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
return value.buffer_size;
|
||||
});
|
||||
buffer.resize(value.buffer_size);
|
||||
buffer.resize(buffer_size);
|
||||
}
|
||||
Psc::JSON to_json() override {
|
||||
return Data_Source::to_json() += specific.snapshot().to_base_json();
|
||||
return Data_Source::to_json() += specific.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
void* lib{};
|
||||
using Func_Type = size_t (*)(char* buf, std::size_t max_len);
|
||||
@@ -474,7 +465,7 @@ public:
|
||||
co_return;
|
||||
}
|
||||
asio::awaitable<void> _open() override {
|
||||
const auto value = specific.snapshot();
|
||||
const auto value = specific.read([](const auto& value) { return value; });
|
||||
{
|
||||
auto r = Psc::try_load_library(Psc::get_abs_path(value.library_path));
|
||||
if (!r) {
|
||||
@@ -524,14 +515,12 @@ public:
|
||||
}
|
||||
void from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) override {
|
||||
Data_Source::from_json(that_json, not_exist_use_default_value);
|
||||
auto value = specific.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
specific.write([&](auto& target) {
|
||||
target = value;
|
||||
specific.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
});
|
||||
}
|
||||
Psc::JSON to_json() override {
|
||||
return Data_Source::to_json() += specific.snapshot().to_base_json();
|
||||
return Data_Source::to_json() += specific.read([](const auto& value) { return value.to_base_json(); });
|
||||
}
|
||||
asio::awaitable<void> _open() override;
|
||||
asio::awaitable<void> _close() override;
|
||||
|
||||
Reference in New Issue
Block a user