blob: a4282b0713ba97ae08599d75a15633486e53ac3f [file] [log] [blame]
Mikhail Naganovf558e022016-11-14 17:45:17 -08001/*
2 * Copyright (C) 2016 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#ifndef ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HIDL_H
18#define ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HIDL_H
19
20#include <android/hardware/audio/2.0/IDevicesFactory.h>
Kevin Rocard070e7512018-05-22 09:29:13 -070021#include <android/hardware/audio/4.0/IDevicesFactory.h>
Mikhail Naganovf558e022016-11-14 17:45:17 -080022#include <media/audiohal/DevicesFactoryHalInterface.h>
23#include <utils/Errors.h>
24#include <utils/RefBase.h>
25
26#include "DeviceHalHidl.h"
27
Kevin Rocard070e7512018-05-22 09:29:13 -070028using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
Mikhail Naganovf558e022016-11-14 17:45:17 -080029
30namespace android {
Kevin Rocard070e7512018-05-22 09:29:13 -070031namespace CPP_VERSION {
Mikhail Naganovf558e022016-11-14 17:45:17 -080032
33class DevicesFactoryHalHidl : public DevicesFactoryHalInterface
34{
35 public:
36 // Opens a device with the specified name. To close the device, it is
37 // necessary to release references to the returned object.
38 virtual status_t openDevice(const char *name, sp<DeviceHalInterface> *device);
39
40 private:
Mikhail Naganov6b111f32017-04-27 18:52:37 -070041 friend class DevicesFactoryHalHybrid;
Mikhail Naganovf558e022016-11-14 17:45:17 -080042
Kevin Rocarddf9b4202018-05-10 19:56:08 -070043 std::vector<sp<IDevicesFactory>> mDeviceFactories;
Mikhail Naganovf558e022016-11-14 17:45:17 -080044
45 // Can not be constructed directly by clients.
46 DevicesFactoryHalHidl();
47
Kevin Rocarddf9b4202018-05-10 19:56:08 -070048 virtual ~DevicesFactoryHalHidl() = default;
Mikhail Naganovf558e022016-11-14 17:45:17 -080049};
50
Kevin Rocard070e7512018-05-22 09:29:13 -070051} // namespace CPP_VERSION
Mikhail Naganovf558e022016-11-14 17:45:17 -080052} // namespace android
53
54#endif // ANDROID_HARDWARE_DEVICES_FACTORY_HAL_HIDL_H