This commit is contained in:
Fancy code 2024-05-23 14:22:40 +08:00
parent cf45a7d007
commit 59fccf3ad1
12 changed files with 216 additions and 45 deletions

View File

@ -16,6 +16,7 @@
#include "ILog.h"
#include "MissionManager.h"
#include "OnMissionState.h"
#include "PirTriggeredMissionState.h"
#include "SdCardHandleState.h"
#include "StorageHandleState.h"
#include "TestMissionState.h"
@ -67,6 +68,10 @@ std::shared_ptr<State> MissionManagerMakePtr::CreateMissionState(const IpcMissio
LogInfo("MissionManagerMakePtr::CreateMissionState\n");
std::shared_ptr<State> state;
switch (mission) {
case IpcMission::PIR_TRIGGERED:
LogInfo("Create PirTriggeredMissionState.\n");
state = std::make_shared<PirTriggeredMissionState>();
break;
case IpcMission::TEST:
LogInfo("Create TestMissionState.\n");
state = std::make_shared<TestMissionState>();

View 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 "PirTriggeredMissionState.h"
#include "ILog.h"
#include "IStorageManager.h"
#include "MissionStateMachine.h"
PirTriggeredMissionState::PirTriggeredMissionState() : MissionState("PirTriggeredMissionState")
{
// mEventHandle[InternalStateEvent::ANY_STATE_SD_STATUS_PERORIED] =
// std::bind(&PirTriggeredMissionState::SdCardEventReportSendToApp, this, _1);
}
void PirTriggeredMissionState::GoInState()
{
MissionState::GoInState();
LogInfo(" ========== PirTriggeredMissionState::GoInState.\n");
}
void PirTriggeredMissionState::GoOutState()
{
MissionState::GoOutState();
LogInfo(" ========== PirTriggeredMissionState::GoOutState.\n");
}
bool PirTriggeredMissionState::SdCardEventReportSendToApp(VStateMachineData *msg)
{
return EXECUTED;
}

View File

@ -0,0 +1,31 @@
/*
* 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 PIR_TRIGGERED_MISSION_STATE_H
#define PIR_TRIGGERED_MISSION_STATE_H
#include "IStateMachine.h"
#include "IStorageManager.h"
#include "MissionState.h"
class PirTriggeredMissionState : public MissionState
{
public:
PirTriggeredMissionState();
virtual ~PirTriggeredMissionState() = default;
void GoInState() override;
void GoOutState() override;
private:
bool SdCardEventReportSendToApp(VStateMachineData *msg);
};
#endif

View File

@ -72,3 +72,7 @@ typedef struct app_get_product_info
std::string mSp;
} AppGetProductInfo;
```
### 1.1.5. 文件命名
* 文件名必须使用驼峰命名法,且首字母大写;

60
doc/git_guide.md Normal file
View File

@ -0,0 +1,60 @@
# 1. git使用手册
## 1.1. 概述
&emsp;&emsp;git是分布式版本控制系统在多人开发中git可以很好的管理代码的版本。
## 1.2. 源码托管服务器
&emsp;&emsp;github和gitlab还有gitee国产都是开源的代码托管服务器可以用来管理源码。
## 1.3. git安装
## 1.4. git分支管理
### 1.4.1. git创建本地分支
* 基于远端分支创建一个本地分支,同时新建一个对应的远端分支:
&emsp;&emsp;当主干发生较大变化例如原厂更新sdk时需要新建分支划分界限。
```
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/app_test
remotes/origin/master
$ git checkout -b master-sdk-202405 origin/master
M ipc-sdk
Branch 'master-sdk-202405' set up to track remote branch 'master' from 'origin'.
Switched to a new branch 'master-sdk-202405'
$ git branch -a
master
* master-sdk-202405
remotes/origin/HEAD -> origin/master
remotes/origin/app_test
remotes/origin/master
$ git push origin master-sdk-202405:sdk-202405
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 250 bytes | 250.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
remote: Create a pull request for 'sdk-202405' on Gitee by visiting:
remote: https://gitee.com/shenzhen-jiuyilian/ipc-rk1106/pull/new/shenzhen-jiuyilian:sdk-202405...shenzhen-jiuyilian:master
To gitee.com:shenzhen-jiuyilian/ipc-rk1106.git
* [new branch] master-sdk-202405 -> sdk-202405
$ git branch -a
master
* master-sdk-202405
remotes/origin/HEAD -> origin/master
remotes/origin/app_test
remotes/origin/master
remotes/origin/sdk-202405
```
## 1.5. 存疑
* 不同的分支之间如何同步某个文件?

View File

@ -1,43 +0,0 @@
# 1. **关于使用git爬取、上传文件以及创建本地分支的方法总结**
## 1.1. 背景
为了使一个有多人的开发团队协作的项目拥有统一的规范管理不至于杂乱无章一个可用、好用的代码管理工具的引入是必要的。目前为止笔者所接触到较多的两大代码管理工具分别是gitee和github本篇规范着重介绍gitee。与任何工具一样相使用好gitee就必然需要按照相对应的方法和步骤。本规范用于介绍在gitee上进行文件获取、上传以及本地分支的创建和提交的方法以及以上步骤遇到问题时的解决方法。
## 1.2. 操作方法/步骤及其解析
* 爬取文件git clone (所爬取的地址)
例如git clone https://gitee.com/xxxxxx/git-test.git
tips:当该指令的使用者在某个终端首次使用该指令时,会需要输入处于该仓库中的用户的账号密码,才允许对仓库中的内容进行获取,其表现如下:
~~~
xxxxx@ubuntu:~/2$ git clone https://gitee.com/xxxxxx/git-test.git
正克隆到 'git-test'...
Username for 'https://gitee.com': xxxxxx
Password for 'https://xxxxx@gitee.com':
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 0
展开对象中: 100% (13/13), 4.31 KiB | 1.08 MiB/s, 完成.
~~~
* 提交文件:
核心步骤:
> cd xxx(所需提交的文件的目录)
> git add xxx(将需要提交的内容传至缓存区xxx所需提交的文件的名字)
> git commit -m "xxxxxx"(本次提交内容的行为的备注信息,在一切上传行为中,该步骤都不可省略)
> git pull origin master(将服务器中的最新内容下拉与本地的内容进行比较此处的master可以替换为读者希望下拉到的分支而非固定的master请注意直至下一步之前该步骤是上传前最后的纠错机会请务必确保无误后再操作下一步)
> git push origin master(将缓存区的内容上传至服务器此处的master可以替换为读者希望上传到的分支而非固定的master)
**tips:以上内容仅为上传文件的核心步骤,一般而言,为了规范化流程以减少出现错误的概率,笔者更建议在核心步骤前或后添加以下步骤:**
> git status .(此步骤用以检查区分本地的代码与gitee服务器中的代码的差别即与服务器中的相比读者新增加了哪些操作)
> xxx(核心步骤)xxx
> git log(该步骤可以将操作者所进行过的步骤以log的形式列出来以便操作者找到关键的信息,该步骤建议无论读者完成任何大型操作之后都进行一次,以便检查自己的操作有无失误)
* 创建并提交本地分支
> git branch -a(显示所有的主、分支并指明操作者所在的分支)
> git checkout -b xxxxx origin/master(切换到一个指定名字的分支中如果该分支不存在则在主支之外创建名字为“xxxxx”的本地分支并切换到该分支)
> git branch -a(显示所有的主、分支并指明操作者所在的分支,本次操作是处于谨慎考虑,再次检查自己所在的分支,以免操作失误)
> git add xxx.txt(将需要提交的内容传至缓存区xxx所需提交的文件的名字该步骤只是一个泛指指代一切希望上传到新创建的分区中的内容其在实际场景中极不可能只有一步由于git不允许将没有内容的分支上传到服务器所以该步骤不可省略)
> git commit -m "fenzhi test.("本次提交内容的行为的备注信息,在一切上传行为中,该步骤都不可省略)
> git pull origin KAIFA(将服务器中的最新内容下拉与本地的内容进行比较此处的KAIFA可以替换为读者希望下拉到的分支请注意直至下一步之前该步骤是上传前最后的纠错机会请务必确保无误后再操作下一步)
> git push origin xxxxxx:KAIFA(将缓存区的内容上传至服务器此处的KAIFA可以替换为读者希望上传到的分支xxxxx为操作者新创建的本地分区)
> git log(该步骤可以将操作者所进行过的步骤以log的形式列出来以便操作者找到关键的信息,该步骤建议无论读者完成任何大型操作之后都进行一次,以便检查自己的操作有无失误)

View File

@ -2,4 +2,8 @@
## 1.1. 概述
&emsp;&emsp;SDK使用cmake构建把分层解耦合的独立模块编译成静态库应用程序根据依赖关系进行自动关联链接。
&emsp;&emsp;SDK使用cmake构建把分层解耦合的独立模块编译成静态库应用程序根据依赖关系进行自动关联链接。
## 1.2. 启用/禁用功能模块
&emsp;&emsp;根据不同的产品需求来启用/禁用功能模块,避免编译不需要的模块。

View File

@ -49,7 +49,9 @@
#### 1.2.1.4. 问题列表
1. 如果用户未对设备出厂设置进行修改,如何区分不同的设备?
通过wifi名称进行区分。
2. 如果APP面对多个出厂设备设备信息完全一样如何快速判断连接的是哪个设备
答:音频互动。滴一声表示链接成功。
### 1.2.2. 相机连接页
@ -131,14 +133,18 @@
#### 1.2.2.3. 问题列表
1. 针对软件迭代需求除了一些和APP业务逻辑相关的参数需要特殊处理外是否可以通过协议来获取设备自定义的参数设置方便设备可以随意的增加/删除设置参数。
答:已经支持,看协议能力。
2. 没发现升级功能。
公版APP不支持升级功能。
## 1.3. APP定制整改总结
1. “记录仪”统一修改为“相机”;
答:公版无法修改,需要定制。
2. 本地相册-“紧急”分类改为“PIR”
3. APP连接设备后自动录像改为默认不录像可手动录像
4. APP上的“循环”改成“全部”“拍照”改成“手动”“紧急”改成“PIR”“停车”改成“定时”
答:设备返回非记录仪即可,见能力集。
4. APP上的“循环”改成“全部”“拍照”改成“手动”“紧急”改成“PIR”“停车”改成“定时”**全部包括手动/PIR/定时**
5. 相机设置需要实现设备自定义设置项功能;
## 1.4. 设置界面动态渲染方案设计

View File

@ -51,4 +51,17 @@ TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_OnMissionStateSt
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MainThread::GetInstance()->Runing();
}
/**
* @brief Construct a new test f object
* ../output_files/test/bin/HuntingCameraTest
* --gtest_filter=HuntingCameraTest.HS_INTEGRATION_HunttingCamera_EXAMPLE_PirTriggeredMissionStateStart
*/
TEST_F(HuntingCameraTest, HS_INTEGRATION_HunttingCamera_EXAMPLE_PirTriggeredMissionStateStart)
{
McuManagerTestTool::MockOtherSideIpcMissionReply(IpcMission::PIR_TRIGGERED);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MainThread::GetInstance()->Runing();
}
} // namespace McuManager_Mock_Test

View File

@ -15,6 +15,7 @@
#include "MissionManagerMakePtrTest.h"
#include "ILog.h"
#include "OnMissionStateMock.h"
#include "PirTriggeredMissionStateMock.h"
#include "TestMissionStateMock.h"
#include "TopStateMock.h"
void OverrideMissionManagerMakePtrObject(std::shared_ptr<MissionManagerMock> &appManagerMock)
@ -55,6 +56,10 @@ std::shared_ptr<State> MissionManagerMakePtrTest::CreateMissionState(const IpcMi
LogInfo("MissionManagerMakePtrTest::CreateMissionState\n");
std::shared_ptr<State> state;
switch (mission) {
case IpcMission::PIR_TRIGGERED:
LogInfo("Create PirTriggeredMissionStateMock.\n");
state = std::make_shared<PirTriggeredMissionStateMock>();
break;
case IpcMission::TEST:
LogInfo("Create TestMissionStateMock.\n");
state = std::make_shared<TestMissionStateMock>();

View File

@ -0,0 +1,16 @@
/*
* 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 "PirTriggeredMissionStateMock.h"
#include "ILog.h"

View File

@ -0,0 +1,33 @@
/*
* 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 PIR_TRIGGERED_MISSION_STATE_MOCK_H
#define PIR_TRIGGERED_MISSION_STATE_MOCK_H
#include "MissionManagerTestTool.h"
#include "PirTriggeredMissionState.h"
class PirTriggeredMissionStateTest : public PirTriggeredMissionState
{
public:
PirTriggeredMissionStateTest() = default;
virtual ~PirTriggeredMissionStateTest() = default;
protected:
};
class PirTriggeredMissionStateMock : public PirTriggeredMissionStateTest
{
public:
PirTriggeredMissionStateMock() = default;
virtual ~PirTriggeredMissionStateMock() = default;
};
#endif