1 /* 2 * Copyright (c) 2021 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 FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_MULTIMODAL_VOICE_EVENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_MULTIMODAL_VOICE_EVENT_H 18 19 #include <string> 20 #include <utility> 21 #include <vector> 22 23 namespace OHOS::Ace { 24 25 enum class SceneLabel { 26 COMMON = 0, 27 VIDEO, 28 AUDIO, 29 PAGE, 30 SWITCH, 31 }; 32 33 class VoiceEvent final { 34 public: 35 VoiceEvent() = default; 36 ~VoiceEvent() = default; 37 VoiceEvent(const std::string& voice, SceneLabel scene, bool isBadge = false) 38 : voice_(voice), scene_(scene), isBadge_(isBadge) 39 {} 40 SetBadgeList(const std::vector<std::pair<std::string,std::string>> & badgeList)41 void SetBadgeList(const std::vector<std::pair<std::string, std::string>>& badgeList) 42 { 43 badges_ = badgeList; 44 } 45 GetVoiceContent()46 const std::string& GetVoiceContent() const 47 { 48 return voice_; 49 } 50 GetVoiceScene()51 SceneLabel GetVoiceScene() const 52 { 53 return scene_; 54 } 55 IsBadge()56 bool IsBadge() const 57 { 58 return isBadge_; 59 } 60 GetBadgeList()61 const std::vector<std::pair<std::string, std::string>>& GetBadgeList() const 62 { 63 return badges_; 64 } 65 66 bool operator==(const VoiceEvent& rhs) const 67 { 68 return voice_ == rhs.GetVoiceContent() && scene_ == rhs.GetVoiceScene(); 69 } 70 71 bool operator!=(const VoiceEvent& rhs) const 72 { 73 return voice_ != rhs.GetVoiceContent() || scene_ != rhs.GetVoiceScene(); 74 } 75 76 private: 77 std::string voice_; 78 SceneLabel scene_ = SceneLabel::COMMON; 79 bool isBadge_ = false; 80 std::vector<std::pair<std::string, std::string>> badges_; 81 }; 82 83 } // namespace OHOS::Ace 84 85 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_MULTIMODAL_VOICE_EVENT_H 86