• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <memory>
20 
21 #include "btif/include/btif_hf.h"
22 #include "include/hardware/bluetooth_headset_callbacks.h"
23 #include "rust/cxx.h"
24 #include "types/raw_address.h"
25 
26 namespace bluetooth {
27 namespace topshim {
28 namespace rust {
29 
30 struct TelephonyDeviceStatus;
31 struct CallInfo;
32 struct PhoneState;
33 
34 class HfpIntf {
35  public:
HfpIntf(headset::Interface * intf)36   HfpIntf(headset::Interface* intf) : intf_(intf){};
37 
38   int init();
39   uint32_t connect(RawAddress addr);
40   int connect_audio(RawAddress addr, bool sco_offload, bool force_cvsd);
41   int set_active_device(RawAddress addr);
42   int set_volume(int8_t volume, RawAddress addr);
43   uint32_t disconnect(RawAddress addr);
44   int disconnect_audio(RawAddress addr);
45   uint32_t device_status_notification(TelephonyDeviceStatus status, RawAddress addr);
46   uint32_t indicator_query_response(
47       TelephonyDeviceStatus device_status, PhoneState phone_state, RawAddress addr);
48   uint32_t current_calls_query_response(const ::rust::Vec<CallInfo>& call_list, RawAddress addr);
49   uint32_t phone_state_change(
50       PhoneState phone_state, const ::rust::String& number, RawAddress addr);
51   uint32_t simple_at_response(bool ok, RawAddress addr);
52   void cleanup();
53 
54  private:
55   headset::Interface* intf_;
56 };
57 
58 std::unique_ptr<HfpIntf> GetHfpProfile(const unsigned char* btif);
59 
60 }  // namespace rust
61 }  // namespace topshim
62 }  // namespace bluetooth
63