Commit 2abbd02e authored by haoshuang's avatar haoshuang

debug

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