comparison src/aci2/bmi/mmiSatClassE.c @ 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 CONDAT (UK)
4
5 ********************************************************************************
6
7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner.
9
10 ********************************************************************************
11
12 $Project name: Basic MMI
13 $Project code: BMI (6349)
14 $Module: MMI
15 $File: MmiSatClassE.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 13/03/03
20
21 ********************************************************************************
22
23 Description: Contains the implementation of SAT Class E
24
25
26
27 ********************************************************************************
28
29 $History: MmiSatClassE.c
30
31 13/03/03 Original Condat(UK) BMI version.
32
33 $End
34
35 *******************************************************************************/
36
37 #define ENTITY_MFW
38
39 /* includes */
40 #include <string.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43
44 #if defined (NEW_FRAME)
45
46 #include "typedefs.h"
47 #include "vsi.h"
48 #include "pei.h"
49 #include "custom.h"
50 #include "gsm.h"
51
52 #else
53
54 #include "STDDEFS.H"
55 #include "custom.h"
56 #include "gsm.h"
57 #include "vsi.h"
58
59 #endif /* (NEW_FRAME) */
60
61 #include "pconst.cdg"
62 #include "mconst.cdg"
63 #include "message.h"
64 #include "ccdapi.h"
65 #include "prim.h"
66 #include "cus_aci.h"
67 #include "cnf_aci.h"
68 #include "mon_aci.h"
69
70 #include "tok.h"
71
72 #include "prim.h"
73 #ifndef PCM_2_FFS
74 #include "pcm.h"
75 #endif
76
77
78 #include "mfw_mfw.h"
79 #include "mfw_kbd.h"
80 #include "mfw_tim.h"
81 #include "mfw_lng.h"
82 #include "mfw_win.h"
83 #include "mfw_icn.h"
84 #include "mfw_sim.h"
85 #include "mfw_nm.h"
86 /* SPR#1428 - SH - New Editor changes */
87 #ifndef NEW_EDITOR
88 #include "mfw_edt.h"
89 #endif /* NEW_EDITOR */
90 #include "mfw_mnu.h"
91 #include "mfw_phb.h"
92 #include "mfw_sms.h"
93
94 #include "dspl.h"
95
96
97 #include "p_mmi.h"
98 #include "message.h"
99 #include "prim.h"
100 #include "aci_cmh.h"
101 #include "mfw_mme.h"
102
103 #include "MmiMmi.h"
104
105 #include "Mmiicons.h"
106 #include "MmiPins.h"
107 #include "MmiMain.h"
108 #include "MmiDialogs.h"
109 #include "MmiIdle.h"
110 #include "MmiStart.h"
111 #include "mmiCall.h"
112 #include "MmiSimToolkit.h"
113 #include "gdi.h"
114 #include "audio.h"
115 #include "MmiLists.h"
116 #include "MmiSounds.h"
117 #include "MmiResources.h"
118 #include "MmiTimeDate.h"
119 #include "mmiSat_i.h"
120 /* SPR#1428 - SH - New Editor changes */
121 #ifdef NEW_EDITOR
122 #include "ATBCommon.h"
123 #include "ATBDisplay.h"
124 #include "ATBEditor.h"
125 #include "AUIEditor.h"
126 #else
127 #include "MmiEditor.h"
128 #endif /* NEW_EDITOR */
129 #include "MmiMenu.h" // SH - 20/11/01 - included to provide symbol SimMenuFunc
130 #include "mmiSmsRead.h" /*MC SPR 940/2*/
131
132 #include "cus_aci.h"
133 #include "prim.h"
134 #include "pcm.h"
135
136 #include "mmiSatClassE.h"
137 #include "mmiColours.h"
138
139 typedef struct
140 {
141 T_MMI_CONTROL mmi_control;
142 T_MFW_HND parent_win;
143 T_MFW_HND win;
144 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
145 char * alpha_id;
146 } T_sat_open_channel;
147
148
149 /* Local function prototypes */
150 static void sat_open_channel_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
151 static void sat_class_e_dialog_destroy(T_MFW_HND win);
152 static void sat_class_e_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
153
154 /*******************************************************************************
155
156 $Function: sat_class_e_create
157
158 $Description: Creation of an instance for the SAT Class E dialog.
159
160 $Returns: mfw window handler
161
162 $Arguments: parent_window - Parent window handler
163
164 *******************************************************************************/
165 T_MFW_HND sat_class_e_create (T_MFW_HND parent_window)
166 {
167 T_sat_open_channel * data = (T_sat_open_channel *)ALLOC_MEMORY (sizeof (T_sat_open_channel));
168 T_MFW_WIN * win;
169
170 TRACE_FUNCTION("sat_open_channel_create()");
171
172 if (data != NULL)
173 {
174 data->win = win_create (parent_window, 0, 0,NULL);
175 }
176 else
177 {
178 TRACE_ERROR("Error: Cannot allocate memory for data!");
179 }
180
181 if (data->win EQ NULL)
182 return NULL;
183
184 /*
185 * Create window handler
186 */
187 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_class_e_exec;
188 data->mmi_control.data = data;
189 data->parent_win = parent_window;
190 win = ((T_MFW_HDR *)data->win)->data;
191 win->user = (MfwUserDataPtr)data;
192
193 /*
194 * return window handle
195 */
196 winShow(data->win);
197 return data->win;
198 }
199
200 /*******************************************************************************
201
202 $Function: sat_open_channel_cb
203
204 $Description: Callback for accept/reject dialog.
205 $Returns: None.
206
207 $Arguments: win: current window
208 identifier: unique id
209 reason: event id
210
211 *******************************************************************************/
212 static void sat_open_channel_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
213 {
214 TRACE_FUNCTION("sat_open_channel_cb()");
215
216 if (win EQ NULL)
217 {
218 return;
219 }
220
221 switch (reason)
222 {
223 case INFO_KCD_LEFT: /* user has accepted Open Channel request */
224 satAccept();
225
226 /* Destroy the dialog */
227 sat_class_e_dialog_destroy(win);
228 break;
229 case INFO_KCD_RIGHT: /* user has rejected Open Channel request */
230 satReject();
231
232 /* Destroy the dialog */
233 sat_class_e_dialog_destroy(win);
234 break;
235 default:
236 break;
237 }
238 }
239
240 /*******************************************************************************
241
242 $Function: sat_class_e_dialog_destroy
243
244 $Description: Close the alert dialog
245
246 $Returns: None.
247
248 $Arguments: alert_dialog: window handle.
249
250 *******************************************************************************/
251 static void sat_class_e_dialog_destroy(T_MFW_HND win)
252 {
253
254 T_MFW_WIN * win_data;
255 T_sat_open_channel * data;
256
257 TRACE_FUNCTION ("sat_class_e_dialog_destroy()");
258
259 if (win == NULL)
260 {
261 TRACE_ERROR("ERROR: win is NULL!");
262 return;
263 }
264
265 win_data = ((T_MFW_HDR *)win)->data;
266
267 if (win_data == NULL)
268 {
269 TRACE_ERROR("ERROR: win_data is NULL!");
270 return;
271 }
272
273 data = (T_sat_open_channel *)win_data->user;
274
275 if (win != NULL)
276 {
277 if (data)
278 {
279 /*
280 * Delete WIN Handler
281 */
282 win_delete (data->win);
283 /*
284 * Free Memory
285 */
286 sat_destroy_TEXT_ASCIIZ (data->alpha_id);
287 FREE_MEMORY ((U8 *)data, sizeof (T_sat_open_channel));
288 }
289 }
290 }
291
292 /*******************************************************************************
293
294 $Function: sat_class_e_cb
295
296 $Description: Callback for Sat Class E dialogs.
297 $Returns: None.
298
299 $Arguments: win: current window
300 identifier: unique id
301 reason: event id
302
303 *******************************************************************************/
304 static void sat_class_e_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
305 {
306 TRACE_FUNCTION("sat_class_e_cb()");
307
308 if (win EQ NULL)
309 {
310 return;
311 }
312
313 switch (reason)
314 {
315 case INFO_KCD_LEFT:
316 case INFO_KCD_RIGHT:
317 case INFO_TIMEOUT:
318
319 /* Destroy the dialog */
320 sat_class_e_dialog_destroy(win);
321 break;
322 default:
323 break;
324 }
325 }
326
327 /*******************************************************************************
328
329 $Function: sat_class_e_exec
330
331 $Description: Dialog function for Sat Class E window.
332
333 $Returns: none
334
335 $Arguments: win - current window
336 event - window event
337 value - unique id
338 call_setup_parameter - call setup info
339
340 SPR#2321 - DS - Corrected misleading comments.
341
342 *******************************************************************************/
343 void sat_class_e_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
344 {
345
346 T_MFW_WIN * win_data;
347 T_sat_open_channel * data;
348 char* text_string;
349
350 T_DISPLAY_DATA display_info;
351
352 TRACE_FUNCTION ("sat_class_e_exec()");
353
354 if (win == NULL)
355 {
356 TRACE_ERROR("ERROR: win is NULL!");
357 return;
358 }
359
360 win_data = ((T_MFW_HDR *)win)->data;
361
362 if (win_data == NULL)
363 {
364 TRACE_ERROR("ERROR: win_data is NULL!");
365 return;
366 }
367
368 data = (T_sat_open_channel *)win_data->user;
369
370 if (data == NULL)
371 {
372 TRACE_ERROR("ERROR: data is NULL!");
373 return;
374 }
375
376 switch (event)
377 {
378 case SAT_OPEN_CHANNEL:
379
380 TRACE_EVENT("SAT_OPEN_CHANNEL");
381
382 /* Start an info screen to accept or reject the Open Channel request */
383 data->sat_command = sat_command;
384
385 /* Extract the data from the Open Channel sat command */
386 if (sat_command != NULL)
387 {
388
389 TRACE_EVENT_P2("dcs: %x, len: %d", sat_command->c.open.alpha_id.code, sat_command->c.open.alpha_id.len);
390
391 /* Alpha identifier */
392
393 /* Check alpha identifier has valid length */
394 if ( (sat_command->c.open.alpha_id.len > 0) &&
395 (sat_command->c.open.alpha_id.len != (U8)-1) )
396 {
397 /* Extract alpha_id data and create string */
398 data->alpha_id = sat_create_TEXT_ASCIIZ(&sat_command->c.open.alpha_id);
399 }
400 else
401 {
402 data->alpha_id = NULL;
403 }
404 }
405 else
406 {
407 TRACE_ERROR("ERROR: NULL sat_command!");
408 }
409
410 if (data->alpha_id)
411 {
412 text_string = data->alpha_id;
413 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialog displays them correctly*/
414 sat_add_unicode_tag_if_needed(text_string);
415 #endif
416 }
417 else
418 {
419 text_string = "Open Channel"; //Need to implement for Chinese
420 }
421
422
423 dlg_initDisplayData_TextStr( &display_info, TxtAccept, TxtReject, text_string, NULL, COLOUR_STATUS);
424 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)sat_open_channel_cb, FOREVER, KEY_LEFT|KEY_RIGHT );
425
426 display_info.Identifier = event;
427
428 /*
429 * Call Info Screen
430 */
431 info_dialog (win, &display_info);
432
433 break;
434
435 case SAT_CLOSE_CHANNEL:
436
437 TRACE_EVENT("SAT_CLOSE_CHANNEL");
438
439 /* Start an info screen to inform the user that the SIM is closing the open channel*/
440 data->sat_command = sat_command;
441
442 /* Extract the data from the Close Channel sat command */
443 if (sat_command != NULL)
444 {
445 TRACE_EVENT_P2("dcs: %x, len: %d", sat_command->c.close.alpha_id.code, sat_command->c.close.alpha_id.len);
446
447 /* Alpha identifier */
448
449 /* SPR#2321 - DS - Check alpha identifier has valid length */
450 if ( (sat_command->c.close.alpha_id.len > 0) &&
451 (sat_command->c.close.alpha_id.len != (U8)-1) )
452 {
453 /* Extract alpha_id data and create string */
454 data->alpha_id = sat_create_TEXT_ASCIIZ(&sat_command->c.close.alpha_id);
455 }
456 else
457 {
458 data->alpha_id = NULL;
459 }
460 }
461
462 if (data->alpha_id)
463 {
464 text_string = data->alpha_id;
465 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialog displays them correctly*/
466 sat_add_unicode_tag_if_needed(text_string);
467 #endif
468 }
469 else
470 {
471 text_string = "Closing Channel"; //Need to implement for Chinese
472 }
473
474
475 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, text_string, NULL, COLOUR_STATUS);
476 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)sat_class_e_cb, THREE_SECS, KEY_LEFT|KEY_RIGHT );
477
478 display_info.Identifier = event;
479
480 /*
481 * Call Info Screen
482 */
483 info_dialog (win, &display_info);
484
485 break;
486
487 case SAT_SEND_DATA:
488
489 TRACE_EVENT("SAT_SEND_DATA");
490
491 /* Start an info screen to inform the user that the SIM is sending data */
492 data->sat_command = sat_command;
493
494 /* Extract the data from the Send Data sat command */
495 if (sat_command != NULL)
496 {
497 TRACE_EVENT_P2("dcs: %x, len: %d", sat_command->c.send.alpha_id.code, sat_command->c.send.alpha_id.len);
498
499 /* Alpha identifier */
500
501 /* SPR#2321 - DS - Check alpha identifier has valid length */
502 if ( (sat_command->c.send.alpha_id.len > 0) &&
503 (sat_command->c.send.alpha_id.len != (U8)-1) )
504 {
505 /* Extract alpha_id data and create string */
506 data->alpha_id = sat_create_TEXT_ASCIIZ(&sat_command->c.send.alpha_id);
507 }
508 else
509 {
510 data->alpha_id = NULL;
511 }
512 }
513
514 if (data->alpha_id)
515 {
516 text_string = data->alpha_id;
517 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialog displays them correctly*/
518 sat_add_unicode_tag_if_needed(text_string);
519 #endif
520 }
521 else
522 {
523 text_string = "Sending Data"; //Need to implement for Chinese
524 }
525
526 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, text_string, NULL, COLOUR_STATUS);
527 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)sat_class_e_cb, THREE_SECS, KEY_LEFT|KEY_RIGHT );
528
529 display_info.Identifier = event;
530
531 /*
532 * Call Info Screen
533 */
534 info_dialog (win, &display_info);
535
536 break;
537
538 case SAT_RECEIVE_DATA:
539
540 TRACE_EVENT("SAT_RECEIVE_DATA");
541
542 /* Start an info screen to inform the user that the SIM is receiving data */
543 data->sat_command = sat_command;
544
545 /* Extract the data from the Receive Data sat command */
546 if (sat_command != NULL)
547 {
548 TRACE_EVENT_P2("dcs: %x, len: %d", sat_command->c.receive.alpha_id.code, sat_command->c.receive.alpha_id.len);
549
550 /* Alpha identifier */
551
552 /* SPR#2321 - DS - Check alpha identifier has valid length */
553 if ( (sat_command->c.receive.alpha_id.len > 0) &&
554 (sat_command->c.receive.alpha_id.len != (U8)-1) )
555 {
556 /* Extract alpha_id data and create string */
557 data->alpha_id = sat_create_TEXT_ASCIIZ(&sat_command->c.receive.alpha_id);
558 }
559 else
560 {
561 data->alpha_id = NULL;
562 }
563 }
564
565 if (data->alpha_id)
566 {
567 text_string = data->alpha_id;
568 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialog displays them correctly*/
569 sat_add_unicode_tag_if_needed(text_string);
570 #endif
571 }
572 else
573 {
574 text_string = "Receiving Data"; //Need to implement for Chinese
575 }
576
577 dlg_initDisplayData_TextStr( &display_info, TxtNull, TxtNull, text_string, NULL, COLOUR_STATUS);
578 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)sat_class_e_cb, THREE_SECS, KEY_LEFT|KEY_RIGHT );
579
580 display_info.Identifier = event;
581
582 /*
583 * Call Info Screen
584 */
585 info_dialog (win, &display_info);
586
587 break;
588
589 default:
590 TRACE_EVENT("sat_open_channel_exec() unexpected event");
591 return;
592 }
593
594 }
595
596 /* EOF - End Of File */