1. 功能导入
1.1 代码导入
include/tuya_ipc_album_demo.h
src/tuya_ipc_album_demo.c
1.2 tuya_ipc_stream_storage_demo适配
1.2.1 头文件包含
Code: Select all
#ifdef SUPPORT_ALBUM
#include "tuya_ipc_album.h"
#endif
1.2.2 相册功能初始化
相册功能在本地存储功能中一起初始化,只需要在TUYA_APP_Init_Stream_Storage初始化本地存储时,初始化参数设置相册数量和名臣即可。
Code: Select all
#if defined(SUPPORT_ALBUM) || defined(SUPPORT_ALBUM_EMERGECY) || defined(SUPPOR_PUSH_PANORAMA)
stg_var.album_info.cnt = 1;
memcpy(&stg_var.album_info.album_name[0], TUYA_IPC_ALBUM_EMERAGE_FILE,strlen(TUYA_IPC_ALBUM_EMERAGE_FILE));
#endif
PR_DEBUG("Init Stream_Storage SD:%s", p_local_storage_info->storage_path);
OPERATE_RET ret = tuya_ipc_ss_init(&stg_var);
1.3 tuya_ipc_p2p_demo.c适配
1.3.1 头文件包含
Code: Select all
#ifdef SUPPORT_ALBUM
#include "tuya_ipc_album.h"
#endif
1.3.2 __TUYA_APP_p2p_event_cb回调适配
相册功能需要在p2p event回调中,处理相册相关的协议。
Code: Select all
#ifdef SUPPORT_ALBUM
case MEDIA_STREAM_ALBUM_QUERY: /* query album */
{
C2C_QUERY_ALBUM_REQ* pSrcType = (C2C_QUERY_ALBUM_REQ*)args;
ret = tuya_ipc_stor_album_cb(event, args);
break;
}
case MEDIA_STREAM_ALBUM_DOWNLOAD_START: /* start download album */
{
C2C_CMD_IO_CTRL_ALBUM_DOWNLOAD_START* pSrcType = (C2C_CMD_IO_CTRL_ALBUM_DOWNLOAD_START*)args;
ret = tuya_ipc_stor_album_cb(event, args);
break;
}
case MEDIA_STREAM_ALBUM_DOWNLOAD_CANCEL: // cancel album
{
C2C_ALBUM_DOWNLOAD_CANCEL* pSrcType = (C2C_ALBUM_DOWNLOAD_CANCEL*)args;
PR_INFO("%s downlaod cancle\n", pSrcType->albumName);
ret = tuya_ipc_stor_album_cb(event, args);
break;
}
case MEDIA_STREAM_ALBUM_DELETE: //delete
{
C2C_CMD_IO_CTRL_ALBUM_DELETE* pSrcType = (C2C_CMD_IO_CTRL_ALBUM_DELETE*)args;
ret = tuya_ipc_stor_album_cb(event, args);
break;
}
#endif
1.4 编译宏
在tuya_ipc_demo_default_cfg.h头文件中添加编译宏SUPPORT_ALBUM
Code: Select all
#define SUPPORT_ALBUM 1
2. 紧急相册
2.1 编译宏
在tuya_ipc_demo_default_cfg.h头文件中添加编译宏SUPPORT_ALBUM和SUPPORT_ALBUM_EMERGECY
Code: Select all
#define SUPPORT_ALBUM 1
#define SUPPORT_ALBUM_EMERGECY 1
2.2 测试命令
如果需要测试紧急相册功能,可以在IPC_APP_simulation中加入以下测试指令
Code: Select all
#ifdef SUPPORT_ALBUM_EMERGECY
/* Simulation of get time for album */
else if (0 == strcmp(test_input, "ipc_emergency_record")) {
album_file_put("ipc_emergency_record");
}
else if (0 == strcmp(test_input, "album_eme2")) {
album_file_put_v2();
}
#endif