hunting/application/MissionManager/src/MediaHandleState.h
2024-07-20 20:41:55 +08:00

44 lines
1.5 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.
*/
#ifndef MEDIA_HANDLE_STATE_H
#define MEDIA_HANDLE_STATE_H
#include "DataProcessing.h"
#include "IStateMachine.h"
#include "LedsHandle.h"
#include "MediaTaskHandle.h"
constexpr int FILE_SIZE_ERROR = -1;
class MediaHandleState : public State,
public DataProcessing,
public MediaTaskHandle,
public VMediaTaskIniator,
public LedsHandle,
public std::enable_shared_from_this<MediaHandleState>
{
public:
MediaHandleState();
virtual ~MediaHandleState() = default;
void GoInState() override;
void GoOutState() override;
bool ExecuteStateMsg(VStateMachineData *msg) override;
private:
void TaskResponse(const MediaTaskInfo &taskinfo) override;
bool ResetKeyMediaTaskHandle(VStateMachineData *msg);
bool MediaTaskFinishedHandle(VStateMachineData *msg);
private:
static int GetFileSize_KB(const char *filePath);
};
#endif