mirror of
				https://gitee.com/jiuyilian/embedded-framework.git
				synced 2025-10-24 18:20:15 -04:00 
			
		
		
		
	Add:MediaManager/MediaHandlState code.
This commit is contained in:
		
							parent
							
								
									a0070c5747
								
							
						
					
					
						commit
						16e98073d8
					
				| 
						 | 
				
			
			@ -27,6 +27,7 @@ execute_process(
 | 
			
		|||
	COMMAND git diff --name-only --diff-filter=ACMRT
 | 
			
		||||
	OUTPUT_VARIABLE MODIFIED_FILES
 | 
			
		||||
	OUTPUT_STRIP_TRAILING_WHITESPACE
 | 
			
		||||
	WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
set(ALL_MODEFIED_FILES "")
 | 
			
		||||
string(LENGTH "${MODIFIED_FILES}" GIT_RESULT_STRING_LENGTH)
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +44,26 @@ foreach(FILE ${MODIFIED_FILES_LIST})
 | 
			
		|||
	set(ALL_MODEFIED_FILES "${ALL_MODEFIED_FILES};${FILE}")
 | 
			
		||||
	endif()
 | 
			
		||||
endforeach()
 | 
			
		||||
# 获取未跟踪的文件
 | 
			
		||||
execute_process(
 | 
			
		||||
	COMMAND git ls-files --others --exclude-standard
 | 
			
		||||
	OUTPUT_VARIABLE UNTRACKED_FILES
 | 
			
		||||
	OUTPUT_STRIP_TRAILING_WHITESPACE
 | 
			
		||||
	WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
string(LENGTH "${UNTRACKED_FILES}" GIT_RESULT_STRING_LENGTH)
 | 
			
		||||
if(GIT_RESULT_STRING_LENGTH EQUAL 0)
 | 
			
		||||
else()
 | 
			
		||||
	string(REPLACE "\n" ";" UNTRACKED_FILES_LIST ${UNTRACKED_FILES})
 | 
			
		||||
endif()
 | 
			
		||||
# 遍历每个文件
 | 
			
		||||
foreach(FILE ${UNTRACKED_FILES_LIST})
 | 
			
		||||
	# 检查文件扩展名,只格式化.cpp和.h文件
 | 
			
		||||
	get_filename_component(FILE_EXT ${FILE} EXT)
 | 
			
		||||
	if(FILE_EXT MATCHES "\\.(c|cpp|h)$")
 | 
			
		||||
	set(ALL_MODEFIED_FILES "${ALL_MODEFIED_FILES};${FILE}")
 | 
			
		||||
	endif()
 | 
			
		||||
endforeach()
 | 
			
		||||
string(LENGTH "${ALL_MODEFIED_FILES}" MODIFIED_STRING_LENGTH)
 | 
			
		||||
# find the clang-tidy tools
 | 
			
		||||
unset(CLANG_TIDY_EXE  CACHE)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,9 +23,11 @@ TopState --> PowerOff
 | 
			
		|||
TopState --> MSDCState
 | 
			
		||||
TopState --> DeviceAbnormal
 | 
			
		||||
TopState --> MissionState
 | 
			
		||||
MissionState --> 空闲
 | 
			
		||||
MissionState --> 存储管理
 | 
			
		||||
存储管理 --> EMMC
 | 
			
		||||
存储管理 --> SD卡
 | 
			
		||||
MissionState --> 媒体管理
 | 
			
		||||
SD卡 --> 插卡
 | 
			
		||||
SD卡 --> 拔卡
 | 
			
		||||
SD卡 --> 卡异常
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,8 @@ enum class InternalStateEvent
 | 
			
		|||
    CHECK_UPGRADE_FILE,
 | 
			
		||||
    MEDIA_REPORT_EVENT,
 | 
			
		||||
    KEY_EVENT_HANDLE,
 | 
			
		||||
    RESET_KEY_MEDIA_TASK,
 | 
			
		||||
    MEDIA_HANDLE_STATE_TASK_TIME_OUT,
 | 
			
		||||
    END
 | 
			
		||||
};
 | 
			
		||||
typedef struct key_event_data
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										37
									
								
								application/MissionManager/src/IdleState.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								application/MissionManager/src/IdleState.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "IFilesManager.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
#include "IMediaManager.h"
 | 
			
		||||
#include "MissionStateMachine.h"
 | 
			
		||||
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);
 | 
			
		||||
}
 | 
			
		||||
void IdleState::GoInState()
 | 
			
		||||
{
 | 
			
		||||
    LogInfo(" ========== IdleState::GoInState.\n");
 | 
			
		||||
}
 | 
			
		||||
void IdleState::GoOutState()
 | 
			
		||||
{
 | 
			
		||||
    LogInfo(" ========== IdleState::GoOutState.\n");
 | 
			
		||||
}
 | 
			
		||||
bool IdleState::ExecuteStateMsg(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    return DataProcessing::EventHandle(msg);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								application/MissionManager/src/IdleState.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								application/MissionManager/src/IdleState.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 IDLE_STATE_H
 | 
			
		||||
#define IDLE_STATE_H
 | 
			
		||||
#include "DataProcessing.h"
 | 
			
		||||
#include "IStateMachine.h"
 | 
			
		||||
class IdleState : public State, public DataProcessing, public std::enable_shared_from_this<IdleState>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    IdleState();
 | 
			
		||||
    virtual ~IdleState() = default;
 | 
			
		||||
    void GoInState() override;
 | 
			
		||||
    void GoOutState() override;
 | 
			
		||||
    bool ExecuteStateMsg(VStateMachineData *msg) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										47
									
								
								application/MissionManager/src/MediaHandleState.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								application/MissionManager/src/MediaHandleState.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaHandleState.h"
 | 
			
		||||
#include "IFilesManager.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
#include "IMediaManager.h"
 | 
			
		||||
#include "MissionStateMachine.h"
 | 
			
		||||
MediaHandleState::MediaHandleState() : State("MediaHandleState")
 | 
			
		||||
{
 | 
			
		||||
    mEventHandle[InternalStateEvent::RESET_KEY_MEDIA_TASK] =
 | 
			
		||||
        std::bind(&MediaHandleState::ResetKeyMediaTaskHandle, this, _1);
 | 
			
		||||
}
 | 
			
		||||
void MediaHandleState::GoInState()
 | 
			
		||||
{
 | 
			
		||||
    LogInfo(" ========== MediaHandleState::GoInState.\n");
 | 
			
		||||
    if (!mMediaHandle) {
 | 
			
		||||
        MediaTaskHandle::Init();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
void MediaHandleState::GoOutState()
 | 
			
		||||
{
 | 
			
		||||
    LogInfo(" ========== MediaHandleState::GoOutState.\n");
 | 
			
		||||
}
 | 
			
		||||
bool MediaHandleState::ExecuteStateMsg(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    return DataProcessing::EventHandle(msg);
 | 
			
		||||
}
 | 
			
		||||
void MediaHandleState::TaskResponse(const std::vector<MediaTaskResponse> &response)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
bool MediaHandleState::ResetKeyMediaTaskHandle(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    MakeSingleTask(InternalStateEvent::RESET_KEY_MEDIA_TASK, shared_from_this());
 | 
			
		||||
    return EXECUTED;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								application/MissionManager/src/MediaHandleState.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								application/MissionManager/src/MediaHandleState.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaTaskHandle.h"
 | 
			
		||||
class MediaHandleState : public State,
 | 
			
		||||
                         public DataProcessing,
 | 
			
		||||
                         public MediaTaskHandle,
 | 
			
		||||
                         public VMediaTaskIniator,
 | 
			
		||||
                         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 std::vector<MediaTaskResponse> &response) override;
 | 
			
		||||
    bool ResetKeyMediaTaskHandle(VStateMachineData *msg);
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										25
									
								
								application/MissionManager/src/MediaTask.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								application/MissionManager/src/MediaTask.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaTask.h"
 | 
			
		||||
MediaTask::MediaTask(const MediaTaskType &type, const InternalStateEvent &bindEvent,
 | 
			
		||||
                     const std::weak_ptr<VMediaTaskIniator> &iniator)
 | 
			
		||||
    : mType(type), mBindEvent(bindEvent), mIniator(iniator)
 | 
			
		||||
{
 | 
			
		||||
    mResponseData.reset();
 | 
			
		||||
}
 | 
			
		||||
unsigned int MediaTask::GetTaskTimeOutMs(void)
 | 
			
		||||
{
 | 
			
		||||
    return MEDIA_TASK_TIMEOUT_MS;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								application/MissionManager/src/MediaTask.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								application/MissionManager/src/MediaTask.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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
 | 
			
		||||
							
								
								
									
										51
									
								
								application/MissionManager/src/MediaTaskHandle.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								application/MissionManager/src/MediaTaskHandle.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaTaskHandle.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
#include "MissionStateMachine.h"
 | 
			
		||||
MediaTaskHandle::MediaTaskHandle()
 | 
			
		||||
{
 | 
			
		||||
    mMediaHandle.reset();
 | 
			
		||||
    // mMediaHandle = std::make_shared<VMediaHandle>();
 | 
			
		||||
}
 | 
			
		||||
void MediaTaskHandle::Init(void)
 | 
			
		||||
{
 | 
			
		||||
    IMediaManager::GetInstance()->GetMediaChannel(MediaChannel::MEDIA_1, mMediaHandle);
 | 
			
		||||
}
 | 
			
		||||
void MediaTaskHandle::UnInit(void)
 | 
			
		||||
{
 | 
			
		||||
    mMediaHandle->ClearTask();
 | 
			
		||||
    mMediaHandle.reset();
 | 
			
		||||
}
 | 
			
		||||
void MediaTaskHandle::MakeSingleTask(const InternalStateEvent &bindEvent,
 | 
			
		||||
                                     const std::shared_ptr<VMediaTaskIniator> &iniator)
 | 
			
		||||
{
 | 
			
		||||
    std::shared_ptr<VMediaTask> task = std::make_shared<MediaTask>(MediaTaskType::END, bindEvent, iniator);
 | 
			
		||||
    if (!mMediaHandle) {
 | 
			
		||||
        LogError("MediaHandle is null");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    auto code = mMediaHandle->ExecuteTask(task);
 | 
			
		||||
    if (IsCodeOK(code)) {
 | 
			
		||||
        mRuningTask = task;
 | 
			
		||||
        long long timeOut = std::dynamic_pointer_cast<MediaTask>(task)->GetTaskTimeOutMs();
 | 
			
		||||
        std::shared_ptr<VMissionData> message = std::make_shared<VMissionData>(
 | 
			
		||||
            static_cast<MissionEvent>(InternalStateEvent::MEDIA_HANDLE_STATE_TASK_TIME_OUT));
 | 
			
		||||
        MissionStateMachine::GetInstance()->MessageExecutedLater(message, timeOut);
 | 
			
		||||
    }
 | 
			
		||||
    // else if () {
 | 
			
		||||
    //     mMediaHandle->StopTask();
 | 
			
		||||
    // }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								application/MissionManager/src/MediaTaskHandle.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								application/MissionManager/src/MediaTaskHandle.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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_HANDLE_H
 | 
			
		||||
#define MEDIA_TASK_HANDLE_H
 | 
			
		||||
#include "DataProcessing.h"
 | 
			
		||||
#include "IMediaManager.h"
 | 
			
		||||
#include "MediaTask.h"
 | 
			
		||||
class MediaTaskHandle
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    MediaTaskHandle();
 | 
			
		||||
    virtual ~MediaTaskHandle() = default;
 | 
			
		||||
    void Init(void);
 | 
			
		||||
    void UnInit(void);
 | 
			
		||||
    void MakeSingleTask(const InternalStateEvent &bindEvent, const std::shared_ptr<VMediaTaskIniator> &iniator);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    std::shared_ptr<VMediaHandle> mMediaHandle;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::shared_ptr<VMediaTask> mRuningTask;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +14,8 @@
 | 
			
		|||
 */
 | 
			
		||||
#include "MissionManagerMakePtr.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
#include "IdleState.h"
 | 
			
		||||
#include "MediaHandleState.h"
 | 
			
		||||
#include "MissionManager.h"
 | 
			
		||||
#include "OnMissionState.h"
 | 
			
		||||
#include "PirTriggeredMissionState.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -103,4 +105,14 @@ std::shared_ptr<State> MissionManagerMakePtr::CreateUpgradeState(void)
 | 
			
		|||
{
 | 
			
		||||
    std::shared_ptr<State> state = std::make_shared<UpgradeState>();
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
std::shared_ptr<State> MissionManagerMakePtr::CreateMediaHandleState(void)
 | 
			
		||||
{
 | 
			
		||||
    std::shared_ptr<State> state = std::make_shared<MediaHandleState>();
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
std::shared_ptr<State> MissionManagerMakePtr::CreateIdleState(void)
 | 
			
		||||
{
 | 
			
		||||
    std::shared_ptr<State> state = std::make_shared<IdleState>();
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -31,5 +31,7 @@ public:
 | 
			
		|||
    virtual std::shared_ptr<State> CreateStorageHandleState(void);
 | 
			
		||||
    virtual std::shared_ptr<State> CreateSdCardHandleState(void);
 | 
			
		||||
    virtual std::shared_ptr<State> CreateUpgradeState(void);
 | 
			
		||||
    virtual std::shared_ptr<State> CreateMediaHandleState(void);
 | 
			
		||||
    virtual std::shared_ptr<State> CreateIdleState(void);
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +60,13 @@ StatusCode MissionStateMachine::SendStateMessage(const std::shared_ptr<VMissionD
 | 
			
		|||
    mStateMachine->SendMessage(static_cast<int>(message->mEvent), msg);
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
StatusCode MissionStateMachine::MessageExecutedLater(const std::shared_ptr<VMissionData> &message,
 | 
			
		||||
                                                     long long &delayTimeMs)
 | 
			
		||||
{
 | 
			
		||||
    std::shared_ptr<VStateMessage> msg = std::make_shared<MissionMessage>(message);
 | 
			
		||||
    mStateMachine->MessageExecutedLater(static_cast<int>(message->mEvent), msg, delayTimeMs);
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
void MissionStateMachine::DelayMessage(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    mStateMachine->DelayMessage(msg);
 | 
			
		||||
| 
						 | 
				
			
			@ -92,6 +99,8 @@ void MissionStateMachine::RunStateMachine(const IpcMission &mission)
 | 
			
		|||
    mStateTree[SystemState::STORAGE_HANDLE_STATE] = MissionManagerMakePtr::GetInstance()->CreateStorageHandleState();
 | 
			
		||||
    mStateTree[SystemState::SD_CARD_HANDLE_STATE] = MissionManagerMakePtr::GetInstance()->CreateSdCardHandleState();
 | 
			
		||||
    mStateTree[SystemState::UPGRADE_STATE] = MissionManagerMakePtr::GetInstance()->CreateUpgradeState();
 | 
			
		||||
    mStateTree[SystemState::MEDIA_HANDLE_STATE] = MissionManagerMakePtr::GetInstance()->CreateMediaHandleState();
 | 
			
		||||
    mStateTree[SystemState::IDLE_STATE] = MissionManagerMakePtr::GetInstance()->CreateIdleState();
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::TOP_STATE].get(), nullptr);
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::MISSION_STATE].get(), mStateTree[SystemState::TOP_STATE].get());
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::STORAGE_HANDLE_STATE].get(),
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +109,9 @@ void MissionStateMachine::RunStateMachine(const IpcMission &mission)
 | 
			
		|||
                             mStateTree[SystemState::STORAGE_HANDLE_STATE].get());
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::UPGRADE_STATE].get(),
 | 
			
		||||
                             mStateTree[SystemState::MISSION_STATE].get());
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::MEDIA_HANDLE_STATE].get(),
 | 
			
		||||
                             mStateTree[SystemState::MISSION_STATE].get());
 | 
			
		||||
    mStateMachine->StatePlus(mStateTree[SystemState::IDLE_STATE].get(), mStateTree[SystemState::MISSION_STATE].get());
 | 
			
		||||
    mStateMachine->SetCurrentState(mStateTree[SystemState::TOP_STATE].get());
 | 
			
		||||
    mStateMachine->StartStateMachine();
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,8 @@ enum class SystemState
 | 
			
		|||
    STORAGE_HANDLE_STATE,
 | 
			
		||||
    SD_CARD_HANDLE_STATE,
 | 
			
		||||
    UPGRADE_STATE,
 | 
			
		||||
    MEDIA_HANDLE_STATE,
 | 
			
		||||
    IDLE_STATE,
 | 
			
		||||
    END
 | 
			
		||||
};
 | 
			
		||||
class MissionStateMachine
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +42,7 @@ public:
 | 
			
		|||
    void Init(void);
 | 
			
		||||
    void UnInit(void);
 | 
			
		||||
    StatusCode SendStateMessage(const std::shared_ptr<VMissionData> &message);
 | 
			
		||||
    StatusCode MessageExecutedLater(const std::shared_ptr<VMissionData> &message, long long &delayTimeMs);
 | 
			
		||||
    void DelayMessage(VStateMachineData *msg);
 | 
			
		||||
    void SwitchState(const SystemState &state);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,8 @@ TestMissionState::TestMissionState() : MissionState("TestMissionState")
 | 
			
		|||
{
 | 
			
		||||
    mEventHandle[InternalStateEvent::ANY_STATE_SD_STATUS_PERORIED] =
 | 
			
		||||
        std::bind(&TestMissionState::SdCardEventReportSendToApp, this, _1);
 | 
			
		||||
    mEventHandle[InternalStateEvent::RESET_KEY_MEDIA_TASK] =
 | 
			
		||||
        std::bind(&TestMissionState::ResetKeyMediaTaskHandle, this, _1);
 | 
			
		||||
    mKeyClickHandle["reset"] = std::bind(&TestMissionState::ClickResetKey, this, _1);
 | 
			
		||||
}
 | 
			
		||||
void TestMissionState::GoInState()
 | 
			
		||||
| 
						 | 
				
			
			@ -48,8 +50,21 @@ bool TestMissionState::SdCardEventReportSendToApp(VStateMachineData *msg)
 | 
			
		|||
    IAppManager::GetInstance()->SetSdCardStatus(status);
 | 
			
		||||
    return EXECUTED;
 | 
			
		||||
}
 | 
			
		||||
bool TestMissionState::ResetKeyMediaTaskHandle(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    MissionStateMachine::GetInstance()->DelayMessage(msg);
 | 
			
		||||
    MissionStateMachine::GetInstance()->SwitchState(SystemState::MEDIA_HANDLE_STATE);
 | 
			
		||||
    return EXECUTED;
 | 
			
		||||
}
 | 
			
		||||
bool TestMissionState::ClickResetKey(const KeyEventData &data)
 | 
			
		||||
{
 | 
			
		||||
    LogInfo("reset key click:make a media task.\n");
 | 
			
		||||
    // std::shared_ptr<VMissionData> message = std::make_shared<VMissionDataV2<MediaReportEvent>>(
 | 
			
		||||
    //     static_cast<MissionEvent>(InternalStateEvent::MEDIA_REPORT_EVENT), event);
 | 
			
		||||
    // MissionStateMachine::GetInstance()->SendStateMessage(message);
 | 
			
		||||
    std::shared_ptr<VMissionData> message =
 | 
			
		||||
        std::make_shared<VMissionData>(static_cast<MissionEvent>(InternalStateEvent::RESET_KEY_MEDIA_TASK));
 | 
			
		||||
    MissionStateMachine::GetInstance()->SendStateMessage(message);
 | 
			
		||||
    return EXECUTED;
 | 
			
		||||
}
 | 
			
		||||
