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