From cf6945c57e11d3a679c8b0c789880dc9e0892fde Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 11 Jul 2024 12:03:02 +0800 Subject: [PATCH] =?utf8?q?=E6=94=B9=E4=B8=BAUI=E8=B7=AF=E5=BE=84=E6=8E=A5?= =?utf8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/blemoder/bletest.cpp | 43 ++++--------------- .../service/ble_service/blemoder/bletest.h | 2 + .../service/ble_service/bleservice/bleEvent.c | 14 ++---- 3 files changed, 14 insertions(+), 45 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 900283abc..01520124a 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -87,6 +87,14 @@ void ble_set_ai_Answer_str(char *buf) OHOS::AiVoiceModel::GetInstance().SetAiAnswerStrStr(std::string(buf)); } +char* ble_get_ai_audio_path_str(void) +{ + return (char *)OHOS::AiVoiceModel::GetInstance().GetAIAudioPath().c_str(); +} + + + + uint8_t ble_get_heart_data() { OHOS::HeartRateData *data=(OHOS::HeartRateData*)malloc(sizeof(OHOS::HeartRateData)); @@ -164,41 +172,6 @@ cJSON* ble_get_recs_data() return data_arryJSON; } -// { -// "type":3, -// "list":[ -// { -// "uid":3758, -// "name":"plate_3758.bin", -// "size":129600 -// }, -// { -// "uid":3759, -// "name":"plate_3759.bin", -// "size":129600 -// } -// ] -// } -// 注:MP3文件目录格式 -// { -// "type":2, -// "list": [ -// { -// "uid":2461, //指定唯一编号,便于APP发送编号删除文件 -// "name":"夜曲.mp3", -// "size":3894464, -// "artist":"周杰伦", -// "dur":223000 //歌曲时长,单位毫秒 -// }, -// { -// "uid":2465, //指定唯一编号,便于APP发送编号删除文件 -// "name":"告白气球.mp3", -// "size":3894464, -// "artist":"周杰伦", -// "dur":223000 //歌曲时长,单位毫秒 -// } -// ] -// } Tag_Trailer_t Mp3Trailer; Tag_ID3V2_TAG_T TAG_T; diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index 8d7f2098f..c9f65d3bf 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -261,6 +261,8 @@ void ble_set_ai_Question_str(char *buf); void ble_set_ai_Answer_str(char *buf); +char* ble_get_ai_audio_path_str(void); + /////////////////////////////MP3相关///////////////////////// typedef struct Tag_Trailer diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index b8b2102de..972a7bd1f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -3903,19 +3903,13 @@ static void GetPasswordCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *tota } } -#ifdef AI_USE_PCM -#define AI_RECORD_PCM_PATH "/user/userdata/AiRecording/AIAudio.pcm" -#else -#define AI_RECORD_SBC_PATH "/user/userdata/AiRecording/AIAudio.msbc" -#endif + bool get_AI_PATH_and_size(char *path,uint32_t *size) { - #ifdef AI_USE_PCM - memcpy((void*)path,AI_RECORD_PCM_PATH,strlen(AI_RECORD_PCM_PATH)); - #else - memcpy((void*)path,AI_RECORD_SBC_PATH,strlen(AI_RECORD_SBC_PATH)); - #endif + + memcpy((void*)path,ble_get_ai_audio_path_str(),strlen(ble_get_ai_audio_path_str())); + FILE *fp= fopen(path,"r+"); if(fp) { -- 2.17.1