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 VIBRATE_METADATA_H 17 #define VIBRATE_METADATA_H 18 19 #include "ringtone_db_const.h" 20 #include "ringtone_type.h" 21 #include "vibrate_type.h" 22 23 24 namespace OHOS { 25 namespace Media { 26 #define EXPORT __attribute__ ((visibility ("default"))) 27 28 class VibrateMetadata { 29 public: 30 EXPORT VibrateMetadata(); 31 EXPORT ~VibrateMetadata() = default; 32 using VariantData = std::variant<int32_t, std::string, int64_t, double>; 33 34 EXPORT void SetVibrateId(const VariantData &vibrateId); 35 EXPORT int32_t GetVibrateId() const; 36 37 EXPORT void SetData(const VariantData &data); 38 EXPORT const std::string &GetData() const; 39 40 EXPORT void SetSize(const VariantData &size); 41 EXPORT int64_t GetSize() const; 42 43 EXPORT void SetDisplayName(const VariantData &displayName); 44 EXPORT const std::string &GetDisplayName() const; 45 46 EXPORT void SetTitle(const VariantData &title); 47 EXPORT const std::string &GetTitle() const; 48 49 EXPORT void SetDisplayLanguage(const VariantData &displayLanguage); 50 EXPORT const std::string &GetDisplayLanguage() const; 51 52 EXPORT void SetVibrateType(const VariantData &vibrateType); 53 EXPORT int32_t GetVibrateType() const; 54 55 EXPORT void SetSourceType(const VariantData &sourceType); 56 EXPORT int32_t GetSourceType() const; 57 58 EXPORT void SetDateAdded(const VariantData &dateAdded); 59 EXPORT int64_t GetDateAdded() const; 60 61 EXPORT void SetDateModified(const VariantData &dateModified); 62 EXPORT int64_t GetDateModified() const; 63 64 EXPORT void SetDateTaken(const VariantData &dateTaken); 65 EXPORT int64_t GetDateTaken() const; 66 67 EXPORT void SetPlayMode(const VariantData &dateTaken); 68 EXPORT int32_t GetPlayMode() const; 69 70 EXPORT void Init(); 71 72 using VibrateMetadataFnPtr = void (VibrateMetadata::*)(const VariantData &); 73 std::unordered_map<std::string, std::pair<RingtoneResultSetDataType, VibrateMetadataFnPtr>> memberFuncMap_; 74 75 EXPORT std::string ToString() const; 76 private: 77 int32_t vibrateId_; 78 std::string data_; 79 int64_t size_; 80 std::string displayName_; 81 std::string title_; 82 std::string displayLanguage_; 83 int32_t vibrateType_; 84 int32_t sourceType_; 85 int64_t dateAdded_; 86 int64_t dateModified_; 87 int64_t dateTaken_; 88 int32_t vibratePlayMode_; 89 }; 90 } // namespace Media 91 } // namespace OHOS 92 93 #endif // VIBRATE_METADATA_H 94