comparison src/ui/mfw/mfw_sima.c @ 3:67bfe9f274f6

src/ui: import of src/ui3 from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:33:10 +0000
parents
children 92abb46dc1ba
comparison
equal deleted inserted replaced
2:3a14ee9a9843 3:67bfe9f274f6
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 /* Added to remove warning Aug - 11 */
85 #ifdef NEPTUNE_BOARD
86 EXTERN void sim_signal (MfwEvt event, void *para);
87 #endif /* NEPTUNE_BOARD */
88 /* End - remove warning Aug - 11 */
89
90
91 T_MFW_READ_CALLBACK read_callback_data;
92
93 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
94 #ifdef FF_MMI_SAT_ICON
95 EXTERN U8 read_image_instance_file;
96 #endif
97
98 /*
99 +--------------------------------------------------------------------+
100 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
101 | STATE : code ROUTINE: sima_response_cb |
102 +--------------------------------------------------------------------+
103
104 PURPOSE : Response Callback Handler.
105
106 */
107
108 GLOBAL BOOL sima_response_cb (ULONG opc, void * data)
109 {
110 // TRACE_FUNCTION ("sim_response_cb()");
111
112 switch (opc)
113 {
114 case SIM_MMI_INSERT_IND:
115 /* MMI relevant parameters from the SIM card has received. */
116 rAT_PlusCFUNP ((T_SIM_MMI_INSERT_IND *)data);
117 return FALSE; /* processed also by ACI */
118
119 case SIM_ACTIVATE_CNF:
120 sim_mmi_parameter((T_SIM_ACTIVATE_CNF *)data);
121 return FALSE;
122
123 case SIM_ACTIVATE_IND:
124 sim_mmi_update_parameter((T_SIM_ACTIVATE_IND *)data);
125 return FALSE;
126 }
127
128 return FALSE; /* not processed by extension */
129 }
130
131 /*
132 +--------------------------------------------------------------------+
133 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
134 | STATE : code ROUTINE: sima_init |
135 +--------------------------------------------------------------------+
136
137 PURPOSE : Install AT-Command Extension.
138
139 */
140
141 void sima_init ()
142 {
143 TRACE_FUNCTION ("sima_init()");
144 }
145
146
147 /*
148 +----------------------------------------------------------------------+
149 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
150 | STATE : code ROUTINE: sim_read_sim |
151 +----------------------------------------------------------------------+
152
153
154 PURPOSE : Request to read SIM card.
155
156 */
157
158 void sim_read_sim(USHORT data_id, UBYTE len, UBYTE max_length)
159 {
160 SHORT table_id;
161
162 TRACE_FUNCTION ("sim_read_sim()");
163
164 table_id = psaSIM_atbNewEntry();
165
166 if(table_id NEQ NO_ENTRY)
167 {
168 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
169 simShrdPrm.atb[table_id].accType = ACT_RD_DAT;
170 // R99 SIM Interface changes . Indicates whether path_info variable has valid values
171 simShrdPrm.atb[table_id].v_path_info = FALSE;
172 simShrdPrm.atb[table_id].reqDataFld = data_id;
173 simShrdPrm.atb[table_id].dataOff = 0;
174 simShrdPrm.atb[table_id].dataLen = len;
175 simShrdPrm.atb[table_id].recMax = max_length;
176 simShrdPrm.atb[table_id].exchData = NULL;
177 simShrdPrm.atb[table_id].rplyCB = sim_read_sim_cb;
178
179 simShrdPrm.aId = table_id;
180
181 if(psaSIM_AccessSIMData( ) < 0)
182 {
183 TRACE_EVENT("FATAL ERROR");
184 }
185 }
186 }
187
188 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
189 #ifdef FF_MMI_SAT_ICON
190 /*
191 +----------------------------------------------------------------------+
192 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
193 | STATE : code ROUTINE: sim_read_sim_icon |
194 +----------------------------------------------------------------------+
195
196
197 PURPOSE : Request to read SIM card EF IMG. This is separated from the
198 above SIM read function as we have to specify the record number
199 also while reading the EF record & we dont want this functionality
200 for Lite variants.
201
202 */
203
204 void sim_read_sim_icon(T_SIM_ACCESS_PARAM *sim_icon_read_param)
205 {
206 SHORT table_id;
207
208 TRACE_FUNCTION ("sim_read_sim_icon()");
209
210 table_id = psaSIM_atbNewEntry();
211
212 if(table_id NEQ NO_ENTRY)
213 {
214 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
215 simShrdPrm.atb[table_id].accType = ACT_RD_REC;
216 // R99 SIM Interface changes. Indicates whether path_info variable has valid values
217 simShrdPrm.atb[table_id].v_path_info = FALSE;
218 simShrdPrm.atb[table_id].reqDataFld = sim_icon_read_param -> data_id;
219 simShrdPrm.atb[table_id].dataOff = sim_icon_read_param -> offset;
220 simShrdPrm.atb[table_id].dataLen = sim_icon_read_param -> len;
221 simShrdPrm.atb[table_id].recMax = sim_icon_read_param -> max_length;
222 simShrdPrm.atb[table_id].exchData = NULL;
223 /* Read the Record number provided, only if available */
224 if(sim_icon_read_param -> record_number)
225 simShrdPrm.atb[table_id].recNr = sim_icon_read_param -> record_number;
226 simShrdPrm.atb[table_id].rplyCB = sim_read_sim_cb;
227
228 simShrdPrm.aId = table_id;
229
230 if(psaSIM_AccessSIMData( ) < 0)
231 {
232 TRACE_EVENT("FATAL ERROR");
233 }
234 }
235 }
236 #endif
237
238 /*
239 +---------------------------------------------------------------------+
240 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
241 | STATE : code ROUTINE: sim_read_sim_cb |
242 +---------------------------------------------------------------------+
243
244
245 PURPOSE : Call back for SIM read.
246
247 */
248
249 void sim_read_sim_cb(SHORT table_id)
250 {
251 TRACE_FUNCTION ("sim_read_sim_cb()");
252
253 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
254
255 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
256 #ifdef FF_MMI_SAT_ICON
257 /* If we are reading the image data contents,
258 we dont need to enter the switch statement */
259 if (read_image_instance_file)
260 {
261 sim_img_instance_data_cnf(simShrdPrm.atb[table_id].errCode,
262 simShrdPrm.atb[table_id].exchData);
263 return;
264 }
265 #endif
266
267 switch (simShrdPrm.atb[table_id].reqDataFld)
268 {
269 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
270 #ifdef FF_MMI_SAT_ICON
271 /* EF-IMG contents */
272 case SIM_IMG:
273 sim_img_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].recNr,
274 (UBYTE *)simShrdPrm.atb[table_id].exchData);
275 break;
276 #endif
277
278 /* Service provide name */
279 case SIM_SPN:
280 nm_spn_cnf(simShrdPrm.atb[table_id].errCode, (T_EF_SPN *)simShrdPrm.atb[table_id].exchData);
281 break;
282
283 /* group identifier level 1 */
284 case SIM_GID1:
285 sim_gid1_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
286 break;
287
288 /* group identifier level 2 */
289 case SIM_GID2:
290 sim_gid2_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
291 break;
292
293 case SIM_SST:
294 sim_read_sst_cnf(simShrdPrm.atb[table_id].errCode, simShrdPrm.atb[table_id].exchData);
295 break;
296 /*MC CONQ5862, 13/06/02*, if not one of above data fileds, send event to MMI*/
297 default:
298 read_callback_data.error_code = simShrdPrm.atb[table_id].errCode;
299 read_callback_data.read_buffer = simShrdPrm.atb[table_id].exchData;
300 sim_signal(E_SIM_READ_CALLBACK, (void*)&read_callback_data);
301 break;
302 }
303 }
304
305
306 /*
307 +----------------------------------------------------------------------+
308 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
309 | STATE : code ROUTINE: sim_write_sim |
310 +----------------------------------------------------------------------+
311
312
313 PURPOSE : Request to write SIM card.
314
315 */
316
317 void sim_write_sim(USHORT data_id, UBYTE *data, UBYTE length)
318 {
319 SHORT table_id;
320
321 /* Write preferred PLMN list in SIM card */
322 table_id = psaSIM_atbNewEntry();
323
324 if(table_id NEQ NO_ENTRY)
325 {
326 simShrdPrm.atb[table_id].ntryUsdFlg = TRUE;
327 simShrdPrm.atb[table_id].accType = ACT_WR_DAT;
328 //R99 Sim Interface changes. Indicates whether path_info variable has valid values
329 simShrdPrm.atb[table_id].v_path_info = FALSE;
330 simShrdPrm.atb[table_id].reqDataFld = data_id;
331 simShrdPrm.atb[table_id].dataOff = 0;
332 simShrdPrm.atb[table_id].dataLen = length;
333 simShrdPrm.atb[table_id].exchData = data;
334 simShrdPrm.atb[table_id].rplyCB = sim_write_sim_cb;
335
336 simShrdPrm.aId = table_id;
337
338 if(psaSIM_AccessSIMData( ) < 0)
339 {
340 TRACE_EVENT("FATAL ERROR");
341 }
342 }
343 }
344
345
346 /*
347 +---------------------------------------------------------------------+
348 | PROJECT: MMI-Framework (8417) MODULE: MFW_SIMA |
349 | STATE : code ROUTINE: sim_write_sim_cb |
350 +---------------------------------------------------------------------+
351
352
353 PURPOSE : Call back for SIM write.
354
355 */
356
357 void sim_write_sim_cb(SHORT table_id)
358 {
359 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
360
361 #ifdef FF_2TO1_PS
362 if (simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR)
363 #else
364 if (simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR)
365 #endif
366 {
367 TRACE_EVENT("FATAL ERROR");
368 }
369 }