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 3 --hash notfrozen -t --stability vintf --min_sdk_version current -pout/soong/.intermediates/system/hardware/interfaces/media/android.media.audio.common.types_interface/4/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.effect_interface/3/preprocessed.aidl -pout/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.core.sounddose_interface/3/preprocessed.aidl -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/audio/aidl/aidl_api/android.hardware.audio.core/2 --previous_hash 003735b3fd3c94c53b02a6eb5e099731f7062610 --ninja -d out/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.core-V3-ndk-source/gen/staging/android/hardware/audio/core/StreamDescriptor.cpp.d -h out/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.core-V3-ndk-source/gen/include/staging -o out/soong/.intermediates/hardware/interfaces/audio/aidl/android.hardware.audio.core-V3-ndk-source/gen/staging -Nhardware/interfaces/audio/aidl hardware/interfaces/audio/aidl/android/hardware/audio/core/StreamDescriptor.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 <tuple>
18 #include <type_traits>
19 #include <utility>
20 #include <variant>
21 #include <vector>
22 #include <android/binder_enums.h>
23 #include <android/binder_interface_utils.h>
24 #include <android/binder_parcelable_utils.h>
25 #include <android/binder_to_string.h>
26 #include <aidl/android/hardware/audio/core/MmapBufferDescriptor.h>
27 #include <aidl/android/hardware/audio/core/StreamDescriptor.h>
28 #include <aidl/android/hardware/common/fmq/MQDescriptor.h>
29 #include <aidl/android/hardware/common/fmq/SynchronizedReadWrite.h>
30 #include <aidl/android/media/audio/common/Void.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::hardware::audio::core {
40 class MmapBufferDescriptor;
41 }  // namespace aidl::android::hardware::audio::core
42 namespace aidl::android::hardware::common::fmq {
43 template <typename T, typename Flavor>
44 class MQDescriptor;
45 }  // namespace aidl::android::hardware::common::fmq
46 namespace aidl::android::media::audio::common {
47 class Void;
48 }  // namespace aidl::android::media::audio::common
49 namespace aidl {
50 namespace android {
51 namespace hardware {
52 namespace audio {
53 namespace core {
54 class StreamDescriptor {
55 public:
56   typedef std::false_type fixed_size;
57   static const char* descriptor;
58 
59   class Position {
60   public:
61     typedef std::true_type fixed_size;
62     static const char* descriptor;
63 
64     int64_t frames __attribute__((aligned (8))) = -1L;
65     int64_t timeNs __attribute__((aligned (8))) = -1L;
66 
67     binder_status_t readFromParcel(const AParcel* parcel);
68     binder_status_t writeToParcel(AParcel* parcel) const;
69 
70     inline bool operator==(const Position& _rhs) const {
71       return std::tie(frames, timeNs) == std::tie(_rhs.frames, _rhs.timeNs);
72     }
73     inline bool operator<(const Position& _rhs) const {
74       return std::tie(frames, timeNs) < std::tie(_rhs.frames, _rhs.timeNs);
75     }
76     inline bool operator!=(const Position& _rhs) const {
77       return !(*this == _rhs);
78     }
79     inline bool operator>(const Position& _rhs) const {
80       return _rhs < *this;
81     }
82     inline bool operator>=(const Position& _rhs) const {
83       return !(*this < _rhs);
84     }
85     inline bool operator<=(const Position& _rhs) const {
86       return !(_rhs < *this);
87     }
88 
89     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
90     enum : int64_t { UNKNOWN = -1L };
toString()91     inline std::string toString() const {
92       std::ostringstream _aidl_os;
93       _aidl_os << "Position{";
94       _aidl_os << "frames: " << ::android::internal::ToString(frames);
95       _aidl_os << ", timeNs: " << ::android::internal::ToString(timeNs);
96       _aidl_os << "}";
97       return _aidl_os.str();
98     }
99   };
100   static_assert(offsetof(Position, frames) == 0);
101   static_assert(sizeof(int64_t) == 8);
102   static_assert(offsetof(Position, timeNs) == 8);
103   static_assert(sizeof(int64_t) == 8);
104   static_assert(alignof(Position) == 8);
105   static_assert(sizeof(Position) == 16);
106   enum class State : int32_t {
107     STANDBY = 1,
108     IDLE = 2,
109     ACTIVE = 3,
110     PAUSED = 4,
111     DRAINING = 5,
112     DRAIN_PAUSED = 6,
113     TRANSFERRING = 7,
114     TRANSFER_PAUSED = 8,
115     ERROR = 100,
116   };
117 
118   enum class DrainMode : int8_t {
119     DRAIN_UNSPECIFIED = 0,
120     DRAIN_ALL = 1,
121     DRAIN_EARLY_NOTIFY = 2,
122   };
123 
124   class Command {
125   public:
126     typedef std::true_type fixed_size;
127     static const char* descriptor;
128 
129     enum class Tag : int8_t {
130       halReservedExit = 0,
131       getStatus = 1,
132       start = 2,
133       burst = 3,
134       drain = 4,
135       standby = 5,
136       pause = 6,
137       flush = 7,
138     };
139 
140     // Expose tag symbols for legacy code
141     static const inline Tag halReservedExit = Tag::halReservedExit;
142     static const inline Tag getStatus = Tag::getStatus;
143     static const inline Tag start = Tag::start;
144     static const inline Tag burst = Tag::burst;
145     static const inline Tag drain = Tag::drain;
146     static const inline Tag standby = Tag::standby;
147     static const inline Tag pause = Tag::pause;
148     static const inline Tag flush = Tag::flush;
149 
150     template <Tag _Tag>
151     using _at = typename std::tuple_element<static_cast<size_t>(_Tag), std::tuple<int32_t, ::aidl::android::media::audio::common::Void, ::aidl::android::media::audio::common::Void, int32_t, ::aidl::android::hardware::audio::core::StreamDescriptor::DrainMode, ::aidl::android::media::audio::common::Void, ::aidl::android::media::audio::common::Void, ::aidl::android::media::audio::common::Void>>::type;
152     template <Tag _Tag, typename _Type>
make(_Type && _arg)153     static Command make(_Type&& _arg) {
154       Command _inst;
155       _inst.set<_Tag>(std::forward<_Type>(_arg));
156       return _inst;
157     }
getTag()158     constexpr Tag getTag() const {
159       return _tag;
160     }
161     template <Tag _Tag>
get()162     const _at<_Tag>& get() const {
163       if (_Tag != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
164       return *(_at<_Tag>*)(&_value);
165     }
166     template <Tag _Tag>
get()167     _at<_Tag>& get() {
168       if (_Tag != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
169       return *(_at<_Tag>*)(&_value);
170     }
171     template <Tag _Tag, typename _Type>
set(_Type && _arg)172     void set(_Type&& _arg) {
173       _tag = _Tag;
174       get<_Tag>() = std::forward<_Type>(_arg);
175     }
176     binder_status_t readFromParcel(const AParcel* _parcel);
177     binder_status_t writeToParcel(AParcel* _parcel) const;
178 
_cmp(const Command & _lhs,const Command & _rhs)179     static int _cmp(const Command& _lhs, const Command& _rhs) {
180       return _cmp_value(_lhs.getTag(), _rhs.getTag()) || _cmp_value_at<flush>(_lhs, _rhs);
181     }
182     template <Tag _Tag>
_cmp_value_at(const Command & _lhs,const Command & _rhs)183     static int _cmp_value_at(const Command& _lhs, const Command& _rhs) {
184       if constexpr (_Tag == halReservedExit) {
185         return _cmp_value(_lhs.get<_Tag>(), _rhs.get<_Tag>());
186       } else {
187         return (_lhs.getTag() == _Tag)
188           ? _cmp_value(_lhs.get<_Tag>(), _rhs.get<_Tag>())
189           : _cmp_value_at<static_cast<Tag>(static_cast<size_t>(_Tag)-1)>(_lhs, _rhs);
190       }
191     }
192     template <typename _Type>
_cmp_value(const _Type & _lhs,const _Type & _rhs)193     static int _cmp_value(const _Type& _lhs, const _Type& _rhs) {
194       return (_lhs == _rhs) ? 0 : (_lhs < _rhs) ? -1 : 1;
195     }
196     inline bool operator!=(const Command&_rhs) const {
197       return _cmp(*this, _rhs) != 0;
198     }
199     inline bool operator<(const Command&_rhs) const {
200       return _cmp(*this, _rhs) < 0;
201     }
202     inline bool operator<=(const Command&_rhs) const {
203       return _cmp(*this, _rhs) <= 0;
204     }
205     inline bool operator==(const Command&_rhs) const {
206       return _cmp(*this, _rhs) == 0;
207     }
208     inline bool operator>(const Command&_rhs) const {
209       return _cmp(*this, _rhs) > 0;
210     }
211     inline bool operator>=(const Command&_rhs) const {
212       return _cmp(*this, _rhs) >= 0;
213     }
214     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()215     inline std::string toString() const {
216       std::ostringstream os;
217       os << "Command{";
218       switch (getTag()) {
219       case halReservedExit: os << "halReservedExit: " << ::android::internal::ToString(get<halReservedExit>()); break;
220       case getStatus: os << "getStatus: " << ::android::internal::ToString(get<getStatus>()); break;
221       case start: os << "start: " << ::android::internal::ToString(get<start>()); break;
222       case burst: os << "burst: " << ::android::internal::ToString(get<burst>()); break;
223       case drain: os << "drain: " << ::android::internal::ToString(get<drain>()); break;
224       case standby: os << "standby: " << ::android::internal::ToString(get<standby>()); break;
225       case pause: os << "pause: " << ::android::internal::ToString(get<pause>()); break;
226       case flush: os << "flush: " << ::android::internal::ToString(get<flush>()); break;
227       }
228       os << "}";
229       return os.str();
230     }
231   private:
232     Tag _tag = halReservedExit;
233     union _value_t {
_value_t()234       _value_t() {}
~_value_t()235       ~_value_t() {}
236       int32_t halReservedExit __attribute__((aligned (4))) = int32_t(0);
237       ::aidl::android::media::audio::common::Void getStatus __attribute__((aligned (1)));
238       ::aidl::android::media::audio::common::Void start __attribute__((aligned (1)));
239       int32_t burst __attribute__((aligned (4)));
240       ::aidl::android::hardware::audio::core::StreamDescriptor::DrainMode drain __attribute__((aligned (1)));
241       ::aidl::android::media::audio::common::Void standby __attribute__((aligned (1)));
242       ::aidl::android::media::audio::common::Void pause __attribute__((aligned (1)));
243       ::aidl::android::media::audio::common::Void flush __attribute__((aligned (1)));
244     } _value;
245   };
246   static_assert(sizeof(int32_t) == 4);
247   static_assert(sizeof(::aidl::android::media::audio::common::Void) == 1);
248   static_assert(sizeof(::aidl::android::media::audio::common::Void) == 1);
249   static_assert(sizeof(int32_t) == 4);
250   static_assert(sizeof(::aidl::android::hardware::audio::core::StreamDescriptor::DrainMode) == 1);
251   static_assert(sizeof(::aidl::android::media::audio::common::Void) == 1);
252   static_assert(sizeof(::aidl::android::media::audio::common::Void) == 1);
253   static_assert(sizeof(::aidl::android::media::audio::common::Void) == 1);
254   static_assert(alignof(Command) == 4);
255   static_assert(sizeof(Command) == 8);
256   class Reply {
257   public:
258     typedef std::true_type fixed_size;
259     static const char* descriptor;
260 
261     int32_t status __attribute__((aligned (4))) = 0;
262     int32_t fmqByteCount __attribute__((aligned (4))) = 0;
263     ::aidl::android::hardware::audio::core::StreamDescriptor::Position observable __attribute__((aligned (8)));
264     ::aidl::android::hardware::audio::core::StreamDescriptor::Position hardware __attribute__((aligned (8)));
265     int32_t latencyMs __attribute__((aligned (4))) = 0;
266     int32_t xrunFrames __attribute__((aligned (4))) = 0;
267     ::aidl::android::hardware::audio::core::StreamDescriptor::State state __attribute__((aligned (4))) = ::aidl::android::hardware::audio::core::StreamDescriptor::State::STANDBY;
268 
269     binder_status_t readFromParcel(const AParcel* parcel);
270     binder_status_t writeToParcel(AParcel* parcel) const;
271 
272     inline bool operator==(const Reply& _rhs) const {
273       return std::tie(status, fmqByteCount, observable, hardware, latencyMs, xrunFrames, state) == std::tie(_rhs.status, _rhs.fmqByteCount, _rhs.observable, _rhs.hardware, _rhs.latencyMs, _rhs.xrunFrames, _rhs.state);
274     }
275     inline bool operator<(const Reply& _rhs) const {
276       return std::tie(status, fmqByteCount, observable, hardware, latencyMs, xrunFrames, state) < std::tie(_rhs.status, _rhs.fmqByteCount, _rhs.observable, _rhs.hardware, _rhs.latencyMs, _rhs.xrunFrames, _rhs.state);
277     }
278     inline bool operator!=(const Reply& _rhs) const {
279       return !(*this == _rhs);
280     }
281     inline bool operator>(const Reply& _rhs) const {
282       return _rhs < *this;
283     }
284     inline bool operator>=(const Reply& _rhs) const {
285       return !(*this < _rhs);
286     }
287     inline bool operator<=(const Reply& _rhs) const {
288       return !(_rhs < *this);
289     }
290 
291     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()292     inline std::string toString() const {
293       std::ostringstream _aidl_os;
294       _aidl_os << "Reply{";
295       _aidl_os << "status: " << ::android::internal::ToString(status);
296       _aidl_os << ", fmqByteCount: " << ::android::internal::ToString(fmqByteCount);
297       _aidl_os << ", observable: " << ::android::internal::ToString(observable);
298       _aidl_os << ", hardware: " << ::android::internal::ToString(hardware);
299       _aidl_os << ", latencyMs: " << ::android::internal::ToString(latencyMs);
300       _aidl_os << ", xrunFrames: " << ::android::internal::ToString(xrunFrames);
301       _aidl_os << ", state: " << ::android::internal::ToString(state);
302       _aidl_os << "}";
303       return _aidl_os.str();
304     }
305   };
306   static_assert(offsetof(Reply, status) == 0);
307   static_assert(sizeof(int32_t) == 4);
308   static_assert(offsetof(Reply, fmqByteCount) == 4);
309   static_assert(sizeof(int32_t) == 4);
310   static_assert(offsetof(Reply, observable) == 8);
311   static_assert(sizeof(::aidl::android::hardware::audio::core::StreamDescriptor::Position) == 16);
312   static_assert(offsetof(Reply, hardware) == 24);
313   static_assert(sizeof(::aidl::android::hardware::audio::core::StreamDescriptor::Position) == 16);
314   static_assert(offsetof(Reply, latencyMs) == 40);
315   static_assert(sizeof(int32_t) == 4);
316   static_assert(offsetof(Reply, xrunFrames) == 44);
317   static_assert(sizeof(int32_t) == 4);
318   static_assert(offsetof(Reply, state) == 48);
319   static_assert(sizeof(::aidl::android::hardware::audio::core::StreamDescriptor::State) == 4);
320   static_assert(alignof(Reply) == 8);
321   static_assert(sizeof(Reply) == 56);
322   class AudioBuffer {
323   public:
324     typedef std::false_type fixed_size;
325     static const char* descriptor;
326 
327     enum class Tag : int32_t {
328       fmq = 0,
329       mmap = 1,
330     };
331 
332     // Expose tag symbols for legacy code
333     static const inline Tag fmq = Tag::fmq;
334     static const inline Tag mmap = Tag::mmap;
335 
336     template<typename _Tp>
337     static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, AudioBuffer>;
338 
AudioBuffer()339     AudioBuffer() : _value(std::in_place_index<static_cast<size_t>(fmq)>, ::aidl::android::hardware::common::fmq::MQDescriptor<int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>()) { }
340 
341     template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
342     // NOLINTNEXTLINE(google-explicit-constructor)
AudioBuffer(_Tp && _arg)343     constexpr AudioBuffer(_Tp&& _arg)
344         : _value(std::forward<_Tp>(_arg)) {}
345 
346     template <size_t _Np, typename... _Tp>
AudioBuffer(std::in_place_index_t<_Np>,_Tp &&..._args)347     constexpr explicit AudioBuffer(std::in_place_index_t<_Np>, _Tp&&... _args)
348         : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
349 
350     template <Tag _tag, typename... _Tp>
make(_Tp &&..._args)351     static AudioBuffer make(_Tp&&... _args) {
352       return AudioBuffer(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
353     }
354 
355     template <Tag _tag, typename _Tp, typename... _Up>
make(std::initializer_list<_Tp> _il,_Up &&..._args)356     static AudioBuffer make(std::initializer_list<_Tp> _il, _Up&&... _args) {
357       return AudioBuffer(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
358     }
359 
getTag()360     Tag getTag() const {
361       return static_cast<Tag>(_value.index());
362     }
363 
364     template <Tag _tag>
get()365     const auto& get() const {
366       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
367       return std::get<static_cast<size_t>(_tag)>(_value);
368     }
369 
370     template <Tag _tag>
get()371     auto& get() {
372       if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
373       return std::get<static_cast<size_t>(_tag)>(_value);
374     }
375 
376     template <Tag _tag, typename... _Tp>
set(_Tp &&..._args)377     void set(_Tp&&... _args) {
378       _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
379     }
380 
381     binder_status_t readFromParcel(const AParcel* _parcel);
382     binder_status_t writeToParcel(AParcel* _parcel) const;
383 
384     inline bool operator==(const AudioBuffer& _rhs) const {
385       return _value == _rhs._value;
386     }
387     inline bool operator<(const AudioBuffer& _rhs) const {
388       return _value < _rhs._value;
389     }
390     inline bool operator!=(const AudioBuffer& _rhs) const {
391       return !(*this == _rhs);
392     }
393     inline bool operator>(const AudioBuffer& _rhs) const {
394       return _rhs < *this;
395     }
396     inline bool operator>=(const AudioBuffer& _rhs) const {
397       return !(*this < _rhs);
398     }
399     inline bool operator<=(const AudioBuffer& _rhs) const {
400       return !(_rhs < *this);
401     }
402 
403     static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
toString()404     inline std::string toString() const {
405       std::ostringstream os;
406       os << "AudioBuffer{";
407       switch (getTag()) {
408       case fmq: os << "fmq: " << ::android::internal::ToString(get<fmq>()); break;
409       case mmap: os << "mmap: " << ::android::internal::ToString(get<mmap>()); break;
410       }
411       os << "}";
412       return os.str();
413     }
414   private:
415     std::variant<::aidl::android::hardware::common::fmq::MQDescriptor<int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>, ::aidl::android::hardware::audio::core::MmapBufferDescriptor> _value;
416   };
417   ::aidl::android::hardware::common::fmq::MQDescriptor<::aidl::android::hardware::audio::core::StreamDescriptor::Command, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> command;
418   ::aidl::android::hardware::common::fmq::MQDescriptor<::aidl::android::hardware::audio::core::StreamDescriptor::Reply, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> reply;
419   int32_t frameSizeBytes = 0;
420   int64_t bufferSizeFrames = 0L;
421   ::aidl::android::hardware::audio::core::StreamDescriptor::AudioBuffer audio;
422 
423   binder_status_t readFromParcel(const AParcel* parcel);
424   binder_status_t writeToParcel(AParcel* parcel) const;
425 
426   inline bool operator==(const StreamDescriptor& _rhs) const {
427     return std::tie(command, reply, frameSizeBytes, bufferSizeFrames, audio) == std::tie(_rhs.command, _rhs.reply, _rhs.frameSizeBytes, _rhs.bufferSizeFrames, _rhs.audio);
428   }
429   inline bool operator<(const StreamDescriptor& _rhs) const {
430     return std::tie(command, reply, frameSizeBytes, bufferSizeFrames, audio) < std::tie(_rhs.command, _rhs.reply, _rhs.frameSizeBytes, _rhs.bufferSizeFrames, _rhs.audio);
431   }
432   inline bool operator!=(const StreamDescriptor& _rhs) const {
433     return !(*this == _rhs);
434   }
435   inline bool operator>(const StreamDescriptor& _rhs) const {
436     return _rhs < *this;
437   }
438   inline bool operator>=(const StreamDescriptor& _rhs) const {
439     return !(*this < _rhs);
440   }
441   inline bool operator<=(const StreamDescriptor& _rhs) const {
442     return !(_rhs < *this);
443   }
444 
445   static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_VINTF;
446   enum : int32_t { LATENCY_UNKNOWN = -1 };
toString()447   inline std::string toString() const {
448     std::ostringstream _aidl_os;
449     _aidl_os << "StreamDescriptor{";
450     _aidl_os << "command: " << ::android::internal::ToString(command);
451     _aidl_os << ", reply: " << ::android::internal::ToString(reply);
452     _aidl_os << ", frameSizeBytes: " << ::android::internal::ToString(frameSizeBytes);
453     _aidl_os << ", bufferSizeFrames: " << ::android::internal::ToString(bufferSizeFrames);
454     _aidl_os << ", audio: " << ::android::internal::ToString(audio);
455     _aidl_os << "}";
456     return _aidl_os.str();
457   }
458 };
459 }  // namespace core
460 }  // namespace audio
461 }  // namespace hardware
462 }  // namespace android
463 }  // namespace aidl
464 namespace aidl {
465 namespace android {
466 namespace hardware {
467 namespace audio {
468 namespace core {
toString(StreamDescriptor::State val)469 [[nodiscard]] static inline std::string toString(StreamDescriptor::State val) {
470   switch(val) {
471   case StreamDescriptor::State::STANDBY:
472     return "STANDBY";
473   case StreamDescriptor::State::IDLE:
474     return "IDLE";
475   case StreamDescriptor::State::ACTIVE:
476     return "ACTIVE";
477   case StreamDescriptor::State::PAUSED:
478     return "PAUSED";
479   case StreamDescriptor::State::DRAINING:
480     return "DRAINING";
481   case StreamDescriptor::State::DRAIN_PAUSED:
482     return "DRAIN_PAUSED";
483   case StreamDescriptor::State::TRANSFERRING:
484     return "TRANSFERRING";
485   case StreamDescriptor::State::TRANSFER_PAUSED:
486     return "TRANSFER_PAUSED";
487   case StreamDescriptor::State::ERROR:
488     return "ERROR";
489   default:
490     return std::to_string(static_cast<int32_t>(val));
491   }
492 }
493 }  // namespace core
494 }  // namespace audio
495 }  // namespace hardware
496 }  // namespace android
497 }  // namespace aidl
498 namespace ndk {
499 namespace internal {
500 #pragma clang diagnostic push
501 #pragma clang diagnostic ignored "-Wc++17-extensions"
502 template <>
503 constexpr inline std::array<aidl::android::hardware::audio::core::StreamDescriptor::State, 9> enum_values<aidl::android::hardware::audio::core::StreamDescriptor::State> = {
504   aidl::android::hardware::audio::core::StreamDescriptor::State::STANDBY,
505   aidl::android::hardware::audio::core::StreamDescriptor::State::IDLE,
506   aidl::android::hardware::audio::core::StreamDescriptor::State::ACTIVE,
507   aidl::android::hardware::audio::core::StreamDescriptor::State::PAUSED,
508   aidl::android::hardware::audio::core::StreamDescriptor::State::DRAINING,
509   aidl::android::hardware::audio::core::StreamDescriptor::State::DRAIN_PAUSED,
510   aidl::android::hardware::audio::core::StreamDescriptor::State::TRANSFERRING,
511   aidl::android::hardware::audio::core::StreamDescriptor::State::TRANSFER_PAUSED,
512   aidl::android::hardware::audio::core::StreamDescriptor::State::ERROR,
513 };
514 #pragma clang diagnostic pop
515 }  // namespace internal
516 }  // namespace ndk
517 namespace aidl {
518 namespace android {
519 namespace hardware {
520 namespace audio {
521 namespace core {
toString(StreamDescriptor::DrainMode val)522 [[nodiscard]] static inline std::string toString(StreamDescriptor::DrainMode val) {
523   switch(val) {
524   case StreamDescriptor::DrainMode::DRAIN_UNSPECIFIED:
525     return "DRAIN_UNSPECIFIED";
526   case StreamDescriptor::DrainMode::DRAIN_ALL:
527     return "DRAIN_ALL";
528   case StreamDescriptor::DrainMode::DRAIN_EARLY_NOTIFY:
529     return "DRAIN_EARLY_NOTIFY";
530   default:
531     return std::to_string(static_cast<int8_t>(val));
532   }
533 }
534 }  // namespace core
535 }  // namespace audio
536 }  // namespace hardware
537 }  // namespace android
538 }  // namespace aidl
539 namespace ndk {
540 namespace internal {
541 #pragma clang diagnostic push
542 #pragma clang diagnostic ignored "-Wc++17-extensions"
543 template <>
544 constexpr inline std::array<aidl::android::hardware::audio::core::StreamDescriptor::DrainMode, 3> enum_values<aidl::android::hardware::audio::core::StreamDescriptor::DrainMode> = {
545   aidl::android::hardware::audio::core::StreamDescriptor::DrainMode::DRAIN_UNSPECIFIED,
546   aidl::android::hardware::audio::core::StreamDescriptor::DrainMode::DRAIN_ALL,
547   aidl::android::hardware::audio::core::StreamDescriptor::DrainMode::DRAIN_EARLY_NOTIFY,
548 };
549 #pragma clang diagnostic pop
550 }  // namespace internal
551 }  // namespace ndk
552 namespace aidl {
553 namespace android {
554 namespace hardware {
555 namespace audio {
556 namespace core {
toString(StreamDescriptor::Command::Tag val)557 [[nodiscard]] static inline std::string toString(StreamDescriptor::Command::Tag val) {
558   switch(val) {
559   case StreamDescriptor::Command::Tag::halReservedExit:
560     return "halReservedExit";
561   case StreamDescriptor::Command::Tag::getStatus:
562     return "getStatus";
563   case StreamDescriptor::Command::Tag::start:
564     return "start";
565   case StreamDescriptor::Command::Tag::burst:
566     return "burst";
567   case StreamDescriptor::Command::Tag::drain:
568     return "drain";
569   case StreamDescriptor::Command::Tag::standby:
570     return "standby";
571   case StreamDescriptor::Command::Tag::pause:
572     return "pause";
573   case StreamDescriptor::Command::Tag::flush:
574     return "flush";
575   default:
576     return std::to_string(static_cast<int8_t>(val));
577   }
578 }
579 }  // namespace core
580 }  // namespace audio
581 }  // namespace hardware
582 }  // namespace android
583 }  // namespace aidl
584 namespace ndk {
585 namespace internal {
586 #pragma clang diagnostic push
587 #pragma clang diagnostic ignored "-Wc++17-extensions"
588 template <>
589 constexpr inline std::array<aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag, 8> enum_values<aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag> = {
590   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::halReservedExit,
591   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::getStatus,
592   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::start,
593   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::burst,
594   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::drain,
595   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::standby,
596   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::pause,
597   aidl::android::hardware::audio::core::StreamDescriptor::Command::Tag::flush,
598 };
599 #pragma clang diagnostic pop
600 }  // namespace internal
601 }  // namespace ndk
602 namespace aidl {
603 namespace android {
604 namespace hardware {
605 namespace audio {
606 namespace core {
toString(StreamDescriptor::AudioBuffer::Tag val)607 [[nodiscard]] static inline std::string toString(StreamDescriptor::AudioBuffer::Tag val) {
608   switch(val) {
609   case StreamDescriptor::AudioBuffer::Tag::fmq:
610     return "fmq";
611   case StreamDescriptor::AudioBuffer::Tag::mmap:
612     return "mmap";
613   default:
614     return std::to_string(static_cast<int32_t>(val));
615   }
616 }
617 }  // namespace core
618 }  // namespace audio
619 }  // namespace hardware
620 }  // namespace android
621 }  // namespace aidl
622 namespace ndk {
623 namespace internal {
624 #pragma clang diagnostic push
625 #pragma clang diagnostic ignored "-Wc++17-extensions"
626 template <>
627 constexpr inline std::array<aidl::android::hardware::audio::core::StreamDescriptor::AudioBuffer::Tag, 2> enum_values<aidl::android::hardware::audio::core::StreamDescriptor::AudioBuffer::Tag> = {
628   aidl::android::hardware::audio::core::StreamDescriptor::AudioBuffer::Tag::fmq,
629   aidl::android::hardware::audio::core::StreamDescriptor::AudioBuffer::Tag::mmap,
630 };
631 #pragma clang diagnostic pop
632 }  // namespace internal
633 }  // namespace ndk
634