From 7a55a655899e4b55a1a06bc2027361fe55c4ff3e Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sat, 1 Nov 2025 23:20:31 -0400 Subject: [PATCH] LivoxProto1: Rename pcloudDataSocketDesc=>pcloudDataFdDesc --- commonLibs/livoxProto1/udpCommandDemuxer.cpp | 8 ++++---- commonLibs/livoxProto1/udpCommandDemuxer.h | 4 ++-- stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp | 15 ++++++++++++--- stimBuffApis/livoxGen1/ioUringAssemblyEngine.h | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/commonLibs/livoxProto1/udpCommandDemuxer.cpp b/commonLibs/livoxProto1/udpCommandDemuxer.cpp index 3e8c6b9..9d720ad 100644 --- a/commonLibs/livoxProto1/udpCommandDemuxer.cpp +++ b/commonLibs/livoxProto1/udpCommandDemuxer.cpp @@ -78,10 +78,10 @@ void UdpCommandDemuxer::stop() cmdEndpointFdDesc.reset(); } - if (pcloudDataSocketDesc) + if (pcloudDataFdDesc) { - pcloudDataSocketDesc->cancel(); - pcloudDataSocketDesc.reset(); + pcloudDataFdDesc->cancel(); + pcloudDataFdDesc.reset(); } isActive.store(false); @@ -201,7 +201,7 @@ void UdpCommandDemuxer::setupPcloudDataSocket() } // Create boost wrapper for async operations - pcloudDataSocketDesc = std::make_shared( + pcloudDataFdDesc = std::make_shared( componentThread->getIoService(), socketGuard.getFd()); // Transfer ownership, prevent auto-close diff --git a/commonLibs/livoxProto1/udpCommandDemuxer.h b/commonLibs/livoxProto1/udpCommandDemuxer.h index 4564020..be8b988 100644 --- a/commonLibs/livoxProto1/udpCommandDemuxer.h +++ b/commonLibs/livoxProto1/udpCommandDemuxer.h @@ -58,12 +58,12 @@ public: std::shared_ptr getPcloudDataFdDesc() const { - return pcloudDataSocketDesc; + return pcloudDataFdDesc; } private: // Socket and async objects - std::shared_ptr pcloudDataSocketDesc; + std::shared_ptr pcloudDataFdDesc; // Socket and async objects std::shared_ptr cmdEndpointFdDesc; diff --git a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp index 071758e..f345ad8 100644 --- a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp +++ b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp @@ -11,6 +11,8 @@ namespace smo { namespace stim_buff { +inline LivoxProto1DllState& getLivoxProto1State() { return livoxProto1; } + struct DummyLivoxEthHeader { enum : uint32_t { @@ -47,8 +49,15 @@ bool IoUringAssemblyEngine::setup() { return false; } // Get point cloud data socket descriptor from UdpCommandDemuxer - int udpFd = (*livoxProto1.livoxProto1_getPcloudDataFdDesc)() - ->native_handle(); + auto& livoxState = getLivoxProto1State(); + if (!livoxState.livoxProto1_getPcloudDataFdDesc) + { return false; } + pcloudDataFdDesc = (*livoxState.livoxProto1_getPcloudDataFdDesc)(); + if (!pcloudDataFdDesc) + { return false; } + + // Get UDP socket file descriptor + int udpFd = pcloudDataFdDesc->native_handle(); if (udpFd < 0) { return false; } @@ -87,7 +96,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 pcloudDataSocketDesc->native_handle() + // - Socket FD from pcloudDataFdDesc->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 5294f2a..32ecb20 100644 --- a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h +++ b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.h @@ -47,7 +47,7 @@ private: bool isSetup; // Point cloud data socket descriptor - std::shared_ptr pcloudDataSocketDesc; + std::shared_ptr pcloudDataFdDesc; // Stall detection timer boost::asio::deadline_timer stallTimer;