#ifndef GLOBALFUNC_H #define GLOBALFUNC_H #include #include "pcaprethread.h" struct Head { byte pre[2]{0x55, 0x55}; byte ver{1}; byte srv{0}; quint16_be len{0}; byte tgtAddr[4]{0xff, 0xff, 0xff, 0xff}; byte srcAddr[4]{0, 0, 0, 0}; byte ptr[4]{0, 0, 0, 0}; byte ans[2]{0, 0}; quint32_be chk{0}; byte bodyh[4]{0, 0, 0, 0}; quint16_be bodylen{0}; }; struct Msg1024 : Head { byte body[1024-sizeof(Head)]{0}; }; static int fi = 0; inline int ie(int size = 1) { fi = size; return 0; } inline int ipp(int size = 1) { auto rtn = fi; fi += size; return rtn; } enum enum_rcvCardType{ enum_xixun_sync = 0, enum_xixun_async = 1, enum_zrf = 2, enum_mxe, NoCard }; enum enum_IcType{ enum_normal = 0, enum_pwm = 1, enum_doubleLatch = 2, }; struct HeadMap { byte pre = ipp(2); byte ver = fi++; byte srv = fi++; byte len = ipp(2); byte tgtAddr = ipp(4); byte srcAddr = ipp(4); byte ptr = ipp(4); byte ans = ipp(2); byte chk = ipp(4); byte body = ipp(4); byte bodylen = ipp(2); byte end = fi; }; //added by alahover -s 20230822 struct HeadMap_ZRF { quint16 pre = ie(2);//0 quint16 tgtAddr = ipp(6);//2 quint16 srcAddr = ipp(6);//8 quint16 protcolFlag = ipp(2);//14 quint16 pkgType = fi++;//16 quint16 reserve = fi++;//17 quint16 rcvIndex = fi++;//18 quint16 netPort = fi++;//19 quint16 end = fi;//20 quint16 paramStart = fi;//20 }; //added by alahover -s 20230825 struct St_Zrf_rb_Param { quint16 rbParamType = ie(1); quint16 deviceNameLen = fi++; quint16 deviceName = ipp(11); quint16 deviceVerLen = fi++; quint16 deviceVer = ipp(8); quint16 posInfoLen = fi++; quint16 posInfo = ipp(8); quint16 statusInfoLen = fi++; quint16 statusInfo = ipp(16); quint16 param = ipp(256); quint16 end = fi; }; //added by alahover -s 20230825 struct St_Zrf_Cmd_Param{ quint16 reserve1 = ie(1);//0 quint16 paramType = fi++;//1 quint16 rcvCardPosH = fi++;//2 quint16 rcvCardPosL = fi++;//3 quint16 reserve2 = fi++;//4 quint16 cmd = ipp(4);//8 quint16 flashSentor = ipp(4);//12 quint16 flashPage = ipp(4);//16 quint16 reserve3 = ipp(4);//20 quint16 param = ipp(256);//21 quint16 reserve4 = ipp(4); quint16 end = fi; }; struct St_Zrf_Base_Param{ quint16 b0_RP = ie(1); //模组信号极性 quint16 b1_xiaoyingTime = ipp(1); //行消影时间 quint16 b2_line_xytime = ipp(1); //行消影时间 quint16 b3_rows1Group = ipp(1); // quint16 b4_cols1Group = fi++; quint16 b5_scanNum = fi++; quint16 b6_emptyPointNum = fi++; quint16 b7_colorIndex = fi++; quint16 b8_dataOutModle = fi++; quint16 b9_brightStatic = fi++; quint16 b10_brightRed = fi++; quint16 b11_brightGreen = fi++; quint16 b12_brightBlue = fi++; quint16 b13_icType = fi++; quint16 b14_icParma = fi++; quint16 b15_redIgain = fi++; quint16 b16_greenIgain = fi++; quint16 b17_blueIgain = fi++; quint16 b18_clkFreq = fi++; quint16 b19_clkDutyCycle = fi++; quint16 b20_pwmIcGrayClk = fi++; quint16 b21_grayLevelMultFreq = fi++; quint16 b22_MultFreqMode = fi++; quint16 b23_reserve = fi++; quint16 b24_freshRate = ipp(2); quint16 b26_syncGraphicsCard = fi++; quint16 b27_Ldq = ipp(2); quint16 b29_reserve = fi++; quint16 b30_pwmMultFreq = fi++; quint16 b31_rcvCardCols = ipp(2); quint16 b33_emptyRowMode = fi++; quint16 b34_emptyRowPos = fi++; quint16 b35_xiaoYingEndTime = fi++; quint16 b36_RowIcParam = fi++; quint16 b37_reserve = fi++; quint16 b38_hub1to32Area = ipp(32); quint16 b70_reserve = fi++; quint16 b71_imgArea1to32Param = ipp(96); quint16 b167_syncPreTime = fi++; quint16 b168_reserve = fi++; quint16 b169_redIcParam1 = ipp(2); quint16 b171_redIcParam2 = ipp(2); quint16 b173_redIcParam3 = ipp(2); quint16 b175_greenIcParam1 = ipp(2); quint16 b177_greenIcParam2 = ipp(2); quint16 b179_greenIcParam3 = ipp(2); quint16 b181_blueIcParam1 = ipp(2); quint16 b183_blueIcParam2 = ipp(2); quint16 b185_blueIcParam3 = ipp(2); quint16 b187_redIcParam4 = ipp(2); quint16 b189_greenIcParam4 = ipp(2); quint16 b191_blueIcParam4 = ipp(2); quint16 end = fi; }; struct St_MiaoDian_Param{ quint16 scanIndex = ie(64); //模组信号极性 quint16 PixelPos = ipp(448); //行消影时间 quint16 end = fi; //行消影时间 }; extern HeadMap headMap; extern HeadMap_ZRF headMap_zrf; extern St_Zrf_rb_Param st_zrf_rb_param;//added by alahover 20230825 extern St_Zrf_Base_Param st_zrf_base_param; extern St_Zrf_Cmd_Param st_zrf_cmd_param; extern St_MiaoDian_Param st_miaodian_param; extern byte *sepas; extern pcap *pcapSend; class PcapReThread; extern PcapReThread *reThd; extern QString gFileHome; extern void GammaGen(unsigned short pGammaDataBuffer[],float fGamma,unsigned int uiGray);//added by alahover 20230829 extern int GetIcTypeFromName(QString strName); QByteArray getNetDev(QWidget *parent, QByteArray, bool); inline int sendMsg(const byte *msg, int size, int id, qint64 timeout, std::function callback, WaitingDlg *waitingDlg = 0) { return reThd->sendMsgNet(msg, size, id, timeout, callback, false, waitingDlg); } inline int sendMsg(QByteArray &msg, int id, qint64 timeout, std::function callback, WaitingDlg *waitingDlg = 0) { return sendMsg((byte*)msg.data(), msg.size(), id, timeout, callback, waitingDlg); } struct SyncResp { int code = 0; QByteArray msg; }; SyncResp sendMsgSync(QByteArray &msg, int id, qint64 timeout, WaitingDlg *waitingDlg = 0); #endif // GLOBALFUNC_H