ConfigModel中取消保存系统音量和通话音量 789/2
authorluozheng <1732036298@qq.com>
Mon, 26 Aug 2024 11:30:12 +0000 (19:30 +0800)
committerluozheng <1732036298@qq.com>
Mon, 26 Aug 2024 11:30:12 +0000 (19:30 +0800)
12 files changed:
code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/drivers/peripheral/config/include/ConfigModel.h
code/sdk/drivers/peripheral/config/include/ConfigModelC.h
code/sdk/drivers/peripheral/config/src/ConfigModel.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h

index 1e067da..da0b478 100644 (file)
@@ -120,12 +120,10 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status)
 
     if (playerCoefficients == VOLUMEPLAYERS) {
         BtAndLocalVolumeSet(volumeSettingView->sounding);  /*蓝牙耳机音乐调节*/
-        ConfigModel::GetInstance()->SetSystemVolume(volumeSettingView->sounding);/*将设置的音量保存到系统音量*/
     }
     if (playerCoefficients == VOLUMEPHONE || playerCoefficients == VOLUMEPHONENOTIFY) {
         unsigned char volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换
         SetSpeakerVolume(volumeValue);
-        ConfigModel::GetInstance()->SetCallVolume(volumeSettingView->sounding);/*将设置的音量保存到通话音量*/
     }
 }
 
index 27beed9..dcc61f5 100644 (file)
@@ -25,6 +25,7 @@
 #include <PlayerListDelSongView.h>\r
 #include "ConfigModel.h"\r
 #include "ctype.h"\r
+#include <custom_utils.h>\r
 namespace OHOS {\r
 static PlayerOnDragListener *g_pPlayerOnDragListener = nullptr;\r
 static JumpView *g_pJumpView = nullptr;\r
@@ -626,7 +627,7 @@ void ButtonOnClickListener::SoundButtonOnClick()
         return;\r
     }\r
     playersView->ChangeView(PlayersView::MAIN_MUSICPLAYER_VIEW, PlayersView::MUSIC_VOLUME_CONTROL_VIEW);\r
-    int32_t volume = ConfigModel::GetInstance()->GetSystemVolume();\r
+    int32_t volume = uapi_systemVolumeGet();\r
     WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "current volume = %d", volume);\r
     if( playersView->GetVolumeSettingView()->GetProgress()) {\r
         playersView->GetVolumeSettingView()->GetProgress()->SetValue(volume);\r
index ec6f1b8..bc327dc 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-19 18:59:49
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 18:35:35
+ * @LastEditTime: 2024-08-26 18:27:45
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationVolumeSettingC.h
  */
 #ifndef SOUND_AND_VIBRATION_VOLUME_SETTINGC_H
@@ -18,7 +18,9 @@ extern "C"
 #include <stdbool.h>
 
     void SystemVolumeSet(int16_t sounding);
+    int SystemVolumeGet(void);
     void CallVolumeSet(int16_t sounding);
+    int CallVolumeGet(void);
     // void VibationModeSet(int value);
     void SilentModelSet(bool isopen);
 #ifdef __cplusplus
index d05d2ed..a78d37d 100644 (file)
@@ -5,6 +5,7 @@
 #include "phoneservice/include/PhoneAudio.h"\r
 #include "phoneservice/include/PhoneService.h"\r
 #include "ConfigModel.h"\r
+#include <custom_utils.h>\r
 namespace OHOS\r
 {\r
 \r
@@ -122,7 +123,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::p_SoundAndVibrationVolumeSettingView is nullptr!");\r
             return false;\r
         }\r
-        int callVolume = ConfigModel::GetInstance()->GetCallVolume();\r
+        int callVolume = uapi_callVolumeGet();\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolume = %d", callVolume);\r
         p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(callVolume);\r
 \r
index 6908038..f7e444c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-19 10:08:31
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-08-01 09:55:37
+ * @LastEditTime: 2024-08-26 18:54:00
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp
  */
 #include "soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h"
@@ -123,19 +123,6 @@ namespace OHOS
     void VoumeProcessSliderEventListener::ChangeVolumeValue(uint8_t status, uint8_t value)
     {
         FindAndApplyStrategy(status, value);
-
-        SoundAndVibrationVolumeSettingView *view = SoundAndVibrationVolumeSettingView::GetInstance();
-        if (view)
-        {
-            if (view->GetVolumeType() == SYSTEM_VOLUME)
-            {
-                ConfigModel::GetInstance()->SetSystemVolume(value);
-            }
-            else if (view->GetVolumeType() == CALL_VOLUME)
-            {
-                ConfigModel::GetInstance()->SetCallVolume(value);
-            }
-        }
     }
 
     // 滑块变化事件处理
@@ -231,24 +218,24 @@ extern "C"
         Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 系统音量设置
     }
 
+    int SystemVolumeGet(void)
+    {
+        return Audio::AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC);
+    }
+
     /*
      * @brief 通话音量设置
      */
     void CallVolumeSet(int16_t sounding)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeSet %d", sounding);