SdCardStatus TestMissionState::SdCardStatusConvert(const StorageEvent &event)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ public:
 | 
			
		|||
 | 
			
		||||
private:
 | 
			
		||||
    bool SdCardEventReportSendToApp(VStateMachineData *msg);
 | 
			
		||||
    bool ResetKeyMediaTaskHandle(VStateMachineData *msg);
 | 
			
		||||
    bool ClickResetKey(const KeyEventData &data);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,8 @@ bool UpgradeState::ExecuteStateMsg(VStateMachineData *msg)
 | 
			
		|||
}
 | 
			
		||||
bool UpgradeState::CheckUpgradeFileHandle(VStateMachineData *msg)
 | 
			
		||||
{
 | 
			
		||||
    // TODO: need to improve:It cannot be blocked.
 | 
			
		||||
    IHuntingUpgrade::GetInstance()->CheckUpgradeFile();
 | 
			
		||||
    MissionStateMachine::GetInstance()->SwitchState(SystemState::IDLE_STATE);
 | 
			
		||||
    return EXECUTED;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +50,8 @@ void McuManagerImpl::OtherSideSendIpcMission(const unsigned int &serialNumber, c
 | 
			
		|||
 | 
			
		||||
* 注释必须使用英文,且使用翻译器翻译;
 | 
			
		||||
  避免编码问题导致的乱码,且需要保证阅读困难时可使用翻译器翻译成可读的中文;
 | 
			
		||||
**注:** 注释翻译工具使用[百度翻译](https://fanyi.baidu.com/);
 | 
			
		||||
 | 
			
		||||
**注:** 注释翻译工具使用[百度翻译](https://fanyi.baidu.com/);翻译的注释在使用doxygen工具生成接口文档时,在网页上方便翻译成中文。
 | 
			
		||||
 | 
			
		||||
### 1.1.3. C++继承
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -76,3 +77,35 @@ typedef struct app_get_product_info
 | 
			
		|||
### 1.1.5. 文件命名
 | 
			
		||||
 | 
			
		||||
* 文件名必须使用驼峰命名法,且首字母大写;
 | 
			
		||||
 | 
			
		||||
### 1.1.6. 代码排版
 | 
			
		||||
 | 
			
		||||
* 使用统一标准的代码排版风格,保持多人开发时代码的整洁,避免因为排版(特别是编辑工具的自动排版功能)导致每次提交时都产生大量的排版修改,影响后续代码异常排查;
 | 
			
		||||
 | 
			
		||||
  请使用仓库跟目录下.clang-format配置文件进行排版,如果使用vscode编辑器开发代码,可直接使用快捷键ctrl+alt+f进行排版;也可以使用构建脚本对代码进行排版。
 | 
			
		||||
 | 
			
		||||
**对发生修改的代码进行格式化:**
 | 
			
		||||
 | 
			
		||||
```code
 | 
			
		||||
$ make cmake                     // 在仓库根目录执行,对发生修改的文件创建格式化命令
 | 
			
		||||
$ cd cmake-shell/
 | 
			
		||||
$ make improve_modified_code     // 文件格式化命令,统一排版,此命名只对发生修改的文件进行格式化
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**对全部文件进行格式化:**
 | 
			
		||||
 | 
			
		||||
```code
 | 
			
		||||
详见配置文件://build/global_config.cmake
 | 
			
		||||
把 COMPILE_IMPROVE_SUPPORT 设置为 true 时,将会在每次编译代码时进行格式化。
 | 
			
		||||
if(${LINUX_TEST} MATCHES "true")
 | 
			
		||||
    set(CLANG_TIDY_SUPPORT                     "true")
 | 
			
		||||
    set(CLANG_FORMAT_SUPPORT                   "true")
 | 
			
		||||
    set(COMPILE_IMPROVE_SUPPORT                "false") # 开启后每次编译可能会很慢
 | 
			
		||||
    set(LLVM_PATH                              "$ENV{HOME}/llvm-project")
 | 
			
		||||
endif()
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 1.1.7. 函数
 | 
			
		||||
 | 
			
		||||
* 单个函数代码行控制在50行内,阅读时无需上下滚动去理解代码逻辑;极少数初始化数据的无逻辑推理的代码除外;
 | 
			
		||||
* 函数参数不能超过10个;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,10 +54,18 @@ void VCameraHalMonitor::ReportEvent(const CameraReportEvent &event)
 | 
			
		|||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
 | 
			
		||||
}
 | 
			
		||||
camera_task_param::camera_task_param(const CameraTaskType &cameraTask) : mCameraTask(cameraTask)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
void VCameraHal::SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
 | 
			
		||||
}
 | 
			
		||||
StatusCode VCameraHal::StartSingleTask(const CameraTaskParam ¶m)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
void VSdCardHalMonitor::ReportEvent(const SdCardHalStatus &status)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION.\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,13 @@ enum class SdCardHalStatus
 | 
			
		|||
    ERROR,
 | 
			
		||||
    END
 | 
			
		||||
};
 | 
			
		||||
enum class CameraTaskType
 | 
			
		||||
{
 | 
			
		||||
    PICTURE = 0,
 | 
			
		||||
    VIDEO,
 | 
			
		||||
    PICTURE_AND_VIDEO,
 | 
			
		||||
    END
 | 
			
		||||
};
 | 
			
		||||
typedef struct camera_report_event
 | 
			
		||||
{
 | 
			
		||||
    camera_report_event(const std::string &fileName, const CameraType &cameraType);
 | 
			
		||||
| 
						 | 
				
			
			@ -86,12 +93,37 @@ public:
 | 
			
		|||
    virtual ~VCameraHalMonitor() = default;
 | 
			
		||||
    virtual void ReportEvent(const CameraReportEvent &event);
 | 
			
		||||
};
 | 
			
		||||
class VCameraTaskContext
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    VCameraTaskContext() = default;
 | 
			
		||||
    virtual ~VCameraTaskContext() = default;
 | 
			
		||||
};
 | 
			
		||||
