From fca5821e0322a7ab630836fbf7523dd701e2155b Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 8 Jan 2026 11:13:53 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E8=93=9D=E7=89=99=E6=92=AD?= =?utf8?q?=E6=94=BE=E7=8A=B6=E6=80=81=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/bluetooth/src/BluetoothModel.cpp | 9 +++++++++ .../nativeui/bluetooth/src/Ln_Bluetooth_apiC.cpp | 12 ++++++++++++ .../nativeui/include/bluetooth/BluetoothModel.h | 3 +++ .../nativeui/include/bluetooth/Ln_Bluetooth_apiC.h | 2 ++ 4 files changed, 26 insertions(+) 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 } -- 2.17.1