diff --git a/smocore/body/body.cpp b/smocore/body/body.cpp index 0c30b71..fd255d3 100644 --- a/smocore/body/body.cpp +++ b/smocore/body/body.cpp @@ -78,7 +78,7 @@ public: std::cout << __func__ << ": About to attachAllSenseDevicesFromSpecs" << '\n'; } - device::DeviceManager::getInstance().attachAllSenseDevicesFromSpecsReq( + device::DeviceManager::getInstance().attachAllUnattachedDevicesFromReq( {context, std::bind( &InitializeReq::initializeReq2, context.get(), context, @@ -117,7 +117,7 @@ public: } std::cout << "Mrntt: About to detach all sense devices." << "\n"; - device::DeviceManager::getInstance().detachAllSenseDevicesReq( + device::DeviceManager::getInstance().detachAllAttachedDeviceRoles( {context, std::bind( &FinalizeReq::finalizeReq2, context.get(), context, diff --git a/smocore/deviceManager/deviceManager.cpp b/smocore/deviceManager/deviceManager.cpp index 2df14fa..93b6d41 100644 --- a/smocore/deviceManager/deviceManager.cpp +++ b/smocore/deviceManager/deviceManager.cpp @@ -483,23 +483,23 @@ void DeviceManager::detachSenseDeviceReq( request.get(), request)); } -class DeviceManager::AttachAllSenseDevicesFromSpecsReq +class DeviceManager::AttachAllUnattachedDevicesFromReq : public PostedAsynchronousContinuation< - attachAllSenseDevicesFromSpecsReqCbFn> + attachAllUnattachedDevicesFromReqCbFn> { public: - AttachAllSenseDevicesFromSpecsReq( + AttachAllUnattachedDevicesFromReq( const unsigned int totalNSpecs, const std::shared_ptr& caller, - Callback cb) - : PostedAsynchronousContinuation( + Callback cb) + : PostedAsynchronousContinuation( caller, cb), loop(totalNSpecs) {} public: - void attachAllSenseDevicesFromSpecsReq1_posted( - [[maybe_unused]] std::shared_ptr + void attachAllUnattachedDevicesFromReq1_posted( + [[maybe_unused]] std::shared_ptr context ) { @@ -508,7 +508,7 @@ public: DeviceManager::getInstance().newDeviceAttachmentSpecInd( *spec, {context, std::bind( - &AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq2, + &AttachAllUnattachedDevicesFromReq::attachAllUnattachedDevicesFromReq2, context.get(), context, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)}); @@ -516,8 +516,8 @@ public: } // Callback methods for the attachment sequence - void attachAllSenseDevicesFromSpecsReq2( - std::shared_ptr context, + void attachAllUnattachedDevicesFromReq2( + std::shared_ptr context, bool success, std::shared_ptr deviceRole, std::shared_ptr spec ) @@ -549,8 +549,8 @@ public: AsynchronousLoop loop; }; -void DeviceManager::attachAllSenseDevicesFromSpecsReq( - Callback cb +void DeviceManager::attachAllUnattachedDevicesFromReq( + Callback cb ) { if (DeviceManager::getInstance().deviceAttachmentSpecs.size() == 0) @@ -561,24 +561,24 @@ void DeviceManager::attachAllSenseDevicesFromSpecsReq( } const auto& caller = ComponentThread::getSelf(); - auto request = std::make_shared( + auto request = std::make_shared( DeviceManager::getInstance().deviceAttachmentSpecs.size(), caller, std::move(cb)); mrntt::mrntt.thread->getIoService().post( std::bind( - &AttachAllSenseDevicesFromSpecsReq::attachAllSenseDevicesFromSpecsReq1_posted, + &AttachAllUnattachedDevicesFromReq::attachAllUnattachedDevicesFromReq1_posted, request.get(), request)); } -class DeviceManager::DetachAllSenseDevicesReq -: public AttachAllSenseDevicesFromSpecsReq +class DeviceManager::DetachAllAttachedDeviceRoles +: public AttachAllUnattachedDevicesFromReq { public: - using AttachAllSenseDevicesFromSpecsReq::AttachAllSenseDevicesFromSpecsReq; + using AttachAllUnattachedDevicesFromReq::AttachAllUnattachedDevicesFromReq; - void detachAllSenseDevicesReq1_posted( - [[maybe_unused]] std::shared_ptr context + void detachAllAttachedDeviceRoles1_posted( + [[maybe_unused]] std::shared_ptr context ) { for (const auto& spec : DeviceManager::deviceAttachmentSpecs) @@ -586,14 +586,14 @@ public: DeviceManager::getInstance().detachSenseDeviceReq( spec, {context, std::bind( - &DetachAllSenseDevicesReq::detachAllSenseDevicesReq2, + &DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles2, context.get(), context, std::placeholders::_1, std::placeholders::_2)}); } } - void detachAllSenseDevicesReq2( - std::shared_ptr context, + void detachAllAttachedDeviceRoles2( + std::shared_ptr context, bool success, std::shared_ptr spec ) { @@ -621,8 +621,8 @@ public: } }; -void DeviceManager::detachAllSenseDevicesReq( - Callback cb +void DeviceManager::detachAllAttachedDeviceRoles( + Callback cb ) { if (DeviceManager::getInstance().deviceAttachmentSpecs.size() == 0) @@ -633,13 +633,13 @@ void DeviceManager::detachAllSenseDevicesReq( } const auto& caller = ComponentThread::getSelf(); - auto request = std::make_shared( + auto request = std::make_shared( DeviceManager::getInstance().deviceAttachmentSpecs.size(), caller, std::move(cb)); mrntt::mrntt.thread->getIoService().post( std::bind( - &DetachAllSenseDevicesReq::detachAllSenseDevicesReq1_posted, + &DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles1_posted, request.get(), request)); } diff --git a/smocore/include/deviceManager/deviceManager.h b/smocore/include/deviceManager/deviceManager.h index ec3df66..6cc275e 100644 --- a/smocore/include/deviceManager/deviceManager.h +++ b/smocore/include/deviceManager/deviceManager.h @@ -66,14 +66,14 @@ public: Callback cb); typedef std::function - attachAllSenseDevicesFromSpecsReqCbFn; + attachAllUnattachedDevicesFromReqCbFn; typedef std::function - detachAllSenseDevicesReqCbFn; + detachAllAttachedDeviceRolesCbFn; - void attachAllSenseDevicesFromSpecsReq( - Callback cb); - void detachAllSenseDevicesReq( - Callback cb); + void attachAllUnattachedDevicesFromReq( + Callback cb); + void detachAllAttachedDeviceRoles( + Callback cb); private: DeviceManager() @@ -96,8 +96,8 @@ private: class RemoveDeviceAttachmentSpecReq; class AttachSenseDeviceReq; typedef AttachSenseDeviceReq DetachSenseDeviceReq; - class AttachAllSenseDevicesFromSpecsReq; - class DetachAllSenseDevicesReq; + class AttachAllUnattachedDevicesFromReq; + class DetachAllAttachedDeviceRoles; }; } // namespace device