支付宝广播方式修改,改为如果处于支付宝绑定界面,断开广播则重新开启广播,已维持绑定界面一直处于可连接状态 1171/4
authorhcj <1224667075@qq.com>
Sat, 12 Oct 2024 11:24:15 +0000 (19:24 +0800)
committerhcj <1224667075@qq.com>
Sat, 12 Oct 2024 11:24:15 +0000 (19:24 +0800)
code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModelC.h
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/alipay/include/AlipayC.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/alipay/src/AlipayMainView.cpp
code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.h
code/sdk/application/wearable/service/ble_service/bleservice/bleService.c
code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c

index f7b86ba..9478284 100644 (file)
@@ -17,6 +17,10 @@ extern "C"
 #endif
 #include <stdint.h>
     void set_alarm_id(uint8_t id);
+
+    int testPlayerStart_(char *);
+
+    int AlarmPlayerStop_();
    
 #ifdef __cplusplus
 #if __cplusplus
index f16f4bf..8b59568 100644 (file)
@@ -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 (file)
index 0000000..1d0cb6b
--- /dev/null
@@ -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
index 5f07ed6..398a05d 100644 (file)
@@ -9,6 +9,24 @@
 #include "UiConfig.h"\r
 #include "alipay_feature.h"\r
 #include "custom_utils.h"\r
+#include "AlipayC.h"\r
+\r
+bool is_Alipay_bind(void)\r
+{\r
+    if( OHOS:: AlipayMainView::GetInstance())\r
+    {\r
+        int16 theView = OHOS::AlipayMainView::GetInstance()->GetWhichInter();\r
+        if(theView==OHOS::ALIPAY_BIND_VIEW)\r
+        {\r
+            return true;\r
+        }\r
+        else\r
+        {\r
+            return false;\r
+        }\r
+    }\r
+    return false;\r
+}\r
 \r
 namespace OHOS {\r
 #define ALIPAY_BIND_SUCCESS_RES_TIMER_LENGTH 3000\r
@@ -22,6 +40,8 @@ static const int16 LABEL_FIRST_WIDTH = 150;
 static const int16 LABEL_FIRST_HEIGHT = 45;\r
 static const int16 LABEL_FIRST_FONT = 35;\r
 \r
+\r
+\r
 AlipayMainView::AlipayMainView()\r
 {\r
     g_alipayMainView = this;\r
@@ -73,6 +93,9 @@ void AlipayMainView::OnStart()
         alipayBind->InitView();\r
         startView = ALIPAY_BIND_VIEW;\r
         container[startView] = alipayBind;\r
+        //如果是绑定界面则打开广播\r
+        start_alipay_ble_service();\r
+\r
         AlipayModel::GetInstance()->AlipayStartBind();\r
     } else {\r
         alipayList = new AlipayList(presenter_);\r
@@ -467,11 +490,11 @@ bool AlipayMainView::ChangeUnbindFinishView(int16 thisView)
 \r
 bool AlipayMainView::ChangeBindView(int16 thisView)\r
 {\r
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView");\r
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView");\r
     AlipayModel::GetInstance()->AlipayStartBind();\r
 \r
     /**启动alipay蓝牙服务*/\r
-\r
+    //需要重新打开广播\r
     start_alipay_ble_service();\r
 \r
     if (container[thisView] == nullptr) {\r
@@ -813,6 +836,11 @@ void AlipayMainView::ChangeView(int16 hideView, int16 showView)
     container[hideView]->SetVisible(false);\r
     container[showView]->SetVisible(true);\r
 \r
+    if(hideView==ALIPAY_BIND_VIEW)\r
+    {\r
+        stop_alipay_ble_service();\r
+    }\r
+    \r
     AlipayModel::GetInstance()->SetAlipayInterLis(showView);\r
 \r
     Draw();\r
index 5374ad0..8869448 100644 (file)
@@ -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
index 0e64e0f..4c408b9 100644 (file)
@@ -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);
index ed6a4d3..d5b3d56 100644 (file)
@@ -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
 }
index 6e8eec2..a6bb65f 100644 (file)
@@ -46,6 +46,7 @@ extern "C" {
 #include "BluetoothWrapper.h"\r
 #endif\r
 \r
+\r
 // extern void bts_data_to_uuid_len2(uint16_t uuid_data, bt_uuid_t *out_uuid);\r
 // extern void bts_init_128bit_uuid(const bt_uuid_t *uuid);\r
 // #include "ble_hid_take_photo_server.h"\r
@@ -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);\r
             }\r
         }\r
+\r
+        if(ble_is_Alipay_bind()==true)\r
+        {\r
+            //如果当前页面处于支付宝界面,则重新开广播\r
+            svr_ble_adv_start();\r
+        }\r
        \r
      \r
     }   \r
@@ -450,9 +457,12 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"支付宝连接");\r
         }\r
+\r
+      \r
+            int ret =svr_ble_adv_stop();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"%x",ret);\r
+        \r
       \r
-        int ret =svr_ble_adv_stop();\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"%x",ret);\r
 \r
   \r
         set_phone_info(addr,conn_id);\r
@@ -1599,23 +1609,14 @@ void ble_avd_mode_change(uint8_t mode)
     {\r
         case MODE_BLE_ADV_SRV:\r
             \r
-            if(exit_alipay_gui == 1)//如果进了绑定二维码界面就走这里\r
+            if(get_ble_connect() && g_ble_conn_id!=0)\r
             {\r
-                exit_alipay_gui = 0;\r
-\r
-                printf("ble_advd_start!!!!!!!!! %d %d Bleconnect:%d\r\n",ble_adv_falg,AdverFlag,Bleconnect);\r
-\r
-                if(Bleconnect == GAP_BLE_STATE_CONNECTED )//退出识图还在连接app需要关闭广播数据\r
-                {\r
-                    svr_ble_adv_stop();\r
-                }\r
+                svr_ble_adv_stop();\r
             }\r
-          \r
             break;\r
         case MODE_ALIPAY_ADV_SRV:\r
 \r
             \r
-            exit_alipay_gui = 1;\r
             printf("alipay_ble_advd_start!!!!!!!!! ble_adv_falg: %d ,AdverFlag: %d",ble_adv_falg,AdverFlag);\r
             svr_ble_adv_start(); \r
           \r
index c1890e9..1b2b38d 100644 (file)
@@ -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;