diff --git a/commonLibs/livoxProto1/udpCommandDemuxer.h b/commonLibs/livoxProto1/udpCommandDemuxer.h index ab53119..4564020 100644 --- a/commonLibs/livoxProto1/udpCommandDemuxer.h +++ b/commonLibs/livoxProto1/udpCommandDemuxer.h @@ -61,6 +61,12 @@ public: return pcloudDataSocketDesc; } +private: + // Socket and async objects + std::shared_ptr pcloudDataSocketDesc; + // Socket and async objects + std::shared_ptr cmdEndpointFdDesc; + private: void setupSockets(); void setupCommandSocket(); @@ -74,11 +80,6 @@ private: uint16_t commandPort; uint16_t dataPort; - // Socket and async objects - std::shared_ptr pcloudDataSocketDesc; - // Socket and async objects - std::shared_ptr cmdEndpointFdDesc; - // State management std::atomic isActive{false}; std::atomic shouldStop{false}; diff --git a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp index 57d10ea..071758e 100644 --- a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp +++ b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "ioUringAssemblyEngine.h" #include "pcloudStimulusBuffer.h" #include "livoxGen1.h" @@ -45,7 +46,7 @@ bool IoUringAssemblyEngine::setup() if (!frameAssemblyDesc || frameAssemblyDesc->slots.empty()) { return false; } - // Get UDP socket file descriptor + // Get point cloud data socket descriptor from UdpCommandDemuxer int udpFd = (*livoxProto1.livoxProto1_getPcloudDataFdDesc)() ->native_handle(); if (udpFd < 0) @@ -86,7 +87,7 @@ void IoUringAssemblyEngine::resetAndAssembleFrame() // 1. Submit frameAssemblyDesc->numSlots RECVMSG SQEs using io_uring_prep_recvmsg() // - Each SQE receives into frameAssemblyDesc->slots[i].vaddr // - With size frameAssemblyDesc->slots[i].nBytes - // - Socket FD from parent.device->pcloudDataSocketDesc->native_handle() + // - Socket FD from pcloudDataSocketDesc->native_handle() // 2. Submit batch via io_uring_submit(&ring) // 3. Set up stall timer using stallTimer with appropriate timeout // - SQEs are independent and can arrive out of order diff --git a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h index 9a63eae..5294f2a 100644 --- a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h +++ b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h @@ -46,6 +46,9 @@ private: struct io_uring ring; bool isSetup; + // Point cloud data socket descriptor + std::shared_ptr pcloudDataSocketDesc; + // Stall detection timer boost::asio::deadline_timer stallTimer;