Commit 2abbd02e authored by haoshuang's avatar haoshuang

debug

parent d5379273
...@@ -3,15 +3,16 @@ ...@@ -3,15 +3,16 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <vector>
#pragma pack(1) #pragma pack(1)
typedef struct _UdpRadarObj typedef struct _UdpRadarObj
{ {
char device[20];
int32_t id; int32_t id;
uint64_t time; uint64_t time;
std::string strId; char type[20];
std::string type;
int32_t vehType; int32_t vehType;
double vehL; double vehL;
double vehW; double vehW;
...@@ -28,20 +29,9 @@ typedef struct _UdpRadarObj ...@@ -28,20 +29,9 @@ typedef struct _UdpRadarObj
double lat; double lat;
double alt; double alt;
int32_t objPos; int32_t objPos;
std::string cross_name; uint64_t pt[4];
std::string inner_pos;
} UdpRadarObj; } UdpRadarObj;
typedef struct _UdpRadarData
{
std::string device;
uint64_t tm;
std::string str_tm;
int32_t size;
UdpRadarObj objs[100];
uint64_t pt[];
} UdpRadarData;
#pragma pack() #pragma pack()
#endif // FUSION_UDP_OBJ_H #endif // FUSION_UDP_OBJ_H
\ No newline at end of file
...@@ -165,7 +165,7 @@ void FusionDistributeTask::udpSrv() ...@@ -165,7 +165,7 @@ void FusionDistributeTask::udpSrv()
{ {
int socketHandle; int socketHandle;
struct sockaddr_in server, client; struct sockaddr_in server, client;
UdpRadarData data; UdpRadarObj obj;
socketHandle = socket(AF_INET, SOCK_DGRAM, 0); socketHandle = socket(AF_INET, SOCK_DGRAM, 0);
if (-1 == socketHandle) { if (-1 == socketHandle) {
...@@ -186,8 +186,8 @@ void FusionDistributeTask::udpSrv() ...@@ -186,8 +186,8 @@ void FusionDistributeTask::udpSrv()
char buf[10240] = { 0 }; char buf[10240] = { 0 };
while (FConfPtr->mBAppExit == false) { while (FConfPtr->mBAppExit == false) {
int cliLen = sizeof(client); int cliLen = sizeof(client);
int ret = recvfrom(socketHandle, (void*)&data, (size_t)sizeof(data), 0, (struct sockaddr*)&client, (socklen_t*)&cliLen); int ret = recvfrom(socketHandle, (void*)&obj, (size_t)sizeof(obj), 0, (struct sockaddr*)&client, (socklen_t*)&cliLen);
if (ret != sizeof(data)) { if (ret != sizeof(obj)) {
continue; continue;
} }
...@@ -196,29 +196,25 @@ void FusionDistributeTask::udpSrv() ...@@ -196,29 +196,25 @@ void FusionDistributeTask::udpSrv()
continue; continue;
} }
UdpRadarData radar_data = {}; tObjPtr->mDevIDStr = obj.device;
memcpy((void*)&radar_data, data, (size_t)sizeof(data));
tObjPtr->mDevIDStr = radar_data.device;
tObjPtr->mModeStr = "r"; tObjPtr->mModeStr = "r";
for (const auto obj : radar_data.objs) { tObjPtr->mID = obj.id;
tObjPtr->mID = obj.id; tObjPtr->mMS = obj.time;
tObjPtr->mMS = obj.time; tObjPtr->mLon = obj.lon;
tObjPtr->mLon = obj.lon; tObjPtr->mLat = obj.lat;
tObjPtr->mLat = obj.lat; tObjPtr->mAlt = 0;
tObjPtr->mAlt = 0; tObjPtr->mHeading = obj.heading;
tObjPtr->mHeading = obj.heading; tObjPtr->mSpeed = obj.speed;
tObjPtr->mSpeed = obj.speed; tObjPtr->mLength = obj.vehL;
tObjPtr->mLength = obj.vehL; tObjPtr->mWidth = obj.vehW;
tObjPtr->mWidth = obj.vehW; tObjPtr->mHeight = obj.vehH;
tObjPtr->mHeight = obj.vehH; tObjPtr->mXPos = obj.xPos;
tObjPtr->mXPos = obj.xPos; tObjPtr->mYPos = obj.yPos;
tObjPtr->mYPos = obj.yPos; tObjPtr->mTypeStr = obj.type;
tObjPtr->mTypeStr = obj.type; tObjPtr->mSubType = 0;
tObjPtr->mSubType = 0; mBufTrafficObjListMutex.lock();
mBufTrafficObjListMutex.lock(); mBufTrafficObjList.push_back(tObjPtr);
mBufTrafficObjList.push_back(tObjPtr); mBufTrafficObjListMutex.unlock();
mBufTrafficObjListMutex.unlock();
}
close(socketHandle); close(socketHandle);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment