Improve main thread.
This commit is contained in:
parent
dd1cfab956
commit
a9cc7abe6b
|
@ -33,6 +33,9 @@ std::shared_ptr<MainThread> &MainThread::GetInstance(std::shared_ptr<MainThread>
|
|||
}
|
||||
StatusCode MainThread::Init(void)
|
||||
{
|
||||
CreateLogModule();
|
||||
ILogInit(LOG_EASYLOGGING);
|
||||
CustomizationInit();
|
||||
mMainThreadRuning = true;
|
||||
CreateAllModules();
|
||||
IHalInit();
|
||||
|
@ -41,11 +44,12 @@ StatusCode MainThread::Init(void)
|
|||
StatusCode MainThread::UnInit(void)
|
||||
{
|
||||
DestoryAllModules();
|
||||
ILogUnInit();
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
StatusCode MainThread::CreateAllModules(void)
|
||||
{
|
||||
CreateLogModule();
|
||||
// CreateLogModule();
|
||||
CreateHalModule();
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ add_custom_target(
|
|||
)
|
||||
add_custom_command(
|
||||
TARGET ${IMPL_TARGET}
|
||||
TARGET ${ABSTRACT_TARGET}
|
||||
PRE_BUILD
|
||||
COMMAND make Hal_code_check
|
||||
COMMAND make Hal_code_format
|
||||
|
|
|
@ -20,11 +20,12 @@ StatusCode CreateHalModule(void)
|
|||
{
|
||||
IHal *hal = NULL;
|
||||
StatusCode code = HalMakePtr::GetInstance()->CreateHalPtr(&hal);
|
||||
if (IsCodeOK(code)) {
|
||||
if (IsCodeOK(code) && NULL != hal) {
|
||||
LogInfo("Create Hal instance ok.\n");
|
||||
ResetHalImpl((IHal *)hal);
|
||||
}
|
||||
else {
|
||||
LogError("Create Hal failed.\n");
|
||||
return CreateStatusCode(STATUS_CODE_NOT_OK);
|
||||
}
|
||||
auto instance = std::make_shared<IHalCpp>();
|
||||
|
@ -48,10 +49,14 @@ std::shared_ptr<HalMakePtr> &HalMakePtr::GetInstance(std::shared_ptr<HalMakePtr>
|
|||
}
|
||||
return instance;
|
||||
}
|
||||
StatusCode HalMakePtr::CreateHalPtr(IHal **hal) { return NewHal((Hal **)hal); }
|
||||
StatusCode HalMakePtr::CreateHalPtr(IHal **hal)
|
||||
{
|
||||
LogWarning("Hal is default hal.\n");
|
||||
return NewHal((Hal **)hal);
|
||||
}
|
||||
StatusCode HalMakePtr::CreateHalSharePtr(std::shared_ptr<IHalCpp> &impl)
|
||||
{
|
||||
LogInfo("HalMakePtr make ptr.\n");
|
||||
LogWarning("IHalCpp is default.\n");
|
||||
impl = std::make_shared<HalCpp>();
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
Loading…
Reference in New Issue
Block a user