Skip to main content

ohaudio_sys/audio_device_base/
audio_device_base_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6use crate::audio_common::OH_AudioCommon_Result;
7use crate::audiostream_base::OH_AudioStream_EncodingType;
8
9#[cfg(feature = "api-12")]
10#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
11impl OH_AudioDevice_ChangeType {
12    /// Device connection.
13    pub const AUDIO_DEVICE_CHANGE_TYPE_CONNECT: OH_AudioDevice_ChangeType =
14        OH_AudioDevice_ChangeType(0);
15    /// Device disconnection.
16    pub const AUDIO_DEVICE_CHANGE_TYPE_DISCONNECT: OH_AudioDevice_ChangeType =
17        OH_AudioDevice_ChangeType(1);
18}
19#[repr(transparent)]
20/// Defines the audio device change type.
21///
22///
23/// Available since API-level: 12
24#[cfg(feature = "api-12")]
25#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
26#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
27pub struct OH_AudioDevice_ChangeType(pub ::core::ffi::c_uint);
28#[cfg(feature = "api-12")]
29#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
30impl OH_AudioDevice_Role {
31    /// Input role.
32    pub const AUDIO_DEVICE_ROLE_INPUT: OH_AudioDevice_Role = OH_AudioDevice_Role(1);
33    /// Output role.
34    pub const AUDIO_DEVICE_ROLE_OUTPUT: OH_AudioDevice_Role = OH_AudioDevice_Role(2);
35}
36#[repr(transparent)]
37/// Defines the audio device device role.
38///
39///
40/// Available since API-level: 12
41#[cfg(feature = "api-12")]
42#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
43#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
44pub struct OH_AudioDevice_Role(pub ::core::ffi::c_uint);
45#[cfg(feature = "api-12")]
46#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
47impl OH_AudioDevice_Type {
48    /// Invalid device.
49    pub const AUDIO_DEVICE_TYPE_INVALID: OH_AudioDevice_Type = OH_AudioDevice_Type(0);
50    /// Built-in earpiece.
51    pub const AUDIO_DEVICE_TYPE_EARPIECE: OH_AudioDevice_Type = OH_AudioDevice_Type(1);
52    /// Built-in speaker.
53    pub const AUDIO_DEVICE_TYPE_SPEAKER: OH_AudioDevice_Type = OH_AudioDevice_Type(2);
54    /// Wired headset, which is a combination of a pair of earpieces and a microphone.
55    pub const AUDIO_DEVICE_TYPE_WIRED_HEADSET: OH_AudioDevice_Type = OH_AudioDevice_Type(3);
56    /// A pair of wired headphones.
57    pub const AUDIO_DEVICE_TYPE_WIRED_HEADPHONES: OH_AudioDevice_Type = OH_AudioDevice_Type(4);
58    /// Bluetooth device using the synchronous connection oriented link (SCO).
59    pub const AUDIO_DEVICE_TYPE_BLUETOOTH_SCO: OH_AudioDevice_Type = OH_AudioDevice_Type(7);
60    /// Bluetooth device using advanced audio distibution profile (A2DP).
61    pub const AUDIO_DEVICE_TYPE_BLUETOOTH_A2DP: OH_AudioDevice_Type = OH_AudioDevice_Type(8);
62    /// Built-in microphone.
63    pub const AUDIO_DEVICE_TYPE_MIC: OH_AudioDevice_Type = OH_AudioDevice_Type(15);
64    /// USB audio headset.
65    pub const AUDIO_DEVICE_TYPE_USB_HEADSET: OH_AudioDevice_Type = OH_AudioDevice_Type(22);
66    /// Display port device.
67    pub const AUDIO_DEVICE_TYPE_DISPLAY_PORT: OH_AudioDevice_Type = OH_AudioDevice_Type(23);
68    /// Device type for rerouting audio to other remote devices by system application.
69    pub const AUDIO_DEVICE_TYPE_REMOTE_CAST: OH_AudioDevice_Type = OH_AudioDevice_Type(24);
70    /// Usb audio device.
71    ///
72    ///
73    /// Available since API-level: 18
74    #[cfg(feature = "api-18")]
75    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
76    pub const AUDIO_DEVICE_TYPE_USB_DEVICE: OH_AudioDevice_Type = OH_AudioDevice_Type(25);
77    /// Accessory device, such as the microphone on a remote control.
78    ///
79    /// Available since API-level: 19
80    #[cfg(feature = "api-19")]
81    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
82    pub const AUDIO_DEVICE_TYPE_ACCESSORY: OH_AudioDevice_Type = OH_AudioDevice_Type(26);
83    /// HDMI device, such as a device connected through an HDMI, ARC, or eARC interface.
84    ///
85    /// Available since API-level: 19
86    #[cfg(feature = "api-19")]
87    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
88    pub const AUDIO_DEVICE_TYPE_HDMI: OH_AudioDevice_Type = OH_AudioDevice_Type(27);
89    /// Line-connected, digital audio output device, such as an S/PDIF device.
90    ///
91    /// Available since API-level: 19
92    #[cfg(feature = "api-19")]
93    #[cfg_attr(docsrs, doc(cfg(feature = "api-19")))]
94    pub const AUDIO_DEVICE_TYPE_LINE_DIGITAL: OH_AudioDevice_Type = OH_AudioDevice_Type(28);
95    /// Hearing aid device.
96    ///
97    /// Available since API-level: 20
98    #[cfg(feature = "api-20")]
99    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
100    pub const AUDIO_DEVICE_TYPE_HEARING_AID: OH_AudioDevice_Type = OH_AudioDevice_Type(30);
101    /// Nearlink device.
102    ///
103    /// Available since API-level: 20
104    #[cfg(feature = "api-20")]
105    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
106    pub const AUDIO_DEVICE_TYPE_NEARLINK: OH_AudioDevice_Type = OH_AudioDevice_Type(31);
107    /// Default device type.
108    pub const AUDIO_DEVICE_TYPE_DEFAULT: OH_AudioDevice_Type = OH_AudioDevice_Type(1000);
109}
110#[repr(transparent)]
111/// Defines the audio device device type.
112///
113///
114/// Available since API-level: 12
115#[cfg(feature = "api-12")]
116#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
117#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
118pub struct OH_AudioDevice_Type(pub ::core::ffi::c_uint);
119#[cfg(feature = "api-12")]
120#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
121impl OH_AudioDevice_Flag {
122    /// None device.
123    pub const AUDIO_DEVICE_FLAG_NONE: OH_AudioDevice_Flag = OH_AudioDevice_Flag(0);
124    /// Output device.
125    pub const AUDIO_DEVICE_FLAG_OUTPUT: OH_AudioDevice_Flag = OH_AudioDevice_Flag(1);
126    /// Input device.
127    pub const AUDIO_DEVICE_FLAG_INPUT: OH_AudioDevice_Flag = OH_AudioDevice_Flag(2);
128    /// All device.
129    pub const AUDIO_DEVICE_FLAG_ALL: OH_AudioDevice_Flag = OH_AudioDevice_Flag(3);
130}
131#[repr(transparent)]
132/// Defines the audio device flag.
133///
134///
135/// Available since API-level: 12
136#[cfg(feature = "api-12")]
137#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
138#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
139pub struct OH_AudioDevice_Flag(pub ::core::ffi::c_uint);
140#[cfg(feature = "api-12")]
141#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
142impl OH_AudioDevice_Usage {
143    /// Device used for media ouput.
144    ///
145    ///
146    /// Available since API-level: 12
147    #[cfg(feature = "api-12")]
148    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
149    pub const AUDIO_DEVICE_USAGE_MEDIA_OUTPUT: OH_AudioDevice_Usage = OH_AudioDevice_Usage(1);
150    /// Device used for media input.
151    ///
152    ///
153    /// Available since API-level: 12
154    #[cfg(feature = "api-12")]
155    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
156    pub const AUDIO_DEVICE_USAGE_MEDIA_INPUT: OH_AudioDevice_Usage = OH_AudioDevice_Usage(2);
157    /// Device used for media, including input and output.
158    ///
159    ///
160    /// Available since API-level: 12
161    #[cfg(feature = "api-12")]
162    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
163    pub const AUDIO_DEVICE_USAGE_MEDIA_ALL: OH_AudioDevice_Usage = OH_AudioDevice_Usage(3);
164    /// Device used for call output.
165    ///
166    ///
167    /// Available since API-level: 12
168    #[cfg(feature = "api-12")]
169    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
170    pub const AUDIO_DEVICE_USAGE_CALL_OUTPUT: OH_AudioDevice_Usage = OH_AudioDevice_Usage(4);
171    /// Device used for call input.
172    ///
173    ///
174    /// Available since API-level: 12
175    #[cfg(feature = "api-12")]
176    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
177    pub const AUDIO_DEVICE_USAGE_CALL_INPUT: OH_AudioDevice_Usage = OH_AudioDevice_Usage(8);
178    /// Device used for call, including input and output.
179    ///
180    ///
181    /// Available since API-level: 12
182    #[cfg(feature = "api-12")]
183    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
184    pub const AUDIO_DEVICE_USAGE_CALL_ALL: OH_AudioDevice_Usage = OH_AudioDevice_Usage(12);
185}
186#[repr(transparent)]
187/// Defines the audio device usage.
188///
189///
190/// Available since API-level: 12
191#[cfg(feature = "api-12")]
192#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
193#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
194pub struct OH_AudioDevice_Usage(pub ::core::ffi::c_uint);
195/// Declaring the audio device descriptor.
196/// The instance is used to get more audio device detail attributes.
197///
198///
199/// Available since API-level: 12
200#[cfg(feature = "api-12")]
201#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
202#[repr(C)]
203pub struct OH_AudioDeviceDescriptor {
204    _unused: [u8; 0],
205}
206/// Declaring the audio device descriptor array.
207///
208///
209/// Available since API-level: 12
210#[cfg(feature = "api-12")]
211#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
212#[repr(C)]
213#[derive(Debug, Copy, Clone)]
214pub struct OH_AudioDeviceDescriptorArray {
215    /// Audio device descriptor array size.
216    pub size: u32,
217    /// Audio device descriptor array.
218    pub descriptors: *mut *mut OH_AudioDeviceDescriptor,
219}
220#[cfg(feature = "api-13")]
221#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
222impl OH_AudioDevice_BlockStatus {
223    /// Audio device is unblocked.
224    ///
225    ///
226    /// Available since API-level: 13
227    #[cfg(feature = "api-13")]
228    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
229    pub const AUDIO_DEVICE_UNBLOCKED: OH_AudioDevice_BlockStatus = OH_AudioDevice_BlockStatus(0);
230    /// Audio Device is blocked.
231    ///
232    ///
233    /// Available since API-level: 13
234    #[cfg(feature = "api-13")]
235    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
236    pub const AUDIO_DEVICE_BLOCKED: OH_AudioDevice_BlockStatus = OH_AudioDevice_BlockStatus(1);
237}
238#[repr(transparent)]
239/// Declaring the audio device blocked status. By default, the audio device is considered as unbloked.
240///
241///
242/// Available since API-level: 13
243#[cfg(feature = "api-13")]
244#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
245#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
246pub struct OH_AudioDevice_BlockStatus(pub ::core::ffi::c_uint);
247extern "C" {
248    /// Query the device role of the target audio device descriptor.
249    ///
250    /// # Arguments
251    ///
252    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
253    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
254    ///
255    /// * `deviceRole` - the pointer [`OH_AudioDevice_DeviceRole`] variable that will be set the device role value.
256    ///
257    /// # Returns
258    ///
259    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
260    ///
261    /// Available since API-level: 12
262    #[cfg(feature = "api-12")]
263    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
264    pub fn OH_AudioDeviceDescriptor_GetDeviceRole(
265        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
266        deviceRole: *mut OH_AudioDevice_Role,
267    ) -> OH_AudioCommon_Result;
268    /// Query the device type of the target audio device descriptor.
269    ///
270    /// # Arguments
271    ///
272    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
273    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
274    ///
275    /// * `deviceType` - the pointer [`OH_AudioDevice_DeviceType`]
276    /// pointer variable that will be set the device type value.
277    ///
278    /// # Returns
279    ///
280    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
281    ///
282    /// Available since API-level: 12
283    #[cfg(feature = "api-12")]
284    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
285    pub fn OH_AudioDeviceDescriptor_GetDeviceType(
286        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
287        deviceType: *mut OH_AudioDevice_Type,
288    ) -> OH_AudioCommon_Result;
289    /// Query the device id of the target audio device descriptor.
290    ///
291    /// # Arguments
292    ///
293    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
294    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
295    ///
296    /// * `id` - pointer variable that will be set the device id value.
297    ///
298    /// # Returns
299    ///
300    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
301    ///
302    /// Available since API-level: 12
303    #[cfg(feature = "api-12")]
304    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
305    pub fn OH_AudioDeviceDescriptor_GetDeviceId(
306        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
307        id: *mut u32,
308    ) -> OH_AudioCommon_Result;
309    /// Query the device name of the target audio device descriptor.
310    ///
311    /// # Arguments
312    ///
313    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
314    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
315    ///
316    /// * `name` - pointer variable that will be set the device name value.
317    /// Do not release the name pointer separately
318    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
319    /// when it is no use anymore.
320    ///
321    /// # Returns
322    ///
323    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
324    ///
325    /// Available since API-level: 12
326    #[cfg(feature = "api-12")]
327    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
328    pub fn OH_AudioDeviceDescriptor_GetDeviceName(
329        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
330        name: *mut *mut ::core::ffi::c_char,
331    ) -> OH_AudioCommon_Result;
332    /// Query the device address of the target audio device descriptor.
333    ///
334    /// # Arguments
335    ///
336    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
337    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
338    ///
339    /// * `address` - pointer variable that will be set the device address value.
340    /// Do not release the address pointer separately
341    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
342    /// when it is no use anymore.
343    ///
344    /// # Returns
345    ///
346    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
347    ///
348    /// Available since API-level: 12
349    #[cfg(feature = "api-12")]
350    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
351    pub fn OH_AudioDeviceDescriptor_GetDeviceAddress(
352        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
353        address: *mut *mut ::core::ffi::c_char,
354    ) -> OH_AudioCommon_Result;
355    /// Query the sample rate array of the target audio device descriptor.
356    ///
357    /// # Arguments
358    ///
359    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
360    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
361    ///
362    /// * `sampleRates` - array pointer variable that will be set the sample rate array value.
363    /// Do not release the sampleRates pointer separately
364    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
365    /// when it is no use anymore.
366    ///
367    /// * `size` - pointer variable that will be set the sample rate size value.
368    ///
369    /// # Returns
370    ///
371    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
372    ///
373    /// Available since API-level: 12
374    #[cfg(feature = "api-12")]
375    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
376    pub fn OH_AudioDeviceDescriptor_GetDeviceSampleRates(
377        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
378        sampleRates: *mut *mut u32,
379        size: *mut u32,
380    ) -> OH_AudioCommon_Result;
381    /// Query the device channel count array of the target audio device descriptor.
382    ///
383    /// # Arguments
384    ///
385    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
386    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
387    ///
388    /// * `channelCounts` - array pointer variable that will be set the channel count array value.
389    /// Do not release the channelCounts pointer separately
390    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
391    /// when it is no use anymore.
392    ///
393    /// * `size` - pointer variable that will be set the channel count size value.
394    ///
395    /// # Returns
396    ///
397    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
398    ///
399    /// Available since API-level: 12
400    #[cfg(feature = "api-12")]
401    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
402    pub fn OH_AudioDeviceDescriptor_GetDeviceChannelCounts(
403        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
404        channelCounts: *mut *mut u32,
405        size: *mut u32,
406    ) -> OH_AudioCommon_Result;
407    /// Query the display name of the target audio device descriptor.
408    ///
409    /// # Arguments
410    ///
411    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
412    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
413    ///
414    /// * `displayName` - pointer variable that will be set the display name value.
415    /// Do not release the displayName pointer separately
416    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
417    /// when it is no use anymore.
418    ///
419    /// # Returns
420    ///
421    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
422    ///
423    /// Available since API-level: 12
424    #[cfg(feature = "api-12")]
425    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
426    pub fn OH_AudioDeviceDescriptor_GetDeviceDisplayName(
427        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
428        displayName: *mut *mut ::core::ffi::c_char,
429    ) -> OH_AudioCommon_Result;
430    /// Query the encoding type array of the target audio device descriptor.
431    ///
432    /// # Arguments
433    ///
434    /// * `audioDeviceDescriptor` - reference returned by [`OH_AudioRoutingManager_GetDevices`] or
435    /// [`OH_AudioRouterManager_OnDeviceChangedCallback`].
436    ///
437    /// * `encodingTypes` - the [`OH_AudioStream_EncodingType`]
438    /// Do not release the encodingTypes pointer separately
439    /// instead call [`OH_AudioRoutingManager_ReleaseDevices`] to release the DeviceDescriptor array
440    /// when it is no use anymore.
441    ///
442    /// * `size` - pointer variable that will be set the encoding type size value.
443    ///
444    /// # Returns
445    ///
446    /// * [`#AUDIOCOMMON_RESULT_SUCCESS`] or [`#AUDIOCOMMON_RESULT_ERROR_INVALID_PARAM`].
447    ///
448    /// Available since API-level: 12
449    #[cfg(feature = "api-12")]
450    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
451    pub fn OH_AudioDeviceDescriptor_GetDeviceEncodingTypes(
452        audioDeviceDescriptor: *mut OH_AudioDeviceDescriptor,
453        encodingTypes: *mut *mut OH_AudioStream_EncodingType,
454        size: *mut u32,
455    ) -> OH_AudioCommon_Result;
456}