tizen 2.3.1 release
[framework/telephony/libtcore.git] / include / type / phonebook.h
1 /*
2  * libtcore
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@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 __TYPE_PHONEBOOK_H__
22 #define __TYPE_PHONEBOOK_H__
23
24 __BEGIN_DECLS
25
26 #include <glib.h>
27 #define PHONEBOOK_NAME_BYTE_MAX         256             //Samsung IPC defined
28 #define PHONEBOOK_NUMBER_BYTE_MAX       256             //Samsung IPC defined
29 #define PHONEBOOK_EMAIL_BYTE_MAX        256             //Samsung IPC defined
30
31 enum tel_phonebook_type {
32         PB_TYPE_FDN, /**< Fixed Dialing Number */
33         PB_TYPE_ADN, /**< SIM - ADN      */
34         PB_TYPE_SDN, /**< Service Dialing Number  */
35         PB_TYPE_USIM, /**< USIM - 3G phone book */
36         PB_TYPE_AAS, /**< Additional number Alpha String */
37         PB_TYPE_GAS, /**< Grouping identifier Alpha String */
38         PB_TYPE_UNKNOWNN = 0xFF, /**< Unknown file type */
39 };
40
41 enum tel_phonebook_field_type {
42         PB_FIELD_NAME = 0x01, /**< Name */
43         PB_FIELD_NUMBER, /**< Number */
44         PB_FIELD_ANR1, /**< First Another number*/
45         PB_FIELD_ANR2, /**< Second Another number */
46         PB_FIELD_ANR3, /**< Third Another number */
47         PB_FIELD_EMAIL1, /**< First Email */
48         PB_FIELD_EMAIL2, /**< Second Email */
49         PB_FIELD_EMAIL3, /**< Third Email */
50         PB_FIELD_EMAIL4, /**< Fourth Email */
51         PB_FIELD_SNE, /**< Second name entry of main name*/
52         PB_FIELD_GRP, /**< Group  */
53         PB_FIELD_PBC, /** <1 byte control info and 1 byte hidden info*/
54 };
55
56 enum tel_phonebook_result {
57         PB_SUCCESS, /**< SIM phonebook operation successful. */
58         PB_FAIL, /**< SIM phonebook operation failure. */
59         PB_INVALID_INDEX, /**< The index passed was not a valid index. */
60         PB_INVALID_NUMBER_LENGTH, /**< The number length is exceeds the max length allowed (or 0). */
61         PB_INVALID_NAME_LENGTH, /**< The name length is exceeds the max length allowed (or 0). */
62         PB_ACCESS_CONDITION_NOT_SATISFIED, /**< Access condition for PB file is not satisfied. */
63 };
64
65 enum tel_phonebook_ton {
66         PB_TON_UNKNOWN = 0, /**< unknown */
67         PB_TON_INTERNATIONAL = 1, /**< international number */
68         PB_TON_NATIONAL = 2, /**< national number */
69         PB_TON_NETWORK_SPECIFIC = 3, /**< network specific number */
70         PB_TON_DEDICATED_ACCESS = 4, /**< subscriber number */
71         PB_TON_ALPHA_NUMERIC = 5, /**< alphanumeric, GSM 7-bit default alphabet) */
72         PB_TON_ABBREVIATED_NUMBER = 6, /**< abbreviated number */
73         PB_TON_RESERVED_FOR_EXT = 7 /**< reserved for extension */
74 };
75
76 enum tel_phonebook_dcs {
77         PB_TEXT_ASCII, /**< ASCII Encoding */
78         PB_TEXT_GSM7BIT, /**< GSM 7 Bit with bit 8 set to 0 Encoding */
79         PB_TEXT_UCS2, /**< UCS2 Encoding */
80         PB_TEXT_HEX, /**< HEX Encoding */
81 };
82
83 struct tel_phonebook_support_list {
84         gboolean b_fdn; /**< Fixed Dialing Number */
85         gboolean b_adn; /**< SIM - ADN(2G phonebook, Under DF phonebook */
86         gboolean b_sdn; /**< Service Dialing Number  */
87         gboolean b_usim; /**< USIM - 3G phonebook */
88         gboolean b_aas; /**< Additional number Alpha String phonebook */
89         gboolean b_gas; /**< Grouping information Alpha String phonebook */
90 };
91
92 struct tel_phonebook_field_support_list {
93         gboolean b_field_list[13];
94         //supported fields are 12 according to 'enum tel_phonebook_field_type'. each index number means enum value.
95         //it is used from index 1. (index 0 doesn't match to any enum value. (no meaning))
96 };
97
98 struct treq_phonebook_get_count {
99         enum tel_phonebook_type phonebook_type;
100 };
101
102 struct treq_phonebook_get_info {
103         enum tel_phonebook_type phonebook_type;
104 };
105
106 struct treq_phonebook_get_usim_info {
107
108 };
109
110 struct treq_phonebook_read_record {
111         enum tel_phonebook_type phonebook_type;
112         unsigned short index;
113 };
114
115 struct treq_phonebook_update_record {
116         enum tel_phonebook_type phonebook_type;
117         unsigned short index;
118
119         unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1];          // +1 is for Null termination
120         unsigned short name_len;
121         enum tel_phonebook_dcs dcs;
122
123         unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1];      // +1 is for Null termination
124         enum tel_phonebook_ton ton;
125
126         /* following fields are valid in only USIM*/
127         unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1];           // +1 is for Null termination
128         unsigned short sne_len;
129         enum tel_phonebook_dcs sne_dcs;
130
131         unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
132         enum tel_phonebook_ton anr1_ton;
133         unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
134         enum tel_phonebook_ton anr2_ton;
135         unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
136         enum tel_phonebook_ton anr3_ton;
137
138         unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
139         unsigned short email1_len;
140         unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
141         unsigned short email2_len;
142         unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
143         unsigned short email3_len;
144         unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
145         unsigned short email4_len;
146
147         unsigned short group_index; //GRP
148         unsigned short pb_control; //PBC
149 };
150
151 struct treq_phonebook_delete_record {
152         enum tel_phonebook_type phonebook_type;
153         unsigned short index;
154 };
155
156 struct tresp_phonebook_get_count {
157         enum tel_phonebook_result result;
158         enum tel_phonebook_type type;
159         unsigned short used_count;
160         unsigned short total_count;
161 };
162
163 struct tresp_phonebook_get_info {
164         enum tel_phonebook_result result;
165         enum tel_phonebook_type type;
166         unsigned short index_min;
167         unsigned short index_max;
168         unsigned short number_length_max;
169         unsigned short text_length_max;
170         unsigned short used_count;
171 };
172
173 struct tel_phonebook_usim_meta {
174         enum tel_phonebook_field_type field;
175         unsigned short index_max;
176         unsigned short text_max;
177         unsigned short used_count;
178 };
179
180 struct tresp_phonebook_get_usim_info {
181         enum tel_phonebook_result result;
182         int field_count;
183         struct tel_phonebook_usim_meta field_list[13]; //supported fields are 13 currently.
184 };
185
186 struct tresp_phonebook_read_record {
187         enum tel_phonebook_result result;
188         enum tel_phonebook_type phonebook_type;
189         unsigned short index;
190         unsigned short next_index;
191
192         unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1];          // +1 is for Null termination
193         unsigned short name_len;
194         enum tel_phonebook_dcs dcs;
195
196         unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1];      // +1 is for Null termination
197         enum tel_phonebook_ton ton;
198
199         /* following fields are valid in only USIM*/
200         unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1];           // +1 is for Null termination
201         unsigned short sne_len;
202         enum tel_phonebook_dcs sne_dcs;
203
204         unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
205         enum tel_phonebook_ton anr1_ton;
206         unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
207         enum tel_phonebook_ton anr2_ton;
208         unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1];        // +1 is for Null termination
209         enum tel_phonebook_ton anr3_ton;
210
211         unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
212         unsigned short email1_len;
213         unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
214         unsigned short email2_len;
215         unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
216         unsigned short email3_len;
217         unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1];       // +1 is for Null termination
218         unsigned short email4_len;
219
220         unsigned short group_index; //GRP
221         unsigned short pb_control; //PBC
222 };
223
224 struct tresp_phonebook_update_record {
225         enum tel_phonebook_result result;
226 };
227
228 struct tresp_phonebook_delete_record {
229         enum tel_phonebook_result result;
230 };
231
232 struct tnoti_phonebook_status {
233         gboolean b_init;
234         struct tel_phonebook_support_list support_list;
235 };
236
237 __END_DECLS
238
239
240 #endif