整机产测蓝牙部分(得不到扫描结果,未能确认问题) 193/1
authorhcj_ <1224667075@qq.com>
Wed, 29 May 2024 16:09:57 +0000 (00:09 +0800)
committerhcj_ <1224667075@qq.com>
Wed, 29 May 2024 16:09:57 +0000 (00:09 +0800)
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp [new file with mode: 0644]

index 0703faa..d1cd5a8 100644 (file)
@@ -619,6 +619,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/DialingMethodView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/TelephonyInitInterface.cpp
 
+    #产测
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testabout.cpp
@@ -634,7 +635,9 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testcat1.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testhrsenson.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp  
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testold.cpp 
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testold.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbt.cpp 
+    
     #${CMAKE_CURRENT_SOURCE_DIR} /service/acc_service.c
 )
 if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
index c79d6a1..be9a322 100644 (file)
@@ -34,6 +34,7 @@ namespace OHOS
         MICROPHONE,\r
         HRSENSON,\r
         GSENSON,\r
+        BTTEST,\r
         OLDTEST,\r
         DEEPSLEEP,\r
         shutdown,\r
index 663ecfa..facb9a1 100644 (file)
@@ -27,6 +27,8 @@
 #include "producttest/include/testgsenson.h"\r
 #include "producttest/include/testold.h"\r
 \r
+#include "producttest/include/testbt.h"\r
+\r
 namespace OHOS\r
 {\r
     \r
@@ -86,6 +88,8 @@ namespace OHOS
         bool ChangeGTESTView(int16_t thisView);\r
         bool ChangeoldTESTView(int16_t thisView);\r
 \r
+        bool ChangeBTTESTView(int16_t thisView);\r
+\r
         bool ClickFunc(int16_t interface);\r
         void ChangeView(int16_t hideView, int16_t showView);\r
         UIScrollView *GetSystemScrollView(int ViewId);\r
@@ -118,6 +122,7 @@ namespace OHOS
 \r
         testgsensonView *test_G_view{nullptr};\r
         testoldView *test_old_view{nullptr};\r
+        testBTView *test_BT_view{nullptr};\r
 \r
         UILabelButtonExt *button[20]={NULL};\r
         bool initViewStatus{false};\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h
new file mode 100644 (file)
index 0000000..c183d82
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef TEST_BT_VIEW_H
+#define TEST_BT_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
+
+//#include "cmsis_os.h"
+#include <iostream>
+namespace OHOS
+{
+        
+    class testBTView
+    {
+
+    public:
+       struct ButtonConfig_ext_t
+        {
+            int x;
+            int y;
+            int w;
+            int h;
+            const char *str;
+            const char *ViewId;
+            const char *ImageSrc;
+
+            //label
+            int label_x;
+            int label_y;
+            uint8_t ALIGN;
+            int  Fontsize;
+        
+        };
+
+
+        
+        struct LabelConfig
+        {
+            int16_t left;
+            int16_t top;
+            int16_t width;
+            int16_t height;
+            int16_t fontSize;      // 字体大小
+            int16_t lineHeigh;     // 行高
+            char *text;      // 文本
+            uint8_t lineBreakMode; // 断行模式。
+        };
+
+
+        struct cat1_msg
+        {
+            char * imei;
+            int sim;
+            char * oper;
+            uint8_t signal;
+        };
+
+        struct cat1_Ver
+        {
+            char * modem_version;  
+            char * cat1appver;
+        };
+
+
+       
+        
+        testBTView();
+        virtual ~testBTView();
+        static testBTView *GetInstance(void);
+        void dial_112(bool);
+        void BT_discovery_callback(void);
+
+        UIScrollView *testBTInitIView(void);
+        void ClearAll(void);
+        void set_BR_connect(char *);
+        void setcat1vermsg(cat1_Ver);
+    private:
+        UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener);
+        UILabel *InitLabel(LabelConfig &labelConfig);
+        bool testBTScrollViewcrollViewinit(void);
+        UIScrollView *testBTScrollView{nullptr};
+        UILabel *label_1_cat1msg_1=NULL;
+        // UILabel *label_1_cat1msg_oper{nullptr};
+        // UILabel *label_1_cat1msg_sim{nullptr};
+        // UILabel *label_1_cat1msg_signal{nullptr}; 
+        UILabelButtonExt* labelButton_next = nullptr;
+        UILabel *label_BR_connect{nullptr};
+        UILabel *label_1_cat1vison_1{nullptr};
+        bool initViewStatus{false};
+        UILabel *Title{nullptr};           // 标题
+        UILabelButtonExt* button{NULL};
+    };
+}
+#endif
\ No newline at end of file
index 65ea32f..d2f747f 100644 (file)
@@ -51,6 +51,7 @@ namespace OHOS
         {MICROPHONE,"microphonebutton", "hrsensonbutton_next",true},\r
         {HRSENSON,"hrsensonbutton", "gsensonbutton_next",true},\r
         {GSENSON,"gsensonbutton","xxxx" ,true},\r
