From: hcj <1224667075@qq.com> Date: Thu, 8 Jan 2026 03:13:53 +0000 (+0800) Subject: 优化蓝牙播放状态控制 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=fca5821e0322a7ab630836fbf7523dd701e2155b;p=mirrors%2FFD230.git 优化蓝牙播放状态控制 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index ce2e140a1..01b256815 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -1205,11 +1205,20 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState) GraphicService::GetInstance()-> PostGraphicEvent(std::bind(ln_bt_report_earphone_connection_status)); } +uint8_t A2dpSrcPlayingState=0; + static void A2dpSrcPlayingStateChanged(bd_addr_t *bdAddr, int playState) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "A2dpSrcPlayingStateChangedCallback addr: %02x%02x%02x%02x%02x%02x playState: %x", bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* 5 4 3 idx */ bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0], playState); /* 2 1 0 idx */ + A2dpSrcPlayingState=playState; + +} + +uint8_t get_A2dpSrcPlayingStat(void) +{ + return A2dpSrcPlayingState; } static void A2dpSrcConfigureChanged(bd_addr_t *bdAddr, a2dp_codec_info_t *info) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/Ln_Bluetooth_apiC.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/Ln_Bluetooth_apiC.cpp index ec20c781a..c1d23d898 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/Ln_Bluetooth_apiC.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/Ln_Bluetooth_apiC.cpp @@ -166,6 +166,9 @@ namespace OHOS LN_CancelBrScanHandle(); } + + + } #ifdef __cplusplus @@ -173,6 +176,13 @@ extern "C" { #endif + + uint8_t ln_get_A2dpSrcPlayingStat(void) + { + return OHOS::get_A2dpSrcPlayingStat(); + } + + // 初始化蓝牙 int ln_bt_init(void) { @@ -445,6 +455,8 @@ extern "C" return volume; } + + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/BluetoothModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/BluetoothModel.h index b92fbc358..03bbe558d 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/BluetoothModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/BluetoothModel.h @@ -29,6 +29,7 @@ typedef enum : uint16_t { CALLERPLAYERS, } CallerFactor; + typedef struct { unsigned char deviceName[BD_NAME_LEN]; /* Name of the device record, must be in UTF-8 */ @@ -148,6 +149,8 @@ void BtInitGatts(void); void BtInitSpp(void); void BleAdvStart(void); void BtA2dpInit(void); +uint8_t get_A2dpSrcPlayingStat(void); + #ifdef __cplusplus } #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/Ln_Bluetooth_apiC.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/Ln_Bluetooth_apiC.h index 2fe968dd2..7955b0d30 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/Ln_Bluetooth_apiC.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/bluetooth/Ln_Bluetooth_apiC.h @@ -54,6 +54,8 @@ int ln_bt_earphone_get_volume(void); bd_addr_t *ln_bt_get_last_conned_device_Addr(void); +uint8_t ln_get_A2dpSrcPlayingStat(void); + #ifdef __cplusplus }