From: penglei <1624952103@qq.com> Date: Sat, 7 Sep 2024 10:51:34 +0000 (+0800) Subject: 优化录音回环产测 X-Git-Tag: release_V1.2.70_20241020_135402~518^2~8 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=c68b2783d941eeb1ea0e7fbaa2a43a9b311ef988;p=mirrors%2FFD230.git 优化录音回环产测 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h index 4c2b912ab..0af074d53 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h @@ -1,3 +1,13 @@ +/* + * @Author: penglei 1624952103@qq.com + * @Date: 2024-08-23 10:50:37 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-09-07 18:04:07 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophone.h + * @Description: + * + * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. + */ #ifndef TEST_MICRPHONE_VIEW_H #define TEST_MICRPHONE_VIEW_H @@ -41,7 +51,7 @@ namespace OHOS virtual ~testmicrohoneView(); static testmicrohoneView *GetInstance(void); void buttoncallback(); - + void addvolumebuttoncallback(); UIScrollView *testmicrophoneInitIView(uint8_t); void ClearAll(void); private: @@ -49,7 +59,7 @@ namespace OHOS bool testphoneScrollViewcrollViewinit(uint8_t); UIScrollView *testmakephoneScrollView{nullptr}; UILabelButtonExt* labelButton_next = nullptr; - UILabelButtonExt* button{NULL}; + UILabelButtonExt* button[2]{NULL}; bool initViewStatus{false}; UILabel *Title{nullptr}; // 标题 }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp index 3cda8dc66..cc2ffad9f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp @@ -255,6 +255,11 @@ namespace OHOS testBTView::GetInstance()->BT_discovery_callback(); } + if(strcmp(view.GetViewId(),"addvolume") == 0) + { + + testmicrohoneView::GetInstance()->addvolumebuttoncallback(); + } #ifdef SUPPORT_A5133_SERVICE if(strcmp(view.GetViewId(),"receive") == 0) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp index 4c8b6419a..8b8f255e2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp @@ -44,16 +44,23 @@ namespace OHOS return g_pSystemAboutTheWatchView; } + int volume = 25; + void testmicrohoneView::ClearAll() { if(testmakephoneScrollView) { testmakephoneScrollView->RemoveAll(); - if(button!=NULL) + if(button[0]!=NULL) + { + delete button[0]; + button[0]=nullptr; + } + if(button[1]!=NULL) { - delete button; - button=nullptr; + delete button[1]; + button[1]=nullptr; } if(labelButton_next) { @@ -74,15 +81,16 @@ namespace OHOS AlarmClockModel::GetInstance()->AlarmPlayerStop(); delete testmakephoneScrollView; testmakephoneScrollView=nullptr; + volume = 25; } } UILabelButtonExt *testmicrohoneView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig) { - UILabelButtonExt *button = new UILabelButtonExt(); + UILabelButtonExt *button= new UILabelButtonExt(); if (button == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button[0] new fail!"); return nullptr; } button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h); @@ -101,9 +109,9 @@ namespace OHOS button->SetOnClickListener(touchListener); // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); - // button->SetOnDragListener(drgListener); + // button[0]->SetOnDragListener(drgListener); - // button->SetDraggable(false); + // button[0]->SetDraggable(false); return button; } @@ -113,7 +121,7 @@ namespace OHOS static char *Path= "/user/userdata/microphone.mp3"; void testmicrohoneView::buttoncallback() { - if(button!=NULL) + if(button[0]!=NULL) { errcode_t ret = 0; if(makphone_falg==0) @@ -128,7 +136,7 @@ namespace OHOS // } // /* ---------------------------------- 开始录音 ---------------------------------- */ // AudioCaptureSample(6, (const char **)args); - ret = uapi_start_audio_test(); + ret = uapi_start_audio_test(volume); if(ret != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " uapi_start_audio_test failed ret : %d ",ret); @@ -136,7 +144,7 @@ namespace OHOS } else { - button->SetText("stop"); + button[0]->SetText("stop"); makphone_falg = 1; } @@ -146,7 +154,7 @@ namespace OHOS // int32_t argc = 1; // uint8_t *argv = (uint8_t*)"stop"; // AudioCaptureSample(argc, (const char **)&argv); - // button->SetText("play"); + // button[0]->SetText("play"); // makphone_falg++; // FILE *file =fopen("/user/userdata/microphone.mp3","rb"); @@ -156,7 +164,7 @@ namespace OHOS // } // fclose(file); uapi_stop_audio_test(); - button->SetText("start"); + button[0]->SetText("start"); makphone_falg = 0; } // else if(makphone_falg==2) @@ -173,6 +181,14 @@ namespace OHOS RootView::GetInstance()->Invalidate(); } + void testmicrohoneView::addvolumebuttoncallback() + { + if(volume <= 45) + { + volume+= 5; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " volumebuttoncallback volume : %d ",volume); + } bool testmicrohoneView::testphoneScrollViewcrollViewinit(uint8_t id) @@ -195,7 +211,7 @@ namespace OHOS /* -------------------------------------------------------------------------- */ ButtonConfig_ext_t buttonconfig; buttonconfig.x = 200; - buttonconfig.y = 200; + buttonconfig.y = 100; buttonconfig.w = 250; buttonconfig.h = 116; buttonconfig.label_x=40; @@ -204,10 +220,23 @@ namespace OHOS buttonconfig.ViewId="testmicrohoneView"; buttonconfig.str="statr"; buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; - button=SetTheButton_ext(buttonconfig); - testmakephoneScrollView->Add(button); + button[0]=SetTheButton_ext(buttonconfig); + testmakephoneScrollView->Add(button[0]); makphone_falg=0; - + + buttonconfig.x = 200; + buttonconfig.y = 300; + buttonconfig.w = 250; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + buttonconfig.ViewId="addvolume"; + buttonconfig.str="+volume"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button[1]=SetTheButton_ext(buttonconfig); + testmakephoneScrollView->Add(button[1]); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); if (draglistener == nullptr) { diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c index 33e752a6a..abec35160 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-06-17 14:31:08 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-09-07 12:28:55 + * @LastEditTime: 2024-09-07 17:59:45 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -1649,7 +1649,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint { //开始录音 uint8_t send_data= 0; - uapi_start_audio_test(); + uapi_start_audio_test(25); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_SPEAKER, 0x01, diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 0dcc41ecb..0ee82b1d4 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -64,6 +64,7 @@ #include "service/a5133_service.h" #include "input_app.h" #endif +#include "broadcast_feature.h" errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg) { @@ -396,7 +397,8 @@ void startup_post_init_task(void) timeinfo = localtime(&rawtime); if(day > 0 && day != timeinfo->tm_mday) { - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA,NULL); + CustomEventPublish(TOPIC_EVENT_NEXTDAY_UPDATE, NULL , 0); + //do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA,NULL); } #ifdef A5133_DEMO_SERVER uapi_button_register_event_cb(a5133_demo_msg_unbind_callback, BUTTON_PWR_CLICKUP_2); @@ -2995,7 +2997,7 @@ typedef struct sample_ai_inst { -errcode_t uapi_start_audio_test(void) +errcode_t uapi_start_audio_test(int volume) { errcode_t ret; sample_ai_inst *inst = TD_NULL; @@ -3017,8 +3019,8 @@ errcode_t uapi_start_audio_test(void) inst->pcm_format.channels = 1; inst->pcm_format.bit_depth = 16; sample_ai_ao_parse_port("adc0", inst); - inst->volume.integer = 25; - + inst->volume.integer = volume; + PRINT("inst->volume.integer : %d\n",inst->volume.integer); ret = sample_ai_player_open(inst); if (ret != ERRCODE_SUCC) { PRINT("sample_ao_player_open error : %d\n", ret); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 5e49f1752..e3f41cdee 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -277,7 +277,7 @@ void uapi_get_a5133_rxdata_timestamp(uint32_t *timestamp); uint32_t uapi_get_a5133_update_state(void); uint32_t uapi_get_a5133_update_state1(void); -errcode_t uapi_start_audio_test(void); +errcode_t uapi_start_audio_test(int volume); errcode_t uapi_stop_audio_test(void);