From 7b5538902fd3460fd4d3619fd8ae86dab30a9983 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 23 Sep 2024 15:52:18 +0800 Subject: [PATCH] =?utf8?q?#470=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=8D=A1?= =?utf8?q?=E7=89=87=E7=AE=A1=E7=90=86-=E9=9F=B3=E4=B9=90-=E6=89=8B?= =?utf8?q?=E6=9C=BA=E9=9F=B3=E4=B9=90=E7=95=8C=E9=9D=A2=E8=A7=A6=E6=91=B8?= =?utf8?q?=E6=97=A0=E5=8F=8D=E5=BA=94=EF=BC=8C=E6=97=A0=E6=B3=95=E5=88=87?= =?utf8?q?=E6=8D=A2=EF=BC=8C=E6=9A=82=E5=81=9C=EF=BC=8C=E9=9F=B3=E9=87=8F?= =?utf8?q?=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../bluetooth/include/BluetoothHeadsetEvent.h | 1 + .../bluetooth/src/BluetoothHeadsetEvent.cpp | 24 +++++- .../player/include/PlayersPresenter.h | 4 +- .../src/MusicPlayerBTConnectFailedView.cpp | 4 +- .../src/MusicPlayerBluetoothDisConView.cpp | 8 +- .../player/src/MusicPlayerSourceView.cpp | 5 +- .../nativeui/player/src/PlayersModel.cpp | 43 ++++------ .../nativeui/player/src/PlayersPresenter.cpp | 78 ++++++++++++++----- .../nativeui/player/src/PlayersView.cpp | 14 ++-- 9 files changed, 117 insertions(+), 64 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothHeadsetEvent.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothHeadsetEvent.h index 2253e6d41..500d14408 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothHeadsetEvent.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothHeadsetEvent.h @@ -38,6 +38,7 @@ void ConnCtStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_state_t void ConnectTgStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_state_t state); void InitBtHeadsetEvent(void); void BtAvrcpVolumeChangedSyncMedia(uint8_t a2dp_volume); +void user_avrcp_ct_press_button(const bd_addr_t *bd_addr, int32_t key_operation); #ifdef __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp index 0ab8b0a74..05852ce42 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp @@ -11,6 +11,7 @@ #include "PlayersModel.h" #include "service_id_define.h" #include "graphic_service.h" +#include using namespace OHOS; @@ -251,6 +252,26 @@ void ConnectTgStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_stat } } +/* -------------------------------------------------------------------------- */ +void user_avrcp_ct_press_button(const bd_addr_t *bd_addr, int32_t key_operation) +{ + (void)avrcp_ct_press_button(bd_addr, key_operation); + uint8_t sleep_cnt = 0; + while (1) { //持续等待接收一个响应消息来确认按键按下操作已被正确处理 + osal_msleep(100); /* sleep 1000 ms */ + if (g_avrcp_srv_inf.avrcp_button_flag == AVRCP_SRV_PRESS_VALUE) { + (void)avrcp_ct_release_button(bd_addr, key_operation); + break; + } + sleep_cnt++; + if (sleep_cnt > 20) { /* sleep 20 times */ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP,"not receive rsp press button msg\n"); + break; + } + } +} +/* -------------------------------------------------------------------------- */ +//记录按下按钮的回调事件以及按键操作值 static void BtAvrcpCtPressButtonRspCallback(const bd_addr_t *bd_addr, int32_t key_operation) { if (bd_addr == nullptr) { @@ -302,10 +323,11 @@ static void BtAvrcpPressReleaseButtonLog(uint32_t key_operation) } } +//记录释放按钮的回调事件以及按键操作值 static void BtAvrcpCtReleaseButtonRspCallback(const bd_addr_t *bd_addr, int32_t key_operation) { UNUSED(bd_addr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "avrcp ct release button cbk key:%d\n", key_operation); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp ct release button cbk key:%x\n", key_operation); if (g_avrcp_srv_inf.avrcp_button_flag == AVRCP_SRV_PRESS_VALUE) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "avrcp ct released button button_flag change:%u->%u\n", g_avrcp_srv_inf.avrcp_button_flag, AVRCP_SRV_RELEASED_VALUE); diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h index 31b761ebb..6cb74cb2c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-20 17:57:54 + * @LastEditTime: 2024-09-23 15:07:25 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h */ @@ -107,6 +107,8 @@ public: bool OnClick(UIView& view, const ClickEvent& event) override; private: void PlayerButtonOnClick(); + void NextButtonOnClick(); + void PreButtonOnClick(); void SoundButtonOnClick(); void PlayerModelButtonOnClick(); void OptionsButtonOnClick(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp index 625281acf..5d90e3328 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-12 11:31:43 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-03 20:31:31 + * @LastEditTime: 2024-09-23 15:42:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBTConnectFailedView.cpp */ #include "player/include/MusicPlayerBTConnectFailedView.h" @@ -36,7 +36,7 @@ namespace OHOS } if (strcmp(view.GetViewId(), CLOSEBUTTON_VIEWID) == 0) { - playersView->ChangeView(PlayersView::MUSIC_BT_CONNECTFAILED_VIEW, PlayersView::MAIN_MUSICPLAYER_VIEW); + playersView->ChangeView(PlayersView::MUSIC_BT_CONNECTFAILED_VIEW, PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBluetoothDisConView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBluetoothDisConView.cpp index 3ee33f84e..a857d7132 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBluetoothDisConView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBluetoothDisConView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-10 16:23:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-12 12:01:13 + * @LastEditTime: 2024-09-23 15:40:20 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerBluetoothDisConView.cpp */ #include "player/include/MusicPlayerBluetoothDisConView.h" @@ -38,6 +38,11 @@ namespace OHOS { playersView->ChangeView(PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW, PlayersView::MAIN_MUSICPLAYER_VIEW); } + else if(strcmp(view.GetViewId(), MUISC_PLAYER_BLUETOOTH_DISCONN_VIEW) == 0) + { + //跳转到蓝牙连接失败视图 + playersView->ChangeView(PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW, PlayersView::MUSIC_BT_CONNECTFAILED_VIEW); + } return true; } @@ -278,6 +283,7 @@ namespace OHOS } } group->SetOnDragListener(dragListener); + group->SetOnClickListener(this); /* -------------------------------------------------------------------------- */ if (scrollView == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp index 90fb34697..2f67c8d68 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp @@ -101,10 +101,7 @@ namespace OHOS PlayersModel::GetInstance()->SetMusicSource(false); UpdateBluetoothHeadSetViewIsVisible(); /* -------------------------------------------------------------------------- */ - if (a2dp) - { - uapi_a2dp_snk_disconnect(); // 切换通道主动断开atdp - } + PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_STOP);//切换到手机音乐停止音乐 /* -------------------------------------------------------------------------- */ playersView->ChangeView(PlayersView::MUSIC_SOURCE_VIEW, PlayersView::MUISC_CONNECTING); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp index 825fd2a33..df1a320a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -20,6 +20,7 @@ #include #include "MainViewSample.h" #include "settings/include/SettingModel.h" +#include "bluetooth/include/BluetoothHeadsetEvent.h" namespace OHOS { static constexpr int VOLUME_MAXIMUM = 100; @@ -822,19 +823,14 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) } bool type = PlayersModel::GetInstance()->GetMusicSource(); if(type) { - bool phonebluetoothcon = SettingModel::GetInstance().GetPhoneConnectStatus(); // 获取手机连接状态 - bool a2dp = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 + bool phoneMusicConnectStatus = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 if(g_PlayerTimes < 3) /*3秒切换时间*/ { - if (!phonebluetoothcon) + if (!phoneMusicConnectStatus) { playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW); } - else if (phonebluetoothcon && !a2dp) // 如果手机蓝牙已连接但手表与手机的a2dp未连接手表主动去连接a2dp - { - playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_BT_CONNECTFAILED_VIEW); - } - else if (phonebluetoothcon && a2dp) + else if (phoneMusicConnectStatus) { playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MAIN_MUSICPLAYER_VIEW); } @@ -959,6 +955,7 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) SetCircleProgress(); } + //更新音乐的声音进度条 void PlayersModel::UpdateVolumeValue(void) { if(PlayersView::GetInstance()) @@ -985,40 +982,32 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) return false; } + //用来控制手机音乐的播放,暂停,下一首,上一首音乐 void PlayersModel::set_phone_music_play_state(avrcp_key_operation_t notify) { - #if 0 - int ret; - int playerState; bd_addr_t bdAddr={0}; uapi_get_br_address(&bdAddr); //获取手机蓝牙地址 - int a2dp_play_stat = a2dp_src_get_playing_state(&bdAddr); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[a2dp_play_stat]%d", a2dp_play_stat); switch(notify) { case AVRCP_KEY_PLAY://播放 - if(a2dp_play_stat == A2DP_IS_PLAYING) - return; - ret = a2dp_src_start_playing(&bdAddr);//设置手机音乐的状态为播放 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[a2dp_src_start_playing],ret:%x", ret); - playerState = AVRCP_PLAY_STATUS_PLAYING; + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_PLAY); break; case AVRCP_KEY_STOP: //停止 - ret = a2dp_src_stop_playing(&bdAddr);//设置手机的状态停止 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[a2dp_src_stop_playing],ret:%x", ret); - playerState = AVRCP_PLAY_STATUS_STOPPED; + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_STOP); break; case AVRCP_KEY_PAUSE://暂停 - ret = a2dp_src_suspend_playing(&bdAddr);//设置手机的状态暂停 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[a2dp_src_suspend_playing],ret:%x", ret); - playerState = AVRCP_PLAY_STATUS_PAUSED; + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_PAUSE); + break; + case AVRCP_KEY_FORWARD: // 下一曲 + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_FORWARD); + break; + case AVRCP_KEY_BACKWARD: // 上一曲 + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_BACKWARD); break; default: - playerState = AVRCP_PLAY_STATUS_STOPPED; + user_avrcp_ct_press_button(&bdAddr,AVRCP_KEY_STOP);//停止 break; } - avrcp_tg_notify_playback_status_changed((unsigned char)(playerState)); - #endif } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp index a4b3cafa4..22442fd3c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -615,18 +615,20 @@ void ButtonOnClickListener::PlayerButtonOnClick() WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PlayerButtonOnClick] calling phone"); return; } + /* -------------------------- 若ct或tg端是已连接状态且当前为手机音乐 ------------------------- */ if(PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && PlayersModel::GetInstance()->GetMusicSource()) { if (state == UICheckBox::UICheckBoxState::SELECTED) { - PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_PLAY); + PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_PLAY); //控制手机音乐播放 } else if (state == UICheckBox::UICheckBoxState::UNSELECTED) { - PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_PAUSE); + PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_PAUSE);//控制手机音乐暂停 } return; } + /* -------------------------------------------------------------------------- */ if (state == UICheckBox::UICheckBoxState::SELECTED) { /* start play */ @@ -637,7 +639,52 @@ void ButtonOnClickListener::PlayerButtonOnClick() /* -------------------------------------------------------------------------- */ PlayersModel::GetInstance()->SetCurrentIndex(PlayersModel::GetInstance()->GetCurrentIndex()); } - +/*下一首按钮被点击时调用*/ +void ButtonOnClickListener::NextButtonOnClick() +{ + /* -------------------------- 若ct或tg端是已连接状态且当前为手机音乐 ------------------------- */ + if(PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && PlayersModel::GetInstance()->GetMusicSource()) + { + PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_FORWARD); //控制手机音乐下一首 + return; + } + else + { + PlayersView *playersView = PlayersView::GetInstance(); + if (playersView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::GetInstance"); + return; + } + if (playersView->GetPlaybackProgress() != nullptr) { + playersView->GetPlaybackProgress()->SetValue(0); // 0:进度0% + playersView->GetPlaybackProgress()->Invalidate(); + } + PlayersModel::GetInstance()->LoopingPlayout(); + } +} +/*上一首按钮被点击时调用*/ +void ButtonOnClickListener::PreButtonOnClick() +{ + /* -------------------------- 若ct或tg端是已连接状态且当前为手机音乐 ------------------------- */ + if(PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && PlayersModel::GetInstance()->GetMusicSource()) + { + PlayersModel::GetInstance()->set_phone_music_play_state(AVRCP_KEY_BACKWARD); //控制手机音乐上一首 + return; + } + else + { + PlayersView *playersView = PlayersView::GetInstance(); + if (playersView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::GetInstance"); + return; + } + if (playersView->GetPlaybackProgress() != nullptr) { + playersView->GetPlaybackProgress()->SetValue(0); // 0:进度0% + playersView->GetPlaybackProgress()->Invalidate(); + } + PlayersModel::GetInstance()->PreviousPlayout(); + } +} /*当声音按钮被点击时候调用*/ void ButtonOnClickListener::SoundButtonOnClick() { @@ -692,8 +739,13 @@ void ButtonOnClickListener::MusicDeleteButtonOnClick() PlayersListGroup::GetInstance()->SetUpListCase(); return; } +//当音乐播放模式按钮被点击时候调用 void ButtonOnClickListener::PlayerModelButtonOnClick() { + PlayersModel::GetInstance()->SetPlayerModelAddOne(); + if (PlayersModel::GetInstance()->GetPlayerModel() > RANDOM) { + PlayersModel::GetInstance()->SetPlayerModel(LOOP); + } PlayersView *playersView = PlayersView::GetInstance(); if (playersView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerModelButtonOnClick playersView nullptr err"); @@ -730,22 +782,10 @@ bool ButtonOnClickListener::OnClick(UIView& view, const ClickEvent& event) if (&view == (UIView *)playersView->GetPlayerButton()) { PlayerButtonOnClick(); } else if (&view == (UIView *)playersView->GetNextButton()) { - if (playersView->GetPlaybackProgress() != nullptr) { - playersView->GetPlaybackProgress()->SetValue(0); // 0:进度0% - playersView->GetPlaybackProgress()->Invalidate(); - } - PlayersModel::GetInstance()->LoopingPlayout(); + NextButtonOnClick(); } else if (&view == (UIView *)playersView->GetPreButton()) { - if (playersView->GetPlaybackProgress() != nullptr) { - playersView->GetPlaybackProgress()->SetValue(0); // 0:进度0% - playersView->GetPlaybackProgress()->Invalidate(); - } - PlayersModel::GetInstance()->PreviousPlayout(); + PreButtonOnClick(); } else if (&view == (UIView *)playersView->GetPlayerModelButton()) { - PlayersModel::GetInstance()->SetPlayerModelAddOne(); - if (PlayersModel::GetInstance()->GetPlayerModel() > RANDOM) { - PlayersModel::GetInstance()->SetPlayerModel(LOOP); - } PlayerModelButtonOnClick(); } else if (&view == (UIView *)playersView->GetSoundButton()) { SoundButtonOnClick(); @@ -1105,7 +1145,7 @@ void PlayerOnDragListener::OnDragChangMusicPlayerBTDisConnectView(const DragEven X_DRAG_FLAG = true; } } -/*从蓝牙连接失败视图回到音乐主视图*/ +/*从蓝牙连接失败视图回到蓝牙未连接视图*/ void PlayerOnDragListener::OnDragChangMusicPlayerBTConnectFailedView(const DragEvent& event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnDragChangMusicPlayerBTConnectFailedView"); @@ -1115,7 +1155,7 @@ void PlayerOnDragListener::OnDragChangMusicPlayerBTConnectFailedView(const DragE WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView GetInstance fail"); return; } - playersView->ChangeView(PlayersView::MUSIC_BT_CONNECTFAILED_VIEW,PlayersView::MAIN_MUSICPLAYER_VIEW); + playersView->ChangeView(PlayersView::MUSIC_BT_CONNECTFAILED_VIEW,PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW); X_DRAG_FLAG = true; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp index d6cea874d..7b611c48b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -871,9 +871,9 @@ namespace OHOS if (play_or_pause_Button && preMusicButton && nextMusicButton && soundButton && playerModelButton) { bool touchableState = !musicSourceType; - play_or_pause_Button->SetTouchable(touchableState); - preMusicButton->SetTouchable(touchableState); - nextMusicButton->SetTouchable(touchableState); + // play_or_pause_Button->SetTouchable(touchableState); + // preMusicButton->SetTouchable(touchableState); + // nextMusicButton->SetTouchable(touchableState); // soundButton->SetTouchable(touchableState); playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用 /* -------------------------------------------------------------------------- */ @@ -953,13 +953,9 @@ namespace OHOS void PlayersView::UpdatePlayerView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView"); - // 1.a2dp未连接,向手机发起a2dp连接 - bool phonebluetoothcon = SettingModel::GetInstance().GetPhoneConnectStatus(); // 获取手机连接状态 - bool a2dp = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 - - bool phoneMusicConnectStatus = phonebluetoothcon && a2dp; + bool phoneMusicConnectStatus = uapi_a2dp_snk_get_device_connect_state();// 获取a2dp连接状态 bool musicSourceType = PlayersModel::GetInstance()->GetMusicSource(); - // 2. + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneMusicConnectStatus %d,musicSourceType %d",phoneMusicConnectStatus,musicSourceType); ImageInfo *image; if (musicSourceType) { -- 2.17.1