SenseApis: Make attachDeviceReq async in drivers and SenseApiMgr
Slowly retrogressively making these sequences async
This commit is contained in:
@@ -273,8 +273,9 @@ static int xcbWindow_finalizeInd(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xcbWindow_attachDeviceReq(
|
||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc
|
||||
static void xcbWindow_attachDeviceReq(
|
||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
|
||||
smo::sense_api::sal_mlo_attachDeviceReqCbFn cb
|
||||
)
|
||||
{
|
||||
g_attachedWindows.emplace_back(
|
||||
@@ -283,11 +284,13 @@ static int xcbWindow_attachDeviceReq(
|
||||
std::cout << __func__ << ": Attached X11 window:\n "
|
||||
<< g_attachedWindows.back()->stringify()
|
||||
<< "\n";
|
||||
return 0;
|
||||
|
||||
cb(true);
|
||||
}
|
||||
|
||||
static int xcbWindow_detachDeviceReq(
|
||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec
|
||||
static void xcbWindow_detachDeviceReq(
|
||||
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec,
|
||||
smo::sense_api::sal_mlo_detachDeviceReqCbFn cb
|
||||
)
|
||||
{
|
||||
auto it = std::find_if(g_attachedWindows.begin(), g_attachedWindows.end(),
|
||||
@@ -298,15 +301,18 @@ static int xcbWindow_detachDeviceReq(
|
||||
|
||||
if (it == g_attachedWindows.end())
|
||||
{
|
||||
std::cerr << __func__ << ": Device not found for detachment:\n"
|
||||
<< spec->stringify() << "\n";
|
||||
return -1;
|
||||
std::cerr << __func__ << ": Device not found for detachment:\n"
|
||||
<< spec->stringify() << "\n";
|
||||
|
||||
cb(false);
|
||||
return;
|
||||
}
|
||||
|
||||
g_attachedWindows.erase(it);
|
||||
std::cout << __func__ << ": Detached X11 window device:\n"
|
||||
<< spec->stringify() << "\n";
|
||||
return 0;
|
||||
|
||||
cb(true);
|
||||
}
|
||||
|
||||
// SenseApi descriptor
|
||||
|
||||
Reference in New Issue
Block a user