10e92cc7310ae2b217ab4d29a4569a4782d65cd6
[apps/core/preloaded/settings.git] / setting-profile / include / setting-profile.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #ifndef __SETTING_PROFILE_H__
22 #define __SETTING_PROFILE_H__
23
24 #include <stdio.h>
25 #include <math.h>
26
27 #include <Elementary.h>
28 #include <glib-object.h>
29
30 #include <player.h>
31 #include <sound_manager.h>
32
33 #include <devman_haptic.h>
34 #include <svi.h>
35
36 #include <setting-common-draw-widget.h>
37 #include <setting-common-view.h>
38 #include <pthread.h>
39
40 #define HAPTIC_TEST_ITERATION 1
41 #define VOLUME_DEN (15.0)       /* ie equals float(SETTING_SOUND_VOL_MAX) */
42
43 typedef enum {
44         SETTING_PROF_VIEW_VOL = 0,
45         SETTING_PROF_VIEW_RTN,
46         SETTING_PROF_VIEW_MAX
47 } setting_profile_types;
48
49 typedef enum {
50         SETTING_VOL_TYPE_RINGTONE = 0,
51         SETTING_VOL_TYPE_NOTIFICATION,
52         SETTING_VOL_TYPE_MEDIA,
53         SETTING_VOL_TYPE_SYSTEM,
54         SETTING_VOL_TYPE_NOTI_VIB,
55         SETTING_VOL_TYPE_HAPTIC_VIB,
56         SETTING_VOL_TYPE_MAX
57 } setting_volume_types;
58
59 typedef enum {
60         SETTING_VOL_SOUND_GROUP = 0,
61         SETTING_VOL_VIBRATION_GROUP,
62         SETTING_VOL_GROUP_MAX
63 } setting_volume_groups;
64
65 #define SETTING_VIB_VOL_MAX 5
66 #define SETTING_VIB_VOL_MIN 1
67 #define SETTING_SOUND_VOL_MAX 15
68 #define SETTING_SOUND_VOL_MIN 1
69 #define SETTING_SYSTEM_VOL_MAX 15
70 #define SETTING_SYSTEM_VOL_MIN 0
71 #define SETTING_SOUND_CONTROLBAR_ITEM_LEN 10
72
73 #define SETTING_DEFAULT_RINGTONE_VOL_INT        13
74 #define SETTING_DEFAULT_NOTI_VOL_INT            7
75 #define SETTING_DEFAULT_MEDIA_VOL_INT           7
76 #define SETTING_DEFAULT_SYSTEM_VOL_INT          5
77 #define SETTING_DEFAULT_NOTI_VIB_INT            5
78 #define SETTING_DEFAULT_HAPTIC_VIB_INT          3
79 #define SETTING_DEFAULT_ALERT_REPEAT_TYPE_INT   0
80
81 #define SETTING_DEFAULT_RINGTONE_PATH   "/opt/share/settings/Ringtones/"
82 #define SETTING_DEFAULT_ALERT_PATH              "/opt/share/settings/Alerts/"
83 #define SETTING_PROFILE_MMC_PATH                "/opt/storage/sdcard/"
84
85 #define SETTING_DEFAULT_CALL_TONE               SETTING_DEFAULT_RINGTONE_PATH"ringtone_sdk.mp3"
86 #define SETTING_DEFAULT_MSG_TONE                SETTING_DEFAULT_ALERT_PATH"General notification_sdk.wav"
87 #define SETTING_DEFAULT_EMAIL_TONE              SETTING_DEFAULT_MSG_TONE
88 #define SETTING_DEFAULT_MEDIA_TONE              SETTING_DEFAULT_CALL_TONE
89
90 typedef struct _SettingProfileUG SettingProfileUG;
91
92 /**
93  * Setting Profile UG context
94  * all UG function has void* as an agument. this is casted back to SettingProfileUG
95  * and the functions access app context.
96  */
97 struct _SettingProfileUG {
98         ui_gadget_h ug;
99         ui_gadget_h ug_loading;
100
101         /* add more variables here (move your appdata to here) */
102         Evas *evas;
103         Evas_Object *win_main_layout;
104         Evas_Object *win_get;
105         Evas_Object *navi_bar;
106         Evas_Object *ctrl_bar;
107         Evas_Object *view_layout;
108         Evas_Object *ly_main;
109         Evas_Object *sub_view[SETTING_PROF_VIEW_MAX];
110         Elm_Object_Item *ctrl_item[SETTING_SOUND_CONTROLBAR_ITEM_LEN];
111
112         Elm_Genlist_Item_Class itc_1text_1icon;
113         Elm_Genlist_Item_Class itc_group_item;
114         Elm_Genlist_Item_Class itc_2text_2;
115         Elm_Genlist_Item_Class itc_layout;
116         Elm_Genlist_Item_Class itc_seperator;
117         Elm_Genlist_Item_Class itc_bg_1icon;
118         Elm_Genlist_Item_Class itc_2text_3_parent;
119         Elm_Genlist_Item_Class itc_1icon_1text_sub;
120
121         /* Volume tab */
122         Setting_GenGroupItem_Data *data_sound;
123         Setting_GenGroupItem_Data *data_vibration;
124         Setting_GenGroupItem_Data *data_call_volume;
125         Setting_GenGroupItem_Data *data_noti_volume;
126         Setting_GenGroupItem_Data *data_vib_volume;
127         Setting_GenGroupItem_Data *data_touch_volume;
128         Setting_GenGroupItem_Data *data_touch_vib;
129         Setting_GenGroupItem_Data *data_media_volume;
130
131         player_h *mp_ringtone;
132         player_h *mp_noti;
133         player_h *mp_sys;
134         player_h *mp_media;
135
136         Ecore_Timer *volume_timer;
137         setting_volume_types cur_vol_type;
138
139         int hnd_hpt;
140         int playing_volume;
141         char *song_playing;
142         char *ringtone_type;
143
144         /* Ringtone tab */
145         Setting_GenGroupItem_Data *data_call_alert_tone;
146         Setting_GenGroupItem_Data *data_call_alert_vib;
147         Setting_GenGroupItem_Data *data_msg_alert_tone;
148         Setting_GenGroupItem_Data *data_email_alert_tone;
149         Setting_GenGroupItem_Data *data_msg_alert_repeat;
150         Setting_GenGroupItem_Data *data_email_alert_repeat;
151         Setting_GenGroupItem_Data *data_lock_sound;
152         Setting_GenGroupItem_Data *data_touch_sounds;
153
154 };
155
156 extern setting_view setting_view_profile_sound_main;
157
158 void setting_profile_play_sound_origin(player_h **mp_handle, void *data,
159                                         void *cb, char *ringtone_file, float vol,
160                                         sound_type_e sound_type);
161 int setting_profile_check_file_exist(void *data, const char *file_path);
162
163 player_h *setting_profile_play_sound(void *data, void *cb,
164                                         char *ringtone_file,
165                                         int vol,
166                                         sound_type_e sound_type);
167
168 int setting_profile_stop_sound(void *data, player_h *player);
169 void setting_profile_change_player_volume(player_h **mp_handle, float vol);
170 int setting_profile_close_other_mm_players_but_type(void *data,
171                                                     sound_type_e type);
172 int setting_profile_close_all_mm_players(void *data);
173 void setting_profile_play_vibration(void *data, int value);
174
175 int setting_profile_get_call_playing_vib_by_vconf_value(int call_vib_value);
176
177
178 #endif