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 --structured --version 5 --hash notfrozen -t --stability vintf --min_sdk_version 31 -pout/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.common_interface/4/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/common/aidl/android.hardware.common_interface/2/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/common/fmq/aidl/android.hardware.common.fmq_interface/1/preprocessed.aidl --previous_api_dir=hardware/interfaces/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/4 --previous_hash ac25616dda1c45dc2915d3f5ac82687a1a6f6e46 --ninja -d out/soong/.intermediates/hardware/interfaces/bluetooth/audio/aidl/android.hardware.bluetooth.audio-V5-ndk-source/gen/staging/android/hardware/bluetooth/audio/CodecId.cpp.d -h out/soong/.intermediates/hardware/interfaces/bluetooth/audio/aidl/android.hardware.bluetooth.audio-V5-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/bluetooth/audio/aidl/android.hardware.bluetooth.audio-V5-ndk-source/gen/staging -Nhardware/interfaces/bluetooth/audio/aidl hardware/interfaces/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.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/hardware/bluetooth/audio/CodecId.h>
26 #ifdef BINDER_STABILITY_SUPPORT
27 #include <android/binder_stability.h>
28 #endif  // BINDER_STABILITY_SUPPORT
29 
30 #ifndef __BIONIC__
31 #define __assert2(a,b,c,d) ((void)0)
32 #endif
33 
34 namespace aidl {
35 namespace android {
36 namespace hardware {
37 namespace bluetooth {
38 namespace audio {
39 class CodecId {
40 public:
41   typedef std::false_type fixed_size;
42   static const char* descriptor;
43 
44   enum class A2dp : int8_t {
45     SBC = 0,
46     AAC = 2,
47   };
48 
49   enum class Core : int8_t {
50     CVSD = 2,
51     MSBC = 5,
52     LC3 = 6,
53   };
54 
55   class Vendor {
56   public:
57     typedef std::false_type fixed_size;
58     static const char* descriptor;
59 
60     int32_t id = 0;
61     int32_t codecId = 0;
62 
63     binder_status_t readFromParcel(const AParcel* parcel);
64     binder_status_t writeToParcel(AParcel* parcel) const;
65 
66     inline bool operator==(const Vendor& _rhs) const {
67       return std::tie(id, codecId) == std::tie(_rhs.id, _rhs.codecId);
68     }
69     inline bool operator<(const Vendor& _rhs) const {
70       return std::tie(id, codecId) < std::tie(_rhs.id, _rhs.codecId);
71     }
72     inline bool operator!=(const Vendor& _rhs) const {
73       return !(*this == _rhs);
74     }
75     inline bool operator>(const Vendor& _rhs) const {
76       return _rhs < *this;
77     }
78     inline bool operator>=(const Vendor& _rhs) const {
79       return !(*this < _rhs);
80     }
81     inline bool operator<=(const Vendor& _rhs) const {
82       return !(_rhs < *this);
83     }
84 
85     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()86     inline std::string toString() const {
87       std::ostringstream _aidl_os;
88       _aidl_os << "Vendor{";
89       _aidl_os << "id: " << ::android::internal::ToString(id);
90       _aidl_os << ", codecId: " << ::android::internal::ToString(codecId);
91       _aidl_os << "}";
92       return _aidl_os.str();
93     }
94   };
95   enum class Tag : int32_t {
96     a2dp = 0,
97     core = 1,
98     vendor = 2,
99   };
100 
101   // Expose tag symbols for legacy code
102   static const inline Tag a2dp = Tag::a2dp;
103   static const inline Tag core = Tag::core;
104   static const inline Tag vendor = Tag::vendor;
105 
106   template<typename _Tp>
107   static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, CodecId>;
108 
CodecId()109   CodecId() : _value(std::in_place_index<static_cast<size_t>(a2dp)>, ::aidl::android::hardware::bluetooth::audio::CodecId::A2dp(::aidl::android::hardware::bluetooth::audio::CodecId::A2dp::SBC)) { }
110 
111   template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
112   // NOLINTNEXTLINE(google-explicit-constructor)
CodecId(_Tp && _arg)113   constexpr CodecId(_Tp&& _arg)
114       : _value(std::forward<_Tp>(_arg)) {}
115 
116   template <size_t _Np, typename... _Tp>
CodecId(std::in_place_index_t<_Np>,_Tp &&..._args)117   constexpr explicit CodecId(std::in_place_index_t<_Np>, _Tp&&... _args)
118       : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
119 
120   template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)121   static CodecId make(_Tp&&... _args) {
122     return CodecId(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
123   }
124 
125   template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)126   static CodecId make(std::initializer_list<_Tp> _il, _Up&&... _args) {
127     return CodecId(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
128   }
129 
getTag()130   Tag getTag() const {
131     return static_cast<Tag>(_value.index());
132   }
133 
134   template <Tag _tag>
get()135   const auto& get() const {
136     if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
137     return std::get<static_cast<size_t>(_tag)>(_value);
138   }
139 
140   template <Tag _tag>
get()141   auto& get() {
142     if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
143     return std::get<static_cast<size_t>(_tag)>(_value);
144   }
145 
146   template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)147   void set(_Tp&&... _args) {
148     _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
149   }
150 
151   binder_status_t readFromParcel(const AParcel* _parcel);
152   binder_status_t writeToParcel(AParcel* _parcel) const;
153 
154   inline bool operator==(const CodecId& _rhs) const {
155     return _value == _rhs._value;
156   }
157   inline bool operator<(const CodecId& _rhs) const {
158     return _value < _rhs._value;
159   }
160   inline bool operator!=(const CodecId& _rhs) const {
161     return !(*this == _rhs);
162   }
163   inline bool operator>(const CodecId& _rhs) const {
164     return _rhs < *this;
165   }
166   inline bool operator>=(const CodecId& _rhs) const {
167     return !(*this < _rhs);
168   }
169   inline bool operator<=(const CodecId& _rhs) const {
170     return !(_rhs < *this);
171   }
172 
173   static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()174   inline std::string toString() const {
175     std::ostringstream os;
176     os << "CodecId{";
177     switch (getTag()) {
178     case a2dp: os << "a2dp: " << ::android::internal::ToString(get<a2dp>()); break;
179     case core: os << "core: " << ::android::internal::ToString(get<core>()); break;
180     case vendor: os << "vendor: " << ::android::internal::ToString(get<vendor>()); break;
181     }
182     os << "}";
183     return os.str();
184   }
185 private:
186   std::variant<::aidl::android::hardware::bluetooth::audio::CodecId::A2dp, ::aidl::android::hardware::bluetooth::audio::CodecId::Core, ::aidl::android::hardware::bluetooth::audio::CodecId::Vendor> _value;
187 };
188 }  // namespace audio
189 }  // namespace bluetooth
190 }  // namespace hardware
191 }  // namespace android
192 }  // namespace aidl
193 namespace aidl {
194 namespace android {
195 namespace hardware {
196 namespace bluetooth {
197 namespace audio {
toString(CodecId::A2dp val)198 [[nodiscard]] static inline std::string toString(CodecId::A2dp val) {
199   switch(val) {
200   case CodecId::A2dp::SBC:
201     return "SBC";
202   case CodecId::A2dp::AAC:
203     return "AAC";
204   default:
205     return std::to_string(static_cast<int8_t>(val));
206   }
207 }
208 }  // namespace audio
209 }  // namespace bluetooth
210 }  // namespace hardware
211 }  // namespace android
212 }  // namespace aidl
213 namespace ndk {
214 namespace internal {
215 #pragma clang diagnostic push
216 #pragma clang diagnostic ignored "-Wc++17-extensions"
217 template <>
218 constexpr inline std::array<aidl::android::hardware::bluetooth::audio::CodecId::A2dp, 2> enum_values<aidl::android::hardware::bluetooth::audio::CodecId::A2dp> = {
219   aidl::android::hardware::bluetooth::audio::CodecId::A2dp::SBC,
220   aidl::android::hardware::bluetooth::audio::CodecId::A2dp::AAC,
221 };
222 #pragma clang diagnostic pop
223 }  // namespace internal
224 }  // namespace ndk
225 namespace aidl {
226 namespace android {
227 namespace hardware {
228 namespace bluetooth {
229 namespace audio {
toString(CodecId::Core val)230 [[nodiscard]] static inline std::string toString(CodecId::Core val) {
231   switch(val) {
232   case CodecId::Core::CVSD:
233     return "CVSD";
234   case CodecId::Core::MSBC:
235     return "MSBC";
236   case CodecId::Core::LC3:
237     return "LC3";
238   default:
239     return std::to_string(static_cast<int8_t>(val));
240   }
241 }
242 }  // namespace audio
243 }  // namespace bluetooth
244 }  // namespace hardware
245 }  // namespace android
246 }  // namespace aidl
247 namespace ndk {
248 namespace internal {
249 #pragma clang diagnostic push
250 #pragma clang diagnostic ignored "-Wc++17-extensions"
251 template <>
252 constexpr inline std::array<aidl::android::hardware::bluetooth::audio::CodecId::Core, 3> enum_values<aidl::android::hardware::bluetooth::audio::CodecId::Core> = {
253   aidl::android::hardware::bluetooth::audio::CodecId::Core::CVSD,
254   aidl::android::hardware::bluetooth::audio::CodecId::Core::MSBC,
255   aidl::android::hardware::bluetooth::audio::CodecId::Core::LC3,
256 };
257 #pragma clang diagnostic pop
258 }  // namespace internal
259 }  // namespace ndk
260 namespace aidl {
261 namespace android {
262 namespace hardware {
263 namespace bluetooth {
264 namespace audio {
toString(CodecId::Tag val)265 [[nodiscard]] static inline std::string toString(CodecId::Tag val) {
266   switch(val) {
267   case CodecId::Tag::a2dp:
268     return "a2dp";
269   case CodecId::Tag::core:
270     return "core";
271   case CodecId::Tag::vendor:
272     return "vendor";
273   default:
274     return std::to_string(static_cast<int32_t>(val));
275   }
276 }
277 }  // namespace audio
278 }  // namespace bluetooth
279 }  // namespace hardware
280 }  // namespace android
281 }  // namespace aidl
282 namespace ndk {
283 namespace internal {
284 #pragma clang diagnostic push
285 #pragma clang diagnostic ignored "-Wc++17-extensions"
286 template <>
287 constexpr inline std::array<aidl::android::hardware::bluetooth::audio::CodecId::Tag, 3> enum_values<aidl::android::hardware::bluetooth::audio::CodecId::Tag> = {
288   aidl::android::hardware::bluetooth::audio::CodecId::Tag::a2dp,
289   aidl::android::hardware::bluetooth::audio::CodecId::Tag::core,
290   aidl::android::hardware::bluetooth::audio::CodecId::Tag::vendor,
291 };
292 #pragma clang diagnostic pop
293 }  // namespace internal
294 }  // namespace ndk
295