+        {BTTEST,"BTbutton","xxxx",true},\r
         {OLDTEST,"oldtestbutton","oldtestexit",true},\r
         {DEEPSLEEP,"deepsleep","xxxxxxxxx",true},\r
         {shutdown,"shutdown","xxxxxxxxx",true},\r
@@ -263,7 +264,13 @@ namespace OHOS
 \r
             testhrsenson1View::GetInstance()->leeklight_test(true);\r
         }\r
+         \r
+        if(strcmp(view.GetViewId(),"discovery") == 0)\r
+        { \r
 \r
+            testBTView::GetInstance()->BT_discovery_callback();\r
+        }\r
+       \r
         return false;\r
     }\r
 \r
index 2f67db8..bdba67b 100644 (file)
@@ -31,8 +31,12 @@ namespace OHOS
         {MICROPHONE,"microphonebutton","microphone" ,&testView::ChangeMPTESTView},\r
         {HRSENSON,"hrsensonbutton","hrsensor" ,&testView::ChangeHRTESTView},\r
         {GSENSON,"gsensonbutton","gsensor" ,&testView::ChangeGTESTView},\r
+\r
+        {BTTEST,"BTbutton","BT" ,&testView::ChangeBTTESTView},\r
+\r
         {OLDTEST,"oldtestbutton","aging" ,&testView::ChangeoldTESTView},\r
         {DEEPSLEEP,"deepsleep","CloseBTCat1&Sleep" ,&testView::ChangeoldTESTView},\r
+\r
         {shutdown,"shutdown","shutdown" ,&testView::ChangeoldTESTView},\r
         // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView},\r
         // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
@@ -544,6 +548,23 @@ namespace OHOS
         return true;\r
     }\r
 \r
+     bool testView::ChangeBTTESTView(int16_t thisView)\r
+    {\r
+        if (SystemScrollView[thisView] == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+            test_BT_view = new testBTView();\r
+            if (test_BT_view == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+                return false;\r
+            }\r
+            SystemScrollView[thisView] = test_BT_view->testBTInitIView();\r
+            RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+        }\r
+        return true;\r
+    }\r
+\r
     UIScrollView *testView::GetSystemScrollView(int ViewId)\r
     {\r
         if (SystemScrollView[ViewId] == nullptr)\r
@@ -676,6 +697,13 @@ namespace OHOS
                 test_old_view = nullptr;\r
                 SystemScrollView[hideView]=nullptr;\r
                 break;\r
+            case BTTEST:\r
+                RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
+                delete test_BT_view;  \r
+                test_BT_view = nullptr;\r
+                SystemScrollView[hideView]=nullptr;\r
+                break;\r
+\r
            default:\r
             break;\r
            }\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp
