1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "bluetooth_a2dp_src_observer.h"
17 #include <hdf_log.h>
18
19 #ifdef LOG_DOMAIN
20 #undef LOG_DOMAIN
21 #endif
22 #define LOG_DOMAIN 0xD000105
23
OnConnectionStateChanged(const OHOS::bluetooth::RawAddress & device,int state,int cause)24 void BluetoothA2dpSrcObserver::OnConnectionStateChanged(const OHOS::bluetooth::RawAddress &device,
25 int state, int cause)
26 {
27 HDF_LOGI("BluetoothA2dpSrcObserver::OnConnectionStateChanged");
28 if ((callbacks_ != nullptr) && (callbacks_->OnConnectionStateChanged)) {
29 callbacks_->OnConnectionStateChanged(device, state, cause);
30 }
31 }
32
OnPlayingStatusChanged(const OHOS::bluetooth::RawAddress & device,int playingState,int error)33 void BluetoothA2dpSrcObserver::OnPlayingStatusChanged(
34 const OHOS::bluetooth::RawAddress &device, int playingState, int error)
35 {
36 HDF_LOGI("BluetoothA2dpSrcObserver::OnPlayingStatusChanged");
37 if ((callbacks_ != nullptr) && (callbacks_->OnPlayingStatusChanged)) {
38 callbacks_->OnPlayingStatusChanged(device, playingState, error);
39 }
40 }
41
OnConfigurationChanged(const OHOS::bluetooth::RawAddress & device,const OHOS::Bluetooth::BluetoothA2dpCodecInfo & info,int error)42 void BluetoothA2dpSrcObserver::OnConfigurationChanged
43 (const OHOS::bluetooth::RawAddress &device, const OHOS::Bluetooth::BluetoothA2dpCodecInfo &info, int error)
44 {
45 HDF_LOGI("BluetoothA2dpSrcObserver::OnConfigurationChanged");
46 if ((callbacks_ != nullptr) && (callbacks_->OnConfigurationChanged)) {
47 callbacks_->OnConfigurationChanged(device, info, error);
48 }
49 }
50
OnMediaStackChanged(const OHOS::bluetooth::RawAddress & device,int action)51 void BluetoothA2dpSrcObserver::OnMediaStackChanged(const OHOS::bluetooth::RawAddress &device, int action)
52 {
53 HDF_LOGI("BluetoothA2dpSrcObserver::OnMediaStackChanged");
54 if ((callbacks_ != nullptr) && (callbacks_->OnMediaStackChanged)) {
55 callbacks_->OnMediaStackChanged(device, action);
56 }
57 }