1 #ifndef HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAM_H
2 #define HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAM_H
3 
4 #include <android/hardware/audio/common/7.0/types.h>
5 #include <android/hardware/audio/7.0/types.h>
6 #include <android/hidl/base/1.0/IBase.h>
7 
8 #include <android/hidl/manager/1.0/IServiceNotification.h>
9 
10 #include <hidl/HidlSupport.h>
11 #include <hidl/MQDescriptor.h>
12 #include <hidl/Status.h>
13 #include <utils/NativeHandle.h>
14 #include <utils/misc.h>
15 
16 namespace android {
17 namespace hardware {
18 namespace audio {
19 namespace V7_0 {
20 
21 struct IStream : public ::android::hidl::base::V1_0::IBase {
22     /**
23      * Type tag for use in template logic that indicates this is a 'pure' class.
24      */
25     typedef ::android::hardware::details::i_tag _hidl_tag;
26 
27     /**
28      * Fully qualified interface name: "[email protected]::IStream"
29      */
30     static const char* descriptor;
31 
32     /**
33      * Returns whether this object's implementation is outside of the current process.
34      */
isRemoteIStream35     virtual bool isRemote() const override { return false; }
36 
37     /**
38      * Return the frame size (number of bytes per sample).
39      *
40      * @return frameSize frame size in bytes.
41      */
42     virtual ::android::hardware::Return<uint64_t> getFrameSize() = 0;
43 
44     /**
45      * Return the frame count of the buffer. Calling this method is equivalent
46      * to getting AUDIO_PARAMETER_STREAM_FRAME_COUNT on the legacy HAL.
47      *
48      * @return count frame count.
49      */
50     virtual ::android::hardware::Return<uint64_t> getFrameCount() = 0;
51 
52     /**
53      * Return the size of input/output buffer in bytes for this stream.
54      * It must be a multiple of the frame size.
55      *
56      * @return buffer buffer size in bytes.
57      */
58     virtual ::android::hardware::Return<uint64_t> getBufferSize() = 0;
59 
60     /**
61      * Return callback for getSupportedProfiles
62      */
63     using getSupportedProfiles_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::AudioProfile>& profiles)>;
64     /**
65      * Return supported audio profiles for this particular stream. This method
66      * is normally called for streams opened on devices that use dynamic
67      * profiles, e.g. HDMI and USB interfaces. Please note that supported
68      * profiles of the stream may differ from the capabilities of the connected
69      * physical device.
70      *
71      * For devices with fixed configurations, e.g. built-in audio devices, all
72      * the profiles are specified in the audio_policy_configuration.xml
73      * file. For such devices, this method must return the configuration from
74      * the config file, or NOT_SUPPORTED retval.
75      *
76      * @return retval operation completion status.
77      * @return formats supported audio profiles.
78      *                 Must be non empty if retval is OK.
79      */
80     virtual ::android::hardware::Return<void> getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) = 0;
81 
82     /**
83      * Return callback for getAudioProperties
84      */
85     using getAudioProperties_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::common::V7_0::AudioConfigBase& config)>;
86     /**
87      * Retrieves basic stream configuration: sample rate, audio format,
88      * channel mask.
89      *
90      * @return retval operation completion status.
91      * @return config basic stream configuration.
92      */
93     virtual ::android::hardware::Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) = 0;
94 
95     /**
96      * Sets stream parameters. Only sets parameters that are specified.
97      *
98      * Optional method. If implemented, only called on a stopped stream.
99      *
100      * @param config basic stream configuration.
101      * @return retval operation completion status.
102      */
103     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setAudioProperties(const ::android::hardware::audio::common::V7_0::AudioConfigBaseOptional& config) = 0;
104 
105     /**
106      * Applies audio effect to the stream.
107      *
108      * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
109      *                 the effect to apply.
110      * @return retval operation completion status.
111      */
112     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> addEffect(uint64_t effectId) = 0;
113 
114     /**
115      * Stops application of the effect to the stream.
116      *
117      * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
118      *                 the effect to remove.
119      * @return retval operation completion status.
120      */
121     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> removeEffect(uint64_t effectId) = 0;
122 
123     /**
124      * Put the audio hardware input/output into standby mode.
125      * Driver must exit from standby mode at the next I/O operation.
126      *
127      * @return retval operation completion status.
128      */
129     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> standby() = 0;
130 
131     /**
132      * Return callback for getDevices
133      */
134     using getDevices_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::DeviceAddress>& devices)>;
135     /**
136      * Return the set of devices which this stream is connected to.
137      *
138      * Optional method
139      *
140      * @return retval operation completion status: OK or NOT_SUPPORTED.
141      * @return device set of devices which this stream is connected to.
142      */
143     virtual ::android::hardware::Return<void> getDevices(getDevices_cb _hidl_cb) = 0;
144 
145     /**
146      * Connects the stream to one or multiple devices.
147      *
148      * This method must only be used for HALs that do not support
149      * 'IDevice.createAudioPatch' method. Calling this method is
150      * equivalent to setting AUDIO_PARAMETER_STREAM_ROUTING preceded
151      * with a device address in the legacy HAL interface.
152      *
153      * @param address device to connect the stream to.
154      * @return retval operation completion status.
155      */
156     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setDevices(const ::android::hardware::hidl_vec<::android::hardware::audio::common::V7_0::DeviceAddress>& devices) = 0;
157 
158     /**
159      * Sets the HW synchronization source. Calling this method is equivalent to
160      * setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
161      *
162      * Optional method
163      *
164      * @param hwAvSync HW synchronization source
165      * @return retval operation completion status.
166      */
167     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setHwAvSync(uint32_t hwAvSync) = 0;
168 
169     /**
170      * Return callback for getParameters
171      */
172     using getParameters_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& parameters)>;
173     /**
174      * Generic method for retrieving vendor-specific parameter values.
175      * The framework does not interpret the parameters, they are passed
176      * in an opaque manner between a vendor application and HAL.
177      *
178      * Multiple parameters can be retrieved at the same time.
179      * The implementation should return as many requested parameters
180      * as possible, even if one or more is not supported
181      *
182      * @param context provides more information about the request
183      * @param keys keys of the requested parameters
184      * @return retval operation completion status.
185      *         OK must be returned if keys is empty.
186      *         NOT_SUPPORTED must be returned if at least one key is unknown.
187      * @return parameters parameter key value pairs.
188      *         Must contain the value of all requested keys if retval == OK
189      */
190     virtual ::android::hardware::Return<void> getParameters(const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& context, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& keys, getParameters_cb _hidl_cb) = 0;
191 
192     /**
193      * Generic method for setting vendor-specific parameter values.
194      * The framework does not interpret the parameters, they are passed
195      * in an opaque manner between a vendor application and HAL.
196      *
197      * Multiple parameters can be set at the same time though this is
198      * discouraged as it make failure analysis harder.
199      *
200      * If possible, a failed setParameters should not impact the platform state.
201      *
202      * @param context provides more information about the request
203      * @param parameters parameter key value pairs.
204      * @return retval operation completion status.
205      *         All parameters must be successfully set for OK to be returned
206      */
207     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> setParameters(const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& context, const ::android::hardware::hidl_vec<::android::hardware::audio::V7_0::ParameterValue>& parameters) = 0;
208 
209     /**
210      * Called by the framework to start a stream operating in mmap mode.
211      * createMmapBuffer() must be called before calling start().
212      * Function only implemented by streams operating in mmap mode.
213      *
214      * @return retval OK in case the success.
215      *                NOT_SUPPORTED on non mmap mode streams
216      *                INVALID_STATE if called out of sequence
217      */
218     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> start() = 0;
219 
220     /**
221      * Called by the framework to stop a stream operating in mmap mode.
222      * Function only implemented by streams operating in mmap mode.
223      *
224      * @return retval OK in case the success.
225      *                NOT_SUPPORTED on non mmap mode streams
226      *                INVALID_STATE if called out of sequence
227      */
228     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> stop() = 0;
229 
230     /**
231      * Return callback for createMmapBuffer
232      */
233     using createMmapBuffer_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::V7_0::MmapBufferInfo& info)>;
234     /**
235      * Called by the framework to retrieve information on the mmap buffer used for audio
236      * samples transfer.
237      * Function only implemented by streams operating in mmap mode.
238      *
239      * @param minSizeFrames minimum buffer size requested. The actual buffer
240      *                     size returned in struct MmapBufferInfo can be larger.
241      *                     The size must be a positive value.
242      * @return retval OK in case the success.
243      *                NOT_SUPPORTED on non mmap mode streams
244      *                NOT_INITIALIZED in case of memory allocation error
245      *                INVALID_ARGUMENTS if the requested buffer size is invalid
246      *                INVALID_STATE if called out of sequence
247      * @return info    a MmapBufferInfo struct containing information on the MMMAP buffer created.
248      */
249     virtual ::android::hardware::Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) = 0;
250 
251     /**
252      * Return callback for getMmapPosition
253      */
254     using getMmapPosition_cb = std::function<void(::android::hardware::audio::V7_0::Result retval, const ::android::hardware::audio::V7_0::MmapPosition& position)>;
255     /**
256      * Called by the framework to read current read/write position in the mmap buffer
257      * with associated time stamp.
258      * Function only implemented by streams operating in mmap mode.
259      *
260      * @return retval OK in case the success.
261      *                NOT_SUPPORTED on non mmap mode streams
262      *                INVALID_STATE if called out of sequence
263      * @return position a MmapPosition struct containing current HW read/write position in frames
264      *                  with associated time stamp.
265      */
266     virtual ::android::hardware::Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) = 0;
267 
268     /**
269      * Called by the framework to deinitialize the stream and free up
270      * all currently allocated resources. It is recommended to close
271      * the stream on the client side as soon as it is becomes unused.
272      *
273      * The client must ensure that this function is not called while
274      * audio data is being transferred through the stream's message queues.
275      *
276      * @return retval OK in case the success.
277      *                NOT_SUPPORTED if called on IStream instead of input or
278      *                              output stream interface.
279      *                INVALID_STATE if the stream was already closed.
280      */
281     virtual ::android::hardware::Return<::android::hardware::audio::V7_0::Result> close() = 0;
282 
283     /**
284      * Return callback for interfaceChain
285      */
286     using interfaceChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
287     /*
288      * Provides run-time type information for this object.
289      * For example, for the following interface definition:
290      *     package [email protected];
291      *     interface IParent {};
292      *     interface IChild extends IParent {};
293      * Calling interfaceChain on an IChild object must yield the following:
294      *     ["[email protected]::IChild",
295      *      "[email protected]::IParent"
296      *      "[email protected]::IBase"]
297      *
298      * @return descriptors a vector of descriptors of the run-time type of the
299      *         object.
300      */
301     virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override;
302 
303     /*
304      * Emit diagnostic information to the given file.
305      *
306      * Optionally overriden.
307      *
308      * @param fd      File descriptor to dump data to.
309      *                Must only be used for the duration of this call.
310      * @param options Arguments for debugging.
311      *                Must support empty for default debug information.
312      */
313     virtual ::android::hardware::Return<void> debug(const ::android::hardware::hidl_handle& fd, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& options) override;
314 
315     /**
316      * Return callback for interfaceDescriptor
317      */
318     using interfaceDescriptor_cb = std::function<void(const ::android::hardware::hidl_string& descriptor)>;
319     /*
320      * Provides run-time type information for this object.
321      * For example, for the following interface definition:
322      *     package [email protected];
323      *     interface IParent {};
324      *     interface IChild extends IParent {};
325      * Calling interfaceDescriptor on an IChild object must yield
326      *     "[email protected]::IChild"
327      *
328      * @return descriptor a descriptor of the run-time type of the
329      *         object (the first element of the vector returned by
330      *         interfaceChain())
331      */
332     virtual ::android::hardware::Return<void> interfaceDescriptor(interfaceDescriptor_cb _hidl_cb) override;
333 
334     /**
335      * Return callback for getHashChain
336      */
337     using getHashChain_cb = std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_array<uint8_t, 32>>& hashchain)>;
338     /*
339      * Returns hashes of the source HAL files that define the interfaces of the
340      * runtime type information on the object.
341      * For example, for the following interface definition:
342      *     package [email protected];
343      *     interface IParent {};
344      *     interface IChild extends IParent {};
345      * Calling interfaceChain on an IChild object must yield the following:
346      *     [(hash of IChild.hal),
347      *      (hash of IParent.hal)
348      *      (hash of IBase.hal)].
349      *
350      * SHA-256 is used as the hashing algorithm. Each hash has 32 bytes
351      * according to SHA-256 standard.
352      *
353      * @return hashchain a vector of SHA-1 digests
354      */
355     virtual ::android::hardware::Return<void> getHashChain(getHashChain_cb _hidl_cb) override;
356 
357     /*
358      * This method trigger the interface to enable/disable instrumentation based
359      * on system property hal.instrumentation.enable.
360      */
361     virtual ::android::hardware::Return<void> setHALInstrumentation() override;
362 
363     /*
364      * Registers a death recipient, to be called when the process hosting this
365      * interface dies.
366      *
367      * @param recipient a hidl_death_recipient callback object
368      * @param cookie a cookie that must be returned with the callback
369      * @return success whether the death recipient was registered successfully.
370      */
371     virtual ::android::hardware::Return<bool> linkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient, uint64_t cookie) override;
372 
373     /*
374      * Provides way to determine if interface is running without requesting
375      * any functionality.
376      */
377     virtual ::android::hardware::Return<void> ping() override;
378 
379     /**
380      * Return callback for getDebugInfo
381      */
382     using getDebugInfo_cb = std::function<void(const ::android::hidl::base::V1_0::DebugInfo& info)>;
383     /*
384      * Get debug information on references on this interface.
385      * @return info debugging information. See comments of DebugInfo.
386      */
387     virtual ::android::hardware::Return<void> getDebugInfo(getDebugInfo_cb _hidl_cb) override;
388 
389     /*
390      * This method notifies the interface that one or more system properties
391      * have changed. The default implementation calls
392      * (C++)  report_sysprop_change() in libcutils or
393      * (Java) android.os.SystemProperties.reportSyspropChanged,
394      * which in turn calls a set of registered callbacks (eg to update trace
395      * tags).
396      */
397     virtual ::android::hardware::Return<void> notifySyspropsChanged() override;
398 
399     /*
400      * Unregisters the registered death recipient. If this service was registered
401      * multiple times with the same exact death recipient, this unlinks the most
402      * recently registered one.
403      *
404      * @param recipient a previously registered hidl_death_recipient callback
405      * @return success whether the death recipient was unregistered successfully.
406      */
407     virtual ::android::hardware::Return<bool> unlinkToDeath(const ::android::sp<::android::hardware::hidl_death_recipient>& recipient) override;
408 
409     // cast static functions
410     /**
411      * This performs a checked cast based on what the underlying implementation actually is.
412      */
413     static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_0::IStream>> castFrom(const ::android::sp<::android::hardware::audio::V7_0::IStream>& parent, bool emitError = false);
414     /**
415      * This performs a checked cast based on what the underlying implementation actually is.
416      */
417     static ::android::hardware::Return<::android::sp<::android::hardware::audio::V7_0::IStream>> castFrom(const ::android::sp<::android::hidl::base::V1_0::IBase>& parent, bool emitError = false);
418 
419     // helper methods for interactions with the hwservicemanager
420     /**
421      * This gets the service of this type with the specified instance name. If the
422      * service is currently not available or not in the VINTF manifest on a Trebilized
423      * device, this will return nullptr. This is useful when you don't want to block
424      * during device boot. If getStub is true, this will try to return an unwrapped
425      * passthrough implementation in the same process. This is useful when getting an
426      * implementation from the same partition/compilation group.
427      *
428      * In general, prefer getService(std::string,bool)
429      */
430     static ::android::sp<IStream> tryGetService(const std::string &serviceName="default", bool getStub=false);
431     /**
432      * Deprecated. See tryGetService(std::string, bool)
433      */
434     static ::android::sp<IStream> tryGetService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return tryGetService(str, getStub); }
435     /**
436      * Deprecated. See tryGetService(std::string, bool)
437      */
438     static ::android::sp<IStream> tryGetService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return tryGetService(str, getStub); }
439     /**
440      * Calls tryGetService("default", bool). This is the recommended instance name for singleton services.
441      */
tryGetServiceIStream442     static ::android::sp<IStream> tryGetService(bool getStub) { return tryGetService("default", getStub); }
443     /**
444      * This gets the service of this type with the specified instance name. If the
445      * service is not in the VINTF manifest on a Trebilized device, this will return
446      * nullptr. If the service is not available, this will wait for the service to
447      * become available. If the service is a lazy service, this will start the service
448      * and return when it becomes available. If getStub is true, this will try to
449      * return an unwrapped passthrough implementation in the same process. This is
450      * useful when getting an implementation from the same partition/compilation group.
451      */
452     static ::android::sp<IStream> getService(const std::string &serviceName="default", bool getStub=false);
453     /**
454      * Deprecated. See getService(std::string, bool)
455      */
456     static ::android::sp<IStream> getService(const char serviceName[], bool getStub=false)  { std::string str(serviceName ? serviceName : "");      return getService(str, getStub); }
457     /**
458      * Deprecated. See getService(std::string, bool)
459      */
460     static ::android::sp<IStream> getService(const ::android::hardware::hidl_string& serviceName, bool getStub=false)  { std::string str(serviceName.c_str());      return getService(str, getStub); }
461     /**
462      * Calls getService("default", bool). This is the recommended instance name for singleton services.
463      */
getServiceIStream464     static ::android::sp<IStream> getService(bool getStub) { return getService("default", getStub); }
465     /**
466      * Registers a service with the service manager. For Trebilized devices, the service
467      * must also be in the VINTF manifest.
468      */
469     __attribute__ ((warn_unused_result))::android::status_t registerAsService(const std::string &serviceName="default");
470     /**
471      * Registers for notifications for when a service is registered.
472      */
473     static bool registerForNotifications(
474             const std::string &serviceName,
475             const ::android::sp<::android::hidl::manager::V1_0::IServiceNotification> &notification);
476 };
477 
478 //
479 // type declarations for package
480 //
481 
482 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_0::IStream>& o);
483 
484 //
485 // type header definitions for package
486 //
487 
toString(const::android::sp<::android::hardware::audio::V7_0::IStream> & o)488 static inline std::string toString(const ::android::sp<::android::hardware::audio::V7_0::IStream>& o) {
489     std::string os = "[class or subclass of ";
490     os += ::android::hardware::audio::V7_0::IStream::descriptor;
491     os += "]";
492     os += o->isRemote() ? "@remote" : "@local";
493     return os;
494 }
495 
496 
497 }  // namespace V7_0
498 }  // namespace audio
499 }  // namespace hardware
500 }  // namespace android
501 
502 //
503 // global type declarations for package
504 //
505 
506 
507 #endif  // HIDL_GENERATED_ANDROID_HARDWARE_AUDIO_V7_0_ISTREAM_H
508