new file mode 100644 (file)
index 0000000..630fe55
--- /dev/null
@@ -0,0 +1,434 @@
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "producttest/include/testPresenter.h"
+#include "producttest/include/testbt.h" 
+#include "AlarmClockModel.h"
+#include "cmsis_os2.h"
+#include "cat1_server.h"
+#include "cat1_ctl.h"
+#include "cat1_server_hal.h"
+#include "custom_runtime.h"
+#include "bts_br_gap.h"
+#include "bts_le_gap.h"
+
+namespace OHOS
+{
+
+    static testBTView *g_pSystemAboutTheWatchView{nullptr};
+
+    testBTView::testBTView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView");
+        g_pSystemAboutTheWatchView = this;
+    }
+
+    testBTView::~testBTView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testBTView::~testBTView");
+        ClearAll();
+        //g_pSystemAboutTheWatchView = nullptr;
+    }
+
+    testBTView *testBTView::GetInstance()
+    {
+
+        return g_pSystemAboutTheWatchView;
+    }
+    static osTimerId_t  Gsenson_TEST_timer=NULL;
+    void testBTView::ClearAll()
+    {
+        if(testBTScrollView)
+        {
+            testBTScrollView->RemoveAll();
+
+            if (Gsenson_TEST_timer != NULL) {
+                osTimerStop(Gsenson_TEST_timer);
+                osTimerDelete(Gsenson_TEST_timer);
+                Gsenson_TEST_timer = NULL;
+                return ;
+            }
+            if(button)
+            {
+                delete button;
+                button=nullptr;
+            }
+            if(labelButton_next)
+            {
+                delete labelButton_next;
+                labelButton_next=nullptr;
+            }
+            if(label_1_cat1msg_1)
+            {
+                delete label_1_cat1msg_1;
+                label_1_cat1msg_1=nullptr;
+            }
+
+            if(label_BR_connect)
+            {
+                delete label_BR_connect;
+                label_BR_connect=nullptr;
+            }
+
+            if(label_1_cat1vison_1)
+            {
+                delete label_1_cat1vison_1;
+                label_1_cat1vison_1=nullptr;
+            }
+
+            if(Title)
+            {
+                delete Title;
+                Title=nullptr;
+            }
+            
+
+            delete testBTScrollView;
+            testBTScrollView=nullptr;
+       }
+    }
+    void testBTView:: set_BR_connect( char* buf)
+    {
+        if(label_BR_connect!=NULL)
+        {
+            label_BR_connect->SetText(buf);
+            RootView::GetInstance()->Invalidate();
+        }
+        
+    }
+    void testBTView:: setcat1vermsg(cat1_Ver t)
+    {
+        
+        if(label_BR_connect!=nullptr)
+        {
+            char buf[124]={0};
+            sprintf(buf,"appver:%s\nmodem_ver:%s\n",t.cat1appver,t.modem_version);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf);
+            label_BR_connect->SetText(buf);
+            RootView::GetInstance()->Invalidate();
+        }
+        
+    }
+
+    UILabelButtonExt *testBTView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig)
+    {
+        UILabelButtonExt *button = new UILabelButtonExt();
+        if (button == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new  fail!");
+            return nullptr;
+        }
+        button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
+        button->SetViewId(buttonconfig.ViewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full);
+        //button->SetStyle(STYLE_BORDER_RADIUS,0);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);
+        //button->SetStyleForState(STYLE_BORDER_RADIUS,0, UIButton::PRESSED);
+        button->SetTouchable(true);
+        button->SetStyle(STYLE_BACKGROUND_OPA, 0x80);
+        button->SetText(buttonconfig.str);
+        button->SetAlign(TEXT_ALIGNMENT_LEFT);
+        button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y );
+        button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);
+        UIView:: OnClickListener *touchListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
+        button->SetOnClickListener(touchListener);
+
+        // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(testPresenter::GetInstance());
+        // button->SetOnDragListener(drgListener);
+
+        // button->SetDraggable(false);
+        return button;
+    }
+    static bool speakfalg=false;
+   
+    static bool discovery_falg=false;
+   
+    void testBTView:: BT_discovery_callback( void)
+    {
+        
+        bool reT_gap;
+        if(discovery_falg==false)
+        {
+            // reT_gap = gap_br_start_discovery();
+            #if BLE_scan
+             reT_gap=gap_ble_start_scan();
+            #else
+            reT_gap = gap_br_start_discovery();
+            #endif
+
+            #if BLE_scan
+            if(reT_gap==ERRCODE_SUCC)
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_start_scan %d !",reT_gap);
+            else
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_start_scan fail %d !",reT_gap);
+            #else
+            if(reT_gap==true)
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_br_start_scan %d !",reT_gap);
+            else
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_br_start_scan fail %d !",reT_gap);
+
+            #endif
+          
+
+            discovery_falg=true;
+        }
+        else
+        {
+             //reT_gap = gap_br_cancel_discovery();
+            #if BLE_scan
+             reT_gap=gap_ble_stop_scan();
+            #else
+              reT_gap = gap_br_cancel_discovery();
+            #endif
+
+
+            #if BLE_scan
+            if(reT_gap==ERRCODE_SUCC)
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_stop_scan %d !",reT_gap);
+            else
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_stop_scan fail %d !",reT_gap);
+            #else
+            if(reT_gap==true)
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_br_cancel_discovery %d !",reT_gap);
+            else
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_br_cancel_discovery fail %d !",reT_gap);
+
+
+            #endif
+
+             discovery_falg=false;
+        } 
+    }
+
+
+     UILabel *testBTView::InitLabel(LabelConfig &labelConfig)
+    {
+        UILabel *label = new UILabel();
+        if (label == nullptr)
+        {
+            return nullptr;
+        }
+        label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小
+        label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize);                                       // 字体大小
+        label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh);                                    // 字体行高
+        label->SetText(labelConfig.text);                                                             // 内容
+        label->SetLineBreakMode(labelConfig.lineBreakMode);                                           // 断行模式。
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize);
+        label->SetAlign(TEXT_ALIGNMENT_LEFT);
+        return label;
+    }
+
+
+    static bd_addr_t bd_addr;
+    static unsigned char addr[6] = {0};
+   static uint8_t number =0;
+
+    static void sample_gap_discovery_result_callback(const bd_addr_t *bd_addr)
+    {
+        unsigned char length = BD_NAME_LEN;
+        unsigned char *device_name = (unsigned char *)(void *)malloc(length);
+        if (device_name == NULL) {
+              WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"gap_discovery_result_callback malloc error!\n");
+            return;
+        }
+        (void)memset_s(device_name, length, 0, length);
+
+        // bool ret1 = gap_get_device_name(scan_result_data->addr, device_name, &length);
+        // int cod = gap_get_device_class(bd_addr);
+        // bool ret2 = gap_read_remote_rssi_value(bd_addr);
+
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RemovePair gap_get_paired_devices_list ret = %s %s", device_name,bd_addr);
+        number++;
+
+        free(device_name);
+    }
+
+    static void sample_gap_discovery_state_changed_callback(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ap_discovery_state_changed_callback status: %d\n", status);
+    }
+
+    static char device_name_buf[64];
+    static void  mgdataTimerCallBack(int data)
+    {
+
+        if(is_bt_discovering(BT_TRANSPORT_INVALID))
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " BT_TRANSPORT_INVALID is_bt_discovering %d",number);
+        }
+        else if(is_bt_discovering(BT_TRANSPORT_BR_EDR))
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " BT_TRANSPORT_BR_EDR is_bt_discovering %d",number);
+        }
+        else if(is_bt_discovering(BT_TRANSPORT_LE))
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " BT_TRANSPORT_LE is_bt_discovering %d",number);
+        }
+        else
+        {
+             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no  bt_discovering %d",number);
+        }
+
+        unsigned int connedDevicesNum = 0;
+
+        bool ret = gap_get_paired_devices_num(&connedDevicesNum);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Setup GetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum);
+
+        if (connedDevicesNum != 0)
+        {
+            gap_paired_device_info_t *devInfo = (gap_paired_device_info_t *)malloc(sizeof(gap_paired_device_info_t) * connedDevicesNum);
+            if (devInfo == NULL) 
+            {
+                return;
+            }
+
+            ret = gap_get_paired_devices_list(devInfo, (int *)&connedDevicesNum);
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RemovePair gap_get_paired_devices_list ret = %d", ret);
+
+
+            for (int i = 0; i < static_cast<int>(connedDevicesNum); ++i) 
+            {
+
+                memcpy_s(device_name_buf,64,devInfo[i].device_name,strlen((const char*)devInfo[i].device_name));
+                testBTView:: GetInstance()->set_BR_connect(device_name_buf);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RemovePair gap_get_paired_devices_list ret = %s", devInfo[i].device_name);
+            }
+             free(devInfo);
+        }
+
+       
+    }
+
+    static void sample_gap_ble_set_scan_param_cbk(errcode_t status)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sample_gap_ble_set_scan_param_cbk%d", status);
+    }
+
+  
+    
+    
+    bool testBTView::testBTScrollViewcrollViewinit(void)
+    {
+
+        testBTScrollView = new UIScrollView();
+        if (testBTScrollView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testBTScrollView new fail!");
+            return false;
+        }
+        testBTScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        testBTScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        testBTScrollView->SetStyle(STYLE_BORDER_RADIUS, 0);
+        testBTScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        testBTScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue);
+
+        LabelConfig Config = {
+            .left = 50,
+            .top = 70,
+            .width = 60,
+            .height = 35,
+            .fontSize = 30,
+            .lineHeigh = 35,
+            .text = "",
+            .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+        };
+
+        label_BR_connect= InitLabel(Config);
+        if (label_BR_connect == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");
+            return false;
+        }
+        testBTScrollView->Add(label_BR_connect);
+        
+        bluetooth_get_local_addr(addr,BD_ADDR_LEN);
+        memcpy(bd_addr.addr,addr,6);
+
+      
+        //enable_bt_stack();
+
+        static gap_call_backs_t cb = 
+        { 
+            .discovery_state_changed_callback=sample_gap_discovery_state_changed_callback,
+            .discovery_result_callback= sample_gap_discovery_result_callback,
+        };
+        //gap_br_set_bt_scan_mode(GAP_SCAN_MODE_GENERAL_DISCOVERABLE,60);  
+       // gap_ble_register_callbacks()
+       
+        //int ret = gap_ble_register_callbacks(&cb);
+
+        int ret= gap_register_callbacks(&cb);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":: %x !",ret);
+        // gap_ble_scan_params_t scan_param = { 0 };
+        // scan_param.scan_interval = 1;
+        // scan_param.scan_window = 5;
+        // scan_param.scan_type = GAP_BLE_SCAN_TYPE_ACTIVE;
+        // scan_param.scan_phy = GAP_BLE_PHY_NO_PACKET;
+        // scan_param.scan_filter_policy = GAP_BLE_ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY;
+        // ret = gap_ble_set_scan_parameters(&scan_param);
+        //bts_sample_log("gap ble set scan parameters ret(errcode_t): %x\n", ret);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":: %x !",ret);
+        // bts_sample_log("gap reg cbk ret %x\n", ret);
+
+       
+
+        //清楚配对
+         gap_remove_all_pairs();
+
+        ButtonConfig_ext_t buttonconfig;
+        buttonconfig.x = 100;
+        buttonconfig.y = 350;
+        buttonconfig.w = 180;
+        buttonconfig.h = 96;
+        buttonconfig.label_x=40;
+        buttonconfig.label_y=0;
+        buttonconfig.Fontsize=30;
+        buttonconfig.ViewId="discovery";
+        buttonconfig.str="discovery";
+        buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;
+        button=SetTheButton_ext(buttonconfig);
+        testBTScrollView->Add(button);
+
+
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(testPresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
+            return false;
+        }
+       testBTScrollView->SetOnDragListener(draglistener);
+
+
+
+        labelButton_next= testAboutView::GetInstance()->init_button_next(267,278,"buttonbutton_next");
+        testBTScrollView->Add(labelButton_next);
+        
+        Title= testAboutView::GetInstance()->init_title(165,45,"BT_TEST");
+        testBTScrollView->Add(Title);
+
+
+        testBTScrollView->SetTouchable(true);
+        testBTScrollView->SetDraggable(true);
+        uint32_t tick;
+        osStatus_t retTimer;
+        Gsenson_TEST_timer = osTimerNew((osTimerFunc_t)mgdataTimerCallBack, osTimerPeriodic, NULL, NULL);
+        tick =3000;// osMs2Tick(1000);
+        retTimer = osTimerStart(Gsenson_TEST_timer, tick);
+        if (retTimer != osOK && Gsenson_TEST_timer != NULL) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+            osTimerDelete(Gsenson_TEST_timer);
+            Gsenson_TEST_timer = NULL;
+            return false;
+        }
+        return true;
+    }
+
+    UIScrollView *testBTView::testBTInitIView()
+    {
+        if (!testBTScrollViewcrollViewinit())
+        {
+            return nullptr;
+        }
+        return testBTScrollView;
+    }
+}
\ No newline at end of file