-        // PhoneAudioSetVolume(sounding); // 通话音量音量设置
-        // SetSpeakerVolume(sounding);
         Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO, sounding); // 系统音量设置
     }
 
-    // /*
-    //  * @brief 震动模式设置
-    //  */
-    // void VibationModeSet(int value)
-    // {
-    //     custom_VibratorFunc_int(value);
-    // }
+    int CallVolumeGet(void)
+    {
+        return Audio::AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO);
+    }
 
     /*
      * @brief 静音模式设置
index 30db852..398f61a 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-06-12 11:44:04\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-07-23 16:58:58\r
+ * @LastEditTime: 2024-08-26 18:56:26\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp\r
  */\r
 #include "soundandvibration/include/SystemVolumeView.h"\r
@@ -10,6 +10,7 @@
 #include "wearable_log.h"\r
 #include <audio_manager.h>\r
 #include "ConfigModel.h"\r
+#include <custom_utils.h>\r
 /*\r
 系统音量:\r
 通话,提醒,查找手表的音量\r
@@ -131,9 +132,9 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::p_SoundAndVibrationVolumeSettingView is nullptr!");\r
             return false;\r
         }\r
-        int systemVolume = ConfigModel::GetInstance()->GetSystemVolume();\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", systemVolume);\r
-        p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(systemVolume);\r
+        int SystemVolume = uapi_systemVolumeGet();\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", SystemVolume);\r
+        p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(SystemVolume);\r
 \r
         return true;\r
     }\r
index 12a3cd9..f6f4e75 100644 (file)
@@ -1889,8 +1889,6 @@ int Get_RaiseToWake(void) //获取抬婉亮屏开关
 }
 void Set_SystemVolume(int value) //设置系统音量
 {
-    OHOS::ConfigModel *p_ConfigModel  =  OHOS::ConfigModel::GetInstance();
-    p_ConfigModel->SetSystemVolume(value);
     uapi_systemVolumeSet(value);
 #ifdef FD230
     SendMsgToUIService(UI_UPDATE_SYSTEM_VOLUME,0,nullptr,0);
@@ -1900,14 +1898,10 @@ void Set_SystemVolume(int value) //设置系统音量
 
 int Get_SystemVolume(void) //获取系统音量
 {
-    OHOS::ConfigModel *p_ConfigModel  =  OHOS::ConfigModel::GetInstance();
-    
-    return p_ConfigModel->GetSystemVolume();
+    return uapi_systemVolumeGet();
 }
 void Set_CallVolume(int value) //设置通话音量
 {
-    OHOS::ConfigModel *p_ConfigModel  =  OHOS::ConfigModel::GetInstance();
-    p_ConfigModel->SetCallVolume(value);
     uapi_callVolumeSet(value);
 #ifdef FD230
     SendMsgToUIService(UI_UPDATE_CALL_VOLUME,0,nullptr,0);
@@ -1917,9 +1911,7 @@ void Set_CallVolume(int value) //设置通话音量
 
 int Get_CallVolume(void) //获取通话音量
 {
-    OHOS::ConfigModel *p_ConfigModel  =  OHOS::ConfigModel::GetInstance();
-    
-    return p_ConfigModel->GetCallVolume();
+    return uapi_callVolumeGet();
 }
 
 uint8_t ble_is_ready(void)
index 2527a92..1269bc1 100644 (file)
@@ -71,8 +71,6 @@ namespace OHOS
             CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE,    //运动目标距离
             CONFIGMODEL_ITEM_DNOTDISTURB,//勿扰模式
             CONFIGMODEL_ITEM_MESSAGE_UNREAD,//未读状态
-            CONFIGMODEL_ITEM_SYSTEM_VOLUME,//系统音量
-            CONFIGMODEL_ITEM_CALL_VOLUME,//通话音量
             CONFIGMODEL_ITEM_VOLTE_CALL,//VoLTE通话
             CONFIGMODEL_ITEM_MOTIONRECOGNITION,//运动识别
             CONFIGMODEL_ITEM_HFP, //通话蓝牙开关
@@ -216,12 +214,6 @@ namespace OHOS
 
         /* ----------------------------- 声音与震动相关set与get ----------------------------- */
         
-        void SetSystemVolume(int value);
-        int GetSystemVolume(void);
-
-        void SetCallVolume(int value);
-        int GetCallVolume(void);
-        
         void SetDmpFactoryStatus(int state);
         int GetDmpFactoryStatus(void);
 
@@ -325,8 +317,6 @@ namespace OHOS
             {ConfigDataType::DATATYPE_INT,     "goal_distance",             "8"   },// CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE,    //运动目标距离   8.0(km)
             {ConfigDataType::DATATYPE_BOOL,    "dnotdisturb",              "false" },// CONFIGMODEL_ITEM_DNOTDISTURB //勿扰模式默认关闭
             {ConfigDataType::DATATYPE_BOOL,    "unread",              "false"},//CONFIGMODEL_ITEM_MESSAGE_UNREAD//未读状态默认未读