template <typename T>
 | 
			
		||||
class CameraTaskContext : public VCameraTaskContext
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    CameraTaskContext(T &value) : mData(value)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
    virtual ~CameraTaskContext() = default;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    T mData;
 | 
			
		||||
};
 | 
			
		||||
typedef struct camera_task_param
 | 
			
		||||
{
 | 
			
		||||
    camera_task_param(const CameraTaskType &cameraTask);
 | 
			
		||||
    const CameraTaskType mCameraTask;
 | 
			
		||||
    std::shared_ptr<VCameraTaskContext> mCtx;
 | 
			
		||||
} CameraTaskParam;
 | 
			
		||||
class VCameraHal
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    VCameraHal() = default;
 | 
			
		||||
    virtual ~VCameraHal() = default;
 | 
			
		||||
    virtual void SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor);
 | 
			
		||||
    virtual StatusCode StartSingleTask(const CameraTaskParam ¶m);
 | 
			
		||||
};
 | 
			
		||||
class VSdCardHalMonitor
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -191,7 +191,7 @@
 | 
			
		|||
 | 
			
		||||
```code
 | 
			
		||||
{
 | 
			
		||||
    "result": 0,
 | 
			
		||||
    "result": 0,                              // 0代表成功,-1代表失败
 | 
			
		||||
    "info":
 | 
			
		||||
    [
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,4 +8,16 @@
 | 
			
		|||
 | 
			
		||||
## 1.2. 文件管理
 | 
			
		||||
 | 
			
		||||
   对抓拍的图片/视频文件的管理。
 | 
			
		||||
   对抓拍的图片/
 | 
			
		||||
 | 
			
		||||
```mermaid
 | 
			
		||||
classDiagram
 | 
			
		||||
TopState "SetMediaMonitor" ..> "ReportEvent" IMediaManager:依赖
 | 
			
		||||
IMediaManager <|.. MediaManager:实例
 | 
			
		||||
IMediaManager o-- VMediaHandle:集合
 | 
			
		||||
IMediaManager o-- VMediaTask:集合
 | 
			
		||||
VMediaHandle <|.. MediaHandle:实例
 | 
			
		||||
MediaHandle *-- VCameraHal:组成
 | 
			
		||||
MediaManager ..> IHal:依赖
 | 
			
		||||
IHal o-- VCameraHal:集合
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ bool CreateMediaManagerModule(void);
 | 
			
		|||
