修改4G相关显示
authorCaisking <Casiking@zhihuishixun.com>
Sat, 26 Apr 2025 03:42:47 +0000 (11:42 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Sat, 26 Apr 2025 03:42:47 +0000 (11:42 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/dropdown/DropDownCardPage1.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/networkandcall/src/NetworkAndCallView.cpp

index c6606f1..d30700a 100644 (file)
@@ -646,11 +646,11 @@ namespace OHOS
         int signal = uapi_dev_runtime_get_cat1_signal();
         int network_on = uapi_dev_runtime_get_cat1_networkstat();
         int cat1_network_type = uapi_dev_runtime_get_cat1_networtype();
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
 
         const int SIGNAL_NO_SIGNAL = 99;
         const int NETWORK_TYPE_NO_NETWORK = 0;
index 8b81b19..3b89ea1 100644 (file)
 #include <custom_utils.h>
 #include "ConfigModel.h"
 
-#ifdef FD230_650
+extern "C" {
+    #include "cat1_ctl.h"
+    bool cat1_api_is_cat1_enabled(void);
+}
+
 #include "dnotdisturb/include/DnotDisturbModel.h"
 #include "sleepmode/include/SleepModeModel.h"
-#include "../../../../../../../drivers/peripheral/slip/cat1Service/cat1_ctl.h"
 #include "alipay_feature.h"
-#endif
+
 
 namespace OHOS
 {
@@ -98,10 +101,10 @@ namespace OHOS
                 uapi_set4GCapability(false);
 #endif
                 state = toggleButton[DropDownCardPage1::toggleButton_4G]->GetState();
-#ifdef FD230_650
-                Updat4GState(uapi_cat1_get_power_stat());
-                ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());
-#endif
+
+                Updat4GState(cat1_api_is_cat1_enabled());
+                ConfigModel::GetInstance()->SetCat1_4Gability(cat1_api_is_cat1_enabled());
+
             }
         }
         else if (viewId == DROPDOWN_ALIPAY_TOGGLEBUTTON_VIEWID) // 支付宝
@@ -118,14 +121,14 @@ namespace OHOS
         }
         else if (viewId == DROPDOWN_SAVEPOWER_TOGGLEBUTTON_VIEWID) // 省电模式开关
         {
-#ifdef FD230_650
+
             state = toggleButton[DropDownCardPage1::toggleButton_SAVEPOWER]->GetState();
             NativeAbility::GetInstance().EnterSlice(VIEW_SAVEELE);
-#endif
+
         }
         else if (viewId == DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID) // 睡眠开关
         {
-#ifdef FD230_650
+
             if (uapi_sleep_mode_flag_get())
             {
                 state = toggleButton[DropDownCardPage1::toggleButton_SLEEP]->GetState();
@@ -135,11 +138,11 @@ namespace OHOS
             {
                 NativeAbility::GetInstance().EnterSlice(VIEW_SLEEPMODE);
             }
-#endif
+
         }
         else if (viewId == DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID) // 勿扰开关
         {
-#ifdef FD230_650
+
             if (DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled() == false)
             {
                 NativeAbility::GetInstance().EnterSlice(VIEW_DNOTDISTURB);
@@ -150,7 +153,7 @@ namespace OHOS
                 UpdateDnotdisturbState(state);
                 DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(state);
             }
-#endif
+
         }
         else if (viewId == DROPDOWN_SETTING_TOGGLEBUTTON_VIEWID) // 设置
         {
@@ -195,18 +198,13 @@ namespace OHOS
     bool DropDownCardPage1::InitPage(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DropDownCardPage1::InitPage");
-        bool state_bt = true;
-        bool state_4g = true;
-        bool state_savepower = true;
-        bool state_sleep = true;
-        bool state_dnotdisturb = true;
-#ifdef FD230_650
+
         bool state_bt = ConfigModel::GetInstance()->GetClassicBlueToothState(); // 传统蓝牙开关
-        bool state_4g = uapi_cat1_get_power_stat();
+        bool state_4g = cat1_api_is_cat1_enabled();
         bool state_savepower = uapi_dev_runtime_get_saveele_status();
         bool state_sleep = uapi_sleep_mode_flag_get();
         bool state_dnotdisturb = DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled();
-#endif
+
 
         ToggleButtonConfig toggleButtonConfig[] = {
             // {0, 0, 100, 100, DROPDOWN_BT_TOGGLEBUTTON_VIEWID, state_bt ? DROPDOWN_BT_CONNECT_IMAGE : DROPDOWN_BT_DISCONNECT_IMAGE, state_bt ? DROPDOWN_BT_CONNECT_IMAGE : DROPDOWN_BT_DISCONNECT_IMAGE, true, state_bt},
@@ -273,9 +271,7 @@ namespace OHOS
     // 刷新4g开关显示
     void DropDownCardPage1::Refresh4GState()
     {
-#ifdef FD230_650
-        Updat4GState(uapi_cat1_get_power_stat());
-#endif
+        Updat4GState(cat1_api_is_cat1_enabled());
     }
 
     void DropDownCardPage1::UpdateDnotdisturbState(bool state)
index bff252e..1281da4 100644 (file)
 #include "iostream"
 #include "ConfigModel.h"
 #include "networkandcall/include/NetworkAndCallC.h"
-#include "cat1_ctl.h"
+
+extern "C" {
+    #include "cat1_ctl.h"
+    bool cat1_api_is_cat1_enabled(void);
+}
+
 #include "NativeRegisterManager.h"
 namespace OHOS
 {
@@ -94,9 +99,9 @@ namespace OHOS
                     else if (it->second == "4GCapability")
                     {
                         uapi_set4GCapability(true);
-                        #ifdef FD230_650
-                        ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());
-                        #endif
+                 
+                        ConfigModel::GetInstance()->SetCat1_4Gability(cat1_api_is_cat1_enabled());
+                    
                         if(p_NetworkAndCallView->GetVoLTEToggleButton())
                         {
                             p_NetworkAndCallView->GetVoLTEToggleButton()->SetTouchable(true);
@@ -117,9 +122,8 @@ namespace OHOS
                         #else
                         uapi_set4GCapability(false);
                         #endif
-                        #ifdef FD230_650
-                        ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());
-                        #endif
+                        ConfigModel::GetInstance()->SetCat1_4Gability(cat1_api_is_cat1_enabled());
+                    
                         if(p_NetworkAndCallView->GetVoLTEToggleButton() && p_NetworkAndCallView->GetVoLTEToggleButton()->GetState())
                         {
                             p_NetworkAndCallView->GetVoLTEToggleButton()->SetState(false);
index 18d3b50..a601ad3 100644 (file)
@@ -3,8 +3,14 @@
 #include "wearable_log.h"
 #include "UiConfig.h"
 #include "ConfigModel.h"
-#include "cat1_ctl.h"
+
+extern "C" {
+    #include "cat1_ctl.h"
+    bool cat1_api_is_cat1_enabled(void);
+}
+
 #include "ui_resource_string.h"
+
 namespace OHOS
 {
 
@@ -171,9 +177,9 @@ namespace OHOS
             {
                 MobileData_toggleButton->SetPosition(298, 145, 100, 50);
             }
-            #ifdef FD230_650
-            MobileData_toggleButton->SetState(uapi_cat1_get_power_stat());
-            #endif
+         
+            MobileData_toggleButton->SetState(cat1_api_is_cat1_enabled());
+           
             MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
             MobileData_toggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
             MobileData_toggleButton->SetOnClickListener(presenter_);