comparison src/aci2/aci/phb.h @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : MMI-Framework (8417)
4 | Modul : PSA_PHB
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Definitions for phonebook management of MMI framework
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef PHB_H
21 #define PHB_H
22
23 #ifdef TI_PS_FFS_PHB
24
25 /*
26 * Include the header files needed for the FFS based SIM phonebook.
27 */
28 #include "db.h"
29 #include "phb_sim.h"
30 #include "phb_aci.h"
31
32 #else
33
34 /*
35 * Old RAM based SIM phonebook.
36 */
37
38 /* A definition to avoid TI_PS_FFS_PHB sometimes */
39 typedef UBYTE T_PHB_STAT;
40
41 #define PHB_BUSY 4
42 #define PHB_READY 5
43 #define PHB_UNKNOWN 6
44 #define PHB_WRITE_FAIL 7
45
46 #define PHB_NUMBER 1
47 #define PHB_NAME 2
48 #define PHB_INDEX 3
49
50 #define PHB_NO_EXT 0
51 #define PHB_NUMBER_EXT 1
52 #define PHB_SUBADDR1_EXT 2
53 #define PHB_SUBADDR2_EXT 3
54
55 /* SIM operation mode */
56
57 #define NO_OPERATION 0
58 #define FDN_DISABLE 1
59 #define FDN_ENABLE 2
60
61 /* definition for the maximal records in the phone book. */
62 #define MAX_PHB_LIST 10
63
64 #define MAX_ECC_RCD 5
65 #define PHB_MAX_TAG_LEN 20
66
67 #ifdef PHONEBOOK_EXTENSION
68 #define PHB_PACKED_NUM_LEN 22
69 #else
70 #define PHB_PACKED_NUM_LEN 10
71 #endif /* #ifdef PHONEBOOK_EXTENSION */
72
73 #define PHB_EXT_RCD 4
74
75 #define MAX_PHB_ENTRY 5
76 #if !defined(FAX_AND_DATA) AND !defined(GPRS)
77 /*
78 * for GoLite decreased to 200 entries
79 */
80 #define MAX_AFB_RECORDS 200
81 #else
82
83 #ifndef _SIMULATION
84 /*
85 * Increased from 255 to 300 entries -
86 * now 16bit encoded - might be even
87 * larger to maintain all SIM phb entries
88 */
89 #define MAX_AFB_RECORDS 300
90 #else /* _SIMULATION */
91
92 /* The number is decreased iin case of simulation for
93 phonebook testing purpose */
94 #define MAX_AFB_RECORDS 8
95 #endif /* _SIMULATION */
96
97 #endif
98
99 #define MAX_RDM_RECORDS 30
100
101 #define MAX_ADN_BITMAP 32
102 #define MAX_FDN_BITMAP 10
103 #define MAX_BDN_BITMAP 5
104 #define MAX_SDN_BITMAP 5
105 #define MAX_ECC_BITMAP 1
106 #define MAX_UPN_BITMAP 1
107 #define PHB_ELEMENT_FREE 0
108 #define PHB_ELEMENT_USED 1
109
110 #ifdef PHONEBOOK_EXTENSION
111 #define MAX_EXT1_BITMAP 8
112 #define MAX_EXT2_BITMAP 4
113
114 typedef enum
115 {
116 EXT1 = 0, /* ADN, LDN phonebook Extention */
117 EXT2, /* FDN phonebook Extention */
118 MAX_PHB_EXT
119 } T_PHB_EXT_TYPE;
120
121 typedef struct
122 {
123 UBYTE mem;
124 UBYTE max_rcd;
125 UBYTE *rcd_bitmap;
126 } T_PHB_EXT_RECORDS;
127 #endif /* PHONEBOOK_EXTENSION */
128
129 typedef enum
130 {
131 NO_PHB_ENTRY = 0,
132 SIM_MEMORY,
133 TE_MEMORY
134 } T_PHB_MEMORY;
135
136 #ifndef NO_ASCIIZ
137 #define NO_ASCIIZ
138 #endif
139
140 typedef enum
141 {
142 ECC = 0, /* Emergency call numbers */
143 ADN, /* Abbreviated dialing number */
144 FDN, /* Fixed dialing number */
145 BDN, /* Barred dialing number */
146 LDN, /* Last dialing number */
147 LRN, /* Last received number */
148 SDN, /* Service dialing number */
149 LMN, /* last missed number */
150 ADN_FDN, /* merged ADN and FDN */
151 UPN, /* User person number */
152 MAX_PHONEBOOK
153 } T_PHB_TYPE;
154
155 /* Phonebook functional return codes */
156 typedef enum
157 {
158 PHB_FAIL = -1, /* execution of command failed */
159 PHB_OK, /* execution of command completed */
160 PHB_FULL, /* Phonebook is full */
161 PHB_EXCT, /* execution (writing to SIM) is running */
162 PHB_INVALID_IDX, /* invalid index requested */
163 PHB_TAG_EXCEEDED /* entry is too long to fit on SIM */
164 } T_PHB_RETURN;
165
166 /* Phonebook search flag */
167 typedef enum
168 {
169 PHB_NEW_SEARCH = 0, /* execution of command failed */
170 PHB_NEXT_SEARCH /* execution of command completed */
171 } T_PHB_SEARCH;
172
173 typedef struct
174 {
175 UBYTE book;
176 UBYTE index; /* record number ( might be > 255) */
177 UBYTE tag_len; /* Length of Alpha identifier */
178 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
179 UBYTE len; /* Length of BCD number/SSC contens */
180 UBYTE ton_npi; /* TON and NPI */
181 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
182 UBYTE subaddr[PHB_PACKED_NUM_LEN];
183 UBYTE cc_id; /* Capability/Configuration identifier */
184 UBYTE year;
185 UBYTE month;
186 UBYTE day;
187 UBYTE hour;
188 UBYTE minute;
189 UBYTE second;
190 UBYTE line; /* MC line call was made from/received upon */
191 } T_PHB_RECORD;
192
193 typedef struct
194 {
195 UBYTE index; /* record number */
196 UBYTE tag_len; /* Length of Alpha identifier */
197 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
198 UBYTE len; /* Length of BCD number/SSC contens */
199 UBYTE ton_npi; /* TON and NPI */
200 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
201 #ifdef PHONEBOOK_EXTENSION
202 UBYTE subaddr[PHB_PACKED_NUM_LEN];
203 UBYTE ext_rcd_num; /* number of the extention record (0xFF => not used) */
204 #endif
205 UBYTE cc_id; /* Capability/Configuration identifier */
206 } T_AFB_RECORD;
207
208 /* Phone book entries */
209
210 /* define UNUSED_INDEX 0xFFFF */
211 #define UNUSED_INDEX (-1)
212 #define UNUSED_BYTE_INDEX 0xFF
213
214 typedef struct T_PHB_AFB_ELEMENT
215 {
216 UBYTE free;
217 UBYTE type;
218 SHORT prev_rcd;
219 SHORT next_rcd;
220 SHORT prev_trcd;
221 SHORT next_trcd;
222 SHORT prev_nrcd;
223 SHORT next_nrcd;
224 SHORT prev_mtrcd;
225 SHORT next_mtrcd;
226 SHORT prev_mnrcd;
227 SHORT next_mnrcd;
228 T_AFB_RECORD entry;
229 } T_PHB_AFB_ELEMENT;
230
231 typedef struct
232 {
233 UBYTE index; /* record number */
234 UBYTE tag_len; /* Length of Alpha identifier */
235 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */
236 UBYTE year;
237 UBYTE month;
238 UBYTE day;
239 UBYTE hour;
240 UBYTE minute;
241 UBYTE second;
242 UBYTE len; /* Length of BCD number/SSC contens */
243 UBYTE ton_npi; /* TON and NPI */
244 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */
245 #ifdef PHONEBOOK_EXTENSION
246 UBYTE subaddr[PHB_PACKED_NUM_LEN];
247 #endif
248 UBYTE cc_id; /* Capability/Configuration identifier */
249 UBYTE line; /* line call was made from/received upon....*/
250 } T_RDM_RECORD;
251
252 /* Phone book entries */
253 typedef struct T_PHB_RDM_ELEMENT
254 {
255 UBYTE free;
256 UBYTE type;
257 UBYTE prev_rcd;
258 UBYTE next_rcd;
259 T_RDM_RECORD entry;
260 } T_PHB_RDM_ELEMENT;
261
262 /*
263 typedef struct T_PHB_RDM_ELEMENT
264 {
265 UBYTE free;
266 UBYTE type;
267 SHORT prev_rcd;
268 SHORT next_rcd;
269 T_RDM_RECORD entry;
270 } T_PHB_RDM_ELEMENT;
271 */
272
273 /* Control block for phone book */
274 typedef struct
275 {
276 UBYTE mem;
277 UBYTE type;
278 UBYTE service;
279 UBYTE alpha_len;
280 SHORT max_rcd;
281 SHORT used_rcd;
282 SHORT first_rcd;
283 SHORT first_trcd;
284 SHORT first_nrcd;
285 SHORT first_mtrcd;
286 SHORT first_mnrcd;
287 UBYTE *rcd_bitmap;
288 } T_PHB_CTB;
289
290 /*
291 typedef struct
292 {
293 UBYTE mem;
294 UBYTE type;
295 UBYTE service;
296 UBYTE alpha_len;
297 UBYTE max_rcd;
298 UBYTE used_rcd;
299 SHORT first_rcd;
300 SHORT first_trcd;
301 SHORT first_nrcd;
302 SHORT first_mtrcd;
303 SHORT first_mnrcd;
304 UBYTE *rcd_bitmap;
305 } T_PHB_CTB;
306 */
307
308 typedef SHORT (*T_PHB_EXT_CMP_FCT)(UBYTE*, USHORT, UBYTE*, USHORT);
309
310 EXTERN void pb_set_compare_fct (T_PHB_EXT_CMP_FCT fct_compare);
311 EXTERN void phb_Init (void);
312 EXTERN void pb_init (void);
313 EXTERN void pb_init_afb (void);
314 EXTERN void pb_exit (void);
315 EXTERN void pb_reset (void);
316 EXTERN T_PHB_RETURN pb_read_ecc (USHORT error, UBYTE ecc_len, UBYTE *sim_ecc);
317 EXTERN BOOL pb_read_sim (USHORT data_id, UBYTE rcd_num, UBYTE len);
318 EXTERN void pb_copy_sim_entry (SHORT cur_index);
319 EXTERN void pb_read_cb (SHORT table_id);
320 EXTERN void pb_read_ext_cb (SHORT table_id);
321 EXTERN void pb_build_req (T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind);
322 EXTERN T_PHB_RETURN pb_start_build (BOOL unchanged);
323 EXTERN T_PHB_RETURN pb_read_eeprom_req (void);
324 EXTERN void pb_read_sim_req (void);
325 EXTERN T_PHB_RETURN pb_write_sim (UBYTE type, UBYTE rcd_num);
326 EXTERN void pb_write_eeprom (void);
327 EXTERN UBYTE pb_ssc (UBYTE nr, UBYTE * serv_table);
328 EXTERN void pb_record_sort (SHORT cur_index);
329 EXTERN void pb_l_record_sort (SHORT cur_index);
330 EXTERN void pb_alpha_sort (SHORT cur_index);
331 EXTERN void pb_num_sort (SHORT cur_index);
332 EXTERN void pb_malpha_sort (SHORT cur_index);
333 EXTERN void pb_mnum_sort (SHORT cur_index);
334 EXTERN T_PHB_RETURN pb_add_record (UBYTE type, UBYTE index, T_PHB_RECORD *entry);
335 EXTERN T_PHB_RETURN pb_delete_record (UBYTE type, UBYTE index, UBYTE *ext_rcd_num, BOOL permanent);
336 EXTERN T_PHB_RETURN pb_read_phys_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
337 EXTERN T_PHB_RETURN pb_read_index_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
338 EXTERN T_PHB_RETURN pb_read_alpha_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
339 EXTERN T_PHB_RETURN pb_read_number_record (UBYTE type, SHORT index, T_PHB_RECORD *entry);
340 EXTERN T_PHB_RETURN pb_search_name (T_ACI_CMD_SRC srcId,
341 UBYTE type,
342 T_ACI_PB_TEXT *searchName,
343 UBYTE mode,
344 SHORT *first_ind,
345 SHORT *result,
346 T_PHB_RECORD *entry);
347 EXTERN T_PHB_RETURN pb_search_number (UBYTE type, UBYTE *number,
348 UBYTE mode,
349 SHORT *first_ind,
350 SHORT *result,
351 T_PHB_RECORD *entry);
352 EXTERN void pb_rcd_chain (UBYTE type,
353 SHORT prev_index,
354 SHORT cur_index,
355 SHORT next_index);
356 EXTERN void pb_l_rcd_chain (UBYTE type,
357 SHORT prev_index,
358 SHORT cur_index,
359 SHORT next_index);
360 EXTERN void pb_name_chain (UBYTE type,
361 SHORT prev_index,
362 SHORT cur_index,
363 SHORT next_index);
364 EXTERN void pb_num_chain (UBYTE type,
365 SHORT prev_index,
366 SHORT cur_index,
367 SHORT next_index);
368 EXTERN void pb_mname_chain (UBYTE type,
369 SHORT prev_index,
370 SHORT cur_index,
371 SHORT next_index);
372 EXTERN void pb_mnum_chain (UBYTE type,
373 SHORT prev_index,
374 SHORT cur_index,
375 SHORT next_index);
376 EXTERN T_PHB_RETURN pb_read_status (UBYTE type, UBYTE *service,
377 SHORT *max_rcd, SHORT *used_rcd,
378 UBYTE *tag_len, SHORT *avail_rcd);
379 EXTERN void pb_status_req (UBYTE *mode);
380 EXTERN T_PHB_RETURN pb_first_free (UBYTE type,SHORT *first_free);
381 EXTERN T_PHB_RETURN pb_check_fdn (UBYTE toa, const UBYTE *number);
382 EXTERN UBYTE pb_check_number (char *cur_number, char *number);
383 #ifdef PHONEBOOK_EXTENSION
384 EXTERN T_PHB_RETURN pb_write_sim_ext (USHORT data_id, UBYTE rcd_num);
385 #endif
386 EXTERN T_PHB_RETURN pb_switch_adn_fdn (UBYTE mode, T_ACI_CLASS classFDN);
387 EXTERN void pb_copy_ldn_record (SHORT index, UBYTE flag);
388 EXTERN void pb_copy_lrn_record (SHORT index, UBYTE flag);
389 EXTERN void pb_copy_lmn_record (SHORT index, UBYTE flag);
390 EXTERN T_PHB_RETURN pb_delete_book (UBYTE book);
391 EXTERN void pb_delete_sim_book (UBYTE book);
392 EXTERN void pb_update_ecc (void);
393 EXTERN int pb_get_entry_len (const UBYTE *pb_tag, UBYTE max_pb_len);
394 EXTERN T_ACI_CLASS pb_get_fdn_classtype (void);
395 EXTERN void pb_set_fdn_input_classtype (T_ACI_CLASS classtype);
396 EXTERN UBYTE pb_get_fdn_mode (void);
397 EXTERN void pb_set_fdn_mode (UBYTE fdnmode);
398 #endif /* else, #ifdef TI_PS_FFS_PHB */
399 #endif /* #ifndef PHB_H */