embedded-framework/application/MissionManager/src/MediaTask.h
2024-06-07 17:57:34 +08:00

42 lines
1.4 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_TASK_H
#define MEDIA_TASK_H
#include "DataProcessing.h"
#include "IMediaManager.h"
constexpr unsigned int MEDIA_TASK_TIMEOUT_MS = 1000 * 60;
class VMediaTaskIniator
{
public:
VMediaTaskIniator() = default;
virtual ~VMediaTaskIniator() = default;
virtual void TaskResponse(const std::vector<MediaTaskResponse> &response) = 0;
};
class MediaTask : public VMediaTask
{
public:
MediaTask(const MediaTaskType &type, const InternalStateEvent &bindEvent,
const std::weak_ptr<VMediaTaskIniator> &iniator);
virtual ~MediaTask() = default;
virtual unsigned int GetTaskTimeOutMs(void);
private:
const MediaTaskType mType;
const InternalStateEvent mBindEvent;
const std::weak_ptr<VMediaTaskIniator> mIniator;
bool mFinished = false;
std::shared_ptr<MediaTaskResponse> mResponseData;
};
#endif