comparison g23m/condat/ms/src/mfw/mfw_sima.c @ 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 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_sima.c $|
4 | $Author:: Es $Revision:: 1 $|
5 | CREATED: 13.10.98 $Modtime:: 2.03.00 15:14 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_SIMA
10
11 PURPOSE : This modul contains the functions for SIM management.
12
13 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S.
14 Description: SAT Icon support
15 Solution : SAT icon support added.
16
17 */
18
19
20 #define ENTITY_MFW
21
22 #include "mfw_sys.h"
23
24 #if defined (NEW_FRAME)
25
26 #include "typedefs.h"
27 #include "vsi.h"
28 #include "custom.h"
29 #include "gsm.h"
30
31 #else
32
33 #include "STDDEFS.H"
34 #include "custom.h"
35 #include "gsm.h"
36 #include "vsi.h"
37
38 #endif
39
40 #include "prim.h"
41
42 #include "message.h"
43 #include "prim.h"
44 #include "aci_cmh.h"
45 #include "prim.h"
46 #ifndef PCM_2_FFS
47 #include "pcm.h"
48 #endif
49
50
51 #include "psa.h"
52 #include "psa_sim.h"
53
54 #include "mfw_mfw.h"
55 #include "mfw_nm.h"
56 #include "mfw_sim.h"
57 #include "mfw_simi.h"
58 #include "mfw_sima.h"
59 #include "mfw_nmi.h"
60 #include "mfw_phb.h"
61 #include "mfw_cm.h"
62 #include "mfw_cmi.h"
63 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
64 #ifdef FF_MMI_SAT_ICON
65 #include "mfw_sat.h"
66 #endif
67
68 #ifndef FF_2TO1_PS
69 #include "p_sim.val"
70 #endif
71
72 #include <string.h>
73
74 #define hCommSIM _ENTITY_PREFIXED(hCommSIM)
75 #if defined (NEW_FRAME)
76 EXTERN T_HANDLE hCommSIM; /* SIM Communication */
77 #else
78 EXTERN T_VSI_CHANDLE hCommSIM; /* SIM Communication */
79 #endif
80
81 EXTERN void aci_create (BOOL (*r_cb)(USHORT opc, void * data),
82 BOOL (*cmd)(char *));
83
84 T_MFW_READ_CALLBACK read_callback_data;
85
86 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
87 #ifdef FF_MMI_SAT_ICON
88 EXTERN U8 read_image_instance_file;
89 #endif
90
91 /*
92 +--------------------------------------------------------------------+
93 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
94 | STATE : code ROUTINE: sima_response_cb |
95 +--------------------------------------------------------------------+
96
97 PURPOSE : Response Callback Handler.
98
99 */
100
101 GLOBAL BOOL sima_response_cb (ULONG opc, void * data)
102 {
103 // TRACE_FUNCTION ("sim_response_cb()");
104
105 switch (opc)
106 {
107 case SIM_MMI_INSERT_IND:
108 /* MMI relevant parameters from the SIM card has received. */
109 rAT_PlusCFUNP ((T_SIM_MMI_INSERT_IND *)data);
110 return FALSE; /* processed also by ACI */
111
112 case SIM_ACTIVATE_CNF:
113 sim_mmi_parameter((T_SIM_ACTIVATE_CNF *)data);
114 return FALSE;
115
116 case SIM_ACTIVATE_IND:
117 sim_mmi_update_parameter((T_SIM_ACTIVATE_IND *)data);
118 return FALSE;
119 }
120
121 return FALSE; /* not processed by extension */
122 }
123
124 /*
125 +--------------------------------------------------------------------+
126 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
127 | STATE : code ROUTINE: sima_init |
128 +--------------------------------------------------------------------+
129
130 PURPOSE : Install AT-Command Extension.
131
132 */
133
134 void sima_init ()
135 {
136 TRACE_FUNCTION ("sima_init()");
137 }
138
139
140 /*
141 +----------------------------------------------------------------------+
142 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
143 | STATE : code ROUTINE: sim_read_sim |
144 +----------------------------------------------------------------------+
145
146
147 PURPOSE : Request to read SIM card.
148
149 */
150
151 void sim_read_sim(USHORT data_id, UBYTE len, UBYTE max_length)
152 {
153 SHORT table_id;
154
155 TRACE_FUNCTION ("sim_read_sim()");
156
157 table_id = psaSIM_atbNewEntry();
158
159 if(table_id NEQ NO_ENTRY)
160 {
161 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
162 simShrdPrm.atb[table_id].accType = ACT_RD_DAT;
163 simShrdPrm.atb[table_id].reqDataFld = data_id;
164 simShrdPrm.atb[table_id].dataOff = 0;
165 simShrdPrm.atb[table_id].dataLen = len;
166 simShrdPrm.atb[table_id].recMax = max_length;
167 simShrdPrm.atb[table_id].exchData = NULL;
168 simShrdPrm.atb[table_id].rplyCB = sim_read_sim_cb;
169
170 simShrdPrm.aId = table_id;
171
172 if(psaSIM_AccessSIMData( ) < 0)
173 {
174 TRACE_EVENT("FATAL ERROR");
175 }
176 }
177 }
178
179 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
180 #ifdef FF_MMI_SAT_ICON
181 /*
182 +----------------------------------------------------------------------+
183 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
184 | STATE : code ROUTINE: sim_read_sim_icon |
185 +----------------------------------------------------------------------+
186
187
188 PURPOSE : Request to read SIM card EF IMG. This is separated from the
189 above SIM read function as we have to specify the record number
190 also while reading the EF record & we dont want this functionality
191 for Lite variants.
192
193 */
194
195 void sim_read_sim_icon(T_SIM_ACCESS_PARAM *sim_icon_read_param)
196 {
197 SHORT table_id;
198
199 TRACE_FUNCTION ("sim_read_sim_icon()");
200
201 table_id = psaSIM_atbNewEntry();
202
203 if(table_id NEQ NO_ENTRY)
204 {
205 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
206 simShrdPrm.atb[table_id].accType = ACT_RD_REC;
207 simShrdPrm.atb[table_id].reqDataFld = sim_icon_read_param -> data_id;
208 simShrdPrm.atb[table_id].dataOff = sim_icon_read_param -> offset;
209 simShrdPrm.atb[table_id].dataLen = sim_icon_read_param -> len;
210 simShrdPrm.atb[table_id].recMax = sim_icon_read_param -> max_length;
211 simShrdPrm.atb[table_id].exchData = NULL;
212 /* Read the Record number provided, only if available */
213 if(sim_icon_read_param -> record_number)
214 simShrdPrm.atb[table_id].recNr = sim_icon_read_param -> record_number;
215 simShrdPrm.atb[table_id].rplyCB = sim_read_sim_cb;
216
217 simShrdPrm.aId = table_id;
218
219 if(psaSIM_AccessSIMData( ) < 0)
220 {
221 TRACE_EVENT("FATAL ERROR");
222 }
223 }
224 }
225 #endif
226
227 /*
228 +---------------------------------------------------------------------+
229 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
230 | STATE : code ROUTINE: sim_read_sim_cb |
231 +---------------------------------------------------------------------+
232
233
234 PURPOSE : Call back for SIM read.
235
236 */
237
238 void sim_read_sim_cb(SHORT table_id)
239 {
240 TRACE_FUNCTION ("sim_read_sim_cb()");
241
242 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
243
244 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
245 #ifdef FF_MMI_SAT_ICON
246 /* If we are reading the image data contents,
247 we dont need to enter the switch statement */
248 if (read_image_instance_file)
249 {
250 sim_img_instance_data_cnf(simShrdPrm.atb[table_id].errCode,
251 simShrdPrm.atb[table_id].exchData);
252 return;
253 }
254 #endif
255
256 switch (simShrdPrm.atb[table_id].reqDataFld)
257 {
258 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
259 #ifdef FF_MMI_SAT_ICON
260 /* EF-IMG contents */
261 case SIM_IMG:
262 sim_img_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].recNr,
263 (UBYTE *)simShrdPrm.atb[table_id].exchData);
264 break;
265 #endif
266
267 /* Service provide name */
268 case SIM_SPN:
269 nm_spn_cnf(simShrdPrm.atb[table_id].errCode, (T_EF_SPN *)simShrdPrm.atb[table_id].exchData);
270 break;
271
272 /* group identifier level 1 */
273 case SIM_GID1:
274 sim_gid1_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
275 break;
276
277 /* group identifier level 2 */
278 case SIM_GID2:
279 sim_gid2_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
280 break;
281
282 case SIM_SST:
283 sim_read_sst_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
284 break;
285 /*MC CONQ5862, 13/06/02*, if not one of above data fileds, send event to MMI*/
286 default:
287 read_callback_data.error_code = simShrdPrm.atb[table_id].errCode;
288 read_callback_data.read_buffer = simShrdPrm.atb[table_id].exchData;
289 sim_signal(E_SIM_READ_CALLBACK, (void*)&read_callback_data);
290 break;
291 }
292 }
293
294
295 /*
296 +----------------------------------------------------------------------+
297 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
298 | STATE : code ROUTINE: sim_write_sim |
299 +----------------------------------------------------------------------+
300
301
302 PURPOSE : Request to write SIM card.
303
304 */
305
306 void sim_write_sim(USHORT data_id, UBYTE *data, UBYTE length)
307 {
308 SHORT table_id;
309
310 /* Write preferred PLMN list in SIM card */
311 table_id = psaSIM_atbNewEntry();
312
313 if(table_id NEQ NO_ENTRY)
314 {
315 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
316 simShrdPrm.atb[table_id].accType = ACT_WR_DAT;
317 simShrdPrm.atb[table_id].reqDataFld = data_id;
318 simShrdPrm.atb[table_id].dataOff = 0;
319 simShrdPrm.atb[table_id].dataLen = length;
320 simShrdPrm.atb[table_id].exchData = data;
321 simShrdPrm.atb[table_id].rplyCB = sim_write_sim_cb;
322
323 simShrdPrm.aId = table_id;
324
325 if(psaSIM_AccessSIMData( ) < 0)
326 {
327 TRACE_EVENT("FATAL ERROR");
328 }
329 }
330 }
331
332
333 /*
334 +---------------------------------------------------------------------+
335 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
336 | STATE : code ROUTINE: sim_write_sim_cb |
337 +---------------------------------------------------------------------+
338
339
340 PURPOSE : Call back for SIM write.
341
342 */
343
344 void sim_write_sim_cb(SHORT table_id)
345 {
346 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
347
348 #ifdef FF_2TO1_PS
349 if (simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR)
350 #else
351 if (simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR)
352 #endif
353 {
354 TRACE_EVENT("FATAL ERROR");
355 }
356 }