• 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_HFP_HF_OBSERVER_IMPL_H
17 #define BLUETOOTH_HFP_HF_OBSERVER_IMPL_H
18 
19 #include <shared_mutex>
20 
21 #include "bluetooth_hfp_ag.h"
22 #include "bluetooth_hfp_utils.h"
23 #include "ffi_remote_data.h"
24 
25 namespace OHOS {
26 namespace Bluetooth {
27 const char* const STR_BT_HANDS_FREE_UNIT_OBSERVER_CONNECTION_STATE_CHANGE = "connectionStateChange";
28 
29 class HandsFreeUnitObserverImpl : public HandsFreeAudioGatewayObserver, public OHOS::FFI::FFIData {
30     DECL_TYPE(HandsFreeUnitObserverImpl, OHOS::FFI::FFIData);
31 
32 public:
HandsFreeUnitObserverImpl()33     HandsFreeUnitObserverImpl() {};
34     ~HandsFreeUnitObserverImpl() override = default;
35     void RegisterStateChangeFunc(std::function<void(StateChangeParam)> cjCallback);
36     void OnConnectionStateChanged(const BluetoothRemoteDevice& device, int state, int cause) override;
37     void OnScoStateChanged(const BluetoothRemoteDevice& device, int state, int reason = 0) override {};
38 
OnActiveDeviceChanged(const BluetoothRemoteDevice & device)39     void OnActiveDeviceChanged(const BluetoothRemoteDevice& device) override {}
OnHfEnhancedDriverSafetyChanged(const BluetoothRemoteDevice & device,int indValue)40     void OnHfEnhancedDriverSafetyChanged(const BluetoothRemoteDevice& device, int indValue) override {}
OnHfpStackChanged(const BluetoothRemoteDevice & device,int action)41     void OnHfpStackChanged(const BluetoothRemoteDevice& device, int action) override {}
42 
43 private:
44     std::function<void(StateChangeParam)> stateChangeFunc { nullptr };
45 };
46 
47 } // namespace Bluetooth
48 } // namespace OHOS
49 #endif /* BLUETOOTH_HFP_HF_OBSERVER_IMPL_H */