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 // clang-format off
18 #include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
19 // clang-format on
20 #include <hidl/MQDescriptor.h>
21 #include <hidl/Status.h>
22 
23 #include "DeviceImpl.h"
24 
25 namespace audio_proxy {
26 namespace service {
27 
28 using ::android::sp;
29 using ::android::hardware::hidl_array;
30 using ::android::hardware::hidl_memory;
31 using ::android::hardware::hidl_string;
32 using ::android::hardware::hidl_vec;
33 using ::android::hardware::Return;
34 using ::android::hardware::Void;
35 using ::android::hardware::audio::V5_0::IDevicesFactory;
36 
37 class BusDeviceProvider;
38 
39 class DevicesFactoryImpl : public IDevicesFactory {
40  public:
41   explicit DevicesFactoryImpl(BusDeviceProvider& busDeviceProvider);
42 
43   // Methods from ::android::hardware::audio::V5_0::IDevicesFactory follow.
44   Return<void> openDevice(const hidl_string& device,
45                           openDevice_cb _hidl_cb) override;
46   Return<void> openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override;
47 
48  private:
49   BusDeviceProvider& mBusDeviceProvider;
50 };
51 
52 }  // namespace service
53 }  // namespace audio_proxy
54