-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/dueros_handler' into 'master'
DuerOS: Overwrite dueros response handler and update the userAgent in profile See merge request adf/esp-adf-internal!1350
- Loading branch information
Showing
14 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
Binary file modified
BIN
+102 KB
(100%)
components/clouds/dueros/lightduer/esp32/libduer-device-v5x.a
Binary file not shown.
Binary file modified
BIN
+163 KB
(100%)
components/clouds/dueros/lightduer/esp32p4/libduer-device-v5x.a
Binary file not shown.
Binary file modified
BIN
+83.7 KB
(100%)
components/clouds/dueros/lightduer/esp32s3/libduer-device-v5x.a
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
set(COMPONENT_SRCS "duer_audio_wrapper.c" "dueros_app.c" "app_main.c") | ||
set(COMPONENT_ADD_INCLUDEDIRS .) | ||
|
||
register_component() | ||
idf_component_register(SRCS "duer_audio_wrapper.c" "dueros_app.c" "dueros_handler.c" "app_main.c" | ||
INCLUDE_DIRS "." | ||
WHOLE_ARCHIVE) | ||
|
||
spiffs_create_partition_image(spiffs_data ../spiffs FLASH_IN_PROJECT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include <stdarg.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/event_groups.h" | ||
#include "freertos/queue.h" | ||
#include "freertos/semphr.h" | ||
#include "freertos/task.h" | ||
|
||
#include "esp_audio_device_info.h" | ||
#include "lightduer_connagent.h" | ||
#include "lightduer_dcs.h" | ||
#include "lightduer_dipb_data_handler.h" | ||
#include "lightduer_dlp.h" | ||
#include "lightduer_ota_notifier.h" | ||
#include "lightduer_voice.h" | ||
|
||
#include "esp_log.h" | ||
|
||
const static char *TAG = "duer_handler"; | ||
static int32_t cur_voice_id = 0; | ||
|
||
duer_status_t duer_dcs_input_text_handler(const char *text, const char *type) | ||
{ | ||
ESP_LOGW(TAG, "duer_dcs_input_text_handler: %s: %s", type, text); | ||
return DUER_OK; | ||
} | ||
|
||
duer_status_t duer_dcs_render_card_handler(baidu_json *payload) | ||
{ | ||
baidu_json *type = NULL; | ||
baidu_json *content = NULL; | ||
duer_status_t ret = DUER_OK; | ||
|
||
do { | ||
if (!payload) { | ||
ret = DUER_ERR_FAILED; | ||
break; | ||
} | ||
|
||
type = baidu_json_GetObjectItem(payload, "type"); | ||
if (!type) { | ||
ret = DUER_ERR_FAILED; | ||
break; | ||
} | ||
|
||
if (strcmp("TextCard", type->valuestring) == 0) { | ||
content = baidu_json_GetObjectItem(payload, "content"); | ||
if (!content) { | ||
ret = DUER_ERR_FAILED; | ||
break; | ||
} | ||
ESP_LOGW(TAG, "Render card content: %s", content->valuestring); | ||
} | ||
} while (0); | ||
|
||
return ret; | ||
} | ||
|
||
duer_status_t duer_dcs_render_stream_card_handler(const duer_dcs_render_stream_card_t *stream_card_payload) | ||
{ | ||
duer_status_t ret = DUER_OK; | ||
|
||
do { | ||
if (!stream_card_payload) { | ||
ret = DUER_ERR_FAILED; | ||
break; | ||
} | ||
if (stream_card_payload->answer) { | ||
ESP_LOGW(TAG, "Render stream card answer: %s\n", stream_card_payload->answer); | ||
} | ||
ESP_LOGW(TAG, "Render stream card index: %d\n", stream_card_payload->index); | ||
if (stream_card_payload->part) { | ||
ESP_LOGW(TAG, "Render stream card part: %s\n", stream_card_payload->part); | ||
} | ||
if (stream_card_payload->tts) { | ||
ESP_LOGW(TAG, "Render stream card tts: %s\n", stream_card_payload->tts); | ||
} | ||
ESP_LOGW(TAG, "Render stream card end: %d\n", stream_card_payload->is_end); | ||
} while (0); | ||
|
||
return ret; | ||
} | ||
|
||
void duer_dcs_set_voice_handler(int voice_id) | ||
{ | ||
ESP_LOGI(TAG, "set voice id to [%d]", voice_id); | ||
cur_voice_id = voice_id; | ||
// TODO: Save the configuration and load when init | ||
} | ||
|
||
int duer_dcs_get_voice_id(void) | ||
{ | ||
return cur_voice_id; | ||
} |