2023-10-20 23:36:22 +08:00
|
|
|
#ifndef HXTASKDISPATCH_H
|
|
|
|
#define HXTASKDISPATCH_H
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
#include "HxUtils.h"
|
|
|
|
#include "MvObjectEventDetect.h"
|
|
|
|
|
2023-10-20 23:48:21 +08:00
|
|
|
#define ALGORITHM_TYPE_ADAS 0
|
|
|
|
#define ALGORITHM_TYPE_BSD 1
|
|
|
|
#define ALGORITHM_TYPE_DSM 2
|
2023-10-20 23:36:22 +08:00
|
|
|
|
2023-11-12 01:13:43 +08:00
|
|
|
class HxTaskDispatch : public QThread
|
2023-10-20 23:36:22 +08:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2023-11-12 01:13:43 +08:00
|
|
|
static void algorithm_alarm_event(QDateTime time, 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);
|
2023-10-20 23:36:22 +08:00
|
|
|
|
2023-10-21 23:39:10 +08:00
|
|
|
static CarInfoInput* get_car_info(void);
|
2023-10-20 23:36:22 +08:00
|
|
|
|
2023-11-27 14:03:29 +08:00
|
|
|
static QString get_video_frame_data(int type, int channel, int frame_id);
|
2023-10-20 23:36:22 +08:00
|
|
|
|
2023-11-12 01:13:43 +08:00
|
|
|
/**
|
|
|
|
* @brief 获取报警检测时间
|
|
|
|
* @param type
|
|
|
|
* @param channel
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
static bool get_alarm_detection_timestamp(int type, int channel);
|
|
|
|
|
2023-10-20 23:36:22 +08:00
|
|
|
/**
|
|
|
|
* @brief 生成报警图片
|
|
|
|
* @param type 报警类型
|
|
|
|
* @param channel 视频通道
|
|
|
|
* @param frame_id 视频帧编号
|
2023-11-12 01:13:43 +08:00
|
|
|
* @return 返回 图片路径
|
2023-10-20 23:36:22 +08:00
|
|
|
*/
|
|
|
|
static QString build_alarm_image(int type, int channel, int frame_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief 生成报警视频
|
|
|
|
* @param type 报警类型
|
|
|
|
* @param channel 视频通道
|
|
|
|
* @param frame_id 视频帧编号
|
2023-11-12 01:13:43 +08:00
|
|
|
* @return 返回 视频路径
|
2023-10-20 23:36:22 +08:00
|
|
|
*/
|
|
|
|
static QString build_alarm_video(int type, int channel, int frame_id);
|
|
|
|
|
2023-11-12 01:13:43 +08:00
|
|
|
/**
|
|
|
|
* @brief enqueue_upload_file
|
|
|
|
* @param filename
|
|
|
|
*/
|
|
|
|
static void enqueue_upload_file(QString filename);
|
|
|
|
|
2023-10-20 23:36:22 +08:00
|
|
|
protected:
|
|
|
|
void run() override;
|
|
|
|
|
|
|
|
private:
|
2023-11-12 01:13:43 +08:00
|
|
|
void update_heartbeat(void);
|
2023-10-20 23:36:22 +08:00
|
|
|
void updata_vehiclue_status(QJsonObject object);
|
|
|
|
void parsing_vehiclue_status(void);
|
2023-11-12 01:13:43 +08:00
|
|
|
void recording_upload_task(void);
|
|
|
|
void upload_file_queue_check(void);
|
2023-10-20 23:36:22 +08:00
|
|
|
void debug_tool_response_event(int type, std::initializer_list<QPair<QString, QJsonValue>> args);
|
2023-11-12 01:13:43 +08:00
|
|
|
void get_warn_param_config(int type);
|
|
|
|
void set_warn_param_config(int type, QJsonObject object);
|
|
|
|
void get_adas_camera_calibration(int type);
|
|
|
|
void set_adas_camera_calibration(int type, QJsonObject object);
|
2023-10-20 23:36:22 +08:00
|
|
|
|
|
|
|
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 (客户端) */
|
2023-10-21 23:39:10 +08:00
|
|
|
HxSocketUtils* platform;
|
2023-10-20 23:36:22 +08:00
|
|
|
|
|
|
|
/* DebugTool Socket (服务端) */
|
2023-10-21 23:39:10 +08:00
|
|
|
HxSocketUtils* debug_tool;
|
2023-10-20 23:36:22 +08:00
|
|
|
|
|
|
|
/* 车辆状态信息 */
|
|
|
|
CarInfoInput car_info;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // HXTASKDISPATCH_H
|