1 /* 2 * Copyright (c) 2022-2023 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 #ifndef OHOS_DAUDIO_AUDIO_EVENT_H 17 #define OHOS_DAUDIO_AUDIO_EVENT_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 typedef enum { 24 EVENT_UNKNOWN = 0, 25 OPEN_CTRL = 1, 26 CLOSE_CTRL = 2, 27 CTRL_OPENED = 3, 28 CTRL_CLOSED = 4, 29 NOTIFY_OPEN_CTRL_RESULT = 5, 30 NOTIFY_CLOSE_CTRL_RESULT = 6, 31 DATA_OPENED = 7, 32 DATA_CLOSED = 8, 33 34 OPEN_SPEAKER = 11, 35 CLOSE_SPEAKER = 12, 36 SPEAKER_OPENED = 13, 37 SPEAKER_CLOSED = 14, 38 NOTIFY_OPEN_SPEAKER_RESULT = 15, 39 NOTIFY_CLOSE_SPEAKER_RESULT = 16, 40 NOTIFY_HDF_SPK_DUMP = 17, 41 NOTIFY_HDF_MIC_DUMP = 18, 42 43 OPEN_MIC = 21, 44 CLOSE_MIC = 22, 45 MIC_OPENED = 23, 46 MIC_CLOSED = 24, 47 NOTIFY_OPEN_MIC_RESULT = 25, 48 NOTIFY_CLOSE_MIC_RESULT = 26, 49 DISABLE_DEVICE = 27, 50 51 VOLUME_SET = 31, 52 VOLUME_GET = 32, 53 VOLUME_CHANGE = 33, 54 VOLUME_MIN_GET = 34, 55 VOLUME_MAX_GET = 35, 56 VOLUME_MUTE_SET = 36, 57 58 AUDIO_FOCUS_CHANGE = 41, 59 AUDIO_RENDER_STATE_CHANGE = 42, 60 61 SET_PARAM = 51, 62 SEND_PARAM = 52, 63 64 AUDIO_ENCODER_ERR = 61, 65 AUDIO_DECODER_ERR = 62, 66 67 CHANGE_PLAY_STATUS = 71, 68 69 MMAP_SPK_START = 81, 70 MMAP_SPK_STOP = 82, 71 MMAP_MIC_START = 83, 72 MMAP_MIC_STOP = 84, 73 AUDIO_START = 85, 74 AUDIO_STOP = 86, 75 } AudioEventType; 76 77 typedef enum { 78 AUDIO_EVENT_UNKNOWN = 0, 79 AUDIO_EVENT_VOLUME_SET = 1, 80 AUDIO_EVENT_VOLUME_GET = 2, 81 AUDIO_EVENT_VOLUME_CHANGE = 3, 82 AUDIO_EVENT_OPEN_SPK_RESULT = 4, 83 AUDIO_EVENT_CLOSE_SPK_RESULT = 5, 84 AUDIO_EVENT_OPEN_MIC_RESULT = 6, 85 AUDIO_EVENT_CLOSE_MIC_RESULT = 7, 86 AUDIO_EVENT_SPK_CLOSED = 8, 87 AUDIO_EVENT_MIC_CLOSED = 9, 88 AUDIO_EVENT_FOCUS_CHANGE = 10, 89 AUDIO_EVENT_RENDER_STATE_CHANGE = 11, 90 AUDIO_EVENT_MUTE_SET = 12, 91 AUDIO_EVENT_CHANGE_PLAY_STATUS = 13, 92 AUDIO_EVENT_MMAP_START_SPK = 14, 93 AUDIO_EVENT_MMAP_STOP_SPK = 15, 94 AUDIO_EVENT_MMAP_START_MIC = 16, 95 AUDIO_EVENT_MMAP_STOP_MIC = 17, 96 AUDIO_EVENT_START = 18, 97 AUDIO_EVENT_STOP = 19, 98 AUDIO_EVENT_SPK_DUMP = 20, 99 AUDIO_EVENT_MIC_DUMP = 21, 100 } AudioEventHDF; 101 class AudioEvent { 102 public: 103 AudioEvent() = default; AudioEvent(const AudioEventType t,const std::string & c)104 AudioEvent(const AudioEventType t, const std::string &c) : type(t), content(c) {}; AudioEvent(const int32_t t,const std::string & c)105 AudioEvent(const int32_t t, const std::string &c) : type(static_cast<AudioEventType>(t)), content(c) {}; 106 ~AudioEvent() = default; 107 AudioEventType type = EVENT_UNKNOWN; 108 std::string content; 109 }; 110 } // namespace DistributedHardware 111 } // namespace OHOS 112 #endif // OHOS_DAUDIO_AUDIO_EVENT_H 113