FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/phb_sim.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 2005 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 SIM phonebook management block | |
18 | The functions of this block are aware about SIM data structures, | |
19 | they are not responsible for communication with the SIM itself. | |
20 | | |
21 | Details can be found in the design document | |
22 | "Phone Book Re-Architecture | |
23 +----------------------------------------------------------------------------- | |
24 */ | |
25 | |
26 #ifndef PHB_SIM_H | |
27 #define PHB_SIM_H | |
28 | |
29 #include "db.h" | |
30 /* | |
31 * Constants | |
32 */ | |
33 #define PHB_MAX_TAG_LEN 20 /* Arbitrary, old phonebook, nobody complained */ | |
34 | |
35 /* | |
36 * 04.08 clause 9.3.23.2 Called Party BCD allows for a | |
37 * PHB_PACKED_NUM_LEN of 40 as biggest definition which | |
38 * still could make any sense, but we have also to consider | |
39 * ACI's MAX_PHB_NUM_LEN in aci_cmh.h, therefore a definition | |
40 * of PHB_PACKED_NUM_LEN with size 20 makes more sense. | |
41 * With this, an ADN entry plus exatly one EXT1 record is filled. | |
42 */ | |
43 #define PHB_PACKED_NUM_LEN 20 /* See MAX_PHB_NUM_LEN in aci_cmh.h */ | |
44 | |
45 #define PHB_PACKED_SUB_LEN 22 /* 11.11 clause 10.5.10, chained 2 EXT records */ | |
46 #define ECC_NUM_LEN 3 | |
47 #define FFS_PHB_DIR "/phb_db" | |
48 | |
49 //#define SIM_ICI 0x6f80 /* Release 1999 LRN, LMN */ | |
50 #define FFS_LRN 0xFF00 /* Structure of SIM_OCI, for LRN, arbitrary unique value */ | |
51 #define FFS_LMN 0xFF01 /* Structure of SIM_OCI, for LMN, arbitrary unique value */ | |
52 #define FFS_EXT_LRN 0xFF02 /* Structure of EXT5 for LRN, arbitrary unique value */ | |
53 #define FFS_EXT_LMN 0xFF03 /* Structure of EXT5 for LMN, arbitrary unique value */ | |
54 #define SIM_OCI 0x6f81 /* Release 1999 LDN */ | |
55 // 0x6f4e is for the SIM EXT4, so we to assign another value for EXT5 here | |
56 //#define SIM_EXT5 0x6f4e /* Release 1999 EXT5 */ | |
57 #define SIM_EXT5 0x6f55 /* Arbitrary EXT5 value for EF_ICI/EF_OCI */ | |
58 | |
59 #define NAME_IDX 1 | |
60 #define NUMBER_IDX 2 | |
61 | |
62 /* ECC Phonebook Structure */ | |
63 typedef struct | |
64 { | |
65 USHORT phy_idx; /* physical record number */ | |
66 UBYTE number[ECC_NUM_LEN]; /* Dialing number/SSC string */ | |
67 } T_PHB_ECC_RECORD; | |
68 | |
69 /* Type of phonebook */ | |
70 typedef enum | |
71 { | |
72 INVALID_PHB = -1, /* Invalid Phonebook Type. */ | |
73 ECC = 0, /* Emergency call numbers */ /* SIM => EF_ECC */ | |
74 ADN, /* Abbreviated dialing number */ /* SIM => EF_ADN */ | |
75 FDN, /* Fixed dialing number */ /* SIM => EF_FDN */ | |
76 BDN, /* Barred dialing number */ /* SIM => EF_BDN */ | |
77 LDN, /* Last dialing number */ /* FFS => "/pcm/LDN" (old phb) */ | |
78 LRN, /* Last received number */ /* FFS => "/pcm/LRN" (old phb) */ | |
79 SDN, /* Service dialing number */ /* SIM => "EF_SDN" */ | |
80 LMN, /* last missed number */ /* FFS => "/pcm/LMN" (old phb) */ | |
81 UPN, /* User person number */ /* SIM => EF_MSISDN */ | |
82 ME, /* ME phonebook, flash based */ /* FFS => to be defined */ | |
83 ADN_ME, /* ADN and ME phonebook merged */ | |
84 MAX_PHONEBOOK | |
85 } T_PHB_TYPE; | |
86 | |
87 | |
88 /* Phonebook result codes. Note: Not every result code occurs within the | |
89 * SIM block of the phonebook (e.g. PHB_EXCT) */ | |
90 typedef enum | |
91 { | |
92 PHB_FAIL = -1, /* execution of command failed */ | |
93 PHB_LOCKED, /* needed elementary file locked */ | |
94 PHB_OK, /* execution of command completed */ | |
95 PHB_FULL, /* Phonebook is full */ | |
96 PHB_EXCT, /* execution (writing to SIM) is running */ | |
97 PHB_INVALID_IDX, /* invalid index requested */ | |
98 PHB_TAG_EXCEEDED, /* entry is too long to fit on SIM */ | |
99 PHB_EMPTY_RECORD /* attempted to read a free record */ | |
100 } T_PHB_RETURN; | |
101 | |
102 | |
103 /* Phonebook entry match criteria */ // ### Is this PHB_SIM? | |
104 typedef enum | |
105 { | |
106 PHB_MATCH_GE, /* Match entry if greater or equal */ | |
107 PHB_MATCH_PARTIAL /* Match entry if exact partial match */ | |
108 } T_PHB_MATCH; | |
109 | |
110 | |
111 /* File locking type */ | |
112 typedef enum | |
113 { | |
114 PHB_UNLOCKED = 0, /* Elementary file not locked */ | |
115 PHB_W_LOCK = 1, /* Elementary file locked for writing */ | |
116 PHB_R_LOCK = 2, /* Elementary file locked for reading */ | |
117 PHB_RW_LOCK = 3 /* Elementary file locked */ | |
118 } T_PHB_LOCK; | |
119 | |
120 | |
121 /* | |
122 * Type definitions | |
123 */ | |
124 | |
125 /* Phonebook time */ | |
126 typedef struct | |
127 { | |
128 UBYTE year; | |
129 UBYTE month; | |
130 UBYTE day; | |
131 UBYTE hour; | |
132 UBYTE minute; | |
133 UBYTE second; | |
134 UBYTE time_zone; /* 0xff means not present */ | |
135 ULONG duration; /* 0 means not answered, */ | |
136 /* 0xFFFFFFFF not present */ | |
137 } T_PHB_TIME; | |
138 | |
139 | |
140 /* Phonebook record */ | |
141 typedef struct | |
142 { | |
143 USHORT phy_recno; /* physical record number */ | |
144 UBYTE tag_len; /* Length of Alpha identifier */ | |
145 UBYTE tag[PHB_MAX_TAG_LEN]; /* Alpha identifier */ | |
146 UBYTE len; /* Length of BCD number/SSC contents */ | |
147 UBYTE ton_npi; /* TON and NPI */ | |
148 UBYTE number[PHB_PACKED_NUM_LEN]; /* Dialing number/SSC string */ | |
149 UBYTE subaddr[PHB_PACKED_SUB_LEN]; | |
150 UBYTE cc_id; /* Capability/Configuration identifier */ | |
151 UBYTE v_time; /* Valid flag */ | |
152 T_PHB_TIME time; /* Time of phone call */ | |
153 UBYTE v_line; /* Valid flag */ | |
154 UBYTE line; /* MC line call was made/received upon */ | |
155 } T_PHB_RECORD; | |
156 | |
157 | |
158 /* | |
159 * Function prototypes | |
160 */ | |
161 | |
162 EXTERN void pb_sim_init (void); | |
163 EXTERN void pb_sim_exit (void); | |
164 EXTERN T_PHB_RETURN pb_sim_set_ecc (UBYTE ecc_len, | |
165 const UBYTE *sim_ecc); | |
166 EXTERN T_PHB_RETURN pb_sim_create_ef (USHORT ef, | |
167 USHORT record_size, | |
168 USHORT records); | |
169 EXTERN T_PHB_RETURN pb_sim_write_ef (USHORT ef, | |
170 USHORT phy_recno, | |
171 USHORT entry_size, | |
172 const UBYTE *buffer, | |
173 BOOL *changed, | |
174 USHORT *ext_record_ef, | |
175 UBYTE *ext_record_no); | |
176 | |
177 EXTERN T_PHB_RETURN pb_sim_open (const T_imsi_field *imsi_field, | |
178 BOOL *changed); | |
179 EXTERN T_PHB_RETURN pb_sim_read_ef (USHORT ef, | |
180 USHORT phy_recno, | |
181 USHORT *entry_size, | |
182 UBYTE *buffer); | |
183 EXTERN T_PHB_RETURN pb_sim_remove_ef (USHORT ef); | |
184 EXTERN T_PHB_RETURN pb_sim_build_index (T_PHB_TYPE type); | |
185 EXTERN T_PHB_RETURN pb_sim_flush_data (void); | |
186 EXTERN T_PHB_RETURN pb_sim_add_record (T_PHB_TYPE type, | |
187 USHORT phy_recno, | |
188 const T_PHB_RECORD *entry, | |
189 T_DB_CHANGED *rec_affected); | |
190 EXTERN T_PHB_RETURN pb_sim_del_record (T_PHB_TYPE type, | |
191 USHORT phy_recno, | |
192 T_DB_CHANGED *rec_affected); | |
193 EXTERN T_PHB_RETURN pb_sim_read_record (T_PHB_TYPE type, | |
194 USHORT phy_recno, | |
195 T_PHB_RECORD *entry); | |
196 EXTERN T_PHB_RETURN pb_sim_read_alpha_record (T_PHB_TYPE type, | |
197 USHORT order_num, | |
198 T_PHB_RECORD *entry); | |
199 EXTERN T_PHB_RETURN pb_sim_read_number_record (T_PHB_TYPE type, | |
200 USHORT order_num, | |
201 T_PHB_RECORD *entry); | |
202 EXTERN T_PHB_RETURN pb_sim_search_name (T_PHB_TYPE type, | |
203 T_PHB_MATCH match, | |
204 const T_ACI_PB_TEXT *search_tag, | |
205 SHORT *order_num); | |
206 EXTERN T_PHB_RETURN pb_sim_search_number (T_PHB_TYPE type, | |
207 const UBYTE *number, | |
208 SHORT *order_num); | |
209 EXTERN T_PHB_RETURN pb_sim_read_sizes (T_PHB_TYPE type, /* IN */ | |
210 SHORT *max_rcd, /* OUT */ | |
211 SHORT *used_rcd, /* OUT */ | |
212 UBYTE *tag_len); | |
213 EXTERN int pb_sim_get_entry_len (const UBYTE *pb_tag, | |
214 UBYTE max_pb_len); | |
215 EXTERN int pb_sim_find_free_record (T_PHB_TYPE type); | |
216 #endif /* #ifndef PHB_SIM_H */ |