Skip to content

Commit 0868688

Browse files
author
esma
committed
feat: add dual-communication demo
1 parent a436da6 commit 0868688

File tree

160 files changed

+36991
-1
lines changed

Some content is hidden

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

160 files changed

+36991
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
1. [qcloud-iot-ble-esp32](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/qcloud-iot-ble-esp32)是LLSync标准蓝牙功能在 `ESP32` 上的移植示例。
55
2. [qcloud-iot-ble-nrf52832](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/qcloud-iot-ble-nrf52832)是LLSync标准蓝牙功能在 `nrf52832` 上的移植示例。
66
3. [qcloud-llsync-config-net-esp32](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/qcloud-llsync-config-net-esp32)是LLSync辅助配网功能在 `ESP32` 上的移植示例。
7-
4. [LLSync标准蓝牙认证模版](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/LLSync%E6%A0%87%E5%87%86%E8%93%9D%E7%89%99%E8%AE%A4%E8%AF%81%E6%A8%A1%E7%89%88)是LLSync标准蓝牙功能认证时用到的模版文件。
7+
4. [qcloud-llsync-dual-comm](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/qcloud-llsync-dual-comm)是LLSync双路通信功能在`ESP32`上的移植示例。
8+
5. [LLSync标准蓝牙认证模版](https://github.com/tencentyun/qcloud-iot-explorer-BLE-sdk-embedded-demo/tree/master/LLSync%E6%A0%87%E5%87%86%E8%93%9D%E7%89%99%E8%AE%A4%E8%AF%81%E6%A8%A1%E7%89%88)是LLSync标准蓝牙功能认证时用到的模版文件。
89

910
移植示例仅作为LLSync SDK移植参考使用,同时也欢迎您提交LLSync在其他开发板上的移植示例给我们!
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
project(llsync)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
if (CONFIG_QCLOUD_IOT_C_SDK)
2+
set(srcs
3+
sdk_src/data_template_action.c
4+
sdk_src/data_template_client.c
5+
sdk_src/data_template_client_common.c
6+
sdk_src/data_template_client_json.c
7+
sdk_src/data_template_client_manager.c
8+
sdk_src/data_template_event.c
9+
sdk_src/dynreg.c
10+
sdk_src/json_parser.c
11+
sdk_src/json_token.c
12+
sdk_src/mqtt_client.c
13+
sdk_src/mqtt_client_common.c
14+
sdk_src/mqtt_client_connect.c
15+
sdk_src/mqtt_client_net.c
16+
sdk_src/mqtt_client_publish.c
17+
sdk_src/mqtt_client_subscribe.c
18+
sdk_src/mqtt_client_unsubscribe.c
19+
sdk_src/mqtt_client_yield.c
20+
sdk_src/network_interface.c
21+
sdk_src/network_socket.c
22+
sdk_src/ota_client.c
23+
sdk_src/ota_fetch.c
24+
sdk_src/ota_lib.c
25+
sdk_src/ota_mqtt.c
26+
sdk_src/qcloud_iot_ca.c
27+
sdk_src/qcloud_iot_device.c
28+
sdk_src/qcloud_iot_log.c
29+
sdk_src/qcloud_wifi_config.c
30+
sdk_src/qcloud_wifi_config_comm_service.c
31+
sdk_src/qcloud_wifi_config_device_bind.c
32+
sdk_src/qcloud_wifi_config_error_handle.c
33+
sdk_src/qcloud_wifi_config_log_handle.c
34+
sdk_src/service_mqtt.c
35+
sdk_src/string_utils.c
36+
sdk_src/utils_aes.c
37+
sdk_src/utils_base64.c
38+
sdk_src/utils_getopt.c
39+
sdk_src/utils_hmac.c
40+
sdk_src/utils_httpc.c
41+
sdk_src/utils_list.c
42+
sdk_src/utils_md5.c
43+
sdk_src/utils_ringbuff.c
44+
sdk_src/utils_sha1.c
45+
sdk_src/utils_timer.c
46+
sdk_src/utils_url_download.c
47+
sdk_src/utils_url_upload.c)
48+
49+
list(APPEND srcs
50+
platform/HAL_Airkiss.c
51+
platform/HAL_BTCombo_config.c
52+
platform/HAL_Device_freertos.c
53+
platform/HAL_OS_freertos.c
54+
platform/HAL_Simple_config.c
55+
platform/HAL_Smart_config.c
56+
platform/HAL_Soft_ap.c
57+
platform/HAL_TCP_lwip.c
58+
platform/HAL_Timer_freertos.c
59+
platform/HAL_UDP_lwip.c
60+
platform/HAL_Wifi_api.c)
61+
62+
set(includes include include/exports sdk_src/internal_inc)
63+
64+
endif ()
65+
66+
idf_component_register(SRCS "${srcs}"
67+
INCLUDE_DIRS "${includes}"
68+
REQUIRES json mbedtls qcloud_llsync esp_wifi)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
menu "QCloud Iot C"
2+
config QCLOUD_IOT_C_SDK
3+
4+
bool "QCloud Iot C SDK."
5+
default "y"
6+
7+
endmenu
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* #undef AUTH_MODE_CERT */
2+
#define AUTH_MODE_KEY
3+
#define AUTH_WITH_NOTLS
4+
/* #undef GATEWAY_ENABLED */
5+
/* #undef COAP_COMM_ENABLED */
6+
#define OTA_MQTT_CHANNEL
7+
/* #undef SYSTEM_COMM */
8+
/* #undef EVENT_POST_ENABLED */
9+
/* #undef ACTION_ENABLED */
10+
#define DEV_DYN_REG_ENABLED
11+
/* #undef LOG_UPLOAD */
12+
/* #undef IOT_DEBUG */
13+
#define DEBUG_DEV_INFO_USED
14+
/* #undef AT_TCP_ENABLED */
15+
/* #undef AT_UART_RECV_IRQ */
16+
/* #undef AT_OS_USED */
17+
/* #undef AT_DEBUG */
18+
/* #undef OTA_USE_HTTPS */
19+
/* #undef GATEWAY_ENABLED */
20+
/* #undef MULTITHREAD_ENABLED */
21+
/* #undef GATEWAY_DYN_BIND_SUBDEV_ENABLED */
22+
/* #undef ASR_ENABLED */
23+
/* #undef RESOURCE_UPDATE_ENABLED */
24+
#define WIFI_CONFIG_ENABLED
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making IoT Hub
3+
available.
4+
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
5+
6+
* Licensed under the MIT License (the "License"); you may not use this file
7+
except in
8+
* compliance with the License. You may obtain a copy of the License at
9+
* http://opensource.org/licenses/MIT
10+
11+
* Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is
13+
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
KIND,
15+
* either express or implied. See the License for the specific language
16+
governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
21+
#ifndef QCLOUD_IOT_EXPORT_ASR_H_
22+
#define QCLOUD_IOT_EXPORT_ASR_H_
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
#include "qcloud_iot_import.h"
29+
30+
#define REAL_TIME_SLICE_FILE_NAME_LEN (64)
31+
#define VOICE_ID_LEN (16)
32+
33+
// refer to https://cloud.tencent.com/document/product/1093/37823#2.-.E8.BE.93.E5.85.A5.E5.8F.82.E6.95.B0
34+
typedef enum {
35+
eENGINE_8K_EN = 0,
36+
eENGINE_8K_ZH = 1,
37+
eENGINE_8K_ZH_S = 2,
38+
eENGINE_16K_ZH = 3,
39+
eENGINE_16K_ZH_VIDEO = 4,
40+
eENGINE_16K_EN = 5,
41+
eENGINE_16K_CA = 6,
42+
eENGINE_16K_JA = 7,
43+
eENGINE_16K_WUU_SH = 8,
44+
eENGINE_DEFAULT = 9,
45+
} eAsrEngineType;
46+
47+
typedef enum {
48+
eASR_FILE = 0,
49+
eASR_REALTIME = 1,
50+
eASR_SENTENCE = 2,
51+
} eAsrType;
52+
53+
typedef enum {
54+
eVOICE_WAVE = 1,
55+
eVOICE_SPEEX = 4,
56+
eVOICE_SILK = 6,
57+
eVOICE_MP3 = 8,
58+
eVOICE_OPUS = 10,
59+
} eVoiceType;
60+
61+
typedef enum {
62+
eRESPONSE_PER_SLICE = 0,
63+
eRESPONSE_END = 1,
64+
} eResType;
65+
66+
typedef struct _RecordAsrConf_ {
67+
uint32_t request_timeout_ms;
68+
69+
// Required parameters
70+
eAsrType req_type;
71+
eAsrEngineType engine_type;
72+
int ch_num;
73+
74+
// Optional parameters
75+
int filter_dirty;
76+
int filter_modal;
77+
int filter_punc;
78+
int convert_num_mode;
79+
int speaker_diarization;
80+
int speaker_number;
81+
char *hot_word_id;
82+
} RecordAsrConf;
83+
84+
// refer to https://cloud.tencent.com/document/product/1093/35799#.E8.AF.B7.E6.B1.82.E7.BB.93.E6.9E.84
85+
typedef struct _RealTimeAsrConf_ {
86+
uint32_t request_timeout_ms;
87+
char file_name[REAL_TIME_SLICE_FILE_NAME_LEN];
88+
89+
// Required parameters
90+
eAsrType req_type;
91+
eAsrEngineType engine_type;
92+
eResType res_type;
93+
eVoiceType voice_format;
94+
char voice_id[VOICE_ID_LEN + 1];
95+
int seq;
96+
int end;
97+
98+
// Optional parameters
99+
int need_vad;
100+
int vad_silence_time;
101+
int filter_dirty;
102+
int filter_modal;
103+
int filter_punc;
104+
int convert_num_mode;
105+
char *hot_word_id;
106+
} RealTimeAsrConf;
107+
108+
typedef void (*OnAsrResultCB)(uint32_t request_id, char *res_text, int total_resutl_num, int resutl_seq);
109+
110+
typedef int (*OnAsrResourceEventUsrCallback)(void *pContext, const char *msg, uint32_t msgLen, int event);
111+
112+
/**
113+
* @brief Init asr client
114+
* MQTT Client should be constructed beforehand
115+
*
116+
* @param product_id: product Id
117+
* @param device_name: device name
118+
* @param pTemplate_client: data template client
119+
* @param usr_cb: user callback
120+
*
121+
* @return a valid asr client handle when success, or NULL otherwise
122+
*/
123+
void *IOT_Asr_Init(const char *product_id, const char *device_name, void *pTemplate_client,
124+
OnAsrResourceEventUsrCallback usr_cb);
125+
126+
/**
127+
* @brief Destroy asr client
128+
*
129+
* @param handle: asr client handle
130+
*
131+
* @return QCLOUD_RET_SUCCESS when success, or err code for failure
132+
*/
133+
int IOT_Asr_Destroy(void *handle);
134+
135+
/**
136+
* @brief Record file asr request
137+
*
138+
* @param handle: asr client handle
139+
*
140+
* @param file_name: record file name with path
141+
*
142+
* @param conf: record file parameter and request conf
143+
*
144+
* @param cb: callback function when asr result received
145+
*
146+
* @return QCLOUD_RET_SUCCESS when success, or err code for failure
147+
*/
148+
int IOT_Asr_RecordFile_Request(void *handle, const char *file_name, RecordAsrConf *conf, OnAsrResultCB cb);
149+
150+
/**
151+
* @brief Realtime asr
152+
*
153+
* @param handle: asr client handle
154+
*
155+
* @param audio_buff: audio data with encoding,like wav/speex/silk/mp3/opus
156+
*
157+
* @param audio_data_len: audio data len
158+
*
159+
* @param conf: real time audio data parameter and request conf
160+
*
161+
* @param cb: callback function when asr result received
162+
*
163+
* @return QCLOUD_RET_SUCCESS when success, or err code for failure
164+
*/
165+
int IOT_Asr_Realtime_Request(void *handle, char *audio_buff, uint32_t audio_data_len, RealTimeAsrConf *conf,
166+
OnAsrResultCB cb);
167+
#ifdef __cplusplus
168+
}
169+
#endif
170+
171+
#endif /* QCLOUD_IOT_EXPORT_OTA_H_ */

0 commit comments

Comments
 (0)