From cfb326c549c300a5f8fabd4624601edadae37c06 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 12 Oct 2024 19:24:15 +0800 Subject: [PATCH] =?utf8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=B9=BF=E6=92=AD?= =?utf8?q?=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=94=B9=E4=B8=BA?= =?utf8?q?=E5=A6=82=E6=9E=9C=E5=A4=84=E4=BA=8E=E6=94=AF=E4=BB=98=E5=AE=9D?= =?utf8?q?=E7=BB=91=E5=AE=9A=E7=95=8C=E9=9D=A2=EF=BC=8C=E6=96=AD=E5=BC=80?= =?utf8?q?=E5=B9=BF=E6=92=AD=E5=88=99=E9=87=8D=E6=96=B0=E5=BC=80=E5=90=AF?= =?utf8?q?=E5=B9=BF=E6=92=AD=EF=BC=8C=E5=B7=B2=E7=BB=B4=E6=8C=81=E7=BB=91?= =?utf8?q?=E5=AE=9A=E7=95=8C=E9=9D=A2=E4=B8=80=E7=9B=B4=E5=A4=84=E4=BA=8E?= =?utf8?q?=E5=8F=AF=E8=BF=9E=E6=8E=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/alarm/include/AlarmClockModelC.h | 4 +++ .../nativeui/alarm/src/AlarmClockModel.cpp | 16 ++++++++++ .../nativeui/alipay/include/AlipayC.h | 19 +++++++++++ .../nativeui/alipay/src/AlipayMainView.cpp | 32 +++++++++++++++++-- .../ble_service/blemoder/CMakeLists.txt | 1 + .../service/ble_service/blemoder/bletest.cpp | 30 ++++++++++------- .../service/ble_service/blemoder/bletest.h | 4 +++ .../ble_service/bleservice/bleService.c | 27 ++++++++-------- .../peripheral/utils/custom_utils_at_cmd.c | 4 +++ 9 files changed, 110 insertions(+), 27 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/alipay/include/AlipayC.h diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModelC.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModelC.h index f7b86ba4b..9478284fd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModelC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModelC.h @@ -17,6 +17,10 @@ extern "C" #endif #include void set_alarm_id(uint8_t id); + + int testPlayerStart_(char *); + + int AlarmPlayerStop_(); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index f16f4bfd6..8b59568d0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -968,6 +968,20 @@ int AlarmClockModel::AlarmPlayerStart(void) return OHOS_SUCCESS; } +int testPlayerStart_(char *str) +{ + AlarmClockModel::GetInstance()->testPlayerStart(str); + return OHOS_SUCCESS; +} + +int AlarmPlayerStop_() +{ + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + return OHOS_SUCCESS; +} + + + int AlarmClockModel::testPlayerStart(char *str) { @@ -976,6 +990,8 @@ int AlarmClockModel::testPlayerStart(char *str) return OHOS_SUCCESS; } + + void AlarmPlayerCallbackImpl::OnPlaybackComplete() { GraphicService::GetInstance()->PostGraphicEvent( diff --git a/code/sdk/application/wearable/fd230app/nativeui/alipay/include/AlipayC.h b/code/sdk/application/wearable/fd230app/nativeui/alipay/include/AlipayC.h new file mode 100644 index 000000000..1d0cb6be7 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/alipay/include/AlipayC.h @@ -0,0 +1,19 @@ +#ifndef ALIPAY_C_H +#define ALIPAY_C_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" +{ +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +bool is_Alipay_bind(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/alipay/src/AlipayMainView.cpp b/code/sdk/application/wearable/fd230app/nativeui/alipay/src/AlipayMainView.cpp index 5f07ed6aa..398a05dee 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alipay/src/AlipayMainView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alipay/src/AlipayMainView.cpp @@ -9,6 +9,24 @@ #include "UiConfig.h" #include "alipay_feature.h" #include "custom_utils.h" +#include "AlipayC.h" + +bool is_Alipay_bind(void) +{ + if( OHOS:: AlipayMainView::GetInstance()) + { + int16 theView = OHOS::AlipayMainView::GetInstance()->GetWhichInter(); + if(theView==OHOS::ALIPAY_BIND_VIEW) + { + return true; + } + else + { + return false; + } + } + return false; +} namespace OHOS { #define ALIPAY_BIND_SUCCESS_RES_TIMER_LENGTH 3000 @@ -22,6 +40,8 @@ static const int16 LABEL_FIRST_WIDTH = 150; static const int16 LABEL_FIRST_HEIGHT = 45; static const int16 LABEL_FIRST_FONT = 35; + + AlipayMainView::AlipayMainView() { g_alipayMainView = this; @@ -73,6 +93,9 @@ void AlipayMainView::OnStart() alipayBind->InitView(); startView = ALIPAY_BIND_VIEW; container[startView] = alipayBind; + //如果是绑定界面则打开广播 + start_alipay_ble_service(); + AlipayModel::GetInstance()->AlipayStartBind(); } else { alipayList = new AlipayList(presenter_); @@ -467,11 +490,11 @@ bool AlipayMainView::ChangeUnbindFinishView(int16 thisView) bool AlipayMainView::ChangeBindView(int16 thisView) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView"); AlipayModel::GetInstance()->AlipayStartBind(); /**启动alipay蓝牙服务*/ - + //需要重新打开广播 start_alipay_ble_service(); if (container[thisView] == nullptr) { @@ -813,6 +836,11 @@ void AlipayMainView::ChangeView(int16 hideView, int16 showView) container[hideView]->SetVisible(false); container[showView]->SetVisible(true); + if(hideView==ALIPAY_BIND_VIEW) + { + stop_alipay_ble_service(); + } + AlipayModel::GetInstance()->SetAlipayInterLis(showView); Draw(); diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt b/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt index 5374ad0e3..88694480e 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt +++ b/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt @@ -39,6 +39,7 @@ ${ROOT_DIR}/application/wearable/fd230app/nativeui/alarm/include ${ROOT_DIR}/application/wearable/fd230app/nativeui/musicplayer/include ${ROOT_DIR}/application/wearable/fd230app/nativeui/schedule/include ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits +${ROOT_DIR}/application/wearable/nativeapp/nativeui/alipay/include # /home/hcj/FD230/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/engines/gfx/gfx_engine_manager.h ${ROOT_DIR}/application/wearable/fd230app/nativeui/alipay/include # /home/hcj/FD230/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h 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 0e64e0f2e..4c408b9de 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -89,6 +89,12 @@ extern "C" { #include "ScheduleData.h" #include "alipay_feature.h" #include "transmitting.h" +#include "AlipayC.h" + +bool ble_is_Alipay_bind(void) +{ + return is_Alipay_bind(); +} void set_ota_upgrade(void) { @@ -96,18 +102,18 @@ void set_ota_upgrade(void) p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_OTA_UPGRADE,1); } -// void test_paly(uint8_t falg) -// { -// if(falg) -// { -// AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3"); -// } -// else -// { -// AlarmClockModel::GetInstance()->AlarmPlayerStop(); -// } - -// } +void test_paly(uint8_t falg) +{ + if(falg) + { + testPlayerStart_("/music/ring/ring.mp3"); + } + else + { + AlarmPlayerStop_(); + } + +} bool get_training_spead_path(char *path ,uint32_t time,uint32_t max_len) { std::string str= OHOS::TraingModel::GetInstance()->GetPaceTablePath(time); 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 ed6a4d36f..d5b3d563d 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -402,6 +402,10 @@ void set_goal_step_notification(uint8_t data); void set_ota_upgrade(void); +void test_paly(uint8_t falg); + +bool ble_is_Alipay_bind(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index 6e8eec268..a6bb65ff9 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -46,6 +46,7 @@ extern "C" { #include "BluetoothWrapper.h" #endif + // extern void bts_data_to_uuid_len2(uint16_t uuid_data, bt_uuid_t *out_uuid); // extern void bts_init_128bit_uuid(const bt_uuid_t *uuid); // #include "ble_hid_take_photo_server.h" @@ -438,6 +439,12 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl ble_ancs_client_clear(conn_id); } } + + if(ble_is_Alipay_bind()==true) + { + //如果当前页面处于支付宝界面,则重新开广播 + svr_ble_adv_start(); + } } @@ -450,9 +457,12 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"支付宝连接"); } + + + int ret =svr_ble_adv_stop(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"%x",ret); + - int ret =svr_ble_adv_stop(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"%x",ret); set_phone_info(addr,conn_id); @@ -1599,23 +1609,14 @@ void ble_avd_mode_change(uint8_t mode) { case MODE_BLE_ADV_SRV: - if(exit_alipay_gui == 1)//如果进了绑定二维码界面就走这里 + if(get_ble_connect() && g_ble_conn_id!=0) { - exit_alipay_gui = 0; - - printf("ble_advd_start!!!!!!!!! %d %d Bleconnect:%d\r\n",ble_adv_falg,AdverFlag,Bleconnect); - - if(Bleconnect == GAP_BLE_STATE_CONNECTED )//退出识图还在连接app需要关闭广播数据 - { - svr_ble_adv_stop(); - } + svr_ble_adv_stop(); } - break; case MODE_ALIPAY_ADV_SRV: - exit_alipay_gui = 1; printf("alipay_ble_advd_start!!!!!!!!! ble_adv_falg: %d ,AdverFlag: %d",ble_adv_falg,AdverFlag); svr_ble_adv_start(); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index c1890e998..1b2b38d83 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -1118,6 +1118,10 @@ static uint32_t BLE_TEST(uint8_t *para, uint32_t paraLen, char *strCommonCmd) break; case 17: CustomEventPublish(TOPIC_EVENT_GOAL_SHOW_VIEW,(uint8_t *)&type_2,1); + break; + case 18: + test_paly(type_2); + break; default: break; -- 2.17.1