112 lines
3.2 KiB
C
112 lines
3.2 KiB
C
![]() |
#ifndef MSG1_H
|
|||
|
#define MSG1_H
|
|||
|
|
|||
|
#include <string>
|
|||
|
#include <opencv2/opencv.hpp>
|
|||
|
#include "LibapiMsg.h"
|
|||
|
|
|||
|
#define PARAM_POS_SRC_IMAGE 0
|
|||
|
#define PARAM_POS_ROI_IMAGE 1
|
|||
|
#define PARAM_POS_ENHANCE_IMAGE 2
|
|||
|
#define PARAM_POS_LIDAR_DATA 4
|
|||
|
#define PARAM_POS_LIDAR_2D3D 5
|
|||
|
#define PARAM_POS_CMeasureInfo 6
|
|||
|
#define PARAM_POS_MOTION_DETECTION_DATA 33
|
|||
|
|
|||
|
// 客户端到主任务的消息定义
|
|||
|
#define CLIENT_MSG_NONE 0
|
|||
|
#define CLIENT_MSG_CONTINUE 1
|
|||
|
#define CLIENT_MSG_RESTART_DETECTION 2
|
|||
|
#define CLIENT_MSG_STOP_DETECTION 3
|
|||
|
|
|||
|
// 发送到客户端得消息定义
|
|||
|
#define TO_CLIENT_NOTIFY_BASE 1000
|
|||
|
#define TO_CLIENT_NOTIFY_CAMERA_CAP_START 1 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_CAMERA_CAP_END 2 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_LIDAR_CAP_START 3 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_LIDAR_CAP_END 4 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_DETECTION_START 5 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_DETECTION_END 6 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_CONNER2D_START 7 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_CONNER2D_END 8 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_CONNER3D_START 9 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_CONNER3D_END 10 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_MEASURE_START 11 + TO_CLIENT_NOTIFY_BASE
|
|||
|
#define TO_CLIENT_NOTIFY_MEASURE_END 12 + TO_CLIENT_NOTIFY_BASE
|
|||
|
|
|||
|
#define DoCallback(ret) \
|
|||
|
MsgBase::Callback(ret, MsgBase::GetCodeInfo(ret));\
|
|||
|
|
|||
|
#define DoCallbackWithData(ret) \
|
|||
|
MsgBase::CallbackWithData(ret, MsgBase::GetCodeInfo(ret));\
|
|||
|
|
|||
|
typedef void (*FuncCallback)(void* returnMeasureInfo);
|
|||
|
struct MsgBase : public LibapiMsg
|
|||
|
{
|
|||
|
public:
|
|||
|
// for test
|
|||
|
static MsgBase* msg_ptr1;
|
|||
|
public:
|
|||
|
static bool bAllRoisConnersCheckIsEnd; // 所有的ROI边缘检测,角点检测结束
|
|||
|
static bool bCloudProjectIsOk; // 3D投影结束
|
|||
|
static int iCameraToLidarMsg; // 2D第一阶段处理结束0:无回复 1:继续执行 2:重新检测 3:停止检测
|
|||
|
static int iClinetMsg; // 客户端确认:0:无回复 1:继续执行 2:重新检测 3:停止检测
|
|||
|
private:
|
|||
|
static FuncCallback pCallback;
|
|||
|
public:
|
|||
|
std::string mLog;
|
|||
|
int mRoiCounts;
|
|||
|
int mRoiIndex;
|
|||
|
std::string mMsgType;
|
|||
|
|
|||
|
public:
|
|||
|
// for test
|
|||
|
static void SetMsgPtr1(MsgBase* msg);
|
|||
|
static MsgBase* GetMsgPtr1();
|
|||
|
public:
|
|||
|
static void SetCallBack(FuncCallback f);
|
|||
|
static void Callback(void* data);
|
|||
|
static void Callback(int code, std::string errorInfo);
|
|||
|
static void CallbackWithData(int code, std::string errorInfo);
|
|||
|
static void WaitBool(bool& b);
|
|||
|
static void SetWaitBool(bool& b);
|
|||
|
static int WaitInt(int& val);
|
|||
|
static void SetWaitInt(int& it, int val);
|
|||
|
static std::string GetCodeInfo(int code);
|
|||
|
};
|
|||
|
|
|||
|
// 给回调函数使用
|
|||
|
typedef struct tagSubRoi
|
|||
|
{
|
|||
|
public:
|
|||
|
long mPparentId;
|
|||
|
long mId;
|
|||
|
char mInfo[256];
|
|||
|
bool isGood;
|
|||
|
float vpOffset[2];
|
|||
|
float mRoiPoints[4 * 2];
|
|||
|
float mInnerConners[4 * 2];
|
|||
|
float mInnerConners3D[4 * 3];
|
|||
|
float edges[4];
|
|||
|
float center[2];
|
|||
|
int cloud_size;
|
|||
|
float* mVc2D;
|
|||
|
float* mVc3D;
|
|||
|
float H[9];
|
|||
|
}SubRoiData;
|
|||
|
|
|||
|
typedef struct tagCallbakInfo
|
|||
|
{
|
|||
|
public:
|
|||
|
int code; // 0:返回数据;1-99999 返回消息
|
|||
|
char errorInfo[256];
|
|||
|
bool bGetData;
|
|||
|
long mId;
|
|||
|
char mInfo[256];
|
|||
|
char mImPath[256];
|
|||
|
char mIm2D3DPtr[256];
|
|||
|
int roi_size;
|
|||
|
SubRoiData subRois[16];
|
|||
|
}CallbackInfo;
|
|||
|
|
|||
|
#endif
|