comparison src/ui3/bmi/mmiSatClassE.c @ 420:e8ddbb0837ed

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