修复问题
parent
da7135e51b
commit
6e94380244
|
@ -3,8 +3,8 @@
|
||||||
#include "barrier/generic_barrier.h"
|
#include "barrier/generic_barrier.h"
|
||||||
#include "platform_scale/generic_platform_scale.h"
|
#include "platform_scale/generic_platform_scale.h"
|
||||||
#include "sound_column/generic_sound_column.h"
|
#include "sound_column/generic_sound_column.h"
|
||||||
// #include "vidicon/generic_vidicon.h"
|
#include "vidicon/generic_vidicon.h"
|
||||||
#include "vidicon/barrier_vidicon.h"
|
// #include "vidicon/barrier_vidicon.h"
|
||||||
|
|
||||||
namespace zsy {
|
namespace zsy {
|
||||||
void DeviceHolder::initBarriers(std::vector<BarrierProperties> &configs)
|
void DeviceHolder::initBarriers(std::vector<BarrierProperties> &configs)
|
||||||
|
@ -39,8 +39,8 @@ namespace zsy {
|
||||||
{
|
{
|
||||||
for (auto &config: configs)
|
for (auto &config: configs)
|
||||||
{
|
{
|
||||||
// vidicons.emplace(config.sn, std::make_shared<GenericVidicon>(config));
|
vidicons.emplace(config.sn, std::make_shared<GenericVidicon>(config));
|
||||||
vidicons.emplace(config.sn, std::make_shared<BarrierVidicon>(config));
|
// vidicons.emplace(config.sn, std::make_shared<BarrierVidicon>(config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace zsy
|
||||||
|
|
||||||
inline void from_json(const nlohmann::json &j, ReportPassResult::Data &o)
|
inline void from_json(const nlohmann::json &j, ReportPassResult::Data &o)
|
||||||
{
|
{
|
||||||
PARSE_JSON(carNumber, o.carNumber);
|
PARSE_JSON(car_number, o.carNumber);
|
||||||
PARSE_JSON(type, o.type);
|
PARSE_JSON(type, o.type);
|
||||||
PARSE_JSON(orderNo, o.orderNo);
|
PARSE_JSON(order_no, o.orderNo);
|
||||||
PARSE_JSON(errMsg, o.errMsg);
|
PARSE_JSON(errMsg, o.errMsg);
|
||||||
PARSE_JSON(scene, o.scene);
|
PARSE_JSON(scene, o.scene);
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,9 @@ namespace zsy
|
||||||
|
|
||||||
inline void from_json(const nlohmann::json &j, ReportResult::Data &o)
|
inline void from_json(const nlohmann::json &j, ReportResult::Data &o)
|
||||||
{
|
{
|
||||||
PARSE_JSON(carNumber, o.carNumber);
|
PARSE_JSON(car_number, o.carNumber);
|
||||||
PARSE_JSON(orderNo, o.orderNo);
|
PARSE_JSON(order_no, o.orderNo);
|
||||||
PARSE_JSON(laneCode, o.laneCode);
|
PARSE_JSON(lane_code, o.laneCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void from_json(const nlohmann::json &j, ReportResult &o)
|
inline void from_json(const nlohmann::json &j, ReportResult &o)
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace zsy
|
||||||
const auto res = jsonData.get<PhotographResult>();
|
const auto res = jsonData.get<PhotographResult>();
|
||||||
|
|
||||||
imageContent = res.payload.image_content;
|
imageContent = res.payload.image_content;
|
||||||
hasNewContent.store(true);
|
hasNewContent.store(true, std::memory_order_release);
|
||||||
});
|
});
|
||||||
Application::eventManager->subscribe(MqttCli::TYPE_LOCAL + "/device/" + config.ip + "/message/down/snapshot/reply", [this](const EventManager::Event &event)
|
Application::eventManager->subscribe(MqttCli::TYPE_LOCAL + "/device/" + config.ip + "/message/down/snapshot/reply", [this](const EventManager::Event &event)
|
||||||
{
|
{
|
||||||
|
@ -111,13 +111,19 @@ namespace zsy
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
LOGGER_INFO("等待:{}", i);
|
LOGGER_INFO("等待照片:{}", i);
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
} while (i <= 10 && !hasNewContent.load());
|
} while (i <= 10 && !hasNewContent.load(std::memory_order_acquire));
|
||||||
|
|
||||||
const auto filename = "car_body_" + Snowflake::genIdStr() + ".jpg";
|
const auto filename = "car_body_" + Snowflake::genIdStr() + ".jpg";
|
||||||
auto content = SysUtil::base64_decode(imageContent);
|
auto content = SysUtil::base64_decode(imageContent);
|
||||||
|
|
||||||
|
if (imageContent == "")
|
||||||
|
{
|
||||||
|
LOGGER_ERROR("未收到图片");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_shared<std::istringstream>(content, std::ios_base::in | std::ios_base::binary);
|
return std::make_shared<std::istringstream>(content, std::ios_base::in | std::ios_base::binary);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue