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