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 RINGTONE_ASSET_H 17 #define RINGTONE_ASSET_H 18 19 #include <mutex> 20 #include <string> 21 22 namespace OHOS { 23 namespace Media { 24 #define EXPORT __attribute__ ((visibility ("default"))) 25 26 class RingtoneAsset { 27 public: 28 EXPORT RingtoneAsset(); 29 EXPORT virtual ~RingtoneAsset() = default; 30 31 EXPORT int32_t GetId() const; 32 EXPORT void SetId(int32_t id); 33 34 EXPORT int64_t GetSize() const; 35 EXPORT void SetSize(int64_t size); 36 37 EXPORT const std::string &GetPath() const; 38 EXPORT void SetPath(const std::string &path); 39 40 EXPORT const std::string &GetDisplayName() const; 41 EXPORT void SetDisplayName(const std::string &displayName); 42 43 EXPORT const std::string &GetTitle() const; 44 EXPORT void SetTitle(const std::string &title); 45 46 EXPORT int32_t GetMediaType() const; 47 EXPORT void SetMediaType(int32_t mediaType); 48 49 EXPORT const std::string &GetMimeType() const; 50 EXPORT void SetMimeType(const std::string &mimeType); 51 52 EXPORT int32_t GetToneType() const; 53 EXPORT void SetToneType(int32_t toneType); 54 55 EXPORT int32_t GetSourceType() const; 56 EXPORT void SetSourceType(int32_t type); 57 58 EXPORT int64_t GetDateAdded() const; 59 EXPORT void SetDateAdded(int64_t dateAdded); 60 61 EXPORT int64_t GetDateModified() const; 62 EXPORT void SetDateModified(int64_t dateModified); 63 64 EXPORT int64_t GetDateTaken() const; 65 EXPORT void SetDateTaken(int64_t dateTaken); 66 67 EXPORT int32_t GetDuration() const; 68 EXPORT void SetDuration(int32_t duration); 69 70 EXPORT int32_t GetShottoneType() const; 71 EXPORT void SetShottoneType(int32_t type); 72 73 EXPORT int32_t GetShottoneSourceType() const; 74 EXPORT void SetShottoneSourceType(int32_t type); 75 76 EXPORT int32_t GetNotificationtoneType() const; 77 EXPORT void SetNotificationtoneType(int32_t type); 78 79 EXPORT int32_t GetNotificationtoneSourceType() const; 80 EXPORT void SetNotificationtoneSourceType(int32_t type); 81 82 EXPORT int32_t GetRingtoneType() const; 83 EXPORT void SetRingtoneType(int32_t type); 84 85 EXPORT int32_t GetRingtoneSourceType() const; 86 EXPORT void SetRingtoneSourceType(int32_t type); 87 88 EXPORT int32_t GetAlarmtoneType() const; 89 EXPORT void SetAlarmtoneType(int32_t type); 90 91 EXPORT int32_t GetAlarmtoneSourceType() const; 92 EXPORT void SetAlarmtoneSourceType(int32_t type); 93 94 EXPORT int32_t GetScannerFlag() const; 95 EXPORT void SetScannerFlag(int32_t flag); 96 97 EXPORT void SetOpenStatus(int32_t fd, int32_t openStatus); 98 EXPORT void RemoveOpenStatus(int32_t fd); 99 EXPORT int32_t GetOpenStatus(int32_t fd); 100 101 EXPORT std::unordered_map<std::string, std::variant<int32_t, int64_t, std::string, double>> &GetMemberMap(); 102 EXPORT std::variant<int32_t, int64_t, std::string, double> &GetMemberValue(const std::string &name); 103 104 private: 105 const std::string &GetStrMember(const std::string &name) const; 106 int32_t GetInt32Member(const std::string &name) const; 107 int64_t GetInt64Member(const std::string &name) const; 108 109 std::unordered_map<std::string, std::variant<int32_t, int64_t, std::string, double>> member_; 110 std::mutex openStatusMapMutex_; 111 std::shared_ptr<std::unordered_map<int32_t, int32_t>> openStatusMap_; 112 }; 113 } // namespace Media 114 } // namespace OHOS 115 116 #endif // RINGTONE_ASSET_H 117