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