• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 #ifndef BLUETOOTH_A2DP_OBSERVER_IMPL_H
17 #define BLUETOOTH_A2DP_OBSERVER_IMPL_H
18 
19 #include <shared_mutex>
20 
21 #include "bluetooth_a2dp_src.h"
22 #include "bluetooth_a2dp_utils.h"
23 #include "ffi_remote_data.h"
24 
25 namespace OHOS {
26 namespace Bluetooth {
27 
28 const char* const STR_BT_A2DP_SOURCE_CONNECTION_STATE_CHANGE = "connectionStateChange";
29 
30 class A2dpSourceObserverImpl : public A2dpSourceObserver, public OHOS::FFI::FFIData {
31     DECL_TYPE(A2dpSourceObserverImpl, OHOS::FFI::FFIData);
32 
33 public:
A2dpSourceObserverImpl()34     A2dpSourceObserverImpl() {};
35     ~A2dpSourceObserverImpl() override = default;
36     void OnConnectionStateChanged(const BluetoothRemoteDevice& device, int state, int cause) override;
37     void RegisterStateChangeFunc(std::function<void(StateChangeParam)> cjCallback);
38 
39 private:
40     friend class A2dpSourceProfileImpl;
41     std::function<void(StateChangeParam)> stateChangeFunc { nullptr };
42 };
43 
44 } // namespace Bluetooth
45 } // namespace OHOS
46 #endif /* NAPI_BLUETOOTH_A2DP_SRC_OBSERVER_H_ */