bool DestroyMediaManagerModule(void);
 | 
			
		||||
enum class MediaChannel
 | 
			
		||||
{
 | 
			
		||||
    MEDIA_1 = 1,
 | 
			
		||||
    MEDIA_1 = 0,
 | 
			
		||||
    MEDIA_2,
 | 
			
		||||
    END
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -39,12 +39,11 @@ typedef struct media_report_event
 | 
			
		|||
    const std::string mFileName;
 | 
			
		||||
    const MediaChannel mMediaChannedl;
 | 
			
		||||
} MediaReportEvent;
 | 
			
		||||
class MediaTaskResponse
 | 
			
		||||
typedef struct media_task_response
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    MediaTaskResponse() = default;
 | 
			
		||||
    ~MediaTaskResponse() = default;
 | 
			
		||||
};
 | 
			
		||||
    media_task_response(const std::string &fileName);
 | 
			
		||||
    const std::string mFileName;
 | 
			
		||||
} MediaTaskResponse;
 | 
			
		||||
class VMediaTask
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			@ -68,6 +67,14 @@ class VMediaHandle
 | 
			
		|||
public:
 | 
			
		||||
    VMediaHandle() = default;
 | 
			
		||||
    virtual ~VMediaHandle() = default;
 | 
			
		||||
    virtual StatusCode ExecuteTask(std::shared_ptr<VMediaTask> &task);
 | 
			
		||||
    virtual StatusCode StopTask(void);
 | 
			
		||||
    virtual StatusCode ClearTask(void);
 | 
			
		||||
    virtual StatusCode SetSpontaneousTaskMonitor(std::shared_ptr<VMediaTask> &task);
 | 
			
		||||
    // virtual StatusCode BeReadyForLive(void);
 | 
			
		||||
    // virtual StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
 | 
			
		||||
    // virtual StatusCode StartMedia(void);
 | 
			
		||||
    // virtual StatusCode StopMedia(void);
 | 
			
		||||
};
 | 
			
		||||
