From 81842e45710c91622dc0b8d5f8269bf98e58b9a0 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Wed, 10 Sep 2025 18:09:06 -0400 Subject: [PATCH] SenseApiDesc: SAL_MLO: attach/detachDeviceReq: return parsed DA spec --- include/user/senseApiDesc.h | 6 ++++-- senseApis/livoxGen1/livoxGen1.cpp | 10 +++++----- senseApis/xcbWindow/xcbWindow.cpp | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/user/senseApiDesc.h b/include/user/senseApiDesc.h index aed913a..17bf1b2 100644 --- a/include/user/senseApiDesc.h +++ b/include/user/senseApiDesc.h @@ -34,8 +34,10 @@ struct SmoThreadingModelDesc std::shared_ptr componentThread; }; -typedef std::function sal_mlo_attachDeviceReqCbFn; -typedef std::function sal_mlo_detachDeviceReqCbFn; +typedef std::function)> + sal_mlo_attachDeviceReqCbFn; +typedef std::function)> + sal_mlo_detachDeviceReqCbFn; typedef int (sal_mlo_initializeIndFn)(void); typedef int (sal_mlo_finalizeIndFn)(void); diff --git a/senseApis/livoxGen1/livoxGen1.cpp b/senseApis/livoxGen1/livoxGen1.cpp index 5a7188c..7a566ad 100644 --- a/senseApis/livoxGen1/livoxGen1.cpp +++ b/senseApis/livoxGen1/livoxGen1.cpp @@ -260,7 +260,7 @@ extern "C" void livoxGen1_attachDeviceReq( { std::cerr << __func__ << ": Failed to create Livox device: " << desc->deviceSelector << std::endl; - cb(false); + cb(false, desc); return; } @@ -272,7 +272,7 @@ extern "C" void livoxGen1_attachDeviceReq( << desc->deviceIdentifier << ")\n"; } - cb(success); + cb(success, desc); } ); } @@ -319,7 +319,7 @@ extern "C" void livoxGen1_detachDeviceReq( { std::cerr << __func__ << ": Failed to destroy Livox device: " << desc->deviceIdentifier << "\n"; - cb(false); + cb(false, desc); return; } @@ -341,7 +341,7 @@ extern "C" void livoxGen1_detachDeviceReq( std::cerr << __func__ << ": Race condition: device not found " "in g_attachedDevices for detachment: " << desc->deviceIdentifier << "\n"; - cb(false); + cb(false, desc); return; } @@ -349,7 +349,7 @@ extern "C" void livoxGen1_detachDeviceReq( std::cout << __func__ << ": Successfully detached Livox device: " << desc->deviceIdentifier << "\n"; - cb(success); + cb(success, desc); } ); } diff --git a/senseApis/xcbWindow/xcbWindow.cpp b/senseApis/xcbWindow/xcbWindow.cpp index 70edde9..97c8112 100644 --- a/senseApis/xcbWindow/xcbWindow.cpp +++ b/senseApis/xcbWindow/xcbWindow.cpp @@ -285,7 +285,7 @@ static void xcbWindow_attachDeviceReq( << g_attachedWindows.back()->stringify() << "\n"; - cb(true); + cb(true, desc); } static void xcbWindow_detachDeviceReq( @@ -304,7 +304,7 @@ static void xcbWindow_detachDeviceReq( std::cerr << __func__ << ": Device not found for detachment:\n" << spec->stringify() << "\n"; - cb(false); + cb(false, spec); return; } @@ -312,7 +312,7 @@ static void xcbWindow_detachDeviceReq( std::cout << __func__ << ": Detached X11 window device:\n" << spec->stringify() << "\n"; - cb(true); + cb(true, spec); } // SenseApi descriptor