4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #ifndef __TYPE_PHONEBOOK_H__
22 #define __TYPE_PHONEBOOK_H__
27 #define PHONEBOOK_NAME_BYTE_MAX 256
28 #define PHONEBOOK_NUMBER_BYTE_MAX 256
29 #define PHONEBOOK_EMAIL_BYTE_MAX 256
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 */
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*/
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. */
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 */
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 */
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 */
92 struct treq_phonebook_get_count {
93 enum tel_phonebook_type phonebook_type;
96 struct treq_phonebook_get_info {
97 enum tel_phonebook_type phonebook_type;
100 struct treq_phonebook_get_usim_info {
104 struct treq_phonebook_read_record {
105 enum tel_phonebook_type phonebook_type;
106 unsigned short index;
109 struct treq_phonebook_update_record {
110 enum tel_phonebook_type phonebook_type;
111 unsigned short index;
113 unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1]; // +1 is for Null termination
114 unsigned short name_len;
115 enum tel_phonebook_dcs dcs;
117 unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
118 enum tel_phonebook_ton ton;
120 /* following fields are valid in only USIM*/
121 unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1]; // +1 is for Null termination
122 unsigned short sne_len;
123 enum tel_phonebook_dcs sne_dcs;
125 unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
126 enum tel_phonebook_ton anr1_ton;
127 unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
128 enum tel_phonebook_ton anr2_ton;
129 unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
130 enum tel_phonebook_ton anr3_ton;
132 unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
133 unsigned short email1_len;
134 unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
135 unsigned short email2_len;
136 unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
137 unsigned short email3_len;
138 unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
139 unsigned short email4_len;
141 unsigned short group_index; //GRP
142 unsigned short pb_control; //PBC
145 struct treq_phonebook_delete_record {
146 enum tel_phonebook_type phonebook_type;
147 unsigned short index;
150 struct tresp_phonebook_get_count {
151 enum tel_phonebook_result result;
152 enum tel_phonebook_type type;
153 unsigned short used_count;
154 unsigned short total_count;
157 struct tresp_phonebook_get_info {
158 enum tel_phonebook_result result;
159 enum tel_phonebook_type type;
160 unsigned short index_min;
161 unsigned short index_max;
162 unsigned short number_length_max;
163 unsigned short text_length_max;
166 struct tel_phonebook_usim_meta {
167 enum tel_phonebook_field_type field;
168 unsigned short index_max;
169 unsigned short text_max;
170 unsigned short used_count;
173 struct tresp_phonebook_get_usim_info {
174 enum tel_phonebook_result result;
176 struct tel_phonebook_usim_meta field_list[13]; //supported fields are 13 currently.
179 struct tresp_phonebook_read_record {
180 enum tel_phonebook_result result;
181 enum tel_phonebook_type phonebook_type;
182 unsigned short index;
183 unsigned short next_index;
185 unsigned char name[PHONEBOOK_NAME_BYTE_MAX+1]; // +1 is for Null termination
186 unsigned short name_len;
187 enum tel_phonebook_dcs dcs;
189 unsigned char number[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
190 enum tel_phonebook_ton ton;
192 /* following fields are valid in only USIM*/
193 unsigned char sne[PHONEBOOK_NAME_BYTE_MAX+1]; // +1 is for Null termination
194 unsigned short sne_len;
195 enum tel_phonebook_dcs sne_dcs;
197 unsigned char anr1[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
198 enum tel_phonebook_ton anr1_ton;
199 unsigned char anr2[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
200 enum tel_phonebook_ton anr2_ton;
201 unsigned char anr3[PHONEBOOK_NUMBER_BYTE_MAX+1]; // +1 is for Null termination
202 enum tel_phonebook_ton anr3_ton;
204 unsigned char email1[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
205 unsigned short email1_len;
206 unsigned char email2[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
207 unsigned short email2_len;
208 unsigned char email3[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
209 unsigned short email3_len;
210 unsigned char email4[PHONEBOOK_EMAIL_BYTE_MAX+1]; // +1 is for Null termination
211 unsigned short email4_len;
213 unsigned short group_index; //GRP
214 unsigned short pb_control; //PBC
217 struct tresp_phonebook_update_record {
218 enum tel_phonebook_result result;
221 struct tresp_phonebook_delete_record {
222 enum tel_phonebook_result result;
225 struct tnoti_phonebook_status {
227 struct tel_phonebook_support_list support_list;