From: hcj <1224667075@qq.com> Date: Sat, 12 Oct 2024 11:24:15 +0000 (+0800) Subject: 支付宝广播方式修改,改为如果处于支付宝绑定界面,断开广播则重新开启广播,已维持绑定界面一直处于可连接状态 X-Git-Tag: release_V1.2.70_20241020_135402~59^2~4 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1171%2F4;p=mirrors%2FFD230.git 支付宝广播方式修改,改为如果处于支付宝绑定界面,断开广播则重新开启广播,已维持绑定界面一直处于可连接状态 --- 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;