{
if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1)
{
- int32_t volume = PhoneCAT1AudioGetVolume();
- int32_t minVolume = PhoneAudioGetCAT1MinVolume();
- int32_t maxVolume = PhoneAudioGetCAT1MAXVolume();
- // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换
- unsigned char hfpVolume = volume;
+ // int32_t volume = PhoneCAT1AudioGetVolume();
+ // int32_t minVolume = PhoneAudioGetCAT1MinVolume();
+ // int32_t maxVolume = PhoneAudioGetCAT1MAXVolume();
+ // // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换
- if (volume != 0 && hfpVolume == 0) {
- hfpVolume = 1;
- }
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d",
- volume, minVolume, maxVolume, hfpVolume);
- return hfpVolume;
+ // if (volume != 0 && hfpVolume == 0) {
+ // hfpVolume = 1;
+ // }
+ // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d",
+ // volume, minVolume, maxVolume, hfpVolume);
+ // return hfpVolume;
+ return PhoneCAT1AudioGetVolume();
}
else
{
- int32_t volume = PhoneAudioGetVolume();
- int32_t minVolume = PhoneAudioGetMinVolume();
- int32_t maxVolume = PhoneAudioGetMaxVolume();
- // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换
- unsigned char hfpVolume = volume;
-
- if (volume != 0 && hfpVolume == 0) {
- hfpVolume = 1;
- }
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d",
- volume, minVolume, maxVolume, hfpVolume);
- return hfpVolume;
+ // int32_t volume = PhoneAudioGetVolume();
+ // int32_t minVolume = PhoneAudioGetMinVolume();
+ // int32_t maxVolume = PhoneAudioGetMaxVolume();
+ // // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换
+
+ // // if (volume != 0 && hfpVolume == 0) {
+ // // hfpVolume = 1;
+ // // }
+ // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d",
+ // volume, minVolume, maxVolume, hfpVolume);
+ // return hfpVolume;
+ return PhoneAudioGetVolume();
}
* @Author: luozheng 1732036298@qq.com\r
* @Date: 2024-08-05 15:20:03\r
* @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-08-20 17:39:13\r
+ * @LastEditTime: 2024-09-18 19:13:53\r
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h\r
*/\r
\r
void UpdatePlayerView(void);\r
void UpdateMusicListStatus(void);\r
void OnClickBackKeyToMainMusicPlayerView(void);\r
+ void StopCurPlayingMusic();\r
+ void UpdateVolumeValue(void);\r
\r
VolumeSettingView *GetVolumeSettingView();\r
PlayerListDelSongView *GetPlayerListDelSongView();\r
{\r
PlayersModel::GetInstance()->SetMusicSource(true);\r
UpdateBluetoothHeadSetViewIsVisible();\r
+ playersView->StopCurPlayingMusic();\r
// 1.a2dp未连接,向手机发起a2dp连接\r
// 如果蓝牙没连接直接是跳转到蓝牙连接失败视图,连接了就有一个主动去连手机的a2dp过程,5秒超市\r
// if (!phonebluetoothcon)\r
else {
if(g_PlayerTimes < 2) /*3秒切换时间*/
{
- bool a2dp = uapi_a2dp_snk_get_device_connect_state();// 获取a2dp连接状态
- if(!a2dp)
- {
- playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_SOURCE_VIEW);
- }
+ playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_SOURCE_VIEW);
}
}
return;
#include "main/include/MainViewSample.h"\r
#include "wearable_log.h"\r
#include "settings/include/SettingModel.h"\r
+#include <custom_utils.h>\r
namespace OHOS\r
{\r
static PlayersView *g_pPlayersView = nullptr;\r
}\r
}\r
\r
+ // 停止当前正在播放的音乐\r
+ void PlayersView::StopCurPlayingMusic()\r
+ {\r
+ uint8_t state = GetPlayerButtonState();\r
+ if (state == UICheckBox::UICheckBoxState::SELECTED)\r
+ {\r
+ PlayersModel::GetInstance()->PlayerStop();\r
+ PlayersModel::GetInstance()->ClearActivateAudioInterrupt();\r
+ }\r
+ }\r
+\r
+ //更新音乐播放器的声音进度条\r
+ void PlayersView::UpdateVolumeValue(void)\r
+ {\r
+ if (volumeSettingView != nullptr && volumeSettingView->GetProgress() != nullptr)\r
+ {\r
+ int val = uapi_systemVolumeGet();\r
+ volumeSettingView->GetProgress()->SetValue(val);\r
+ }\r
+ }\r
+\r
/// @brief 设置音乐播放按钮是否可点击\r
/// @param musicSourceType 音乐来源类型 false:手表音乐 true 手机音乐\r
/// @param phoneMusicConnectStatus 手机音乐连接状态\r
play_or_pause_Button->SetTouchable(touchableState);\r
preMusicButton->SetTouchable(touchableState);\r
nextMusicButton->SetTouchable(touchableState);\r
- soundButton->SetTouchable(touchableState);\r
+ // soundButton->SetTouchable(touchableState);\r
playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用\r
/* -------------------------------------------------------------------------- */\r
if (musicSourceType) // 如果切換到手机音乐,且当前在放歌,就停止音乐\r
{\r
- /*暂停音乐*/\r
- uint8_t state = GetPlayerButtonState();\r
- int32_t playerState; /*获取Player的状态*/\r
- if (state == UICheckBox::UICheckBoxState::SELECTED)\r
- {\r
- PlayersModel::GetInstance()->PlayerStop();\r
- PlayersModel::GetInstance()->ClearActivateAudioInterrupt();\r
- }\r
+ /*停止音乐*/\r
+ StopCurPlayingMusic();\r
}\r
/* -------------------------------------------------------------------------- */\r
PreLoadPlayerModeImageRes();\r
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-23 09:17:00
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-19 17:47:54
+ * @LastEditTime: 2024-09-18 19:34:06
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp
*/
#include "soundandvibration/include/SoundAndVibrationModel.h"
#include "soundandvibration/include/CallVolumeView.h"
#include "wearable_log.h"
#include "ConfigModel.h"
+#include "player/include/PlayersView.h"
namespace OHOS
{
bool SoundAndVibrationModel::UpdateSystemVolume(void)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateSystemVolume");
- SystemVolumeView *p_SystemVolumeView = SystemVolumeView::GetInstance();
- if (p_SystemVolumeView == nullptr)
+ if (SystemVolumeView::GetInstance())
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::GetInstance fail!!");
- return false;
+ SystemVolumeView::GetInstance()->UpdateSystemVolumeSliderValue();
}
- p_SystemVolumeView->UpdateSystemVolumeSliderValue();
+ //同步显示音乐的声音进度条
+ if(PlayersView::GetInstance())
+ {
+ PlayersView::GetInstance()->UpdateVolumeValue();
+ }
return true;
}