Mrntt: Call initializeDeviceReattacher in init
It works surprisingly well on the first try.
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include <callback.h>
|
#include <callback.h>
|
||||||
#include <componentThread.h>
|
#include <componentThread.h>
|
||||||
#include <deviceManager/deviceManager.h>
|
#include <deviceManager/deviceManager.h>
|
||||||
|
#include <deviceManager/deviceReattacher.h>
|
||||||
#include <senseApis/senseApiManager.h>
|
#include <senseApis/senseApiManager.h>
|
||||||
#include <marionette/marionette.h>
|
#include <marionette/marionette.h>
|
||||||
#include <mind.h>
|
#include <mind.h>
|
||||||
@@ -26,6 +27,10 @@ std::vector<std::shared_ptr<DeviceRole>>
|
|||||||
std::vector<DeviceAttachmentSpec>
|
std::vector<DeviceAttachmentSpec>
|
||||||
DeviceManager::commandLineDASpecs;
|
DeviceManager::commandLineDASpecs;
|
||||||
|
|
||||||
|
DeviceManager::~DeviceManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const std::string DeviceManager::stringifyDeviceSpecs(void)
|
const std::string DeviceManager::stringifyDeviceSpecs(void)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@@ -700,5 +705,20 @@ void DeviceManager::detachAllAttachedDeviceRoles(
|
|||||||
request.get(), request));
|
request.get(), request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceManager::initializeDeviceReattacher()
|
||||||
|
{
|
||||||
|
deviceReattacher = std::make_unique<DeviceReattacher>(
|
||||||
|
*this, mrntt::mrntt.thread);
|
||||||
|
|
||||||
|
deviceReattacher->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::finalizeDeviceReattacher()
|
||||||
|
{
|
||||||
|
if (deviceReattacher) {
|
||||||
|
deviceReattacher->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace device
|
} // namespace device
|
||||||
} // namespace smo
|
} // namespace smo
|
||||||
|
|||||||
@@ -13,12 +13,15 @@
|
|||||||
#include <asynchronousLoop.h>
|
#include <asynchronousLoop.h>
|
||||||
#include <deviceManager/device.h>
|
#include <deviceManager/device.h>
|
||||||
#include <deviceManager/deviceRole.h>
|
#include <deviceManager/deviceRole.h>
|
||||||
|
#include <deviceManager/deviceReattacher.h>
|
||||||
#include <callback.h>
|
#include <callback.h>
|
||||||
#include <qutex.h>
|
#include <qutex.h>
|
||||||
|
|
||||||
namespace smo {
|
namespace smo {
|
||||||
namespace device {
|
namespace device {
|
||||||
|
|
||||||
|
class DeviceReattacher;
|
||||||
|
|
||||||
class DeviceManager
|
class DeviceManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -33,6 +36,9 @@ public:
|
|||||||
void finalize(void)
|
void finalize(void)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
void initializeDeviceReattacher();
|
||||||
|
void finalizeDeviceReattacher();
|
||||||
|
|
||||||
std::string readDapSpecFile(const std::string& filename);
|
std::string readDapSpecFile(const std::string& filename);
|
||||||
void collateAllDapSpecs(void);
|
void collateAllDapSpecs(void);
|
||||||
void parseAllDapSpecs(void);
|
void parseAllDapSpecs(void);
|
||||||
@@ -82,9 +88,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceManager()
|
DeviceManager()
|
||||||
: qutex("DeviceManager")
|
: qutex("DeviceManager"), deviceReattacher(nullptr)
|
||||||
{}
|
{}
|
||||||
~DeviceManager() = default;
|
~DeviceManager();
|
||||||
DeviceManager(const DeviceManager&) = delete;
|
DeviceManager(const DeviceManager&) = delete;
|
||||||
DeviceManager& operator=(const DeviceManager&) = delete;
|
DeviceManager& operator=(const DeviceManager&) = delete;
|
||||||
|
|
||||||
@@ -98,6 +104,8 @@ public:
|
|||||||
static std::vector<DeviceAttachmentSpec> commandLineDASpecs;
|
static std::vector<DeviceAttachmentSpec> commandLineDASpecs;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::unique_ptr<DeviceReattacher> deviceReattacher;
|
||||||
|
|
||||||
class NewDeviceAttachmentSpecInd;
|
class NewDeviceAttachmentSpecInd;
|
||||||
class RemoveDeviceAttachmentSpecReq;
|
class RemoveDeviceAttachmentSpecReq;
|
||||||
class AttachSenseDeviceReq;
|
class AttachSenseDeviceReq;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <callback.h>
|
#include <callback.h>
|
||||||
#include <component.h>
|
#include <component.h>
|
||||||
#include <componentThread.h>
|
#include <componentThread.h>
|
||||||
|
#include <deviceManager/deviceManager.h>
|
||||||
#include <mindManager/mindManager.h>
|
#include <mindManager/mindManager.h>
|
||||||
#include <marionette/marionette.h>
|
#include <marionette/marionette.h>
|
||||||
|
|
||||||
@@ -56,6 +57,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device::DeviceManager::getInstance().initializeDeviceReattacher();
|
||||||
context->callOriginalCb(success);
|
context->callOriginalCb(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +72,8 @@ public:
|
|||||||
+ ": Must be executed on Marionette thread");
|
+ ": Must be executed on Marionette thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device::DeviceManager::getInstance().finalizeDeviceReattacher();
|
||||||
|
|
||||||
smo::mind::globalMind->finalizeReq({context, std::bind(
|
smo::mind::globalMind->finalizeReq({context, std::bind(
|
||||||
&MrnttLifetimeMgmtOp::finalizeReq2,
|
&MrnttLifetimeMgmtOp::finalizeReq2,
|
||||||
this, context, std::placeholders::_1)});
|
this, context, std::placeholders::_1)});
|
||||||
|
|||||||
Reference in New Issue
Block a user