FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/mfw/CPHS_mod.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 #ifndef _CPHS_H_ | |
2 #define _CPHS_H_ | |
3 /*-----------------------------------------------------------------------* | |
4 * * | |
5 * CPHS / SIM lock Standalone module * | |
6 * * | |
7 *-----------------------------------------------------------------------*/ | |
8 | |
9 /*-----------------------------------------------------------------------* | |
10 * CPHS Part * | |
11 *-----------------------------------------------------------------------*/ | |
12 | |
13 | |
14 /*---- Constants --------------------------------------------------------*/ | |
15 #define CPHS_CSP_SIZE 20 | |
16 | |
17 /*---- Types ------------------------------------------------------------*/ | |
18 | |
19 #define SHORT short | |
20 #define UBYTE unsigned char | |
21 #define BYTE unsigned char | |
22 #define BOOL UBYTE | |
23 | |
24 | |
25 typedef enum /* SIM operation status */ | |
26 { | |
27 SIMOP_UNKNOWN = 20, | |
28 SIMOP_WRITE_ERR, | |
29 SIMOP_WRITE_OK, | |
30 SIMOP_READ_ERR, | |
31 SIMOP_READ_OK | |
32 } T_CPHS_SIMOP_STATUS; | |
33 | |
34 typedef enum | |
35 { | |
36 CPHS_FAIL = -1, | |
37 CPHS_NOT_PRESENT, | |
38 CPHS_IS_OK, | |
39 CPHS_EXEC, | |
40 CPHS_NOT_INIT, | |
41 CPHS_SIM_READ_ERROR, | |
42 CPHS_SIM_WRITE_ERROR | |
43 } T_CPHS_RET; //function return status | |
44 | |
45 typedef enum //line identifier values | |
46 { | |
47 CPHS_LINE_INDEX_LINE1 = 1, | |
48 CPHS_LINE_INDEX_LINE2 = 2, | |
49 CPHS_LINE_INDEX_FAX = 4, | |
50 CPHS_LINE_INDEX_DATA = 8 | |
51 } T_CPHS_LINE_INDEX; | |
52 | |
53 typedef enum //Roaming indicator values | |
54 { | |
55 CPHS_ROAMING_OFF, | |
56 CPHS_ROAMING_ON | |
57 } T_CPHS_ROAMING_IND; | |
58 | |
59 | |
60 typedef enum //Voicemail/divert status flags | |
61 { | |
62 CPHS_FLAG_NOT_PRESENT = -1, | |
63 CPHS_LINEFLAG_NOT_SET, | |
64 CPHS_LINEFLAG_SET | |
65 } T_CPHS_FLAG_STATUS; | |
66 | |
67 | |
68 typedef enum //possible emergency numbers | |
69 { | |
70 CPHS_EMERGENCY_NUM_112 = 112, | |
71 CPHS_EMERGENCY_NUM_999 = 999 | |
72 } T_CPHS_EMERGENCY_NUM; | |
73 | |
74 typedef struct //format of text strings | |
75 { | |
76 UBYTE len; | |
77 //UBYTE* data; | |
78 UBYTE data[22]; | |
79 } T_CPHS_DATA; | |
80 | |
81 | |
82 | |
83 typedef struct //status of lines for voicemail/divert | |
84 { | |
85 UBYTE result; //result of read/write op | |
86 T_CPHS_FLAG_STATUS line1; | |
87 T_CPHS_FLAG_STATUS line2; | |
88 T_CPHS_FLAG_STATUS fax; | |
89 T_CPHS_FLAG_STATUS data; | |
90 } T_CPHS_LINE_IND; | |
91 | |
92 typedef struct //ALS selected line | |
93 { | |
94 UBYTE result; | |
95 T_CPHS_LINE_INDEX line; | |
96 T_CPHS_FLAG_STATUS locked; | |
97 } T_CPHS_ALS_INFO; | |
98 | |
99 typedef struct //ALS line description | |
100 { | |
101 UBYTE result; | |
102 T_CPHS_LINE_INDEX line; | |
103 T_CPHS_DATA description; | |
104 } T_CPHS_ALS_LINE; | |
105 | |
106 typedef struct //operator name in long and short forms | |
107 { | |
108 UBYTE result; | |
109 T_CPHS_DATA long_name; | |
110 T_CPHS_DATA short_name; | |
111 } T_CPHS_OPN; | |
112 | |
113 | |
114 | |
115 typedef struct //CPHS config info | |
116 { | |
117 UBYTE phase; | |
118 BOOL opn_short; | |
119 BOOL mailbox_num; | |
120 BOOL sst; | |
121 BOOL csp; | |
122 BOOL info_num; | |
123 } T_CPHS_INFO; | |
124 | |
125 typedef struct //single Customer service profile entry | |
126 { | |
127 UBYTE group_code; | |
128 UBYTE services; | |
129 } T_CPHS_CSP_ENTRY; | |
130 | |
131 typedef struct //customer service Profile | |
132 { | |
133 UBYTE result; //Result of last read/write | |
134 T_CPHS_CSP_ENTRY csp[CPHS_CSP_SIZE]; | |
135 //UBYTE csp[CPHS_CSP_SIZE]; | |
136 } T_CPHS_CSP; | |
137 | |
138 typedef struct //single mailbox entry | |
139 { | |
140 UBYTE index; | |
141 T_CPHS_DATA alpha; | |
142 UBYTE number[22]; | |
143 UBYTE ton; | |
144 UBYTE npi; | |
145 UBYTE service; | |
146 } T_CPHS_MAILBOX_NUM_ENTRY; | |
147 | |
148 typedef struct //mailbox entries | |
149 { | |
150 UBYTE result; //read/write result | |
151 UBYTE count; | |
152 // T_CPHS_MAILBOX_NUM_ENTRY *entries; | |
153 T_CPHS_MAILBOX_NUM_ENTRY entries[4]; | |
154 } T_CPHS_MAILBOX_NUM_LIST; | |
155 | |
156 | |
157 | |
158 typedef struct //single information number list entry | |
159 { | |
160 UBYTE index; | |
161 T_CPHS_DATA alpha; | |
162 UBYTE entryStat; | |
163 } T_CPHS_INFO_NUM; | |
164 | |
165 typedef struct //information number | |
166 { | |
167 UBYTE entryStat; | |
168 UBYTE result; //result of last read/write op | |
169 UBYTE index; | |
170 T_CPHS_DATA alpha; | |
171 UBYTE number[22]; | |
172 UBYTE ton; | |
173 UBYTE npi; | |
174 } T_CPHS_INFO_NUM_ENTRY; | |
175 | |
176 typedef struct //information number list | |
177 { | |
178 UBYTE count; //no of entries | |
179 UBYTE level; | |
180 UBYTE index; | |
181 //T_CPHS_INFO_NUM *entry; | |
182 T_CPHS_INFO_NUM entry[10]; | |
183 } T_CPHS_INFO_NUM_LIST; | |
184 | |
185 | |
186 //Callback function type | |
187 typedef int (*T_CPHS_CB_FUNC) (T_CPHS_INFO_NUM_LIST *,T_CPHS_INFO_NUM_ENTRY *); | |
188 | |
189 | |
190 /*---- Functions --------------------------------------------------------*/ | |
191 | |
192 /* all CPHS functions return the following values: */ | |
193 /* */ | |
194 /* CPHS_OK : on successfull execution */ | |
195 /* CPHS_EXEC : if CPHS operation is still executing */ | |
196 /* CPHS_NOT_INIT : if a CPHS function is called before the */ | |
197 /* CPHS initialize function has been called */ | |
198 /* CPHS_NOT_PRESENT : if current function is not present for */ | |
199 /* current SIM */ | |
200 /* CPHS_SIM_READ_ERROR : on SIM read operation failure */ | |
201 /* CPHS_SIM_WRITE_ERROR : on SIM read operation failure */ | |
202 /* CPHS_FAIL : on other failures */ | |
203 | |
204 | |
205 | |
206 /* set the roaming indicator */ | |
207 | |
208 | |
209 | |
210 | |
211 T_CPHS_RET cphs_Init(T_CPHS_CB_FUNC callback); | |
212 /* initializes CPHS module, reads CPHS data fields from SIM and caches */ | |
213 /* the read data. */ | |
214 | |
215 | |
216 T_CPHS_RET cphs_refresh(T_CPHS_CB_FUNC callback); | |
217 /* reads CPHS data fields from SIM and updates the cached CPHS data */ | |
218 | |
219 T_CPHS_RET cphs_Exit(); | |
220 /* de-initializes CPHS module */ | |
221 | |
222 | |
223 | |
224 T_CPHS_RET cphs_getOPN ( T_CPHS_OPN* opn ); | |
225 /* reads from SIM the operator long name and if available the short */ | |
226 /* name, too */ | |
227 | |
228 | |
229 T_CPHS_RET cphs_setDivertCallInd ( UBYTE line_mask, | |
230 T_CPHS_FLAG_STATUS flag ); | |
231 /* sets on SIM the divert call flag for the given lines in the */ | |
232 /* parameter line_mask. The bitmask will be created by oring the lines.*/ | |
233 /* The bits for the lines are defined in T_CPHS_LINE_INDEX. */ | |
234 | |
235 | |
236 | |
237 T_CPHS_RET cphs_getAlsInfo ( T_CPHS_ALS_INFO *info ); | |
238 /* reads from SIM the information of alternate line service */ | |
239 /* ( selected line, alternate line service locked/unlocked) */ | |
240 | |
241 T_CPHS_RET cphs_setAlsInfo ( T_CPHS_ALS_INFO *info ); | |
242 /* sets on SIM the informtion of alternate line service / selects the */ | |
243 /* active line */ | |
244 | |
245 T_CPHS_RET cphs_setRoamingInd ( T_CPHS_ROAMING_IND* indicator ); | |
246 | |
247 | |
248 T_CPHS_RET cphs_getAlsLineDescr ( T_CPHS_ALS_LINE* line ); | |
249 /* reads the (alpha)numeric description for the given line */ | |
250 | |
251 T_CPHS_RET cphs_setAlsLineDescr ( T_CPHS_ALS_LINE line ); | |
252 /* sets a (alpha)numeric description for the given line */ | |
253 | |
254 T_CPHS_RET cphs_getRoamingInd ( T_CPHS_ROAMING_IND* indicator ); | |
255 /* checks if roaming is active | |
256 */ | |
257 | |
258 /* reads from SIMif calls shall be diverted for the available lines */ | |
259 /* (line1, line2, fax, data) */ | |
260 T_CPHS_RET cphs_getDivertCallInd ( T_CPHS_LINE_IND* indicator ); | |
261 | |
262 | |
263 | |
264 T_CPHS_RET cphs_getVoiceMessageInd( T_CPHS_LINE_IND* indicator); | |
265 /* reads from SIM if voice mails are waiting for the available lines */ | |
266 /* (line1, line2, fax, data) */ | |
267 | |
268 T_CPHS_RET cphs_setVoiceMessageInd( UBYTE line_mask, | |
269 T_CPHS_FLAG_STATUS flag ); | |
270 /* sets on SIM the voice mail waiting flag for the given lines in the */ | |
271 /* parameter line_mask. The bitmask will be created by oring the lines.*/ | |
272 /* The bits for the lines are defined in T_CPHS_LINE_INDEX. */ | |
273 | |
274 | |
275 | |
276 | |
277 T_CPHS_RET cphs_checkEmergencyCall( char* num ); | |
278 /* check if the current call number(ASCII encoded) is an emergency number supported */ | |
279 /* by CPHS. */ | |
280 | |
281 | |
282 | |
283 T_CPHS_RET cphs_getCPHSInfo ( T_CPHS_INFO *info ); | |
284 /* reads from SIM the phase of the SIM and which optional datafields */ | |
285 /* are present in the SIM */ | |
286 /* (operator name shortform, mailbox numbers, service string table, */ | |
287 /* information numbers) */ | |
288 | |
289 | |
290 | |
291 T_CPHS_RET cphs_getCSP ( T_CPHS_CSP *csp ); | |
292 /* reads all entries of the customer service profile and fills */ | |
293 | |
294 | |
295 | |
296 T_CPHS_RET cphs_getMailboxNumbers ( T_CPHS_MAILBOX_NUM_LIST *nums ); | |
297 /* reads all mailbox numbers from the SIM fills all mailbox number */ | |
298 /* entries in the mailbox number list */ | |
299 | |
300 | |
301 | |
302 T_CPHS_RET cphs_getInfoNumbers ( T_CPHS_INFO_NUM_LIST *nums, UBYTE level, UBYTE startIndex, T_CPHS_CB_FUNC callback); | |
303 // reads all information numbers from the SIM fills all information | |
304 // numbers into the array of pointers at the directory level specified from the specified | |
305 //index until an entry of a different level is encountered | |
306 //The callback function is called when the list has been retrieved from the SIM and is passed | |
307 //the list as a parameter | |
308 //e.g. cphs_getInfoNumbers(NumberList, 1, 1, callback_func) would get the first level | |
309 //in the information numbers list | |
310 //to get the directory below an item in this list, you'd have to read the entry index and | |
311 //call cphs_getInfoNumbers(NewNumberList, entry_level+1, entry_index+1, callback_func), as | |
312 //directory contents are stored right after the directory heading. | |
313 //The MSB of the entryStat field in a info number list entry is set to 1 if it is a number | |
314 //and 0 if it is a directory heading. | |
315 | |
316 | |
317 T_CPHS_RET cphs_selectInfoNumber ( USHORT index, | |
318 T_CPHS_INFO_NUM_ENTRY *num, T_CPHS_CB_FUNC callback); | |
319 // reads the information number entry given by index from */ | |
320 // the SIM */ */ | |
321 //The index of a desired entry can be found in the "index" field of that entry in a previously | |
322 //retrieved information number list | |
323 | |
324 | |
325 | |
326 | |
327 | |
328 /*-----------------------------------------------------------------------* | |
329 * SIMLOCK Part * | |
330 *-----------------------------------------------------------------------*/ | |
331 | |
332 | |
333 /*---- Predefined Values ------------------------------------------------*/ | |
334 | |
335 #define SIMLOCK_PWD_MAX_LEN 16 | |
336 #define SIMLOCK_PWD_MIN_LEN_SIM 6 | |
337 #define SIMLOCK_PWD_MIN_LEN_OTHER 8 | |
338 | |
339 | |
340 /*---- Types ------------------------------------------------------------*/ | |
341 | |
342 typedef enum | |
343 { | |
344 SIMLOCK_FAIL = -1, | |
345 SIMLOCK_ENABLE, | |
346 SIMLOCK_DISABLE, | |
347 SIMLOCK_LOCKED, | |
348 SIMLOCK_BLOCKED | |
349 } T_SIMLOCK_RET; | |
350 | |
351 typedef enum | |
352 { | |
353 SIMLOCK_NETWORK = 0, | |
354 SIMLOCK_NETWORK_SUBSET, | |
355 SIMLOCK_SERVICE_PROVIDER, | |
356 SIMLOCK_CORPORATE, | |
357 SIMLOCK_SIM, | |
358 SIMLOCK_FIRST_SIM | |
359 } T_SIMLOCK_TYPE; | |
360 | |
361 | |
362 /*---- Functions --------------------------------------------------------*/ | |
363 | |
364 //T_SIMLOCK_RET simlock_checkLock ( T_SIMLOCK_TYPE type ); | |
365 /* checks the lock status of the given lock type. On successfull check */ | |
366 /* the status will be returned. If an error occured SIMLOCK_FAIL will */ | |
367 | |
368 //#define _TESTING__ | |
369 #ifdef _TESTING__ | |
370 void Cphs_reading_test(); | |
371 void Cphs_writing_test(); | |
372 #endif | |
373 | |
374 #endif //_CPHS_H_ | |
375 |