1 /* 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_AUDIO_V2_0_DEVICESFACTORY_H 18 #define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H 19 20 #include <hardware/audio.h> 21 22 #include <android/hardware/audio/2.0/IDevicesFactory.h> 23 #include <hidl/Status.h> 24 25 #include <hidl/MQDescriptor.h> 26 namespace android { 27 namespace hardware { 28 namespace audio { 29 namespace V2_0 { 30 namespace implementation { 31 32 using ::android::hardware::audio::V2_0::IDevice; 33 using ::android::hardware::audio::V2_0::IDevicesFactory; 34 using ::android::hardware::audio::V2_0::Result; 35 using ::android::hardware::Return; 36 using ::android::hardware::Void; 37 using ::android::hardware::hidl_vec; 38 using ::android::hardware::hidl_string; 39 using ::android::sp; 40 41 struct DevicesFactory : public IDevicesFactory { 42 // Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow. 43 Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override; 44 45 private: 46 static const char* deviceToString(IDevicesFactory::Device device); 47 static int loadAudioInterface(const char *if_name, audio_hw_device_t **dev); 48 49 }; 50 51 extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name); 52 53 } // namespace implementation 54 } // namespace V2_0 55 } // namespace audio 56 } // namespace hardware 57 } // namespace android 58 59 #endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H 60