1 /*
2  * This file is auto-generated.  DO NOT MODIFY.
3  * Using: out/host/linux-x86/bin/aidl --lang=ndk -Weverything -Wno-missing-permission-annotation -Werror -Weverything --structured --version 4 --hash notfrozen -t --stability vintf --min_sdk_version 29 --previous_api_dir=system/hardware/interfaces/media/aidl_api/android.media.audio.common.types/3 --previous_hash 0c86a38729dd5d560fe3a0eca6aa9d8cf83efb00 --ninja -d out/soong/.intermediates/system/hardware/interfaces/media/android.media.audio.common.types-V4-ndk-source/gen/staging/android/media/audio/common/AudioHalCapParameter.cpp.d -h out/soong/.intermediates/system/hardware/interfaces/media/android.media.audio.common.types-V4-ndk-source/gen/include/staging -o out/soong/.intermediates/system/hardware/interfaces/media/android.media.audio.common.types-V4-ndk-source/gen/staging -Nsystem/hardware/interfaces/media/aidl system/hardware/interfaces/media/aidl/android/media/audio/common/AudioHalCapParameter.aidl
4  *
5  * DO NOT CHECK THIS FILE INTO A CODE TREE (e.g. git, etc..).
6  * ALWAYS GENERATE THIS FILE FROM UPDATED AIDL COMPILER
7  * AS A BUILD INTERMEDIATE ONLY. THIS IS NOT SOURCE CODE.
8  */
9 #pragma once
10 
11 #include <array>
12 #include <cassert>
13 #include <cstdint>
14 #include <memory>
15 #include <optional>
16 #include <string>
17 #include <type_traits>
18 #include <utility>
19 #include <variant>
20 #include <vector>
21 #include <android/binder_enums.h>
22 #include <android/binder_interface_utils.h>
23 #include <android/binder_parcelable_utils.h>
24 #include <android/binder_to_string.h>
25 #include <aidl/android/media/audio/common/AudioDeviceAddress.h>
26 #include <aidl/android/media/audio/common/AudioDeviceDescription.h>
27 #include <aidl/android/media/audio/common/AudioHalCapParameter.h>
28 #include <aidl/android/media/audio/common/AudioProductStrategyType.h>
29 #include <aidl/android/media/audio/common/AudioSource.h>
30 #include <aidl/android/media/audio/common/AudioStreamType.h>
31 #ifdef BINDER_STABILITY_SUPPORT
32 #include <android/binder_stability.h>
33 #endif  // BINDER_STABILITY_SUPPORT
34 
35 #ifndef __BIONIC__
36 #define __assert2(a,b,c,d) ((void)0)
37 #endif
38 
39 namespace aidl::android::media::audio::common {
40 class AudioDeviceDescription;
41 }  // namespace aidl::android::media::audio::common
42 namespace aidl {
43 namespace android {
44 namespace media {
45 namespace audio {
46 namespace common {
47 class AudioHalCapParameter {
48 public:
49   typedef std::false_type fixed_size;
50   static const char* descriptor;
51 
52   class StrategyDevice {
53   public:
54     typedef std::false_type fixed_size;
55     static const char* descriptor;
56 
57     ::aidl::android::media::audio::common::AudioDeviceDescription device;
58     int32_t id = -1;
59     bool isSelected = false;
60 
61     binder_status_t readFromParcel(const AParcel* parcel);
62     binder_status_t writeToParcel(AParcel* parcel) const;
63 
64     inline bool operator==(const StrategyDevice& _rhs) const {
65       return std::tie(device, id, isSelected) == std::tie(_rhs.device, _rhs.id, _rhs.isSelected);
66     }
67     inline bool operator<(const StrategyDevice& _rhs) const {
68       return std::tie(device, id, isSelected) < std::tie(_rhs.device, _rhs.id, _rhs.isSelected);
69     }
70     inline bool operator!=(const StrategyDevice& _rhs) const {
71       return !(*this == _rhs);
72     }
73     inline bool operator>(const StrategyDevice& _rhs) const {
74       return _rhs < *this;
75     }
76     inline bool operator>=(const StrategyDevice& _rhs) const {
77       return !(*this < _rhs);
78     }
79     inline bool operator<=(const StrategyDevice& _rhs) const {
80       return !(_rhs < *this);
81     }
82 
83     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()84     inline std::string toString() const {
85       std::ostringstream _aidl_os;
86       _aidl_os << "StrategyDevice{";
87       _aidl_os << "device: " << ::android::internal::ToString(device);
88       _aidl_os << ", id: " << ::android::internal::ToString(id);
89       _aidl_os << ", isSelected: " << ::android::internal::ToString(isSelected);
90       _aidl_os << "}";
91       return _aidl_os.str();
92     }
93   };
94   class InputSourceDevice {
95   public:
96     typedef std::false_type fixed_size;
97     static const char* descriptor;
98 
99     ::aidl::android::media::audio::common::AudioDeviceDescription device;
100     ::aidl::android::media::audio::common::AudioSource inputSource = ::aidl::android::media::audio::common::AudioSource::DEFAULT;
101     bool isSelected = false;
102 
103     binder_status_t readFromParcel(const AParcel* parcel);
104     binder_status_t writeToParcel(AParcel* parcel) const;
105 
106     inline bool operator==(const InputSourceDevice& _rhs) const {
107       return std::tie(device, inputSource, isSelected) == std::tie(_rhs.device, _rhs.inputSource, _rhs.isSelected);
108     }
109     inline bool operator<(const InputSourceDevice& _rhs) const {
110       return std::tie(device, inputSource, isSelected) < std::tie(_rhs.device, _rhs.inputSource, _rhs.isSelected);
111     }
112     inline bool operator!=(const InputSourceDevice& _rhs) const {
113       return !(*this == _rhs);
114     }
115     inline bool operator>(const InputSourceDevice& _rhs) const {
116       return _rhs < *this;
117     }
118     inline bool operator>=(const InputSourceDevice& _rhs) const {
119       return !(*this < _rhs);
120     }
121     inline bool operator<=(const InputSourceDevice& _rhs) const {
122       return !(_rhs < *this);
123     }
124 
125     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()126     inline std::string toString() const {
127       std::ostringstream _aidl_os;
128       _aidl_os << "InputSourceDevice{";
129       _aidl_os << "device: " << ::android::internal::ToString(device);
130       _aidl_os << ", inputSource: " << ::android::internal::ToString(inputSource);
131       _aidl_os << ", isSelected: " << ::android::internal::ToString(isSelected);
132       _aidl_os << "}";
133       return _aidl_os.str();
134     }
135   };
136   class StrategyDeviceAddress {
137   public:
138     typedef std::false_type fixed_size;
139     static const char* descriptor;
140 
141     ::aidl::android::media::audio::common::AudioDeviceAddress deviceAddress;
142     int32_t id = -1;
143 
144     binder_status_t readFromParcel(const AParcel* parcel);
145     binder_status_t writeToParcel(AParcel* parcel) const;
146 
147     inline bool operator==(const StrategyDeviceAddress& _rhs) const {
148       return std::tie(deviceAddress, id) == std::tie(_rhs.deviceAddress, _rhs.id);
149     }
150     inline bool operator<(const StrategyDeviceAddress& _rhs) const {
151       return std::tie(deviceAddress, id) < std::tie(_rhs.deviceAddress, _rhs.id);
152     }
153     inline bool operator!=(const StrategyDeviceAddress& _rhs) const {
154       return !(*this == _rhs);
155     }
156     inline bool operator>(const StrategyDeviceAddress& _rhs) const {
157       return _rhs < *this;
158     }
159     inline bool operator>=(const StrategyDeviceAddress& _rhs) const {
160       return !(*this < _rhs);
161     }
162     inline bool operator<=(const StrategyDeviceAddress& _rhs) const {
163       return !(_rhs < *this);
164     }
165 
166     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()167     inline std::string toString() const {
168       std::ostringstream _aidl_os;
169       _aidl_os << "StrategyDeviceAddress{";
170       _aidl_os << "deviceAddress: " << ::android::internal::ToString(deviceAddress);
171       _aidl_os << ", id: " << ::android::internal::ToString(id);
172       _aidl_os << "}";
173       return _aidl_os.str();
174     }
175   };
176   class StreamVolumeProfile {
177   public:
178     typedef std::false_type fixed_size;
179     static const char* descriptor;
180 
181     ::aidl::android::media::audio::common::AudioStreamType stream = ::aidl::android::media::audio::common::AudioStreamType::INVALID;
182     ::aidl::android::media::audio::common::AudioStreamType profile = ::aidl::android::media::audio::common::AudioStreamType::INVALID;
183 
184     binder_status_t readFromParcel(const AParcel* parcel);
185     binder_status_t writeToParcel(AParcel* parcel) const;
186 
187     inline bool operator==(const StreamVolumeProfile& _rhs) const {
188       return std::tie(stream, profile) == std::tie(_rhs.stream, _rhs.profile);
189     }
190     inline bool operator<(const StreamVolumeProfile& _rhs) const {
191       return std::tie(stream, profile) < std::tie(_rhs.stream, _rhs.profile);
192     }
193     inline bool operator!=(const StreamVolumeProfile& _rhs) const {
194       return !(*this == _rhs);
195     }
196     inline bool operator>(const StreamVolumeProfile& _rhs) const {
197       return _rhs < *this;
198     }
199     inline bool operator>=(const StreamVolumeProfile& _rhs) const {
200       return !(*this < _rhs);
201     }
202     inline bool operator<=(const StreamVolumeProfile& _rhs) const {
203       return !(_rhs < *this);
204     }
205 
206     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()207     inline std::string toString() const {
208       std::ostringstream _aidl_os;
209       _aidl_os << "StreamVolumeProfile{";
210       _aidl_os << "stream: " << ::android::internal::ToString(stream);
211       _aidl_os << ", profile: " << ::android::internal::ToString(profile);
212       _aidl_os << "}";
213       return _aidl_os.str();
214     }
215   };
216   enum class Tag : int32_t {
217     selectedStrategyDevice = 0,
218     selectedInputSourceDevice = 1,
219     strategyDeviceAddress = 2,
220     streamVolumeProfile = 3,
221   };
222 
223   // Expose tag symbols for legacy code
224   static const inline Tag selectedStrategyDevice = Tag::selectedStrategyDevice;
225   static const inline Tag selectedInputSourceDevice = Tag::selectedInputSourceDevice;
226   static const inline Tag strategyDeviceAddress = Tag::strategyDeviceAddress;
227   static const inline Tag streamVolumeProfile = Tag::streamVolumeProfile;
228 
229   template<typename _Tp>
230   static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, AudioHalCapParameter>;
231 
AudioHalCapParameter()232   AudioHalCapParameter() : _value(std::in_place_index<static_cast<size_t>(selectedStrategyDevice)>, ::aidl::android::media::audio::common::AudioHalCapParameter::StrategyDevice()) { }
233 
234   template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
235   // NOLINTNEXTLINE(google-explicit-constructor)
AudioHalCapParameter(_Tp && _arg)236   constexpr AudioHalCapParameter(_Tp&& _arg)
237       : _value(std::forward<_Tp>(_arg)) {}
238 
239   template <size_t _Np, typename... _Tp>
AudioHalCapParameter(std::in_place_index_t<_Np>,_Tp &&..._args)240   constexpr explicit AudioHalCapParameter(std::in_place_index_t<_Np>, _Tp&&... _args)
241       : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
242 
243   template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)244   static AudioHalCapParameter make(_Tp&&... _args) {
245     return AudioHalCapParameter(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
246   }
247 
248   template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)249   static AudioHalCapParameter make(std::initializer_list<_Tp> _il, _Up&&... _args) {
250     return AudioHalCapParameter(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
251   }
252 
getTag()253   Tag getTag() const {
254     return static_cast<Tag>(_value.index());
255   }
256 
257   template <Tag _tag>
get()258   const auto& get() const {
259     if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
260     return std::get<static_cast<size_t>(_tag)>(_value);
261   }
262 
263   template <Tag _tag>
get()264   auto& get() {
265     if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
266     return std::get<static_cast<size_t>(_tag)>(_value);
267   }
268 
269   template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)270   void set(_Tp&&... _args) {
271     _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
272   }
273 
274   binder_status_t readFromParcel(const AParcel* _parcel);
275   binder_status_t writeToParcel(AParcel* _parcel) const;
276 
277   inline bool operator==(const AudioHalCapParameter& _rhs) const {
278     return _value == _rhs._value;
279   }
280   inline bool operator<(const AudioHalCapParameter& _rhs) const {
281     return _value < _rhs._value;
282   }
283   inline bool operator!=(const AudioHalCapParameter& _rhs) const {
284     return !(*this == _rhs);
285   }
286   inline bool operator>(const AudioHalCapParameter& _rhs) const {
287     return _rhs < *this;
288   }
289   inline bool operator>=(const AudioHalCapParameter& _rhs) const {
290     return !(*this < _rhs);
291   }
292   inline bool operator<=(const AudioHalCapParameter& _rhs) const {
293     return !(_rhs < *this);
294   }
295 
296   static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()297   inline std::string toString() const {
298     std::ostringstream os;
299     os << "AudioHalCapParameter{";
300     switch (getTag()) {
301     case selectedStrategyDevice: os << "selectedStrategyDevice: " << ::android::internal::ToString(get<selectedStrategyDevice>()); break;
302     case selectedInputSourceDevice: os << "selectedInputSourceDevice: " << ::android::internal::ToString(get<selectedInputSourceDevice>()); break;
303     case strategyDeviceAddress: os << "strategyDeviceAddress: " << ::android::internal::ToString(get<strategyDeviceAddress>()); break;
304     case streamVolumeProfile: os << "streamVolumeProfile: " << ::android::internal::ToString(get<streamVolumeProfile>()); break;
305     }
306     os << "}";
307     return os.str();
308   }
309 private:
310   std::variant<::aidl::android::media::audio::common::AudioHalCapParameter::StrategyDevice, ::aidl::android::media::audio::common::AudioHalCapParameter::InputSourceDevice, ::aidl::android::media::audio::common::AudioHalCapParameter::StrategyDeviceAddress, ::aidl::android::media::audio::common::AudioHalCapParameter::StreamVolumeProfile> _value;
311 };
312 }  // namespace common
313 }  // namespace audio
314 }  // namespace media
315 }  // namespace android
316 }  // namespace aidl
317 namespace aidl {
318 namespace android {
319 namespace media {
320 namespace audio {
321 namespace common {
toString(AudioHalCapParameter::Tag val)322 [[nodiscard]] static inline std::string toString(AudioHalCapParameter::Tag val) {
323   switch(val) {
324   case AudioHalCapParameter::Tag::selectedStrategyDevice:
325     return "selectedStrategyDevice";
326   case AudioHalCapParameter::Tag::selectedInputSourceDevice:
327     return "selectedInputSourceDevice";
328   case AudioHalCapParameter::Tag::strategyDeviceAddress:
329     return "strategyDeviceAddress";
330   case AudioHalCapParameter::Tag::streamVolumeProfile:
331     return "streamVolumeProfile";
332   default:
333     return std::to_string(static_cast<int32_t>(val));
334   }
335 }
336 }  // namespace common
337 }  // namespace audio
338 }  // namespace media
339 }  // namespace android
340 }  // namespace aidl
341 namespace ndk {
342 namespace internal {
343 #pragma clang diagnostic push
344 #pragma clang diagnostic ignored "-Wc++17-extensions"
345 template <>
346 constexpr inline std::array<aidl::android::media::audio::common::AudioHalCapParameter::Tag, 4> enum_values<aidl::android::media::audio::common::AudioHalCapParameter::Tag> = {
347   aidl::android::media::audio::common::AudioHalCapParameter::Tag::selectedStrategyDevice,
348   aidl::android::media::audio::common::AudioHalCapParameter::Tag::selectedInputSourceDevice,
349   aidl::android::media::audio::common::AudioHalCapParameter::Tag::strategyDeviceAddress,
350   aidl::android::media::audio::common::AudioHalCapParameter::Tag::streamVolumeProfile,
351 };
352 #pragma clang diagnostic pop
353 }  // namespace internal
354 }  // namespace ndk
355