1 // Copyright (C) 2020 The Android Open Source Project
2 //
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 #pragma once
16 
17 #include <memory>
18 
19 #include "public/audio_proxy.h"
20 
21 // clang-format off
22 #include PATH(android/hardware/audio/FILE_VERSION/types.h)
23 #include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
24 // clang-format on
25 
26 namespace audio_proxy {
27 namespace CPP_VERSION {
28 
29 using ::android::hardware::hidl_bitfield;
30 using namespace ::android::hardware::audio::CPP_VERSION;
31 using namespace ::android::hardware::audio::common::CPP_VERSION;
32 
33 class AudioProxyStreamOut;
34 
35 // C++ friendly wrapper of audio_proxy_device.
36 class AudioProxyDevice final {
37  public:
38   explicit AudioProxyDevice(audio_proxy_device_t* device);
39   ~AudioProxyDevice();
40 
41   const char* getAddress();
42 
43   Result openOutputStream(hidl_bitfield<AudioOutputFlag> flags,
44                           const AudioConfig& config,
45                           std::unique_ptr<AudioProxyStreamOut>* streamOut,
46                           AudioConfig* configOut);
47 
48  private:
49   audio_proxy_device_t* const mDevice;
50 };
51 
52 }  // namespace CPP_VERSION
53 }  // namespace audio_proxy
54