class IMediaManager
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -78,5 +85,6 @@ public:
 | 
			
		|||
    virtual StatusCode Init(void);
 | 
			
		||||
    virtual StatusCode UnInit(void);
 | 
			
		||||
    virtual StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
 | 
			
		||||
    virtual StatusCode GetMediaChannel(const MediaChannel &channel, std::shared_ptr<VMediaHandle> &handle);
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -18,6 +18,9 @@ media_report_event::media_report_event(const std::string &fileName, const MediaC
 | 
			
		|||
    : mFileName(fileName), mMediaChannedl(mediaChannedl)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
media_task_response::media_task_response(const std::string &fileName) : mFileName(fileName)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
const MediaTaskType VMediaTask::GetTaskType(void)
 | 
			
		||||
{
 | 
			
		||||
    return MediaTaskType::END;
 | 
			
		||||
| 
						 | 
				
			
			@ -39,14 +42,55 @@ const unsigned int VMediaTask::GetIsMultShot(void)
 | 
			
		|||
}
 | 
			
		||||
StatusCode VMediaMonitor::ReportEvent(const MediaReportEvent &event)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode VMediaHandle::ExecuteTask(std::shared_ptr<VMediaTask> &task)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode VMediaHandle::StopTask(void)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode VMediaHandle::ClearTask(void)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode VMediaHandle::SetSpontaneousTaskMonitor(std::shared_ptr<VMediaTask> &task)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
// StatusCode VMediaHandle::BeReadyForLive(void)
 | 
			
		||||
// {
 | 
			
		||||
//     LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
//     return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
// }
 | 
			
		||||
// StatusCode VMediaHandle::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
 | 
			
		||||
// {
 | 
			
		||||
//     LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
//     return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
// }
 | 
			
		||||
// StatusCode VMediaHandle::StartMedia(void)
 | 
			
		||||
// {
 | 
			
		||||
//     LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
//     return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
// }
 | 
			
		||||
// StatusCode VMediaHandle::StopMedia(void)
 | 
			
		||||
// {
 | 
			
		||||
//     LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
//     return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
// }
 | 
			
		||||
std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMediaManager> *impl)
 | 
			
		||||
{
 | 
			
		||||
    static auto instance = std::make_shared<IMediaManager>();
 | 
			
		||||
    if (impl) {
 | 
			
		||||
        if (instance.use_count() == 1) {
 | 
			
		||||
            LogInfo("Instance changed succeed.\n");
 | 
			
		||||
            LogWarning("Instance changed succeed.\n");
 | 
			
		||||
            instance = *impl;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
| 
						 | 
				
			
			@ -57,13 +101,21 @@ std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMedi
 | 
			
		|||
}
 | 
			
		||||
StatusCode IMediaManager::Init(void)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode IMediaManager::UnInit(void)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode IMediaManager::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
StatusCode IMediaManager::GetMediaChannel(const MediaChannel &channel, std::shared_ptr<VMediaHandle> &handle)
 | 
			
		||||
{
 | 
			
		||||
    LogWarning("STATUS_CODE_VIRTUAL_FUNCTION");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										54
									
								
								middleware/MediaManager/src/MediaHandle.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								middleware/MediaManager/src/MediaHandle.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaHandle.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
MediaHandle::MediaHandle(const MediaChannel &mediaChannel, const std::shared_ptr<VCameraHal> &cameraHal)
 | 
			
		||||
    : mMediaChannel(mediaChannel), mCameraHal(cameraHal)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaHandle::ExecuteTask(std::shared_ptr<VMediaTask> &task)
 | 
			
		||||
{
 | 
			
		||||
    std::lock_guard<std::mutex> locker(mMutex);
 | 
			
		||||
    LogInfo("CameraHandle::ExecuteTask.\n");
 | 
			
		||||
    auto runingTask = mCurrentTask.lock();
 | 
			
		||||
    if (!mCurrentTask.expired()) {
 | 
			
		||||
        if (!runingTask->IsTaskFinished()) {
 | 
			
		||||
            LogError("Camera is runing task, can't execute more task.\n");
 | 
			
		||||
            return CreateStatusCode(STATUS_CODE_NOT_OK);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    CameraTaskType taskType = TaskTypeConvert(task->GetTaskType());
 | 
			
		||||
    CameraTaskParam data(taskType);
 | 
			
		||||
    auto code = mCameraHal->StartSingleTask(data);
 | 
			
		||||
    if (IsCodeOK(code)) {
 | 
			
		||||
        mCurrentTask = task;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        LogError("Execute task failed.\n");
 | 
			
		||||
    }
 | 
			
		||||
    return code;
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaHandle::StopTask(void)
 | 
			
		||||
{
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaHandle::ClearTask(void)
 | 
			
		||||
{
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
CameraTaskType MediaHandle::TaskTypeConvert(const MediaTaskType &type)
 | 
			
		||||
{
 | 
			
		||||
    return CameraTaskType::END;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								middleware/MediaManager/src/MediaHandle.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								middleware/MediaManager/src/MediaHandle.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 MEDI_AHANDLE_H
 | 
			
		||||
#define MEDI_AHANDLE_H
 | 
			
		||||
#include "IHalCpp.h"
 | 
			
		||||
#include "IMediaManager.h"
 | 
			
		||||
#include <mutex>
 | 
			
		||||
class MediaHandle : public VMediaHandle, public std::enable_shared_from_this<MediaHandle>
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    MediaHandle(const MediaChannel &mediaChannel, const std::shared_ptr<VCameraHal> &cameraHal);
 | 
			
		||||
    virtual ~MediaHandle() = default;
 | 
			
		||||
    StatusCode ExecuteTask(std::shared_ptr<VMediaTask> &task) override;
 | 
			
		||||
    StatusCode StopTask(void) override;
 | 
			
		||||
    StatusCode ClearTask(void) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    CameraTaskType TaskTypeConvert(const MediaTaskType &type);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::mutex mMutex;
 | 
			
		||||
    const MediaChannel &mMediaChannel;
 | 
			
		||||
    std::shared_ptr<VCameraHal> mCameraHal;
 | 
			
		||||
    std::weak_ptr<VMediaTask> mCurrentTask;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -14,19 +14,31 @@
 | 
			
		|||
 */
 | 
			
		||||
#include "MediaManagerImpl.h"
 | 
			
		||||
#include "ILog.h"
 | 
			
		||||
#include "MediaHandle.h"
 | 
			
		||||
StatusCode MediaManagerImpl::Init(void)
 | 
			
		||||
{
 | 
			
		||||
    IHalCpp::GetInstance()->GetCameraHal(mAllCameras);
 | 
			
		||||
    InitMediaHandles(mAllCameras);
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaManagerImpl::UnInit(void)
 | 
			
		||||
{
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaManagerImpl::GetMediaChannel(const MediaChannel &channel, std::shared_ptr<VMediaHandle> &handle)
 | 
			
		||||
{
 | 
			
		||||
    auto it = mAllMediaChannels.find(channel);
 | 
			
		||||
    if (it == mAllMediaChannels.end()) {
 | 
			
		||||
        LogError("GetMediaChannel failed.\n");
 | 
			
		||||
        return CreateStatusCode(STATUS_CODE_NOT_OK);
 | 
			
		||||
    }
 | 
			
		||||
    handle = it->second;
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
StatusCode MediaManagerImpl::SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
 | 
			
		||||
{
 | 
			
		||||
    mMediaMonitor = monitor;
 | 
			
		||||
    SetCamerasMonitor();
 | 
			
		||||
    SetCamerasMonitor(mAllCameras);
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_OK);
 | 
			
		||||
}
 | 
			
		||||
void MediaManagerImpl::ReportEvent(const CameraReportEvent &event)
 | 
			
		||||
| 
						 | 
				
			
			@ -40,11 +52,32 @@ void MediaManagerImpl::ReportEvent(const CameraReportEvent &event)
 | 
			
		|||
    }
 | 
			
		||||
    monitor->ReportEvent(reprot);
 | 
			
		||||
}
 | 
			
		||||
void MediaManagerImpl::SetCamerasMonitor(void)
 | 
			
		||||
void MediaManagerImpl::SetCamerasMonitor(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras)
 | 
			
		||||
{
 | 
			
		||||
    if (allCameras.empty()) {
 | 
			
		||||
        LogWarning("No camera found.\n");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    std::shared_ptr<VCameraHalMonitor> moniter = shared_from_this();
 | 
			
		||||
    for (const auto &camera : mAllCameras) {
 | 
			
		||||
    for (const auto &camera : allCameras) {
 | 
			
		||||
        LogInfo("SetCameraMonitor.\n");
 | 
			
		||||
        camera.second->SetCameraMonitor(moniter);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
void MediaManagerImpl::InitMediaHandles(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras)
 | 
			
		||||
{
 | 
			
		||||
    if (allCameras.empty()) {
 | 
			
		||||
        LogWarning("No camera found.\n");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    for (int i = 0; i < static_cast<int>(CameraType::END); i++) {
 | 
			
		||||
        auto camera = allCameras.find(static_cast<CameraType>(i));
 | 
			
		||||
        if (camera == allCameras.end()) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        MediaChannel channel = static_cast<MediaChannel>(i);
 | 
			
		||||
        std::shared_ptr<VMediaHandle> media = std::make_shared<MediaHandle>(channel, camera->second);
 | 
			
		||||
        mAllMediaChannels[channel] = media;
 | 
			
		||||
        LogInfo("InitMediaHandles. channel = %d \n", static_cast<MediaChannel>(i));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -26,14 +26,17 @@ public:
 | 
			
		|||
    virtual ~MediaManagerImpl() = default;
 | 
			
		||||
    StatusCode Init(void) override;
 | 
			
		||||
    StatusCode UnInit(void) override;
 | 
			
		||||
    StatusCode GetMediaChannel(const MediaChannel &channel, std::shared_ptr<VMediaHandle> &handle) override;
 | 
			
		||||
    StatusCode SetMediaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
 | 
			
		||||
    void ReportEvent(const CameraReportEvent &event) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void SetCamerasMonitor(void);
 | 
			
		||||
    void SetCamerasMonitor(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras);
 | 
			
		||||
    void InitMediaHandles(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCameras;
 | 
			
		||||
    std::map<MediaChannel, std::shared_ptr<VMediaHandle>> mAllMediaChannels;
 | 
			
		||||
    std::weak_ptr<VMediaMonitor> mMediaMonitor;
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -57,6 +57,8 @@ TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_KeyControl2)
 | 
			
		|||
 */
 | 
			
		||||
TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_KeyControlClick)
 | 
			
		||||
{
 | 
			
		||||
    SetAllCamerasResult(mAllCamerasMock);
 | 
			
		||||
    MockOtherSideIpcMissionReply(IpcMission::TEST);
 | 
			
		||||
    MainThread::GetInstance()->Init();
 | 
			
		||||
    TestManager::ResetTimeOut(1000 * 3);
 | 
			
		||||
    HalTestTool::MockKeyClick("reset", 200); // Simulate pressing a button.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,20 @@ void CameraHalTest::SetCameraMonitorTrace(std::shared_ptr<VCameraHalMonitor> &mo
 | 
			
		|||
{
 | 
			
		||||
    LogWarning("SetCameraMonitorTrace.\n");
 | 
			
		||||
}
 | 
			
		||||
StatusCode CameraHalTest::StartSingleTask(const CameraTaskParam ¶m)
 | 
			
		||||
{
 | 
			
		||||
    LogInfo("CameraHalTest::StartSingleTask\n");
 | 
			
		||||
    StatusCode code = StartSingleTaskTrace(param);
 | 
			
		||||
    // if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
 | 
			
		||||
    //     return HalCpp::GetAllKeys(allKeys);
 | 
			
		||||
    // }
 | 
			
		||||
    return code;
 | 
			
		||||
}
 | 
			
		||||
StatusCode CameraHalTest::StartSingleTaskTrace(const CameraTaskParam ¶m)
 | 
			
		||||
{
 | 
			
		||||
    LogInfo("CameraHalTest::StartSingleTaskTrace\n");
 | 
			
		||||
    return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
 | 
			
		||||
}
 | 
			
		||||
CameraHalMock::CameraHalMock(const CameraType &cameraType) : CameraHalTest(cameraType)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,9 +22,11 @@ public:
 | 
			
		|||
    CameraHalTest(const CameraType &cameraType);
 | 
			
		||||
    virtual ~CameraHalTest() = default;
 | 
			
		||||
    void SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor) override;
 | 
			
		||||
    StatusCode StartSingleTask(const CameraTaskParam ¶m) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    virtual void SetCameraMonitorTrace(std::shared_ptr<VCameraHalMonitor> &monitor);
 | 
			
		||||
    virtual StatusCode StartSingleTaskTrace(const CameraTaskParam ¶m);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    const CameraType mCameraType;
 | 
			
		||||
| 
						 | 
				
			
			@ -38,5 +40,6 @@ public:
 | 
			
		|||
    virtual ~CameraHalMock() = default;
 | 
			
		||||
    void MockReportCameraEvent(const CameraReportEvent &event);
 | 
			
		||||
    MOCK_METHOD1(SetCameraMonitorTrace, void(std::shared_ptr<VCameraHalMonitor> &));
 | 
			
		||||
    MOCK_METHOD1(StartSingleTaskTrace, StatusCode(const CameraTaskParam &));
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -327,7 +327,11 @@ void HalTestTool::InitCamerasMock(std::shared_ptr<VCameraHal> &vMock)
 | 
			
		|||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    constexpr int USER_SHOULD_SET_CAMERA_MONITER = 1;
 | 
			
		||||
    // constexpr int SINGLE_TASK_DEFAULT_TIMES = 0;
 | 
			
		||||
    EXPECT_CALL(*mock.get(), SetCameraMonitorTrace(_)).Times(USER_SHOULD_SET_CAMERA_MONITER);
 | 
			
		||||
    EXPECT_CALL(*mock.get(), StartSingleTaskTrace(_))
 | 
			
		||||
        .Times(AnyNumber())
 | 
			
		||||
        .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_OK))));
 | 
			
		||||
}
 | 
			
		||||
void HalTestTool::MockSdCardRemove(std::shared_ptr<LinuxTest> &mock)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								test/middleware/MediaManager/tool/src/MediaHandleMock.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								test/middleware/MediaManager/tool/src/MediaHandleMock.cpp
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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 "MediaHandleMock.h"
 | 
			
		||||
							
								
								
									
										18
									
								
								test/middleware/MediaManager/tool/src/MediaHandleMock.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/middleware/MediaManager/tool/src/MediaHandleMock.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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_MOCK_H
 | 
			
		||||
#define MEDIA_HANDLE_MOCK_H
 | 
			
		||||
#include "MediaHandle.h"
 | 
			
		||||
#endif
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user