Databse design.
This commit is contained in:
parent
df3ddf6cd5
commit
b9e2e92df9
|
@ -2,6 +2,8 @@
|
|||
|
||||
## 1.1. 产品概述
|
||||
|
||||
   一款低功耗的IPC产品设计方案。
|
||||
|
||||
## 1.2. 结构设计
|
||||
1. 迷彩外观;
|
||||
2. 抽屉式电池箱组;
|
||||
|
@ -25,8 +27,6 @@
|
|||
10. 光感传感器:白天/黑夜;
|
||||
11. 指示灯:设备状态/SD卡状态/电量/无线信号灯/账号状态;
|
||||
|
||||
### 1.3.2. 生产测试/研发调试
|
||||
|
||||
## 1.4. 软件设计
|
||||
|
||||
### 1.4.1. 多态单例设计模式
|
||||
|
@ -129,6 +129,19 @@ hal
|
|||
|
||||
   通过构建配置文件选择需要实例化的网络服务模块代码。
|
||||
|
||||
##### 1.4.2.1.3. 相机状态管理
|
||||
|
||||
   相机主业务逻辑使用状态机机制进行管理。
|
||||
|
||||
###### 1.4.2.1.3.1. 任务状态
|
||||
|
||||
   任务状态是指相机启动需要执行的任务,可能是拍照 / 视频,可能是其它任务。
|
||||
|
||||
**例如:**
|
||||
1. 移动物体侦测启动;
|
||||
2. 定时启动拍照 / 录像;
|
||||
3. 测试启动;
|
||||
|
||||
#### 1.4.2.2. 中间件(middleware)
|
||||
|
||||
##### 1.4.2.2.1. 中间件概述
|
||||
|
@ -202,25 +215,31 @@ User ->> +ipc_config:初始化
|
|||
ipc_config ->> +i_config:打开配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
alt 打开成功
|
||||
loop 读取所有数据到IPC数据结构体
|
||||
ipc_config ->> +i_config:读取一个数据到IPC数据结构体
|
||||
i_config -->> -ipc_config:return
|
||||
opt 读取失败
|
||||
ipc_config ->> ipc_config:生成默认数据
|
||||
ipc_config ->> +i_config:设置默认数据
|
||||
i_config ->> -ipc_config:return
|
||||
rect rgba(255,220,200,1)
|
||||
loop 读取所有数据到IPC数据结构体
|
||||
ipc_config ->> +i_config:读取一个数据到IPC数据结构体
|
||||
i_config -->> -ipc_config:return
|
||||
rect rgba(255,255,200,1)
|
||||
opt 读取失败
|
||||
ipc_config ->> ipc_config:生成默认数据
|
||||
ipc_config ->> +i_config:设置默认数据
|
||||
i_config ->> -ipc_config:return
|
||||
end
|
||||
end
|
||||
end
|
||||
ipc_config ->> +i_config:关闭配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
end
|
||||
ipc_config ->> +i_config:关闭配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
else 打开失败
|
||||
ipc_config ->> ipc_config:生产默认数据
|
||||
ipc_config ->> +i_config:创建配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
ipc_config ->> +i_config:设置默认数据
|
||||
i_config -->> -ipc_config:return
|
||||
ipc_config ->> +i_config:关闭配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
rect rgba(255,200,200,1)
|
||||
ipc_config ->> ipc_config:生产默认数据
|
||||
ipc_config ->> +i_config:创建配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
ipc_config ->> +i_config:设置默认数据
|
||||
i_config -->> -ipc_config:return
|
||||
ipc_config ->> +i_config:关闭配置文件
|
||||
i_config -->> -ipc_config:return
|
||||
end
|
||||
end
|
||||
ipc_config -->> -User:return
|
||||
User ->> +ipc_config:解初始化
|
||||
|
@ -276,8 +295,27 @@ ipc_config -->> -User:return
|
|||
   提供实现状态机管理机制C++接口,使用鸿蒙状态机开源源码进行改造封装。
|
||||
|
||||
###### 1.4.2.2.7.1. 状态机管理设计模式
|
||||
|
||||
   使用多态单例设计模式,暂定使用鸿蒙状态机开源代码改造实现,后续可替换其它源码或者自研代码。
|
||||
|
||||
##### 1.4.2.2.8. 文件数据库
|
||||
|
||||
   文件数据库负责管理设备的媒体资源(图片 / 视频等)。
|
||||
|
||||
###### 1.4.2.2.8.1. 文件数据设计模式
|
||||
|
||||
   使用混合多态单例模式开发。
