1 /* 2 * Copyright (c) 2024 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 TONE_ATTRS_H 17 #define TONE_ATTRS_H 18 19 #include <string> 20 21 #include "audio_info.h" 22 23 24 namespace OHOS { 25 namespace Media { 26 27 enum ToneCustomizedType { 28 PRE_INSTALLED = 0, 29 CUSTOMISED = 1, 30 }; 31 constexpr int32_t TONE_CATEGORY_INVALID = -1; 32 constexpr int32_t TONE_CATEGORY_RINGTONE = 1; 33 constexpr int32_t TONE_CATEGORY_TEXT_MESSAGE = 2; 34 constexpr int32_t TONE_CATEGORY_NOTIFICATION = 4; 35 constexpr int32_t TONE_CATEGORY_ALARM = 8; 36 37 class ToneAttrs { 38 public: ToneAttrs(std::string title,std::string fileName,std::string uri,ToneCustomizedType custType,int32_t category)39 ToneAttrs(std::string title, std::string fileName, std::string uri, ToneCustomizedType custType, 40 int32_t category) : title_(title), fileName_(fileName), uri_(uri), custType_(custType), category_(category) {} 41 ~ToneAttrs() = default; 42 /** 43 * @brief Returns the title of the tone attrs. 44 * 45 * @return Returns title as string if the title is obtained successfully. 46 * returns an empty string otherwise. 47 * @since 12 48 */ GetTitle()49 std::string GetTitle() const 50 { 51 return title_; 52 } 53 SetTitle(const std::string title)54 void SetTitle(const std::string title) 55 { 56 title_ = title; 57 } 58 GetFileName()59 std::string GetFileName() const 60 { 61 return fileName_; 62 } 63 SetFileName(const std::string fileName)64 void SetFileName(const std::string fileName) 65 { 66 fileName_ = fileName; 67 } 68 GetUri()69 std::string GetUri() const 70 { 71 return uri_; 72 } 73 SetUri(const std::string uri)74 void SetUri(const std::string uri) 75 { 76 uri_ = uri; 77 } 78 GetCustomizedType()79 ToneCustomizedType GetCustomizedType() const 80 { 81 return custType_; 82 } 83 SetCategory(const int32_t category)84 void SetCategory(const int32_t category) 85 { 86 category_ = category; 87 } 88 GetCategory()89 int32_t GetCategory() const 90 { 91 return category_; 92 } 93 94 private: 95 std::string title_ = "title_test"; 96 std::string fileName_ = "fileName_test"; 97 std::string uri_ = "uri_test"; 98 ToneCustomizedType custType_ = CUSTOMISED; 99 int32_t category_ = 0; 100 }; 101 } // namespace Media 102 } // namespace OHOS 103 #endif // TONE_ATTRS_H 104