hunting/application/MissionManager/src/IdleState.cpp
2024-06-25 22:44:32 +08:00

45 lines
1.6 KiB
C++

/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "IdleState.h"
#include "DataProcessing.h"
#include "ILog.h"
#include "IStateMachine.h"
#include "MissionStateMachine.h"
#include <functional>
IdleState::IdleState() : State("IdleState")
{
// mEventHandle[InternalStateEvent::MEDIA_REPORT_EVENT] = std::bind(&IdleState::MediaReportHandle, this, _1);
// mEventHandle[InternalStateEvent::SD_CARD_HANDLE_STATE_SD_STATUS_REPORTED] =
// std::bind(&IdleState::SdCardEventHandle, this, _1);
mEventHandle[InternalStateEvent::RESET_KEY_MEDIA_TASK] = std::bind(&IdleState::ResetKeyMediaTaskHandle, this, _1);
}
void IdleState::GoInState()
{
LogInfo(" ========== IdleState::GoInState.\n");
}
void IdleState::GoOutState()
{
LogInfo(" ========== IdleState::GoOutState.\n");
}
bool IdleState::ExecuteStateMsg(VStateMachineData *msg)
{
return DataProcessing::EventHandle(msg);
}
bool IdleState::ResetKeyMediaTaskHandle(VStateMachineData *msg)
{
MissionStateMachine::GetInstance()->DelayMessage(msg);
MissionStateMachine::GetInstance()->SwitchState(SystemState::STORAGE_HANDLE_STATE);
return EXECUTED;
}