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_TYPE_H 17 #define RINGTONE_TYPE_H 18 19 namespace OHOS { 20 namespace Media { 21 22 enum ToneType : int32_t { 23 TONE_TYPE_INVALID = -1, 24 TONE_TYPE_ALARM, 25 TONE_TYPE_RINGTONE, 26 TONE_TYPE_NOTIFICATION, 27 TONE_TYPE_MAX, 28 }; 29 30 enum SourceType : int32_t { 31 SOURCE_TYPE_INVALID = -1, 32 SOURCE_TYPE_PRESET = 1, // system preset 33 SOURCE_TYPE_CUSTOMISED, // user customised 34 SOURCE_TYPE_MAX, 35 }; 36 37 enum RingtoneResultSetDataType : int32_t { 38 DATA_TYPE_NULL = 0, 39 DATA_TYPE_STRING, 40 DATA_TYPE_INT32, 41 DATA_TYPE_INT64, 42 DATA_TYPE_DOUBLE 43 }; 44 45 enum RingtoneMediaType : int32_t { 46 RINGTONE_MEDIA_TYPE_INVALID = -1, 47 RINGTONE_MEDIA_TYPE_AUDIO = 2, 48 RINGTONE_MEDIA_TYPE_MAX 49 }; 50 51 enum ToneSettingType : int32_t { 52 TONE_SETTING_TYPE_INVALID = -1, 53 TONE_SETTING_TYPE_ALARM = 0, 54 TONE_SETTING_TYPE_SHOT, 55 TONE_SETTING_TYPE_RINGTONE, 56 TONE_SETTING_TYPE_NOTIFICATION, 57 TONE_SETTING_TYPE_MAX 58 }; 59 60 enum ShotToneType : int32_t { 61 SHOT_TONE_TYPE_NOT = 0, // not set 62 SHOT_TONE_TYPE_SIM_CARD_1, // SimCard 1 63 SHOT_TONE_TYPE_SIM_CARD_2, // SimCard 2 64 SHOT_TONE_TYPE_SIM_CARD_BOTH, // both 1 and 2 65 SHOT_TONE_TYPE_MAX 66 }; 67 68 enum NotificationToneType : int32_t { 69 NOTIFICATION_TONE_TYPE_NOT = 0, // not set 70 NOTIFICATION_TONE_TYPE, // notification tone 71 NOTIFICATION_TONE_TYPE_MAX 72 }; 73 74 enum RingToneType : int32_t { 75 RING_TONE_TYPE_NOT = 0, // not set 76 RING_TONE_TYPE_SIM_CARD_1, // SimCard 1 77 RING_TONE_TYPE_SIM_CARD_2, // SimCard 2 78 RING_TONE_TYPE_SIM_CARD_BOTH, // both 1 and 2 79 RING_TONE_TYPE_MAX 80 }; 81 82 enum AlarmToneType : int32_t { 83 ALARM_TONE_TYPE_NOT = 0, // not set 84 ALARM_TONE_TYPE, // alarm tone 85 ALARM_TONE_TYPE_MAX 86 }; 87 88 enum DefaultSystemToneType : int32_t { 89 DEFAULT_RING_TYPE_SIM_CARD_1 = 1, 90 DEFAULT_RING_TYPE_SIM_CARD_2, 91 DEFAULT_SHOT_TYPE_SIM_CARD_1, 92 DEFAULT_SHOT_TYPE_SIM_CARD_2, 93 DEFAULT_NOTIFICATION_TYPE, 94 DEFAULT_ALARM_TYPE, 95 }; 96 97 // ringtone system default setting 98 static const char PARAM_RINGTONE_SETTING_SHOT[] = "const.multimedia.system_tone_sim_card_0"; 99 static const char PARAM_RINGTONE_SETTING_SHOT2[] = "const.multimedia.system_tone_sim_card_1"; 100 static const char PARAM_RINGTONE_SETTING_NOTIFICATIONTONE[] = "const.multimedia.notification_tone"; 101 static const char PARAM_RINGTONE_SETTING_RINGTONE[] = "const.multimedia.ringtone_sim_card_0"; 102 static const char PARAM_RINGTONE_SETTING_RINGTONE2[] = "const.multimedia.ringtone_sim_card_1"; 103 static const char PARAM_RINGTONE_SETTING_ALARM[] = "const.multimedia.alarm_tone"; 104 // default value 105 const int32_t TONE_ID_DEFAULT = -1; 106 const std::string DATA_DEFAULT = {}; 107 const int64_t SIZE_DEFAULT = 0; 108 const std::string DISPLAY_NAME_DEFAULT = {}; 109 const std::string TITLE_DEFAULT = {}; 110 const int32_t METADATA_MEDIA_TYPE_DEFAULT = RINGTONE_MEDIA_TYPE_AUDIO; 111 const int32_t TONE_TYPE_DEFAULT = TONE_TYPE_INVALID; 112 const std::string MIME_TYPE_DEFAULT = {}; 113 const int32_t SOURCE_TYPE_DEFAULT = SOURCE_TYPE_INVALID; 114 const int64_t DATE_ADDED_DEFAULT = 0; 115 const int64_t DATE_MODIFIED_DEFAULT = 0; 116 const int64_t DATE_TAKEN_DEFAULT = 0; 117 const int32_t DURATION_DEFAULT = 0; 118 const int32_t SHOT_TONE_TYPE_DEFAULT = SHOT_TONE_TYPE_NOT; 119 const int32_t SHOT_TONE_SOURCE_TYPE_DEFAULT = SOURCE_TYPE_INVALID; 120 const int32_t NOTIFICATION_TONE_TYPE_DEFAULT = NOTIFICATION_TONE_TYPE_NOT; 121 const int32_t NOTIFICATION_TONE_SOURCE_TYPE_DEFAULT = SOURCE_TYPE_INVALID; 122 const int32_t RING_TONE_TYPE_DEFAULT = RING_TONE_TYPE_NOT; 123 const int32_t RING_TONE_SOURCE_TYPE_DEFAULT = SOURCE_TYPE_INVALID; 124 const int32_t ALARM_TONE_TYPE_DEFAULT = ALARM_TONE_TYPE_NOT; 125 const int32_t ALARM_TONE_SOURCE_TYPE_DEFAULT = SOURCE_TYPE_INVALID; 126 const int32_t TONE_SETTING_TYPE_DEFAULT = TONE_SETTING_TYPE_INVALID; 127 128 const char RINGTONE_SLASH_CHAR = '/'; 129 constexpr int32_t RINGTONE_DEFAULT_INT32 = 0; 130 constexpr int64_t RINGTONE_DEFAULT_INT64 = 0; 131 const std::string RINGTONE_DEFAULT_STR = ""; 132 133 /** Supported ringtone types */ 134 const std::string RINGTONE_CONTAINER_TYPE_3GA = "3ga"; 135 const std::string RINGTONE_CONTAINER_TYPE_AC3 = "ac3"; 136 const std::string RINGTONE_CONTAINER_TYPE_A52 = "a52"; 137 const std::string RINGTONE_CONTAINER_TYPE_AMR = "amr"; 138 const std::string RINGTONE_CONTAINER_TYPE_IMY = "imy"; 139 const std::string RINGTONE_CONTAINER_TYPE_RTTTL = "rtttl"; 140 const std::string RINGTONE_CONTAINER_TYPE_XMF = "xmf"; 141 const std::string RINGTONE_CONTAINER_TYPE_RTX = "rtx"; 142 const std::string RINGTONE_CONTAINER_TYPE_MXMF = "mxmf"; 143 const std::string RINGTONE_CONTAINER_TYPE_M4A = "m4a"; 144 const std::string RINGTONE_CONTAINER_TYPE_M4B = "m4b"; 145 const std::string RINGTONE_CONTAINER_TYPE_M4P = "m4p"; 146 const std::string RINGTONE_CONTAINER_TYPE_F4A = "f4a"; 147 const std::string RINGTONE_CONTAINER_TYPE_F4B = "f4b"; 148 const std::string RINGTONE_CONTAINER_TYPE_F4P = "f4p"; 149 const std::string RINGTONE_CONTAINER_TYPE_M3U = "m3u"; 150 const std::string RINGTONE_CONTAINER_TYPE_SMF = "smf"; 151 const std::string RINGTONE_CONTAINER_TYPE_MKA = "mka"; 152 const std::string RINGTONE_CONTAINER_TYPE_RA = "ra"; 153 const std::string RINGTONE_CONTAINER_TYPE_MP3 = "mp3"; 154 const std::string RINGTONE_CONTAINER_TYPE_AAC = "aac"; 155 const std::string RINGTONE_CONTAINER_TYPE_ADTS = "adts"; 156 const std::string RINGTONE_CONTAINER_TYPE_ADT = "adt"; 157 const std::string RINGTONE_CONTAINER_TYPE_SND = "snd"; 158 const std::string RINGTONE_CONTAINER_TYPE_FLAC = "flac"; 159 const std::string RINGTONE_CONTAINER_TYPE_MP2 = "mp2"; 160 const std::string RINGTONE_CONTAINER_TYPE_MP1 = "mp1"; 161 const std::string RINGTONE_CONTAINER_TYPE_MPA = "mpa"; 162 const std::string RINGTONE_CONTAINER_TYPE_M4R = "m4r"; 163 const std::string RINGTONE_CONTAINER_TYPE_WAV = "wav"; 164 const std::string RINGTONE_CONTAINER_TYPE_OGG = "ogg"; 165 } // namespace Media 166 } // namespace OHOS 167 168 #endif // RINGTONE_TYPE_H 169