-            {ConfigDataType::DATATYPE_INT,     "system_volume",             "100"  },// CONFIGMODEL_ITEM_SYSTEM_VOLUME //
-            {ConfigDataType::DATATYPE_INT,     "call_volume",               "100"  },// CONFIGMODEL_ITEM_CALL_VOLUME //
             {ConfigDataType::DATATYPE_BOOL,    "voltecall",                "true" },// CONFIGMODEL_ITEM_VOLTE_CALL #默认是开启VOLTE
             {ConfigDataType::DATATYPE_BOOL,    "motion_recognition",        "false" },// CONFIGMODEL_ITEM_MOTIONRECOGNITION
             {ConfigDataType::DATATYPE_BOOL,    "hfp",                      "true" },// CONFIGMODEL_ITEM_HFP
index b0b9623..2b0ec7c 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-17 09:32:03
- * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2024-08-19 10:16:53
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-26 19:20:26
  * @FilePath: /FD230/code/sdk/drivers/peripheral/config/include/ConfigModelC.h
  */
 #ifndef _CONFIG_MODEL_C_H_
@@ -46,11 +46,6 @@ void cm_initializeScreenDuration(void);
  */
 void cm_initializeRaiseToWake(void);
 
-/*
- * @brief 初始化系统音量和通话音量 
- */
-void cm_initializeVolume(void);
-
 /*
  * @brief 初始化震动模式 
  */
index 16de7a0..d6265f1 100644 (file)
@@ -1123,32 +1123,6 @@ namespace OHOS
         return get_configData_int(CONFIGMODEL_ITEM_SCREEN_BRIGHTNESS_VALUE);
     }
 
-    //设置系统音量
-    void ConfigModel::SetSystemVolume(int value)
-    {
-        set_condigData_Int(CONFIGMODEL_ITEM_SYSTEM_VOLUME,value);
-        //uapi_systemVolumeSet(value);
-    }
-
-    //获取系统音量
-    int ConfigModel::GetSystemVolume(void)
-    {
-        return get_configData_int(CONFIGMODEL_ITEM_SYSTEM_VOLUME);
-    }
-
-    //设置通话音量
-    void ConfigModel::SetCallVolume(int value)
-    {
-        set_condigData_Int(CONFIGMODEL_ITEM_CALL_VOLUME,value);
-        //uapi_callVolumeSet(value);
-    }
-    
-    //获取通话音量
-    int ConfigModel::GetCallVolume(void)
-    {
-        return get_configData_int(CONFIGMODEL_ITEM_CALL_VOLUME);
-    }
-
     //设置运动识别是否开启
     void ConfigModel::SetMotionRecognition(bool state)
     {
@@ -1367,15 +1341,6 @@ void cm_initializeRaiseToWake(void)
     }
 }
 
-void cm_initializeVolume(void)
-{
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cm_initializeVolume");
-    int systemVolume =  OHOS::ConfigModel::GetInstance()->GetSystemVolume();
-    int callVolume = OHOS::ConfigModel::GetInstance()->GetCallVolume();
-    uapi_systemVolumeSet(systemVolume);
-    uapi_callVolumeSet(callVolume);
-}
-
 void cm_initializeVibrationModel(void)
 {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cm_initializeVibrationModel");
index 2ace3f2..df392e3 100644 (file)
@@ -351,7 +351,6 @@ void startup_post_init_task(void)
     cm_initScreenBrightness();
     cm_initializeScreenDuration();
     cm_initializeRaiseToWake();
-    cm_initializeVolume();
     cm_initializeVibrationModel();
     cm_initializeSilentModel();
     // cm_initializeVoLTECall();
@@ -1132,6 +1131,12 @@ void uapi_systemVolumeSet(int16_t sounding)
     #endif
 }
 
+/*系统声音获取*/
+int uapi_systemVolumeGet(void)
+{
+    return SystemVolumeGet();
+}
+
 //通话音量设置
 void uapi_callVolumeSet(int16_t sounding)
 {
@@ -1140,13 +1145,12 @@ void uapi_callVolumeSet(int16_t sounding)
     #endif
 }
 
-// //震动强度设置
-// void uapi_vibrationModeSet(int value)
-// {
-//     #ifdef FD230
-//     VibationModeSet(value);
-//     #endif
-// }
+//通话音量获取
+int uapi_callVolumeGet(void)
+{
+    return CallVolumeGet();
+}
+
 
 //设置是否静音
 void uapi_setSilentMode(bool isopen)
index 66602c2..4a096c2 100644 (file)
@@ -114,7 +114,9 @@ void uapi_setScreenDuration(int32_t time);
 int32_t uapi_get_screen_state(void);
 
 void uapi_systemVolumeSet(int16_t sounding);
+int uapi_systemVolumeGet(void);
 void uapi_callVolumeSet(int16_t sounding);
+int uapi_callVolumeGet(void);
 // void uapi_vibrationModeSet(int value);
 void uapi_setSilentMode(bool isopen);
 void uapi_set4GCapability(bool isopen);