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 <string> 20 #include <tuple> 21 #include <variant> 22 #include <vector> 23 24 // clang-format off 25 #include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h) 26 #include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) 27 // clang-format on 28 29 enum { PARAM_FACTORY_NAME, PARAM_DEVICE_NAME }; 30 using DeviceParameter = std::tuple<std::string, std::string>; 31 32 // Nesting a tuple in another tuple allows to use GTest Combine function to generate 33 // all combinations of devices and configs. 34 #if MAJOR_VERSION <= 6 35 enum { PARAM_DEVICE, PARAM_CONFIG, PARAM_FLAGS }; 36 enum { INDEX_INPUT, INDEX_OUTPUT }; 37 using DeviceConfigParameter = std::tuple< 38 DeviceParameter, android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioConfig, 39 std::variant<android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioInputFlag, 40 android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioOutputFlag>>; 41 #elif MAJOR_VERSION >= 7 42 enum { PARAM_DEVICE, PARAM_PORT_NAME, PARAM_ATTACHED_DEV_ADDR, PARAM_CONFIG, PARAM_FLAGS }; 43 using DeviceConfigParameter = 44 std::tuple<DeviceParameter, std::string, 45 android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::DeviceAddress, 46 android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::AudioConfig, 47 std::vector<android::hardware::audio::CORE_TYPES_CPP_VERSION::AudioInOutFlag>>; 48 #endif 49