Skip to content

Commit aee6de2

Browse files
authored
Dev camera (tuya#310)
* add tuya_p2p component * add camera-demo * update pull_request_template.md * add camera_demo github-action * fix build error
1 parent 518b456 commit aee6de2

356 files changed

Lines changed: 124502 additions & 15 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
### PR description
2-
[Describe the PR content in detail here]
1+
### PR 描述/PR description
2+
[在此详细描述 PR 的内容]/[Describe the PR content in detail here]
33

44

5-
### Code Quality:
6-
As part of this pull request, I've considered the following:
7-
- [ ] Ensure that the code comments and documentation are clear, and use English for comments to ensure code readability.
8-
9-
- [ ] Ensure that the file header follows the [File Header Format](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#file-header-format).
10-
11-
- [ ] Ensure that function headers follow the Doxygen format as specified in [Comments](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#comments).
12-
13-
- [ ] Reviewed the [Coding Style Guide](https://www.tuyaopen.ai/docs/contribute/coding-style-guide) and verified code style compliance, including indentation, spacing, naming conventions, and other style guidelines.
14-
15-
- [ ] Have used the [code-formatting](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#code-formatting) source code formatting tool to ensure compliance with TuyaOpen coding standards.
16-
5+
### 代码质量/Code Quality:
6+
在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following:
7+
- [ ] 确保代码注释和文档清晰,并使用英文注释以保证代码可读性。Ensure that the code comments and documentation are clear, and use English for comments to ensure code readability.
8+
- [ ] 确保文件头遵循[文件头格式](https://www.tuyaopen.ai/zh/docs/contribute/coding-style-guide#%E5%A4%B4%E6%96%87%E4%BB%B6)。Ensure that the file header follows the [File Header Format](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#file-header-format).
9+
- [ ] 确保函数头遵循 [Doxygen 格式](https://www.tuyaopen.ai/zh/docs/contribute/coding-style-guide#%E6%B3%A8%E9%87%8A)。Ensure that function headers follow the Doxygen format as specified in [Comments](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#comments).
10+
- [ ] 已查阅 [编码风格指南](https://www.tuyaopen.ai/zh/docs/contribute/coding-style-guide),并核查代码风格合规性,包括缩进、空格、命名规范及其他风格要求。 Reviewed the [Coding Style Guide](https://www.tuyaopen.ai/docs/contribute/coding-style-guide) and verified code style compliance, including indentation, spacing, naming conventions, and other style guidelines.
11+
- [ ] 已使用[代码格式化工具](https://www.tuyaopen.ai/zh/docs/contribute/coding-style-guide#%E6%A0%BC%E5%BC%8F%E5%8C%96%E4%BB%A3%E7%A0%81)确保符合 TuyaOpen 编码规范。Have used the [code-formatting](https://www.tuyaopen.ai/docs/contribute/coding-style-guide#code-formatting) source code formatting tool to ensure compliance with TuyaOpen coding standards.

.github/workflows/check-build-apps.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
. ./export.sh
3939
cd ${{ github.workspace }}/apps/tuya.ai/your_otto_robot
4040
tos.py dev bac -d ${{ github.workspace }}/dist
41+
- name: Check [camera_demo] Build
42+
run: |
43+
cd ${{ github.workspace }}
44+
. ./export.sh
45+
cd ${{ github.workspace }}/apps/tuya_cloud/camera_demo
4146
- name: Check [weather_get_demo] Build
4247
run: |
4348
cd ${{ github.workspace }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
##
2+
# @file CMakeLists.txt
3+
# @brief
4+
#/
5+
6+
# APP_PATH
7+
set(APP_PATH ${CMAKE_CURRENT_LIST_DIR})
8+
9+
# APP_NAME
10+
get_filename_component(APP_NAME ${APP_PATH} NAME)
11+
12+
# APP_SRCS
13+
aux_source_directory(${APP_PATH}/src APP_SRCS)
14+
15+
set(APP_INC ${APP_PATH}/include)
16+
17+
########################################
18+
# Target Configure
19+
########################################
20+
add_library(${EXAMPLE_LIB})
21+
22+
target_sources(${EXAMPLE_LIB}
23+
PRIVATE
24+
${APP_SRCS}
25+
)
26+
27+
target_include_directories(${EXAMPLE_LIB}
28+
PRIVATE
29+
${APP_INC}
30+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
config CAMERA_DEMO
2+
bool
3+
default y
4+
select ENABLE_TUYA_P2P

apps/tuya_cloud/camera_demo/app_default.config

Whitespace-only changes.

apps/tuya_cloud/camera_demo/config/Ubuntu.config

Whitespace-only changes.
4.26 MB
Binary file not shown.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* @file reset_netcfg.c
3+
* @brief Implements reset network configuration functionality for IoT devices
4+
*
5+
* This source file provides the implementation of the reset network configuration
6+
* functionality required for IoT devices. It includes functionality for managing
7+
* reset counters, handling reset events, and clearing network configurations.
8+
* The implementation supports integration with the Tuya IoT platform and ensures
9+
* proper handling of reset-related operations. This file is essential for developers
10+
* working on IoT applications that require robust network configuration reset mechanisms.
11+
*
12+
* @copyright Copyright (c) 2021-2025 Tuya Inc. All Rights Reserved.
13+
*/
14+
15+
#ifndef __RESET_NETCFG_H__
16+
#define __RESET_NETCFG_H__
17+
18+
#include "tuya_cloud_types.h"
19+
20+
#ifdef __cplusplus
21+
extern "C" {
22+
#endif
23+
24+
/***********************************************************
25+
************************macro define************************
26+
***********************************************************/
27+
28+
/***********************************************************
29+
***********************typedef define***********************
30+
***********************************************************/
31+
32+
/***********************************************************
33+
********************function declaration********************
34+
***********************************************************/
35+
/**
36+
* @brief Starts the network configuration reset process.
37+
*
38+
* This function initiates the process to reset the network configuration
39+
* of the device. It is typically used to clear existing network settings
40+
* and prepare the device for reconfiguration.
41+
*
42+
* @return int Returns 0 on success, or a negative value on failure.
43+
*/
44+
int reset_netconfig_start(void);
45+
46+
/**
47+
* @brief Checks the status of the network configuration reset process.
48+
*
49+
* This function verifies whether the network configuration reset process
50+
* has been completed successfully or is still in progress.
51+
*
52+
* @return int Returns 0 on success, or a negative value on failure.
53+
*/
54+
int reset_netconfig_check(void);
55+
56+
#ifdef __cplusplus
57+
}
58+
#endif
59+
60+
#endif /* __RESET_NETCFG_H__ */
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @file tuya_config.h
3+
* @brief IoT specific configuration file
4+
*
5+
* @copyright Copyright (c) 2021-2024 Tuya Inc. All Rights Reserved.
6+
*/
7+
8+
#ifndef TUYA_CONFIG_H_
9+
#define TUYA_CONFIG_H_
10+
11+
/**
12+
* @brief configure the product information
13+
*
14+
* TUYA_PRODUCT_ID: PID, create on the Tuya IoT platform
15+
* TUYA_DEVICE_UUID: UUID, create on the Tuya IoT platform
16+
* TUYA_DEVICE_AUTHKEY: AUTHKEY, create on the Tuya IoT platform
17+
*
18+
* detail please refer to:
19+
* 1. Create the product and get the pid:
20+
* https://developer.tuya.com/cn/docs/iot-device-dev/application-creation?id=Kbxw7ket3aujc
21+
* 2. Get the open-sdk license code or module: https://platform.tuya.com/purchase/index?type=6
22+
*
23+
* warning: please replace these production information with your product id
24+
* and license, otherwise the demo cannot work.
25+
*
26+
*/
27+
// clang-format off
28+
#define TUYA_PRODUCT_ID "urj3rcaetqy6l6zd" // Please change your product id
29+
#define TUYA_OPENSDK_UUID "uuidxxxxxxxxxxxxxxxx" // Please change the correct uuid
30+
#define TUYA_OPENSDK_AUTHKEY "keyxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // Please change the correct authkey
31+
32+
/**
33+
* @brief PINCODE for AP provisioning
34+
*
35+
* TUYA_NETCFG_PINCODE: a random PINCODE for AP provisioning, PINCODE was generated BY TUYA PMS system!!!
36+
*
37+
* WARNING: PINCODE is mandatory for AP provisioning
38+
*/
39+
// #define TUYA_NETCFG_PINCODE "69832860"
40+
41+
// clang-format on
42+
43+
#endif
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* @file tuya_ipc_demo.h
3+
* @brief Header file for Tuya IPC demo functionality
4+
*
5+
* This header file provides the interface declarations for the Tuya IPC demo
6+
* functionality required for video streaming applications. It includes function
7+
* declarations for managing demo video files, handling video frame processing,
8+
* and providing callback functions for media streaming. The interface supports
9+
* integration with the Tuya IoT platform and ensures proper handling of video
10+
* streaming operations. This file is essential for developers working on IoT
11+
* camera applications that require robust video streaming mechanisms.
12+
*
13+
* @copyright Copyright (c) 2021-2025 Tuya Inc. All Rights Reserved.
14+
*/
15+
16+
#ifndef __TUYA_IPC_DEMO_H__
17+
#define __TUYA_IPC_DEMO_H__
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
#include "tuya_ipc_p2p.h"
24+
25+
/**
26+
* @brief Initialize demo video file
27+
*/
28+
void tuya_ipc_demo_start(void);
29+
30+
/**
31+
* @brief Clean up demo resources
32+
*/
33+
void tuya_ipc_demo_end(void);
34+
35+
/**
36+
* @brief Signal disconnect callback function
37+
* @return 0 on success
38+
*/
39+
int demo_on_signal_disconnect_callback(void);
40+
41+
/**
42+
* @brief Get video frame callback function
43+
* @param media_frame Media frame structure
44+
* @return 0 on success, -1 on failure
45+
*/
46+
int demo_on_get_video_frame_callback(MEDIA_FRAME *media_frame);
47+
48+
/**
49+
* @brief Get audio frame callback function
50+
* @param media_frame Media frame structure
51+
* @return 0 on success
52+
*/
53+
int demo_on_get_audio_frame_callback(MEDIA_FRAME *media_frame);
54+
55+
#ifdef __cplusplus
56+
}
57+
#endif
58+
59+
#endif /*__TUYA_IPC_DEMO_H__*/

0 commit comments

Comments
 (0)