mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
!845 Feature:自建链路StateMachine实现
Merge pull request !845 from zhx/master
This commit is contained in:
commit
6ee56b85b1
@ -438,6 +438,26 @@ enum {
|
||||
* Result(29360224) for the mission for continuing is not alive, try again after restart mission.
|
||||
*/
|
||||
MISSION_FOR_CONTINUING_IS_NOT_ALIVE = 29360224,
|
||||
/**
|
||||
* Result(29360225) for sending event failed during continuation.
|
||||
*/
|
||||
CONTINUE_SEND_EVENT_FAILED = 29360225,
|
||||
/**
|
||||
* Result(29360226) for state machine receving invalid state code.
|
||||
*/
|
||||
CONTINUE_STATE_MACHINE_INVALID_STATE = 29360226,
|
||||
/**
|
||||
* Result(29360227) for session shutdown during continuation.
|
||||
*/
|
||||
CONTINUE_SESSION_SHUTDOWN = 29360227,
|
||||
/**
|
||||
* Result(29360228) for calling ContinueAbility failed during continuation.
|
||||
*/
|
||||
CONTINUE_CALL_CONTINUE_ABILITY_FAILED = 29360228,
|
||||
/**
|
||||
* Result(29360229) for calling StartAbility failed during continuation.
|
||||
*/
|
||||
CONTINUE_CALL_START_ABILITY_FAILED = 29360229,
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "dsched_data_buffer.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dsched_continue_event_handler.h"
|
||||
#include "dsched_continue_state_machine.h"
|
||||
#include "event_handler.h"
|
||||
@ -62,6 +64,12 @@ typedef enum {
|
||||
CONTINUE_SINK = 1
|
||||
} DSchedContinueDirection;
|
||||
|
||||
struct ContinueAbilityData {
|
||||
OHOS::AAFwk::Want want;
|
||||
int32_t callerUid;
|
||||
uint32_t accessToken;
|
||||
};
|
||||
|
||||
class DSchedContinue : public std::enable_shared_from_this<DSchedContinue> {
|
||||
public:
|
||||
explicit DSchedContinue(int32_t direction, DSchedContinueInfo &continueInfo);
|
||||
@ -78,13 +86,14 @@ public:
|
||||
int32_t PostNotifyCompleteTask();
|
||||
int32_t PostContinueEndTask();
|
||||
|
||||
int32_t ExecuteContinueReq();
|
||||
int32_t ExecuteContinueAbility();
|
||||
int32_t ExecuteContinueCommReply();
|
||||
int32_t ExecuteContinueSend();
|
||||
int32_t ExecuteContinueData();
|
||||
int32_t ExecuteNotifyComplete();
|
||||
int32_t ExecuteContinueEnd();
|
||||
int32_t ExecuteContinueReq(std::shared_ptr<DistributedWantParams> wantParams);
|
||||
int32_t ExecuteContinueAbility(int32_t appVersion);
|
||||
int32_t ExecuteContinueReply();
|
||||
int32_t ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data);
|
||||
int32_t ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd);
|
||||
int32_t ExecuteNotifyComplete(int32_t result);
|
||||
int32_t ExecuteContinueEnd(int32_t result);
|
||||
int32_t ExecuteContinueError(int32_t result);
|
||||
|
||||
void OnDataRecv(std::shared_ptr<DSchedDataBuffer> data);
|
||||
void OnShutDown();
|
||||
|
@ -26,6 +26,7 @@
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
typedef enum {
|
||||
DSCHED_CONTINUE_INVALID_EVENT = -1,
|
||||
DSCHED_CONTINUE_REQ_PULL_EVENT = 0,
|
||||
DSCHED_CONTINUE_REPLY_EVENT = 1,
|
||||
DSCHED_CONTINUE_DATA_EVENT = 2,
|
||||
@ -34,7 +35,8 @@ typedef enum {
|
||||
DSHCED_CONTINUE_ABILITY_EVENT = 4,
|
||||
DSHCED_CONTINUE_SEND_DATA_EVENT = 5,
|
||||
|
||||
DSCHED_CONTINUE_END_EVENT = 6
|
||||
DSCHED_CONTINUE_COMPLETE_EVENT = 6,
|
||||
DSCHED_CONTINUE_END_EVENT = 7
|
||||
} DSchedContinueEventType;
|
||||
|
||||
class DSchedContinueCmdBase {
|
||||
|
@ -16,7 +16,11 @@
|
||||
#ifndef OHOS_DSCHED_CONTINUE_STATE_H
|
||||
#define OHOS_DSCHED_CONTINUE_STATE_H
|
||||
|
||||
#include "ability_manager_client.h"
|
||||
#include "event_handler.h"
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributedWant/distributed_want_params_wrapper.h"
|
||||
#include "distributed_sched_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -45,4 +49,4 @@ public:
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_STATE_H
|
||||
|
@ -30,9 +30,10 @@ public:
|
||||
DSchedContinueStateType GetStateType();
|
||||
|
||||
private:
|
||||
std::shared_ptr<DSchedContinueState> CreateState(DSchedContinueStateType stateType);
|
||||
std::shared_ptr<DSchedContinueState> currentState_;
|
||||
std::weak_ptr<DSchedContinue> dContinue_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_STATE_MACHINE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_STATE_MACHINE_H
|
||||
|
@ -39,10 +39,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueDataState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_DATA_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_DATA_STATE_H
|
||||
|
@ -37,10 +37,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueSinkEndState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_END_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_END_STATE_H
|
||||
|
@ -33,16 +33,18 @@ public:
|
||||
private:
|
||||
int32_t DoContinuePullReqTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
int32_t DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
int32_t DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueSinkStartState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_START_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_START_STATE_H
|
||||
|
@ -39,10 +39,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueSinkWaitEndState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_WAIT_END_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SINK_WAIT_END_STATE_H
|
||||
|
@ -39,10 +39,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueAbilityState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_ABILITY_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_ABILITY_STATE_H
|
||||
|
@ -37,10 +37,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueEndState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_END_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_END_STATE_H
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
DSchedContinueStateType GetStateType() override;
|
||||
|
||||
private:
|
||||
int32_t DoContinueAbiityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
int32_t DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
int32_t DoContinuePushReqTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
@ -41,10 +41,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueSourceStartState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_START_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_START_STATE_H
|
||||
|
@ -39,10 +39,10 @@ private:
|
||||
private:
|
||||
using DSchedStateFunc = int32_t (DSchedContinueWaitEndState::*)(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event);
|
||||
|
||||
|
||||
std::weak_ptr<DSchedContinueStateMachine> stateMachine_;
|
||||
std::map<uint32_t, DSchedStateFunc> memberFuncMap_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_WAIT_END_STATE_H
|
||||
#endif // OHOS_DSCHED_CONTINUE_SOURCE_WAIT_END_STATE_H
|
||||
|
@ -124,37 +124,42 @@ void DSchedContinue::ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueReq()
|
||||
int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams> wantParams)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueAbility()
|
||||
int32_t DSchedContinue::ExecuteContinueAbility(int32_t appVersion)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueCommReply()
|
||||
int32_t DSchedContinue::ExecuteContinueReply()
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueSend()
|
||||
int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueData()
|
||||
int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteNotifyComplete()
|
||||
int32_t DSchedContinue::ExecuteNotifyComplete(int32_t result)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueEnd()
|
||||
int32_t DSchedContinue::ExecuteContinueEnd(int32_t result)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueError(int32_t result)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -15,10 +15,22 @@
|
||||
|
||||
#include "dsched_continue_state_machine.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "sink_state/dsched_continue_data_state.h"
|
||||
#include "sink_state/dsched_continue_sink_end_state.h"
|
||||
#include "sink_state/dsched_continue_sink_start_state.h"
|
||||
#include "sink_state/dsched_continue_sink_wait_end_state.h"
|
||||
#include "source_state/dsched_continue_ability_state.h"
|
||||
#include "source_state/dsched_continue_source_end_state.h"
|
||||
#include "source_state/dsched_continue_source_start_state.h"
|
||||
#include "source_state/dsched_continue_source_wait_end_state.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueStateMachine";
|
||||
}
|
||||
DSchedContinueStateMachine::DSchedContinueStateMachine(std::shared_ptr<DSchedContinue> dContinue)
|
||||
: dContinue_(dContinue)
|
||||
{
|
||||
@ -30,11 +42,72 @@ DSchedContinueStateMachine::~DSchedContinueStateMachine()
|
||||
|
||||
int32_t DSchedContinueStateMachine::Execute(const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
std::shared_ptr<DSchedContinue> dContinue = dContinue_.lock();
|
||||
if (dContinue == nullptr || currentState_ == nullptr) {
|
||||
HILOGE("DSchedContinueStateMachine excute failed, continue or currentState is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
int32_t ret = currentState_->Execute(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueStateMachine currentState: %d excute event %d failed, ret %d",
|
||||
currentState_->GetStateType(), event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DSchedContinueStateMachine::UpdateState(DSchedContinueStateType stateType)
|
||||
{
|
||||
if (stateType != DSCHED_CONTINUE_SOURCE_START_STATE && stateType != DSCHED_CONTINUE_SINK_START_STATE) {
|
||||
HILOGI("DSchedContinueStateMachine update state from %d to %d", currentState_->GetStateType(), stateType);
|
||||
} else {
|
||||
HILOGI("DSchedContinueStateMachine update state %d", stateType);
|
||||
}
|
||||
currentState_ = CreateState(stateType);
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<DSchedContinueState> DSchedContinueStateMachine::CreateState(DSchedContinueStateType stateType)
|
||||
{
|
||||
std::shared_ptr<DSchedContinueState> state = nullptr;
|
||||
auto stateMachine = std::shared_ptr<DSchedContinueStateMachine>(shared_from_this());
|
||||
switch (stateType) {
|
||||
case DSCHED_CONTINUE_SOURCE_START_STATE: {
|
||||
state = std::make_shared<DSchedContinueSourceStartState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_ABILITY_STATE: {
|
||||
state = std::make_shared<DSchedContinueAbilityState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_SOURCE_WAIT_END_STATE: {
|
||||
state = std::make_shared<DSchedContinueWaitEndState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_SOURCE_END_STATE: {
|
||||
state = std::make_shared<DSchedContinueEndState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_SINK_START_STATE: {
|
||||
state = std::make_shared<DSchedContinueSinkStartState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_DATA_STATE: {
|
||||
state = std::make_shared<DSchedContinueDataState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_SINK_WAIT_END_STATE: {
|
||||
state = std::make_shared<DSchedContinueSinkWaitEndState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
case DSCHED_CONTINUE_SINK_END_STATE: {
|
||||
state = std::make_shared<DSchedContinueSinkEndState>(stateMachine);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
HILOGE("DSchedContinueStateMachine create state failed, stateType: %d", stateType);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueStateMachine::GetStateType()
|
||||
@ -45,4 +118,4 @@ DSchedContinueStateType DSchedContinueStateMachine::GetStateType()
|
||||
return currentState_->GetStateType();
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,20 @@
|
||||
|
||||
#include "dsched_continue_data_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueDataState";
|
||||
}
|
||||
DSchedContinueDataState::DSchedContinueDataState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_DATA_EVENT] = &DSchedContinueDataState::DoContinueDataTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueDataState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueDataState::~DSchedContinueDataState()
|
||||
@ -29,7 +38,18 @@ DSchedContinueDataState::~DSchedContinueDataState()
|
||||
int32_t DSchedContinueDataState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueDataState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueDataState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueDataState::GetStateType()
|
||||
@ -40,13 +60,33 @@ DSchedContinueStateType DSchedContinueDataState::GetStateType()
|
||||
int32_t DSchedContinueDataState::DoContinueDataTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueDataState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<DSchedContinueDataCmd>();
|
||||
int32_t ret = dContinue->ExecuteContinueData(syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueAbilityState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueDataState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueDataState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueDataState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,19 @@
|
||||
|
||||
#include "dsched_continue_sink_end_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueSinkEndState";
|
||||
}
|
||||
DSchedContinueSinkEndState::DSchedContinueSinkEndState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueSinkEndState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueSinkEndState::~DSchedContinueSinkEndState()
|
||||
@ -29,7 +37,18 @@ DSchedContinueSinkEndState::~DSchedContinueSinkEndState()
|
||||
int32_t DSchedContinueSinkEndState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueSinkEndState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueSinkEndState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueSinkEndState::GetStateType()
|
||||
@ -40,7 +59,17 @@ DSchedContinueStateType DSchedContinueSinkEndState::GetStateType()
|
||||
int32_t DSchedContinueSinkEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueEnd(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSinkEndState ExecuteContinueEnd failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,21 @@
|
||||
|
||||
#include "dsched_continue_sink_start_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueSinkStartState";
|
||||
}
|
||||
DSchedContinueSinkStartState::DSchedContinueSinkStartState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_REQ_PULL_EVENT] = &DSchedContinueSinkStartState::DoContinuePullReqTask;
|
||||
memberFuncMap_[DSHCED_CONTINUE_ABILITY_EVENT] = &DSchedContinueSinkStartState::DoContinueAbilityTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueSinkStartState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueSinkStartState::~DSchedContinueSinkStartState()
|
||||
@ -29,7 +39,18 @@ DSchedContinueSinkStartState::~DSchedContinueSinkStartState()
|
||||
int32_t DSchedContinueSinkStartState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueSinkStartState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueSinkStartState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueSinkStartState::GetStateType()
|
||||
@ -40,13 +61,44 @@ DSchedContinueStateType DSchedContinueSinkStartState::GetStateType()
|
||||
int32_t DSchedContinueSinkStartState::DoContinuePullReqTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<DistributedWantParams>();
|
||||
int32_t ret = dContinue->ExecuteContinueReq(syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSinkStartState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSinkStartState::DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
return dContinue->ExecuteContinueReply();
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSinkStartState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSinkStartState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,20 @@
|
||||
|
||||
#include "dsched_continue_sink_wait_end_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueSinkWaitEndState";
|
||||
}
|
||||
DSchedContinueSinkWaitEndState::DSchedContinueSinkWaitEndState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_COMPLETE_EVENT] = &DSchedContinueSinkWaitEndState::DoNotifyCompleteTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueSinkWaitEndState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueSinkWaitEndState::~DSchedContinueSinkWaitEndState()
|
||||
@ -29,7 +38,18 @@ DSchedContinueSinkWaitEndState::~DSchedContinueSinkWaitEndState()
|
||||
int32_t DSchedContinueSinkWaitEndState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueSinkWaitEndState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueSinkWaitEndState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueSinkWaitEndState::GetStateType()
|
||||
@ -40,13 +60,33 @@ DSchedContinueStateType DSchedContinueSinkWaitEndState::GetStateType()
|
||||
int32_t DSchedContinueSinkWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkWaitEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteNotifyComplete(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSinkWaitEndState sync continue data failed, datat is null");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSinkWaitEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSinkWaitEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSinkWaitEndState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,20 @@
|
||||
|
||||
#include "dsched_continue_ability_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueAbilityState";
|
||||
}
|
||||
DSchedContinueAbilityState::DSchedContinueAbilityState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSHCED_CONTINUE_SEND_DATA_EVENT] = &DSchedContinueAbilityState::DoContinueSendTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueAbilityState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueAbilityState::~DSchedContinueAbilityState()
|
||||
@ -29,7 +38,18 @@ DSchedContinueAbilityState::~DSchedContinueAbilityState()
|
||||
int32_t DSchedContinueAbilityState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueAbilityState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueAbilityState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueAbilityState::GetStateType()
|
||||
@ -40,13 +60,33 @@ DSchedContinueStateType DSchedContinueAbilityState::GetStateType()
|
||||
int32_t DSchedContinueAbilityState::DoContinueSendTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueAbilityState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<ContinueAbilityData>();
|
||||
int32_t ret = dContinue->ExecuteContinueSend(syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueAbilityState ExecuteContinueSend failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueAbilityState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueAbilityState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueAbilityState ExecuteContinueEnd failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,19 @@
|
||||
|
||||
#include "dsched_continue_source_end_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueEndState";
|
||||
}
|
||||
DSchedContinueEndState::DSchedContinueEndState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueEndState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueEndState::~DSchedContinueEndState()
|
||||
@ -29,7 +37,18 @@ DSchedContinueEndState::~DSchedContinueEndState()
|
||||
int32_t DSchedContinueEndState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueEndState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueEndState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueEndState::GetStateType()
|
||||
@ -40,7 +59,17 @@ DSchedContinueStateType DSchedContinueEndState::GetStateType()
|
||||
int32_t DSchedContinueEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueEnd(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSourceStartState ExecuteContinueEnd failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,21 @@
|
||||
|
||||
#include "dsched_continue_source_start_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueSourceStartState";
|
||||
}
|
||||
DSchedContinueSourceStartState::DSchedContinueSourceStartState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSHCED_CONTINUE_REQ_PUSH_EVENT] = &DSchedContinueSourceStartState::DoContinuePushReqTask;
|
||||
memberFuncMap_[DSHCED_CONTINUE_ABILITY_EVENT] = &DSchedContinueSourceStartState::DoContinueAbilityTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueSourceStartState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueSourceStartState::~DSchedContinueSourceStartState()
|
||||
@ -29,7 +39,18 @@ DSchedContinueSourceStartState::~DSchedContinueSourceStartState()
|
||||
int32_t DSchedContinueSourceStartState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueSourceStartState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueSourceStartState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueSourceStartState::GetStateType()
|
||||
@ -37,22 +58,52 @@ DSchedContinueStateType DSchedContinueSourceStartState::GetStateType()
|
||||
return DSCHED_CONTINUE_SOURCE_START_STATE;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSourceStartState::DoContinueAbiityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSourceStartState::DoContinuePushReqTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSourceStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<DistributedWantParams>();
|
||||
int32_t ret = dContinue->ExecuteContinueReq(syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSourceStartState ExecuteContinueAbility failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSourceStartState::DoContinueAbilityTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSourceStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueAbility(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSourceStartState ExecuteContinueAbility failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueSourceStartState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueSourceStartState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSourceStartState ExecuteContinueError failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
@ -15,11 +15,20 @@
|
||||
|
||||
#include "dsched_continue_source_wait_end_state.h"
|
||||
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::string TAG = "DSchedContinueWaitEndState";
|
||||
}
|
||||
DSchedContinueWaitEndState::DSchedContinueWaitEndState(std::shared_ptr<DSchedContinueStateMachine> stateMachine)
|
||||
: stateMachine_(stateMachine)
|
||||
{
|
||||
memberFuncMap_[DSCHED_CONTINUE_COMPLETE_EVENT] = &DSchedContinueWaitEndState::DoNotifyCompleteTask;
|
||||
memberFuncMap_[DSCHED_CONTINUE_END_EVENT] = &DSchedContinueWaitEndState::DoContinueEndTask;
|
||||
}
|
||||
|
||||
DSchedContinueWaitEndState::~DSchedContinueWaitEndState()
|
||||
@ -29,7 +38,18 @@ DSchedContinueWaitEndState::~DSchedContinueWaitEndState()
|
||||
int32_t DSchedContinueWaitEndState::Execute(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto iterFunc = memberFuncMap_.find(event->GetInnerEventId());
|
||||
if (iterFunc == memberFuncMap_.end()) {
|
||||
HILOGI("DSchedContinueWaitEndState execute %d in wrong state", event->GetInnerEventId());
|
||||
return CONTINUE_STATE_MACHINE_INVALID_STATE;
|
||||
}
|
||||
|
||||
auto memberFunc = iterFunc->second;
|
||||
int32_t ret = (this->*memberFunc)(dContinue, event);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGI("DSchedContinueWaitEndState execute %d failed, ret: %d", event->GetInnerEventId(), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DSchedContinueStateType DSchedContinueWaitEndState::GetStateType()
|
||||
@ -40,13 +60,33 @@ DSchedContinueStateType DSchedContinueWaitEndState::GetStateType()
|
||||
int32_t DSchedContinueWaitEndState::DoNotifyCompleteTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueWaitEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteNotifyComplete(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueSourceStartState ExecuteNotifyComplete failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinueWaitEndState::DoContinueEndTask(std::shared_ptr<DSchedContinue> dContinue,
|
||||
const AppExecFwk::InnerEvent::Pointer &event)
|
||||
{
|
||||
return ERR_OK;
|
||||
auto stateMachine = stateMachine_.lock();
|
||||
if (stateMachine == nullptr) {
|
||||
HILOGE("DSchedContinueWaitEndState stateMachine is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
auto syncContinueData = event->GetSharedObject<int32_t>();
|
||||
int32_t ret = dContinue->ExecuteContinueError(*syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueWaitEndState ExecuteContinueEnd failed, ret: %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user