1 // copyright 2016 the android open source project
2 //
3 // licensed under the apache license, version 2.0 (the "license");
4 // you may not use this file except in compliance with the license.
5 // you may obtain a copy of the license at
6 //
7 //      http://www.apache.org/licenses/license-2.0
8 //
9 // unless required by applicable law or agreed to in writing, software
10 // distributed under the license is distributed on an "as is" basis,
11 // without warranties or conditions of any kind, either express or implied.
12 // see the license for the specific language governing permissions and
13 // limitations under the license.
14 //
15 
16 // Type to represent audio devices in a brillo system.
17 
18 #ifndef BRILLO_AUDIO_AUDIOSERVICE_BRILLO_AUDIO_DEVICE_INFO_H_
19 #define BRILLO_AUDIO_AUDIOSERVICE_BRILLO_AUDIO_DEVICE_INFO_H_
20 
21 #include <sys/cdefs.h>
22 
23 __BEGIN_DECLS
24 
25 struct BAudioDeviceInfo;
26 
27 typedef struct BAudioDeviceInfo BAudioDeviceInfo;
28 
29 // A device type associated with an unknown or uninitialized device.
30 static const int TYPE_UNKNOWN = 0;
31 
32 // A device type describing the speaker system (i.e. a mono speaker or stereo
33 // speakers) built in a device.
34 static const int TYPE_BUILTIN_SPEAKER = 1;
35 
36 // A device type describing a headset, which is the combination of a headphones
37 // and microphone. This type represents just the transducer in the headset.
38 static const int TYPE_WIRED_HEADSET = 2;
39 
40 // A device type describing a headset, which is the combination of a headphones
41 // and microphone. This type represents the microphone in the headset.
42 static const int TYPE_WIRED_HEADSET_MIC = 3;
43 
44 // A device type describing a pair of wired headphones.
45 static const int TYPE_WIRED_HEADPHONES = 4;
46 
47 // A device type describing the microphone(s) built in a device.
48 static const int TYPE_BUILTIN_MIC = 5;
49 
50 // Create a BAudioDeviceInfo based on a type described above.
51 //
52 // Arg:
53 //   device: An int representing an audio type as defined above.
54 //
55 // Returns a pointer to a BAudioDeviceInfo object.
56 BAudioDeviceInfo* BAudioDeviceInfo_new(int device);
57 
58 // Get the type of the device.
59 //
60 // Arg:
61 //   device: A pointer to a BAudioDeviceInfo object to be freed.
62 //
63 // Returns an int representing the type of the device.
64 int BAudioDeviceInfo_getType(BAudioDeviceInfo* device);
65 
66 // Free a BAudioDeviceInfo.
67 //
68 // Arg:
69 //   device: A pointer to a BAudioDeviceInfo object to be freed.
70 void BAudioDeviceInfo_delete(BAudioDeviceInfo* device);
71 
72 __END_DECLS
73 
74 #endif  // BRILLO_AUDIO_AUDIOSERVICE_BRILLO_AUDIO_DEVICE_INFO_H_
75