IVA/app/HxTaskDispatch.h
2023-10-21 23:39:10 +08:00

99 lines
2.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef HXTASKDISPATCH_H
#define HXTASKDISPATCH_H
#include <QThread>
#include "HxDataBase.h"
#include "HxUtils.h"
#include "MvObjectEventDetect.h"
#define ALGORITHM_TYPE_ADAS 0
#define ALGORITHM_TYPE_BSD 1
#define ALGORITHM_TYPE_DSM 2
class TaskDispatch : public QThread
{
Q_OBJECT
public:
/**
* @brief 初始化
*/
static void initialization(void);
/**
* @brief 初始化DebugTool监听程序
* @param port 端口
*/
static void listern(uint16_t port);
/**
* @brief 连接上位机
* @param address 地址
*/
static void connect_to_host(QString address, int port);
static void algorithm_alarm_event(int channel, int level, int event_type, int detect_type, int left, int top, int right, int bottom, int distance, int speed, QString base64_string, QString filepath);
static DataBase database(void);
static CarInfoInput* get_car_info(void);
static QString get_video_frame_data(int type, int channel, int id);
/**
* @brief 生成报警图片
* @param type 报警类型
* @param channel 视频通道
* @param frame_id 视频帧编号
* @return 返回 Base64 字符串
*/
static QString build_alarm_image(int type, int channel, int frame_id);
/**
* @brief 生成报警视频
* @param type 报警类型
* @param channel 视频通道
* @param frame_id 视频帧编号
*/
static QString build_alarm_video(int type, int channel, int frame_id);
protected:
void run() override;
private:
void update_heartbeat();
void updata_vehiclue_status(QJsonObject object);
void parsing_vehiclue_status(void);
void debug_tool_response_event(int type, std::initializer_list<QPair<QString, QJsonValue>> args);
signals:
void data_write_event(QByteArray data);
public slots:
void data_receive_event(QByteArray data);
private:
/* 事件检测配置信息*/
ObjectEventDetectConfig event_detect_config;
/* 心跳发送时间戳 */
QDateTime heartbeat_timestamp;
/* 车辆状态更新时间 */
QDateTime vehicle_status_update_time;
/* 边缘云 Socket (客户端) */
HxSocketUtils* platform;
/* DebugTool Socket (服务端) */
HxSocketUtils* debug_tool;
/* 车辆状态信息 */
CarInfoInput car_info;
/* 倒车灯10熄灭 */
int reversing_light = 0;
};
#endif // HXTASKDISPATCH_H