Tizen 2.0 Release
[profile/ivi/phone-contacts.git] / include / phone-ug.h
1 /*
2 * Copyright 2012 Samsung Electronics Co., Ltd
3 *
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://floralicense.org/license/
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __PHONE_UG_H__
18 #define __PHONE_UG_H__
19
20 /**
21  * @defgroup   PHONE_UG PHONE UI-gadget
22  * @ingroup    SLP_UG
23  * @addtogroup PHONE_UG
24  * @{
25  *
26  * Phone UI-gadget
27  * \n This header file contains the declaration & description for Phone UG.
28  *
29  * @section Header To use Them:
30  * @code
31  * #include <phone-ug.h>
32  * @endcode
33  *
34  * @section example Example:
35  * @code
36  #include <stdio.h>
37  #include <ui-gadget.h>
38  #include <phone-ug.h>
39  * @endcode
40  *
41  void phonelog_ug ()
42  {
43     bundle *bd;
44     char buf[16];
45
46     bd = bundle_create();
47     if(NULL == bd) {
48        ERR("bundle_create() Failed");
49        return;
50     }
51
52     snprintf(buf, sizeof(buf), "%d", PH_UG_REQUEST_LOG_CHECK);
53     bundle_add(bd, PH_UG_BUNDLE_TYPE, buf);
54
55     cbs.layout_cb = ug_layout_cb;
56     cbs.result_cb = NULL;
57     cbs.destroy_cb = ug_destroy_cb;
58
59     ug = ug_create(NULL, UG_PHONE_LOG, UG_MODE_FULLVIEW, bd, &cbs);
60     if(NULL == ug)
61        ERR("ug_create() Failed");
62
63     bundle_free(bd);
64  }
65  * @endcode
66  */
67
68 /**
69  * The name of phonelog UG
70  */
71 #define UG_DIALER_LOG "dialer-efl"
72
73 /**
74  * The name of dialer UG
75  * @see #PH_UG_LOG_TYPES
76  */
77 #define UG_PHONE_LOG "phonelog-efl"
78
79 /**
80  * The name of phoneui UG
81  */
82 #define UG_PHONEUI_LOG "phoneui-efl"
83
84 /**
85  * types of #UG_PHONEUI
86  */
87 enum PHUI_UG_LIST_TYPES{
88         PH_UG_REQUEST_SELECT = 11,/**< . */
89         PH_UG_REQUEST_SELECT_NUMBER = 12,/**< . */
90         PH_UG_REQUEST_SELECT_EMAIL = 13,/**< . */
91         PH_UG_REQUEST_SELECT_NUMBER_OR_EMAIL = 17,/**< . */
92
93         PH_UG_REQUEST_SET_WITH_NUM = 21,/**< . */
94         PH_UG_REQUEST_SET_WITH_EMAIL = 22,/**< . */
95         PH_UG_REQUEST_SET_WITH_WEB = 23,/**< . */
96         PH_UG_REQUEST_SET_WITH_IMG = 24,/**< . */
97         PH_UG_REQUEST_SET_WITH_RINGTONE = 25,/**< . */
98
99         PH_UG_REQUEST_CHECK = 31,/**< . */
100         PH_UG_REQUEST_CHECK_FOR_NUMBER = 32,/**< . */
101         PH_UG_REQUEST_CHECK_FOR_EMAIL = 33,/**< . */
102         PH_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL = 34,/**< . */
103
104         PH_UG_REQUEST_LAUNCH_VOICECALL = 51,/**< . */
105 };
106
107 /**
108  * The name of speeddial UG
109  */
110 #define UG_SPEEDDIAL_LOG "speeddial-efl"
111
112
113 /**
114  * types of #PH_UG_LOG_TYPES
115  */
116 enum PH_UG_LOG_TYPES{
117         PH_UG_REQUEST_LOG_CHECK = 11,
118         PH_UG_REQUEST_LOG_SELECT = 12,
119 };
120
121 /**
122  * The key of request bundle for type.
123  * \n Value : convert id to string by using \%d.
124  */
125 #define PH_UG_BUNDLE_TYPE "type"
126
127 /**
128  * The key of result bundle for phonelog index
129  * \n The contact index on #PH_UG_REQUEST_LOG_SELECT
130  * \n Value : convert id to integer by using atoi()
131  * \n Recommends to destroy Phone UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
132  * \n In ug_cbs.result_cb, ug_destroy() should not be called.
133  */
134 #define PH_UG_BUNDLE_RESULT_PLOG_ID "plog_id"
135
136 /**
137  * The key of result bundle for a list of phonelog index
138  * \n The phonelog index on #PH_UG_REQUEST_LOG_CHECK
139  * \n Value : convert string to a integer array by using g_base64_decode()
140  * \n Recommends to destroy Phone UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
141  * \n In ug_cbs.result_cb, ug_destroy() should not be called.
142  * @par example
143  * @code
144  void phonelog_result_cb(struct ui_gadget *ug, bundle *result, void *data)
145  {
146     if(NULL == ug || NULL == data)
147        return;
148
149     if(result) {
150        const char *val;
151        int *list, len, i;
152
153        val = bundle_get_val(result, PH_UG_BUNDLE_RESULT_PLOG_ID_LIST);
154        list = (int *)g_base64_decode(val, &len);
155
156        for(i=0;i<len/sizeof(int);i++)
157           printf("selected contact = %d", list[i]);
158
159        g_free(list);
160     }
161  }
162  *
163  * @endcode
164  */
165 #define PH_UG_BUNDLE_RESULT_PLOG_ID_LIST "get_select_list"        // TODO : change to "plog_id_list"
166
167 /**
168  * @}
169  */
170
171 #endif //__PHONE_UG_H__