1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
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 /**
17  * @addtogroup Audio
18  * @{
19  *
20  * @brief Defines audio-related APIs, including custom data types and functions for loading drivers,
21  * accessing a driver adapter, and rendering and capturing audios.
22  *
23  * @since 1.0
24  * @version 1.0
25  */
26 
27 /**
28  * @file audio_events.h
29  *
30  * @brief Defines the type of audio event used by the media service
31  *
32  * @since 1.0
33  * @version 1.0
34  */
35 
36 #ifndef AUDIO_EVENTS_H
37 #define AUDIO_EVENTS_H
38 
39 #include <stdint.h>
40 
41 typedef enum AudioEventType {
42     HDF_AUDIO_DEVICE_ADD        = 0x1,
43     HDF_AUDIO_DEVICE_REMOVE     = 0x2,
44     HDF_AUDIO_LOAD_SUCCESS      = 0x3,
45     HDF_AUDIO_LOAD_FAILURE      = 0x4,
46     HDF_AUDIO_UNLOAD            = 0x5,
47     HDF_AUDIO_SERVICE_VALID     = 0x7,
48     HDF_AUDIO_SERVICE_INVALID   = 0x8,
49     HDF_AUDIO_CAPTURE_THRESHOLD = 0x9,
50     HDF_AUDIO_EVENT_UNKOWN,
51 } EVENT_TYPE;
52 
53 typedef enum AudioEventType EVENT_LOAD_TYPE;
54 typedef enum AudioEventType EVENT_SERVICE_TYPE;
55 
56 typedef enum AudioDeviceType {
57     HDF_AUDIO_LINEOUT        = 0x1,
58     HDF_AUDIO_HEADPHONE      = 0x2,
59     HDF_AUDIO_HEADSET        = 0x4,
60     HDF_AUDIO_USB_HEADSET    = 0x8,
61     HDF_AUDIO_USB_HEADPHONE  = 0x10,
62     HDF_AUDIO_USBA_HEADSET   = 0x20,
63     HDF_AUDIO_USBA_HEADPHONE = 0x40,
64     HDF_AUDIO_PRIMARY_DEVICE = 0x80,
65     HDF_AUDIO_USB_DEVICE     = 0x100,
66     HDF_AUDIO_A2DP_DEVICE    = 0x200,
67     HDF_AUDIO_HDMI_DEVICE    = 0x400,
68     HDF_AUDIO_DEVICE_UNKOWN,
69 } DEVICE_TYPE;
70 
71 struct AudioEvent {
72     uint32_t eventType;
73     uint32_t deviceType;
74 };
75 
76 #endif /* AUDIO_EVENTS_H */
77 /** @} */
78