|
||||
|
||||
###### 1.4.2.2.8.2. 开源库选型
|
||||
|
||||
   sqlite3开源库,编译成工具类库提供给文件数据库使用。
|
||||
|
||||
###### 1.4.2.2.8.3. 基本功能和业务需求
|
||||
|
||||
1. 对媒体资源文件的增删改查处理;
|
||||
2. 记录媒体资源文件的生成时间,任务(是否发送);
|
||||
3. 业务根据需要,通过数据库判断哪些文件已经发送完成,哪些文件发送失败,哪些文件待发送;
|
||||
|
||||
#### 1.4.2.3. 硬件适配层(hal)
|
||||
|
||||
   负责适配不同的硬件平台。
|
||||
|
@ -485,16 +523,29 @@ https://gitee.com/RT-Thread-Mirror/TinyFrame
|
|||
|
||||
   负责IPC应用和媒体进程之间的协议组包 / 拆包,在协议和业务之间进行转换接口的封装。
|
||||
|
||||
## 1.5. 自动化测试
|
||||
## 1.5. 生产测试/研发调试
|
||||
|
||||
### 1.5.1. 自动化测试概述
|
||||
   基于公版代码派生出来的特定的定制版本,用于辅助生产和测试。
|
||||
|
||||
## 1.6. 自动化测试
|
||||
|
||||
### 1.6.1. 自动化测试概述
|
||||
|
||||
   自动化测试是该产品设计的一大特点,需要严格执行。自动化测试指使用纯代码对业务设计进行测试用例设计,实现业务集成测试的能力。
|
||||
|
||||
### 1.5.2. 自动化测试规范
|
||||
|
||||
### 1.6.2. 自动化测试规范
|
||||
|
||||
1. 每个源码文件在开发时,均要写调试的example,用于验证该文件的接口功能;测试文件的命名规则为:文件名 + “_Test.c(pp)”;
|
||||
例如:
|
||||
* C语言:log_impl.c对应的测试文件为log_impl_Test.cpp;
|
||||
* C++:LogImpl.cpp对应的测试文件为LogImpl_Test.cpp;
|
||||
2.
|
||||
|
||||
## 1.7. 编码规范
|
||||
|
||||
1. 文件命名统一使用大驼峰命名规则;
|
||||
2. 混合多态单例的C++抽象接口头文件需要有Cpp关键字标识;
|
||||
3. 多单单例的头文件 / 类名 统一使用“I”前缀,interface的单词首字母;
|
||||
4. 抽象对象接口类统一使用“V”前缀, virtual的单词首字母;
|
||||
5. 所有函数统一使用大驼峰命名规则;
|
||||
6. 其它遵循华为的编码规范要求;
|
|
@ -10,7 +10,11 @@ namespace IHalTest
|
|||
{
|
||||
InitLog(LOG_EASYLOGGING, nullptr);
|
||||
create_hal_module();
|
||||
IHalInit();
|
||||
StatusCode code = IHalInit();
|
||||
if (IsCodeOK(code))
|
||||
{
|
||||
PrintStringCode(code);
|
||||
}
|
||||
IHalUnInit();
|
||||
destroy_hal_module();
|
||||
UnInitLog();
|
||||
|
|
|
@ -21,6 +21,10 @@ extern "C"
|
|||
const long int mStatusCode;
|
||||
} StatusCode;
|
||||
const StatusCode CreateStatusCode(const long int code);
|
||||
static inline const char *PrintStringCode(const StatusCode code)
|
||||
{
|
||||
return code.mPrintStringCode(code);
|
||||
}
|
||||
static inline bool IsCodeOK(const StatusCode code)
|
||||
{
|
||||
return STATUS_CODE_OK == code.mStatusCode ? true : false;
|
||||
|
|
|
@ -7,7 +7,7 @@ static const char *StatusCodeString[STATUS_CODE_END + 1] = {
|
|||
"STATUS_CODE_NOT_OK",
|
||||
"STATUS_CODE_INVALID_PARAMENTER",
|
||||
"STATUS_CODE_END"};
|
||||
static const char *PrintStringCode(const StatusCode this)
|
||||
static const char *_PrintStringCode_(const StatusCode this)
|
||||
{
|
||||
if (STATUS_CODE_OK <= this.mStatusCode && this.mStatusCode <= STATUS_CODE_END)
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ static bool CodeEqual(const StatusCode code, const char *value)
|
|||
static StatusCode NewStatusCode(const long int code)
|
||||
{
|
||||
StatusCode result = {
|
||||
PrintStringCode,
|
||||
_PrintStringCode_,
|
||||
CodeEqual,
|
||||
code};
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue
Block a user