FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiSatInput.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 | c0052fe355d3 |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
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 | |
14 $Module: SMS | |
15 $File: mmiSatInput.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 Implementation of MMI SIM Application Toolkit (SAT) | |
26 | |
27 ******************************************************************************** | |
28 | |
29 $History: mmiSatInput.c | |
30 | |
31 Oct 09, 2006 DR: OMAPS00092083 - x0047075 (Archana). | |
32 Description: CT-PTCRB[27.22.4.1.5]-MS Resets while Icon Display | |
33 Solution : If the sat icon is present which is self explanatory then editor buffer is intialized to blank. | |
34 | |
35 Feb 02, 2006 DR: OMAPS00061468 - x0035544. | |
36 Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails | |
37 Solution : SAT SET UP IDLE MODE TEXT (Icon) support added. | |
38 | |
39 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S. | |
40 Description: SAT Icon support | |
41 Solution : SAT icon support added. | |
42 | |
43 Nov 09, 2005 REF: OMAPS00043190 - x0018858 | |
44 Description: PTCRB - 27.22.4.1.4 (DISPLAY TEXT (Sustained text) Fails in 1900 DISPLAY TEXT | |
45 (Sustained text) | |
46 Solution: Have added a new global variable to store the handle of the window and then release | |
47 it when a higher priority call event comes in. | |
48 | |
49 a0876501 (Shashi Shekar B.S.) 03-Oct-2005 MMI-SPR-34554: | |
50 Terminal Response for Get Inkey (Yes/No) response correctly sent now. | |
51 | |
52 25/10/00 Original Condat(UK) BMI version. | |
53 21/02/03 removed all calls to function sat_add_unicode_tag_if_needed() | |
54 $End | |
55 | |
56 *******************************************************************************/ | |
57 | |
58 #define ENTITY_MFW | |
59 | |
60 /* includes */ | |
61 #include <string.h> | |
62 #include <stdio.h> | |
63 #include <stdlib.h> | |
64 | |
65 #if defined (NEW_FRAME) | |
66 | |
67 #include "typedefs.h" | |
68 #include "vsi.h" | |
69 #include "pei.h" | |
70 #include "custom.h" | |
71 #include "gsm.h" | |
72 | |
73 #else | |
74 | |
75 #include "STDDEFS.H" | |
76 #include "custom.h" | |
77 #include "gsm.h" | |
78 #include "vsi.h" | |
79 | |
80 #endif | |
81 #include "mfw_sys.h" | |
82 | |
83 #include "mfw_mfw.h" | |
84 #include "mfw_win.h" | |
85 #include "mfw_kbd.h" | |
86 /* SPR#1428 - SH - New Editor changes */ | |
87 #ifndef NEW_EDITOR | |
88 #include "mfw_edt.h" | |
89 #endif | |
90 #include "mfw_lng.h" | |
91 #include "mfw_icn.h" | |
92 #include "mfw_phb.h" | |
93 #include "mfw_sim.h" | |
94 #include "mfw_nm.h" | |
95 #include "mfw_sms.h" | |
96 #include "mfw_mnu.h" | |
97 #include "mfw_sat.h" | |
98 #include "mfw_tim.h" | |
99 #include "mfw_ss.h" | |
100 #include "mfw_str.h" | |
101 | |
102 #include "dspl.h" | |
103 | |
104 #include "MmiMmi.h" | |
105 #include "MmiDummy.h" | |
106 #include "MmiDialogs.h" | |
107 #include "MmiLists.h" | |
108 | |
109 #include "MmiMain.h" | |
110 #include "MmiStart.h" | |
111 #include "MmiPins.h" | |
112 #include "MmiMenu.h" | |
113 #include "MmiSoftKeys.h" | |
114 #include "MmiSounds.h" | |
115 #include "mmiCall.h" | |
116 | |
117 #include "mmiSat_i.h" | |
118 /* SPR#1428 - SH - New Editor changes */ | |
119 #ifdef NEW_EDITOR | |
120 #include "ATBCommon.h" | |
121 #include "ATBDisplay.h" | |
122 #include "ATBEditor.h" | |
123 #include "AUIEditor.h" | |
124 #include "mmiColours.h" | |
125 #else | |
126 #include "MmiEditor.h" | |
127 #endif | |
128 #include "psa_util.h" | |
129 | |
130 #include "cus_aci.h" | |
131 #include "prim.h" | |
132 #ifndef PCM_2_FFS | |
133 #include "pcm.h" | |
134 #endif | |
135 | |
136 /* SPR#1428 - SH - New Editor changes */ | |
137 #ifdef NEW_EDITOR | |
138 static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT event); | |
139 #else /* NEW_EDITOR */ | |
140 static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event); | |
141 #endif /* NEW_EDITOR */ | |
142 | |
143 #ifdef EASY_TEXT_ENABLED | |
144 #include "MmiChineseInput.h" /* SPR#1700 - DS - Added to implement Chinese Editor support in SAT */ | |
145 #endif | |
146 | |
147 #define TRACE_SAT_STRING /* SPR#1700 - DS - Debug flag for tracing SAT String */ | |
148 | |
149 /********************************************************************* | |
150 * | |
151 * SUB WINDOW SAT_GET_KEY | |
152 * | |
153 *********************************************************************/ | |
154 #define SAT_GET_KEY_BUFFER_SIZE (UBYTE)(1+2) /* two spares for mfwEdt */ | |
155 | |
156 typedef struct | |
157 { | |
158 T_MMI_CONTROL mmi_control; | |
159 T_MFW_HND win; | |
160 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | |
161 #ifdef NEW_EDITOR | |
162 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
163 #else | |
164 T_EDITOR_DATA editor_data; | |
165 #endif | |
166 char *edt_buffer; /* buffer for editor */ | |
167 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | |
168 T_MFW_HND win_editor; /* SPR#2490 - DS - Store editor window */ | |
169 } T_sat_get_key; | |
170 | |
171 #if (BOARD==61) | |
172 // ADDED BY RAVI - 29-11-2005 - OMAPS00042166 | |
173 extern void sat_add_unicode_tag_if_needed(char* string); | |
174 //END RAVI - 29-11-2005 | |
175 #endif | |
176 | |
177 static void sat_get_key_destroy (T_MFW_HND own_window); | |
178 static void sat_get_key_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command); | |
179 | |
180 /******************************************************************************* | |
181 | |
182 $Function: sat_get_key_create | |
183 | |
184 $Description: Creation of an instance for the SAT GET KEY dialog.Window must | |
185 be available after reception of SAT command,only one instance. | |
186 | |
187 | |
188 $Returns: mfw window handler | |
189 | |
190 $Arguments: parent_window - Parent window handler | |
191 | |
192 *******************************************************************************/ | |
193 | |
194 T_MFW_HND sat_get_key_create (T_MFW_HND parent_window) | |
195 { | |
196 T_sat_get_key * data = (T_sat_get_key *)ALLOC_MEMORY (sizeof (T_sat_get_key)); | |
197 T_MFW_WIN * win; | |
198 | |
199 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); // c030 rsa | |
200 | |
201 if (data->win EQ NULL) | |
202 return NULL; | |
203 | |
204 /* | |
205 * Create window handler | |
206 */ | |
207 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_get_key_exec; | |
208 data->mmi_control.data = data; | |
209 win = ((T_MFW_HDR *)data->win)->data; | |
210 win->user = (MfwUserDataPtr)data; | |
211 | |
212 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */ | |
213 | |
214 /* | |
215 * return window handle | |
216 */ | |
217 win_show(data->win); | |
218 return data->win; | |
219 } | |
220 | |
221 /******************************************************************************* | |
222 | |
223 $Function: sat_get_key_destroy | |
224 | |
225 $Description: Destroy the sat get inkey dialog. | |
226 | |
227 | |
228 $Returns: none | |
229 | |
230 $Arguments: own_window - window handler | |
231 | |
232 *******************************************************************************/ | |
233 | |
234 static void sat_get_key_destroy (T_MFW_HND own_window) | |
235 { | |
236 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; | |
237 T_sat_get_key * data = (T_sat_get_key *)win_data->user; | |
238 | |
239 if (own_window == NULL) | |
240 { | |
241 TRACE_EVENT ("Error : sat_get_key_destroy called with NULL Pointer"); | |
242 return; | |
243 } | |
244 | |
245 if (data) | |
246 { | |
247 /* | |
248 * Delete WIN Handler | |
249 */ | |
250 win_delete (data->win); | |
251 /* | |
252 * Free Memory | |
253 */ | |
254 FREE_MEMORY ((U8 *)data->edt_buffer, | |
255 SAT_GET_KEY_BUFFER_SIZE * sizeof(char)); | |
256 | |
257 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
258 #ifdef FF_MMI_SAT_ICON | |
259 if (data->editor_data.editor_attr.TitleIcon.data != NULL) | |
260 { | |
261 FREE_MEMORY((U8 *)data->editor_data.editor_attr.TitleIcon.data, data->editor_data.editor_attr.TitleIcon.width * | |
262 data->editor_data.editor_attr.TitleIcon.height); | |
263 data->editor_data.editor_attr.TitleIcon.data = NULL; | |
264 } | |
265 #endif | |
266 /* SPR#1428 - SH - New Editor changes */ | |
267 #ifdef NEW_EDITOR | |
268 sat_destroy_TEXT_ASCIIZ ((char *)data->editor_data.TitleString); /* label */ | |
269 | |
270 if (data->win_editor) | |
271 { | |
272 AUI_edit_Destroy(data->win_editor); /* SPR#2490 - DS - Destroy editor */ | |
273 data->win_editor = NULL; | |
274 } | |
275 #else /* NEW_EDITOR */ | |
276 sat_destroy_TEXT_ASCIIZ (data->editor_data.TextString); /* label */ | |
277 #endif /* NEW_EDITOR */ | |
278 FREE_MEMORY ((U8 *)data, sizeof (T_sat_get_key)); | |
279 } | |
280 } | |
281 | |
282 /******************************************************************************* | |
283 | |
284 $Function: sat_get_key_exec | |
285 | |
286 $Description: Dialog function for sat_get_key_exec window. | |
287 | |
288 | |
289 $Returns: none | |
290 | |
291 $Arguments: win - window handler | |
292 event -window event | |
293 value - unique id | |
294 sat_command - Sat command info | |
295 | |
296 *******************************************************************************/ | |
297 | |
298 static void sat_get_key_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | |
299 { | |
300 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
301 T_sat_get_key * data = (T_sat_get_key *)win_data->user; | |
302 | |
303 T_SAT_TXT * txt; | |
304 T_SAT_RES sat_res; | |
305 | |
306 /* SPR#1428 - SH - New Editor: we'll put data in these, for efficiency */ | |
307 #ifdef NEW_EDITOR | |
308 USHORT leftSK, rightSK, mode, cursor; | |
309 UBYTE *textStr; | |
310 #endif | |
311 | |
312 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
313 #ifdef FF_MMI_SAT_ICON | |
314 USHORT icon_length; | |
315 #endif | |
316 | |
317 TRACE_FUNCTION ("sat_get_key_exec()"); | |
318 | |
319 switch (event) | |
320 { | |
321 case SAT_GET_KEY: | |
322 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ | |
323 txt = (T_SAT_TXT *)&sat_command->c.text; | |
324 | |
325 /* allocate a buffer to hold the edited chars */ | |
326 data->edt_buffer = (char *)ALLOC_MEMORY ( | |
327 SAT_GET_KEY_BUFFER_SIZE * sizeof(char)); | |
328 | |
329 /* SPR#1428 - SH - New Editor changes */ | |
330 #ifdef NEW_EDITOR | |
331 /* | |
332 * Setup an Editor to get a single key | |
333 */ | |
334 | |
335 AUI_edit_SetDefault(&data->editor_data); | |
336 AUI_edit_SetDisplay(&data->editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); | |
337 | |
338 /* SPR#2490 - DS - Initialise editor window reference */ | |
339 data->win_editor = NULL; | |
340 | |
341 if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0) | |
342 { | |
343 leftSK = TxtHelp; /* help available */ | |
344 } | |
345 else | |
346 { | |
347 leftSK = TxtNull; /* no help available */ | |
348 } | |
349 if ((sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0) | |
350 { | |
351 /* yes/no decision */ | |
352 leftSK = TxtYes; | |
353 rightSK = TxtNo; | |
354 mode = ED_MODE_READONLY; /* treat as read-only, thus ignoring normal keys */ | |
355 cursor = ED_CURSOR_NONE; | |
356 } | |
357 else | |
358 { | |
359 /* normal single key request */ | |
360 leftSK = TxtSoftOK; | |
361 rightSK = TxtSoftBack; | |
362 if ((sat_command->qual & SAT_M_INKEY_ALPHA) EQ 0) /* 0=digits, 1=alpha */ | |
363 { | |
364 mode = 0; /* Digits mode */ | |
365 cursor = ED_CURSOR_UNDERLINE; | |
366 } | |
367 else | |
368 { | |
369 mode = ED_MODE_ALPHA; /* Alphanumeric mode */ | |
370 cursor = ED_CURSOR_BAR; | |
371 } | |
372 } | |
373 | |
374 if (txt->len > 0) | |
375 { | |
376 textStr = (UBYTE *)sat_create_TEXT_ASCIIZ (txt); /* label */ | |
377 | |
378 } | |
379 else | |
380 { | |
381 textStr = NULL; /* no label */ | |
382 } | |
383 | |
384 AUI_edit_SetTextStr(&data->editor_data, leftSK, rightSK, TxtNull, textStr); | |
385 | |
386 AUI_edit_SetEvents(&data->editor_data, event, FALSE /*SPR#2490 - DS*/, TWENTY_SECS, (T_AUI_EDIT_CB)sat_editor_cb); | |
387 AUI_edit_SetMode(&data->editor_data, mode, cursor); | |
388 | |
389 if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0) | |
390 { | |
391 AUI_edit_SetAltTextStr(&data->editor_data, 1, TxtHelp, FALSE, TxtNull); /* help available */ | |
392 } | |
393 | |
394 /* provide an empty zero terminated buffer */ | |
395 data->edt_buffer[0] = '\0'; | |
396 | |
397 /* SPR#1559 - SH - Set appropriate editor size */ | |
398 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->edt_buffer, strlen(data->edt_buffer)+1+1 /* SPR#2321 - DS - Display key */); | |
399 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
400 #ifdef FF_MMI_SAT_ICON | |
401 /*Check if the SAT command has icon*/ | |
402 if(sat_command->c.text.icon.qual != 0xFF) | |
403 { | |
404 /* Copy the icon data to the editor attributes*/ | |
405 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.text.iconInfo.width; | |
406 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.text.iconInfo.height; | |
407 | |
408 icon_length = sat_command->c.text.iconInfo.width * sat_command->c.text.iconInfo.height; | |
409 | |
410 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length); | |
411 | |
412 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.text.iconInfo.dst, icon_length); | |
413 data->editor_data.editor_attr.TitleIcon.isTitle = TRUE; | |
414 | |
415 /* Icon is self-explanatory. No need to display text for this case.*/ | |
416 if(sat_command->c.text.icon.qual == 0x00) | |
417 { | |
418 /* Icon is self-explanatory. Do not display the text*/ | |
419 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE; | |
420 } | |
421 | |
422 /* Free the memory of icon data that we got through the SATK command*/ | |
423 mfwFree((U8 *)sat_command->c.text.iconInfo.dst, icon_length); | |
424 sat_command->c.text.iconInfo.dst = NULL; | |
425 } | |
426 #endif | |
427 | |
428 /* | |
429 * Start the Editor | |
430 */ | |
431 /* SPR#2490 - DS - Store editor window reference */ | |
432 data->win_editor = AUI_edit_Start(win, &data->editor_data); | |
433 if (data->win_editor == NULL) | |
434 { | |
435 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
436 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
437 sat_done (sat_command, sat_res); | |
438 sat_get_key_destroy (data->win); | |
439 } | |
440 #else /* NEW_EDITOR */ | |
441 /* | |
442 * Setup an Editor to get a single key | |
443 */ | |
444 if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0) | |
445 { | |
446 data->editor_data.AlternateLeftSoftKey = TxtHelp; /* help available */ | |
447 } | |
448 else | |
449 { | |
450 data->editor_data.AlternateLeftSoftKey = TxtNull; /* no help available */ | |
451 } | |
452 if ((sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0) | |
453 { | |
454 /* yes/no decision */ | |
455 data->editor_data.LeftSoftKey = TxtYes; | |
456 data->editor_data.RightSoftKey = TxtNo; | |
457 data->editor_data.mode = E_EDIT_READ_ONLY_MODE; /* treat as read-only, thus ignoring normal keys */ | |
458 } | |
459 else | |
460 { | |
461 /* normal single key request */ | |
462 data->editor_data.LeftSoftKey = TxtSoftOK; | |
463 data->editor_data.RightSoftKey = TxtSoftBack; | |
464 if ((sat_command->qual & SAT_M_INKEY_ALPHA) EQ 0) /* 0=digits, 1=alpha */ | |
465 { | |
466 data->editor_data.mode = E_EDIT_DIGITS_MODE; | |
467 } | |
468 else | |
469 { | |
470 data->editor_data.mode = E_EDIT_ALPHA_MODE; | |
471 } | |
472 } | |
473 data->editor_data.TextId = TxtNull; | |
474 if (txt->len > 0) | |
475 { | |
476 data->editor_data.TextString = sat_create_TEXT_ASCIIZ (txt); /* label */ | |
477 | |
478 } | |
479 else | |
480 { | |
481 data->editor_data.TextString = NULL; /* no label */ | |
482 } | |
483 data->editor_data.min_enter = 0; /* get a single key */ | |
484 data->editor_data.timeout = TWENTY_SECS; | |
485 data->editor_data.Identifier = event; | |
486 if ((sat_command->qual & SAT_M_INKEY_HELP_AVAIL) NEQ 0) | |
487 { | |
488 data->editor_data.AlternateLeftSoftKey = TxtHelp; /* help available */ | |
489 } | |
490 else | |
491 { | |
492 data->editor_data.AlternateLeftSoftKey = 0; /* no help available */ | |
493 } | |
494 data->editor_data.hide = FALSE; | |
495 | |
496 | |
497 /* provide an empty zero terminated buffer */ | |
498 data->edt_buffer[0] = '\0'; | |
499 | |
500 /* | |
501 * Start the Editor | |
502 */ | |
503 if (editor_start_common (win, data->edt_buffer, 3, &data->editor_data, (T_EDIT_CB)sat_editor_cb) == NULL) | |
504 { | |
505 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
506 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
507 sat_done (sat_command, sat_res); | |
508 sat_get_key_destroy (data->win); | |
509 } | |
510 #endif /* NEW_EDITOR */ | |
511 break; | |
512 | |
513 /* sbh - all window types are being provided with this event to destroy the window */ | |
514 case SAT_DESTROY_WINDOW: | |
515 sat_get_key_destroy (data->win); | |
516 break; | |
517 /* ...sbh */ | |
518 | |
519 default: | |
520 TRACE_EVENT ("sim_get_key_exec() unexpected event"); | |
521 break; | |
522 } | |
523 } | |
524 | |
525 /********************************************************************* | |
526 * | |
527 * SUB WINDOW SAT_GET_STRING | |
528 * | |
529 *********************************************************************/ | |
530 #define SAT_GET_STRING_BUFFER_SIZE (UBYTE)255 | |
531 typedef struct | |
532 { | |
533 T_MMI_CONTROL mmi_control; | |
534 T_MFW_HND win; | |
535 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | |
536 #ifdef NEW_EDITOR | |
537 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
538 #else | |
539 T_EDITOR_DATA editor_data; | |
540 #endif | |
541 char *edt_buffer; /* buffer for editor */ | |
542 U16 max_chars; | |
543 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | |
544 T_MFW_HND chinese_edit_win; /* SPR#1700 - DS - Chinese editor window reference */ | |
545 T_MFW_HND win_editor; /* SPR#2490 - DS - Store editor window */ | |
546 | |
547 } T_sat_get_string; | |
548 | |
549 typedef struct { | |
550 T_SAT_TXT txt; | |
551 UBYTE buffer[1]; /* open array */ | |
552 } T_sat_get_string_result; /* NOTE: txt and buffer shall be packed */ | |
553 | |
554 static void sat_get_string_destroy (T_MFW_HND own_window); | |
555 static void sat_get_string_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command); | |
556 | |
557 | |
558 | |
559 /******************************************************************************* | |
560 | |
561 $Function: sat_get_string_create | |
562 | |
563 $Description: Creation of an instance for the SAT GET STRING dialog.Window must | |
564 be available after reception of SAT command,only one instance. | |
565 | |
566 | |
567 $Returns: window | |
568 | |
569 $Arguments: parent_window - parent window | |
570 *******************************************************************************/ | |
571 T_MFW_HND sat_get_string_create (T_MFW_HND parent_window) | |
572 { | |
573 T_sat_get_string * data = (T_sat_get_string *)ALLOC_MEMORY (sizeof (T_sat_get_string)); | |
574 T_MFW_WIN * win; | |
575 | |
576 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); // c030 rsa | |
577 | |
578 if (data->win EQ NULL) | |
579 return NULL; | |
580 | |
581 /* | |
582 * Create window handler | |
583 */ | |
584 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_get_string_exec; | |
585 data->mmi_control.data = data; | |
586 win = ((T_MFW_HDR *)data->win)->data; | |
587 win->user = (MfwUserDataPtr)data; | |
588 | |
589 | |
590 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */ | |
591 | |
592 /* | |
593 * return window handle | |
594 */ | |
595 win_show(data->win); | |
596 return data->win; | |
597 } | |
598 | |
599 /******************************************************************************* | |
600 | |
601 $Function: sat_get_string_destroy | |
602 | |
603 $Description: Destroy the sat get string dialog. | |
604 | |
605 | |
606 $Returns: none | |
607 | |
608 $Arguments: own_window - current window. | |
609 *******************************************************************************/ | |
610 static void sat_get_string_destroy (T_MFW_HND own_window) | |
611 { | |
612 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; | |
613 T_sat_get_string * data = (T_sat_get_string *)win_data->user; | |
614 | |
615 if (own_window == NULL) | |
616 { | |
617 TRACE_EVENT ("Error : sat_get_string_destroy called with NULL Pointer"); | |
618 return; | |
619 } | |
620 | |
621 TRACE_FUNCTION("sat_get_string_destroy()"); | |
622 | |
623 if (data) | |
624 { | |
625 /* | |
626 * Delete WIN Handler | |
627 */ | |
628 win_delete (data->win); | |
629 | |
630 /* | |
631 * Free Memory | |
632 */ | |
633 if (((data->sat_command->qual & SAT_M_INPUT_ALPHA) == 1) /* 0=digits, 1=alpha */ | |
634 && (data->sat_command->qual & SAT_M_INPUT_UCS2) /* Unicode input requested */ | |
635 && (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)) | |
636 { | |
637 FREE_MEMORY ((U8 *)data->edt_buffer, | |
638 (U16)sizeof(U16) + (data->max_chars * sizeof(U16))); | |
639 | |
640 /* SPR#1700 - DS - Destroy Chinese editor */ | |
641 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
642 if (data->chinese_edit_win) | |
643 { | |
644 chinese_input_destroy(data->chinese_edit_win); | |
645 data->chinese_edit_win = NULL; | |
646 } | |
647 #endif /* CHINESE_MMI && EASY_TEXT_ENABLED */ | |
648 } | |
649 else /* Ascii */ | |
650 { | |
651 FREE_MEMORY ((U8 *)data->edt_buffer, | |
652 data->max_chars * sizeof(char)); | |
653 } | |
654 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
655 #ifdef FF_MMI_SAT_ICON | |
656 if (data->editor_data.editor_attr.TitleIcon.data != NULL) | |
657 { | |
658 FREE_MEMORY((U8 *)data->editor_data.editor_attr.TitleIcon.data, data->editor_data.editor_attr.TitleIcon.width * | |
659 data->editor_data.editor_attr.TitleIcon.height); | |
660 data->editor_data.editor_attr.TitleIcon.data = NULL; | |
661 } | |
662 #endif | |
663 /* SPR#1428 - SH - New Editor changes */ | |
664 #ifdef NEW_EDITOR | |
665 sat_destroy_TEXT_ASCIIZ ((char *)data->editor_data.TitleString); /* label */ | |
666 if (data->win_editor) | |
667 { | |
668 AUI_edit_Destroy(data->win_editor); /* SPR#2490 - DS - Destroy editor */ | |
669 data->win_editor = NULL; | |
670 } | |
671 #else /* NEW_EDITOR */ | |
672 sat_destroy_TEXT_ASCIIZ (data->editor_data.TextString); /* label */ | |
673 #endif /* NEW_EDITOR */ | |
674 | |
675 FREE_MEMORY ((U8 *)data, sizeof (T_sat_get_string)); | |
676 } | |
677 } | |
678 | |
679 | |
680 /******************************************************************************* | |
681 | |
682 $Function: sat_get_string_exec | |
683 | |
684 $Description: Dialog function for sat_get_string window. | |
685 | |
686 | |
687 $Returns: none | |
688 | |
689 $Arguments: win - window handle | |
690 event - window event | |
691 value - unique id | |
692 sat_command - Sat Command info. | |
693 *******************************************************************************/ | |
694 static void sat_get_string_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | |
695 { | |
696 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
697 T_sat_get_string * data = (T_sat_get_string *)win_data->user; | |
698 T_SAT_INPUT * inp; | |
699 T_SAT_TXT * defRsp; | |
700 T_SAT_RES sat_res; | |
701 UBYTE firstDefRespChar; /* SPR#2321 - DS - First character in default response */ | |
702 /* SPR#1428 - SH - New Editor: store data in these, for efficiency */ | |
703 #ifdef NEW_EDITOR | |
704 USHORT mode; | |
705 UBYTE *textStr; | |
706 #endif | |
707 | |
708 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
709 #ifdef FF_MMI_SAT_ICON | |
710 USHORT icon_length; | |
711 #endif | |
712 | |
713 TRACE_FUNCTION ("sat_get_string_exec()"); | |
714 | |
715 switch (event) | |
716 { | |
717 case SAT_GET_STRING: | |
718 | |
719 /* SPR#1700 - DS - Modifed to handle Chinese/Unicode | |
720 */ | |
721 | |
722 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */ | |
723 inp = (T_SAT_INPUT *)&sat_command->c.inp; | |
724 | |
725 /* SPR#2321 - DS - Max buffer size of 160 chars for SAT STRING (Get Input) */ | |
726 if ((U16)inp->rspMax > 160) | |
727 { | |
728 TRACE_EVENT("SAT supplied max is bigger than supported string size. Set to supported max 160"); | |
729 data->max_chars = (U16)160+1; | |
730 } | |
731 else | |
732 { | |
733 data->max_chars = (U16)(inp->rspMax)+1; | |
734 } | |
735 | |
736 /* allocate a buffer to hold the edited chars + terminator */ | |
737 if (((data->sat_command->qual & SAT_M_INPUT_ALPHA) == 1) /* 0=digits, 1=alpha */ | |
738 && (data->sat_command->qual & SAT_M_INPUT_UCS2) /* Unicode input requested */ | |
739 && (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)) | |
740 { | |
741 /* Include slot for unicode tag */ | |
742 data->edt_buffer = (char *)ALLOC_MEMORY ((U16)sizeof(U16) + (data->max_chars * sizeof(U16))); | |
743 } | |
744 else /* Ascii */ | |
745 { | |
746 data->edt_buffer = (char *)ALLOC_MEMORY (data->max_chars * sizeof(char)); | |
747 } | |
748 | |
749 #ifdef TRACE_SAT_STRING | |
750 TRACE_EVENT_P3("rspMax %d, max_chars %d, defRsp.code %02x", inp->rspMax, data->max_chars, inp->defRsp.code); | |
751 #endif /* TRACE_SAT_STRING */ | |
752 | |
753 /*MC, SPR940/2 if we are a expecting unicode response. This, of course assumes we're getting the correct DCS*/ | |
754 if (inp->defRsp.code == MFW_DCS_UCS2) | |
755 { /*we have to put a unicode tag in so the editor knows to use Unicode*/ | |
756 data->edt_buffer[0]= (char)0x80; /* x0039928 - Lint warning fix */ | |
757 data->edt_buffer[1]= (char)0x7F; | |
758 } | |
759 | |
760 /* SPR#2321 - DS - Default response set up */ | |
761 defRsp = &inp->defRsp; | |
762 firstDefRespChar = *((UBYTE*)defRsp+defRsp->text); | |
763 | |
764 #ifdef TRACE_SAT_STRING | |
765 TRACE_EVENT_P2("prompt.len %d, defRsp->len %d", inp->prompt.len, defRsp->len); | |
766 #endif /* TRACE_SAT_STRING */ | |
767 | |
768 if (defRsp->len > 0) /* default response available? */ | |
769 { | |
770 if (firstDefRespChar != 0x00) | |
771 { | |
772 /* provide a zero terminated buffer, initially containing the default response */ | |
773 sat_TEXT_to_ASCIIZ (data->edt_buffer, defRsp); | |
774 } | |
775 else | |
776 { | |
777 /* NULL default response: provide an empty buffer */ | |
778 data->edt_buffer[0] = '\0'; | |
779 } | |
780 } | |
781 else | |
782 { | |
783 /* no default response: provide an empty buffer */ | |
784 data->edt_buffer[0] = '\0'; | |
785 } | |
786 | |
787 /* SPR#1428 - SH - New Editor changes */ | |
788 #ifdef NEW_EDITOR | |
789 | |
790 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
791 /* If chinese is selected use the chinese editor */ | |
792 if (((data->sat_command->qual & SAT_M_INPUT_ALPHA) == 1) /* 0=digits, 1=alpha */ | |
793 && (data->sat_command->qual & SAT_M_INPUT_UCS2) /* Unicode input requested */ | |
794 && (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
795 && (data->edt_buffer[0]==0x00 || data->edt_buffer[0] == (char)0x80)) | |
796 { | |
797 T_CHINESE_DATA chinese_data; | |
798 | |
799 /* Initialise the Chinese editor window reference */ | |
800 data->chinese_edit_win = NULL; | |
801 | |
802 TRACE_EVENT("Setup Chinese SAT String editor"); | |
803 | |
804 chinese_data.TextString = (char*) data->edt_buffer; | |
805 | |
806 if (inp->prompt.len > 0) | |
807 { | |
808 textStr = (UBYTE *)sat_create_TEXT_ASCIIZ (&inp->prompt); /* label */ | |
809 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialogue displays them correctly*/ | |
810 sat_add_unicode_tag_if_needed(textStr); | |
811 #endif | |
812 } | |
813 else | |
814 { | |
815 textStr = NULL; /* no label */ | |
816 } | |
817 | |
818 /* Setup Chinese editor data */ | |
819 chinese_data.Callback = (T_AUI_EDIT_CB)sat_editor_cb; | |
820 chinese_data.Identifier = event; | |
821 chinese_data.LeftSoftKey = TxtSoftOK; | |
822 chinese_data.DestroyEditor = FALSE; | |
823 chinese_data.EditorSize = data->max_chars-1; | |
824 data->chinese_edit_win = chinese_input(win, &chinese_data); | |
825 } | |
826 else | |
827 #endif /* CHINESE_MMI && EASY_TEXT_ENABLED */ | |
828 { | |
829 /* | |
830 * Setup an Editor to get a string | |
831 */ | |
832 AUI_edit_SetDefault(&data->editor_data); | |
833 AUI_edit_SetDisplay(&data->editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT); | |
834 | |
835 /* SPR#2490 - DS - Initialise editor window reference */ | |
836 data->win_editor = NULL; | |
837 | |
838 if ((sat_command->qual & SAT_M_INPUT_HELP_AVAIL) NEQ 0) | |
839 { | |
840 AUI_edit_SetAltTextStr(&data->editor_data, inp->rspMin, TxtHelp, FALSE, TxtNull); /* help available */ | |
841 } | |
842 else | |
843 { | |
844 AUI_edit_SetAltTextStr(&data->editor_data, inp->rspMin, TxtNull, FALSE, TxtNull); /* help available */ | |
845 } | |
846 | |
847 mode = 0; | |
848 if ((sat_command->qual & SAT_M_INPUT_NOECHO) NEQ 0) | |
849 { | |
850 mode |= ED_MODE_HIDDEN; | |
851 } | |
852 | |
853 if ((sat_command->qual & SAT_M_INPUT_ALPHA) EQ 0) /* 0=digits, 1=alpha */ | |
854 { | |
855 /* Don't need to alter mode */ | |
856 } | |
857 else | |
858 { | |
859 mode |= ED_MODE_ALPHA; | |
860 } | |
861 | |
862 if (inp->prompt.len > 0) | |
863 { | |
864 textStr = (UBYTE *)sat_create_TEXT_ASCIIZ (&inp->prompt); /* label */ | |
865 #ifdef NO_ASCIIZ/*MC SPR 940/2 Add tag to Unicode strings so info dialogue displays them correctly*/ | |
866 sat_add_unicode_tag_if_needed(textStr); | |
867 #endif | |
868 } | |
869 else | |
870 { | |
871 textStr = NULL; /* no label */ | |
872 } | |
873 | |
874 AUI_edit_SetMode(&data->editor_data,mode,ED_CURSOR_UNDERLINE); | |
875 AUI_edit_SetTextStr(&data->editor_data, TxtSoftOK, TxtSoftBack, TxtNull, textStr); | |
876 AUI_edit_SetEvents(&data->editor_data, event, FALSE /*SPR#2490 - DS*/, TWENTY_SECS, (T_AUI_EDIT_CB)sat_editor_cb); | |
877 | |
878 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->edt_buffer, data->max_chars); | |
879 | |
880 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
881 #ifdef FF_MMI_SAT_ICON | |
882 /*Check if the SAT command has icon*/ | |
883 if(sat_command->c.inp.prompt.icon.qual != 0xFF) | |
884 { | |
885 /* Copy the icon data to the editor attributes*/ | |
886 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.inp.prompt.iconInfo.width; | |
887 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.inp.prompt.iconInfo.height; | |
888 | |
889 icon_length = sat_command->c.inp.prompt.iconInfo.width * sat_command->c.inp.prompt.iconInfo.height; | |
890 | |
891 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length); | |
892 | |
893 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.inp.prompt.iconInfo.dst, icon_length); | |
894 data->editor_data.editor_attr.TitleIcon.isTitle = TRUE; | |
895 | |
896 /* Icon is self-explanatory. No need to display text for this case.*/ | |
897 if(sat_command->c.inp.prompt.icon.qual == 0x00) | |
898 { | |
899 /* Icon is self-explanatory. Do not display the text*/ | |
900 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE; | |
901 } | |
902 /* Free the memory of icon data that we got through the SATK command*/ | |
903 mfwFree((U8 *)sat_command->c.inp.prompt.iconInfo.dst, icon_length); | |
904 sat_command->c.inp.prompt.iconInfo.dst = NULL; | |
905 } | |
906 #endif | |
907 | |
908 /* | |
909 * Start the Editor | |
910 */ | |
911 /* SPR#2490 - DS - Store editor window reference */ | |
912 data->win_editor = AUI_edit_Start(win, &data->editor_data); | |
913 if (data->win_editor == NULL) | |
914 { | |
915 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
916 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
917 sat_done (sat_command, sat_res); | |
918 sat_get_string_destroy (data->win); | |
919 } | |
920 } | |
921 #else /* NEW_EDITOR */ | |
922 /* | |
923 * Setup an Editor to get a string | |
924 */ | |
925 data->editor_data.LeftSoftKey = TxtSoftOK; | |
926 if ((sat_command->qual & SAT_M_INPUT_HELP_AVAIL) NEQ 0) | |
927 { | |
928 data->editor_data.AlternateLeftSoftKey = TxtHelp; /* help available */ | |
929 } | |
930 else | |
931 { | |
932 data->editor_data.AlternateLeftSoftKey = TxtNull; /* no help available */ | |
933 } | |
934 data->editor_data.RightSoftKey = TxtSoftBack; | |
935 data->editor_data.hide = ((sat_command->qual & SAT_M_INPUT_NOECHO) NEQ 0); | |
936 if ((sat_command->qual & SAT_M_INPUT_ALPHA) EQ 0) /* 0=digits, 1=alpha */ | |
937 { | |
938 data->editor_data.mode = E_EDIT_DIGITS_MODE; | |
939 } | |
940 else | |
941 { | |
942 data->editor_data.mode = E_EDIT_ALPHA_MODE; | |
943 } | |
944 data->editor_data.TextId = TxtNull; | |
945 if (inp->prompt.len > 0) | |
946 { | |
947 data->editor_data.TextString = sat_create_TEXT_ASCIIZ (&inp->prompt); /* label */ | |
948 | |
949 } | |
950 else | |
951 { | |
952 data->editor_data.TextString = NULL; /* no label */ | |
953 } | |
954 data->editor_data.min_enter = inp->rspMin; | |
955 data->editor_data.timeout = TWENTY_SECS; | |
956 data->editor_data.Identifier = event; | |
957 | |
958 /* | |
959 * Start the Editor | |
960 */ | |
961 if (editor_start_common (win, data->edt_buffer, data->max_chars, &data->editor_data, (T_EDIT_CB)sat_editor_cb) == NULL) | |
962 { | |
963 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
964 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
965 sat_done (sat_command, sat_res); | |
966 sat_get_string_destroy (data->win); | |
967 } | |
968 #endif /* NEW_EDITOR */ | |
969 break; | |
970 | |
971 /* sbh - all window types are being provided with this event to destroy the window */ | |
972 case SAT_DESTROY_WINDOW: | |
973 | |
974 TRACE_EVENT("SAT_DESTROY_WINDOW"); | |
975 | |
976 if (data->win) | |
977 { | |
978 sat_get_string_destroy (data->win); | |
979 data->win = NULL; | |
980 } | |
981 break; | |
982 /* ...sbh */ | |
983 | |
984 default: | |
985 TRACE_EVENT ("sat_get_string_exec() unexpected event"); | |
986 break; | |
987 } | |
988 } | |
989 | |
990 /********************************************************************* | |
991 * | |
992 * SUB WINDOW SAT_DISPLAY_TEXT | |
993 * | |
994 *********************************************************************/ | |
995 typedef struct | |
996 { | |
997 T_MMI_CONTROL mmi_control; | |
998 T_MFW_HND win; | |
999 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */ | |
1000 #ifdef NEW_EDITOR | |
1001 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
1002 #else | |
1003 T_EDITOR_DATA editor_data; | |
1004 #endif | |
1005 char *info_buffer; /* buffer for info */ | |
1006 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */ | |
1007 } T_sat_display_text; | |
1008 | |
1009 //Nov 09, 2005 REF: OMAPS00043190 - x0018858 | |
1010 // Added a globale variable to store the handle since it will not be possible to add structure elements | |
1011 // for all type of windows | |
1012 T_MFW_HND satDisplayTextWin = NULL; | |
1013 | |
1014 static void sat_display_text_destroy (T_MFW_HND own_window); | |
1015 static void sat_display_text_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command); | |
1016 | |
1017 /******************************************************************************* | |
1018 | |
1019 $Function: sat_display_text_create | |
1020 | |
1021 $Description: Creation of an instance for the SAT DISPLAY TEXT dialog.Window | |
1022 must be available after reception of SAT command,only one instance. | |
1023 | |
1024 $Returns: Window handle | |
1025 | |
1026 $Arguments: parent_window - parent window | |
1027 *******************************************************************************/ | |
1028 | |
1029 T_MFW_HND sat_display_text_create (T_MFW_HND parent_window) | |
1030 { | |
1031 T_sat_display_text * data = (T_sat_display_text *)ALLOC_MEMORY (sizeof (T_sat_display_text)); | |
1032 T_MFW_WIN * win; | |
1033 | |
1034 TRACE_FUNCTION("sat_display_text_create"); | |
1035 | |
1036 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb); // c030 rsa | |
1037 | |
1038 if (data->win EQ NULL) | |
1039 return NULL; | |
1040 | |
1041 /* | |
1042 * Create window handler | |
1043 */ | |
1044 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_display_text_exec; | |
1045 data->mmi_control.data = data; | |
1046 win = ((T_MFW_HDR *)data->win)->data; | |
1047 win->user = (MfwUserDataPtr)data; | |
1048 | |
1049 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */ | |
1050 | |
1051 /* | |
1052 * return window handle | |
1053 */ | |
1054 win_show(data->win); | |
1055 | |
1056 return data->win; | |
1057 } | |
1058 | |
1059 /******************************************************************************* | |
1060 | |
1061 $Function: sat_display_text_destroy | |
1062 | |
1063 $Description: Destroy the sat play tone dialog. | |
1064 | |
1065 $Returns: none | |
1066 | |
1067 $Arguments: own_window - current window | |
1068 *******************************************************************************/ | |
1069 static void sat_display_text_destroy (T_MFW_HND own_window) | |
1070 { | |
1071 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data; | |
1072 T_sat_display_text * data = (T_sat_display_text *)win_data->user; | |
1073 | |
1074 TRACE_FUNCTION("sat_display_text_destroy"); | |
1075 if (own_window == NULL) | |
1076 { | |
1077 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
1078 return; | |
1079 } | |
1080 | |
1081 if (data) | |
1082 { | |
1083 /* | |
1084 * Delete WIN Handler | |
1085 */ | |
1086 win_delete (data->win); | |
1087 /* | |
1088 * Free Memory | |
1089 */ | |
1090 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1091 #ifdef FF_MMI_SAT_ICON | |
1092 if (data->editor_data.editor_attr.TitleIcon.data != NULL) | |
1093 { | |
1094 FREE_MEMORY((U8 *)data->editor_data.editor_attr.TitleIcon.data, data->editor_data.editor_attr.TitleIcon.width * | |
1095 data->editor_data.editor_attr.TitleIcon.height); | |
1096 data->editor_data.editor_attr.TitleIcon.data = NULL; | |
1097 } | |
1098 #endif | |
1099 | |
1100 sat_destroy_TEXT_ASCIIZ (data->info_buffer); /* displayed text */ | |
1101 FREE_MEMORY ((U8 *)data, sizeof (T_sat_display_text)); | |
1102 } | |
1103 } | |
1104 | |
1105 /******************************************************************************* | |
1106 | |
1107 $Function: sat_display_text_exec | |
1108 | |
1109 $Description: Dialog function for sat_display_text_exec window. | |
1110 | |
1111 $Returns: none | |
1112 | |
1113 $Arguments: win - window | |
1114 event - window event | |
1115 value - unique id | |
1116 sat_command - sat command data. | |
1117 *******************************************************************************/ | |
1118 | |
1119 static void sat_display_text_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command) | |
1120 { | |
1121 | |
1122 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1123 T_sat_display_text * data = (T_sat_display_text *)win_data->user; | |
1124 T_SAT_RES sat_res; | |
1125 | |
1126 | |
1127 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1128 #ifdef FF_MMI_SAT_ICON | |
1129 USHORT icon_length; | |
1130 #endif | |
1131 | |
1132 TRACE_FUNCTION ("sat_display_text_exec()"); | |
1133 | |
1134 switch (event) | |
1135 { | |
1136 case SAT_DISPLAY_TEXT: | |
1137 data->sat_command = sat_command; | |
1138 | |
1139 /* SPR#1428 - SH - New Editor changes */ | |
1140 #ifdef NEW_EDITOR | |
1141 /* | |
1142 * Setup an Editor to display a string | |
1143 */ | |
1144 AUI_edit_SetDefault(&data->editor_data); | |
1145 /* SPR#1559 - SH - Now use ZONE_FULLSOFTKEYS */ | |
1146 AUI_edit_SetDisplay(&data->editor_data, ZONE_FULLSOFTKEYS, COLOUR_EDITOR, EDITOR_FONT); | |
1147 AUI_edit_SetTextStr(&data->editor_data, TxtSoftOK, TxtSoftBack, TxtNull, NULL); | |
1148 | |
1149 AUI_edit_SetMode(&data->editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); | |
1150 | |
1151 if ((data->sat_command->qual & SAT_M_TEXT_WAIT) NEQ 0) | |
1152 { | |
1153 AUI_edit_SetEvents(&data->editor_data, SAT_DISPLAY_TEXT_WAIT, TRUE, TWO_MIN, (T_AUI_EDIT_CB)sat_editor_cb); | |
1154 } | |
1155 else | |
1156 { | |
1157 AUI_edit_SetEvents(&data->editor_data, event, TRUE, TEN_SECS, (T_AUI_EDIT_CB)sat_editor_cb); | |
1158 } | |
1159 | |
1160 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1161 #ifdef FF_MMI_SAT_ICON | |
1162 /*Check if the SAT command has icon*/ | |
1163 if(sat_command->c.text.icon.qual != 0xFF) | |
1164 { | |
1165 /* Icon is self-explanatory. No need to display text for this case.*/ | |
1166 if(sat_command->c.text.icon.qual == 0x00) | |
1167 { | |
1168 /* Icon is self-explanatory. Do not display the text. | |
1169 Only for SAT commands that use ATB editor directly, | |
1170 we pass NULL as the text string, i.e., there is no Title string. | |
1171 The string is embedded as part of ATB string in these cases. | |
1172 For commands using AUI editor for Title string display, | |
1173 we pass the string & it is not displayed based on 'selfExplanatory' flag. | |
1174 */ | |
1175 data->editor_data.editor_attr.TitleIcon.selfExplanatory = TRUE; | |
1176 data->info_buffer = NULL; | |
1177 } | |
1178 else | |
1179 /* provide a buffer, containing the string to be displayed */ | |
1180 data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text); | |
1181 | |
1182 /* Copy the icon data to the editor*/ | |
1183 data->editor_data.editor_attr.TitleIcon.width = sat_command->c.text.iconInfo.width; | |
1184 data->editor_data.editor_attr.TitleIcon.height = sat_command->c.text.iconInfo.height; | |
1185 | |
1186 icon_length = sat_command->c.inp.prompt.iconInfo.width * sat_command->c.inp.prompt.iconInfo.height; | |
1187 | |
1188 data->editor_data.editor_attr.TitleIcon.data = (char *)ALLOC_MEMORY (icon_length); | |
1189 | |
1190 memcpy(data->editor_data.editor_attr.TitleIcon.data, sat_command->c.inp.prompt.iconInfo.dst, icon_length); | |
1191 data->editor_data.editor_attr.TitleIcon.isTitle = FALSE; | |
1192 data->editor_data.editor_attr.TitleIcon.display_type = SAT_ICON_DISPLAY_TEXT; | |
1193 | |
1194 /* Free the memory of icon data that we got through the SATK command*/ | |
1195 mfwFree((U8 *)sat_command->c.inp.prompt.iconInfo.dst, icon_length); | |
1196 sat_command->c.inp.prompt.iconInfo.dst = NULL; | |
1197 } | |
1198 else | |
1199 { | |
1200 /* provide a buffer, containing the string to be displayed */ | |
1201 data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text); | |
1202 } | |
1203 #else | |
1204 /* provide a buffer, containing the string to be displayed */ | |
1205 data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text); | |
1206 #endif | |
1207 | |
1208 #if 0 /* SPR#2340 - DS - Trace out buffer contents */ | |
1209 for (i=0; i<sat_command->c.text.len+2+2 /* include tag+whole string+terminator */; i++) | |
1210 TRACE_EVENT_P2("SAT info_buffer[%d]: 0x%02x", i, data->info_buffer[i]); | |
1211 #endif | |
1212 | |
1213 /* | |
1214 * Start the Editor | |
1215 */ | |
1216 | |
1217 /* SPR#1559 - SH - Check for unicode strings */ | |
1218 | |
1219 /*Oct 09, 2006 DRT: OMAPS00092083 - x0047075(Archana) | |
1220 Descrption:CT-PTCRB[27.22.4.1.5]-MS Resets while Icon Display | |
1221 Solution : If the sat icon is present which is self explanatory then editor buffer is intialized to blank.*/ | |
1222 if(data->info_buffer == NULL) | |
1223 { | |
1224 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE*)"", 1); | |
1225 } | |
1226 else if (data->info_buffer[0]== (char)0x80) /* x0039928 - Lint warning fix */ | |
1227 { | |
1228 /* SPR#2340 - DS - Len is number of characters, NOT number of bytes */ | |
1229 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_UNICODE, (UBYTE *)&data->info_buffer[2], ( (sat_command->c.text.len)/2+1 )); | |
1230 } | |
1231 else | |
1232 { | |
1233 AUI_edit_SetBuffer(&data->editor_data, ATB_DCS_ASCII, (UBYTE *)data->info_buffer, sat_command->c.text.len+1); | |
1234 } | |
1235 | |
1236 TRACE_EVENT_P2("Editor len: %d, size: %d", data->editor_data.editor_attr.text.len, data->editor_data.editor_attr.size); | |
1237 //Nov 09, 2005 REF: OMAPS00043190 - x0018858 | |
1238 // Store the handle of the editor in a globale variable for further use. A global variable has to be used here | |
1239 // since there is no other way to access this element in the other applications. | |
1240 satDisplayTextWin=AUI_edit_Start(win, &data->editor_data); | |
1241 if ( satDisplayTextWin == NULL) | |
1242 { | |
1243 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
1244 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1245 sat_done (sat_command, sat_res); | |
1246 sat_display_text_destroy (satDisplayTextWin); | |
1247 } | |
1248 break; | |
1249 #else /* NEW_EDITOR */ | |
1250 /* | |
1251 * Setup an Editor to display a string | |
1252 */ | |
1253 data->editor_data.LeftSoftKey = TxtSoftOK; | |
1254 data->editor_data.AlternateLeftSoftKey = TxtNull; | |
1255 data->editor_data.RightSoftKey = TxtSoftBack; | |
1256 data->editor_data.hide = FALSE; | |
1257 data->editor_data.mode = E_EDIT_READ_ONLY_MODE; | |
1258 data->editor_data.TextId = TxtNull; | |
1259 data->editor_data.TextString = NULL; /* no label */ | |
1260 data->editor_data.min_enter = 0; | |
1261 if ((data->sat_command->qual & SAT_M_TEXT_WAIT) NEQ 0) | |
1262 { | |
1263 data->editor_data.timeout = TWO_MIN; | |
1264 data->editor_data.Identifier = SAT_DISPLAY_TEXT_WAIT; | |
1265 } | |
1266 else | |
1267 { | |
1268 data->editor_data.timeout = TEN_SECS; | |
1269 data->editor_data.Identifier = event; | |
1270 } | |
1271 | |
1272 /* provide a buffer, containing the string to be displayed */ | |
1273 data->info_buffer = sat_create_TEXT_ASCIIZ (&sat_command->c.text); | |
1274 /* | |
1275 * Start the Editor | |
1276 */ | |
1277 | |
1278 if (editor_start_common (win, data->info_buffer, sat_command->c.text.len+1, &data->editor_data, (T_EDIT_CB)sat_editor_cb) == NULL) | |
1279 { | |
1280 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE; | |
1281 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1282 sat_done (sat_command, sat_res); | |
1283 sat_display_text_destroy (data->win); | |
1284 } | |
1285 break; | |
1286 #endif /* NEW_EDITOR */ | |
1287 | |
1288 /* SH - all window types are being provided with this event to destroy the window */ | |
1289 case SAT_DESTROY_WINDOW: | |
1290 sat_display_text_destroy (data->win); | |
1291 break; | |
1292 | |
1293 default: | |
1294 TRACE_EVENT ("sim_display_text_exec() unexpected event"); | |
1295 break; | |
1296 } | |
1297 } | |
1298 | |
1299 | |
1300 /******************************************************************************* | |
1301 | |
1302 $Function: sat_ASCII_to_TEXT | |
1303 | |
1304 $Description: This routine converts an ASCIIZ string into an MFW SAT text | |
1305 descriptor the coding scheme is taken accordign to the code in <txt> | |
1306 | |
1307 $Returns: none | |
1308 | |
1309 $Arguments: txt - text info | |
1310 destination - text destination | |
1311 source - text source | |
1312 | |
1313 *******************************************************************************/ | |
1314 | |
1315 static void sat_ASCII_to_TEXT (T_SAT_TXT * txt, UBYTE * destination, UBYTE * source) | |
1316 { | |
1317 UBYTE * temp_buffer; | |
1318 | |
1319 switch (txt->code) | |
1320 { | |
1321 case MFW_DCS_7bits: | |
1322 temp_buffer = (UBYTE *)ALLOC_MEMORY(txt->len+1); | |
1323 sat_ascii_to_gsm ((char *)temp_buffer, (char *)source, (U16)(txt->len)); | |
1324 utl_cvt8To7 (temp_buffer, txt->len, destination, 0); | |
1325 FREE_MEMORY ((U8 *)temp_buffer, txt->len+1); | |
1326 break; | |
1327 case MFW_DCS_8bits: | |
1328 sat_ascii_to_gsm ((char *)destination, (char *)source, (U16)(txt->len)); | |
1329 break; | |
1330 case MFW_DCS_UCS2: | |
1331 sat_ascii_to_ucode ((wchar_t *)destination, (char *)source, (U16)(txt->len)); | |
1332 break; | |
1333 default: | |
1334 sat_ascii_to_gsm ((char *)destination, (char *)source, (U16)(txt->len)); | |
1335 TRACE_EVENT("sat_ASCII_to_TEXT() unexp. DCS"); | |
1336 break; | |
1337 } | |
1338 } | |
1339 | |
1340 #ifdef INTEGRATION_SEPT00 | |
1341 | |
1342 /******************************************************************************* | |
1343 | |
1344 $Function: sat_UCODE_to_TEXT | |
1345 | |
1346 $Description: This routine converts an UCODE string into an MFW SAT text descriptor | |
1347 the coding scheme is taken accordign to the code in <txt> | |
1348 | |
1349 | |
1350 $Returns: none | |
1351 | |
1352 $Arguments: txt - text info | |
1353 destination - text destination | |
1354 source - text source | |
1355 | |
1356 *******************************************************************************/ | |
1357 static void sat_UCODE_to_TEXT (T_SAT_TXT * txt, UBYTE * destination, cp_wstring_t source) | |
1358 { | |
1359 UBYTE * temp_buffer; | |
1360 UBYTE size; | |
1361 UBYTE outLen; | |
1362 | |
1363 switch (txt->code) | |
1364 { | |
1365 case MFW_DCS_7bits: | |
1366 size = (source->length/sizeof(wchar_t))+1; | |
1367 temp_buffer = (UBYTE *)ALLOC_MEMORY(size); | |
1368 string_UCS2_to_GSM( | |
1369 MFW_DCS_7bits, // gsm format | |
1370 (wstring_t *)source,// source unicode string, includes own length | |
1371 size, // maximum output size | |
1372 temp_buffer, // destination byte array | |
1373 &outLen // actual length in bytes is stored here. | |
1374 ); | |
1375 txt->len = utl_cvt8To7 (temp_buffer, outLen, destination, 0); | |
1376 FREE_MEMORY ((U8 *)temp_buffer, size); | |
1377 break; | |
1378 case MFW_DCS_8bits: | |
1379 string_UCS2_to_GSM( | |
1380 MFW_DCS_7bits, // gsm format | |
1381 (wstring_t *)source,// source unicode string, includes own length | |
1382 size, // maximum output size | |
1383 destination, // destination byte array | |
1384 &txt->len // actual length in bytes is stored here. | |
1385 ); | |
1386 break; | |
1387 case MFW_DCS_UCS2: | |
1388 txt->len = source->length*sizeof(wchar_t); // txt count is in number of bytes | |
1389 memcpy(destination, source, txt->len); | |
1390 break; | |
1391 default: | |
1392 string_UCS2_to_GSM( | |
1393 MFW_DCS_7bits, // gsm format | |
1394 (wstring_t *)source,// source unicode string, includes own length | |
1395 size, // maximum output size | |
1396 destination, // destination byte array | |
1397 &txt->len // actual length in bytes is stored here. | |
1398 ); | |
1399 TRACE_EVENT("sat_UCODE_to_TEXT() unexp. DCS"); | |
1400 break; | |
1401 } | |
1402 } | |
1403 #endif /* INTEGRATION_SEPT00 */ | |
1404 | |
1405 /******************************************************************************* | |
1406 | |
1407 $Function: sat_get_key_send_result | |
1408 | |
1409 $Description: | |
1410 | |
1411 | |
1412 $Returns: none | |
1413 | |
1414 $Arguments: data - key info | |
1415 | |
1416 *******************************************************************************/ | |
1417 | |
1418 static void sat_get_key_send_result (T_sat_get_key * data) | |
1419 { | |
1420 T_SAT_RES sat_res; | |
1421 struct { | |
1422 T_SAT_TXT txt; | |
1423 UBYTE buffer[SAT_GET_KEY_BUFFER_SIZE]; /* buffer for result */ | |
1424 } buf; /* NOTE: txt and buffer shall be packed */ | |
1425 | |
1426 /* update the output parameter */ | |
1427 | |
1428 /* a0876501 (Shashi Shekar B.S.) 03-Oct-2005 MMI-SPR-34554. | |
1429 Populate Yes/No terminal response. | |
1430 Ignore the DCS type to be sent if 'SAT_M_INKEY_YES_NO' is ON. | |
1431 Refer GSM 11.14 Sec 12.6, Get Inkey. */ | |
1432 if ((data->sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0) | |
1433 { | |
1434 /* Data coding scheme is not considered for Yes/No response */ | |
1435 buf.txt.code = SAT_M_INKEY_YES_NO; | |
1436 | |
1437 buf.txt.text = sizeof(T_SAT_TXT); | |
1438 buf.txt.len = 1; | |
1439 | |
1440 /* Simply copy the data populated in sat_editor_cb */ | |
1441 buf.buffer[0] = (UBYTE)data->edt_buffer[0]; | |
1442 } | |
1443 else | |
1444 { | |
1445 /* set the required DCS for the result to be returned */ | |
1446 if ((data->sat_command->qual & SAT_M_INKEY_UCS2) NEQ 0) | |
1447 { | |
1448 buf.txt.code = MFW_DCS_UCS2; | |
1449 } | |
1450 else | |
1451 { | |
1452 buf.txt.code = MFW_DCS_8bits; /* use the SMS default alphabet */ | |
1453 } | |
1454 | |
1455 buf.txt.text = sizeof(T_SAT_TXT); | |
1456 buf.txt.len = 1; | |
1457 | |
1458 /* convert and send the result */ | |
1459 sat_ASCII_to_TEXT(&buf.txt, buf.buffer, (UBYTE *)data->edt_buffer); | |
1460 } | |
1461 | |
1462 /* SPR#2340 - DS - Check if an icon was supplied with GET KEY command. | |
1463 * If supplied, set the result to 0x04 'Command performed successfully, but | |
1464 * requested icon could not be displayed'. | |
1465 */ | |
1466 if (data->sat_command->c.text.icon.qual == 0xFF && | |
1467 data->sat_command->c.text.icon.id == 0xFF) | |
1468 { | |
1469 /* Icon not present */ | |
1470 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1471 } | |
1472 else | |
1473 { | |
1474 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1475 #ifdef FF_MMI_SAT_ICON | |
1476 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1477 #else | |
1478 /* Icon present but ME cannot display icon */ | |
1479 sat_res[SAT_ERR_INDEX] = SatResNoIcon; | |
1480 #endif | |
1481 } | |
1482 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1483 satString (data->sat_command, &buf.txt, sat_res, sizeof(T_SAT_RES)); | |
1484 } | |
1485 | |
1486 /******************************************************************************* | |
1487 | |
1488 $Function: sat_get_string_send_result | |
1489 | |
1490 $Description: | |
1491 | |
1492 | |
1493 $Returns: none | |
1494 | |
1495 $Arguments: data - string info | |
1496 | |
1497 SPR#1700 - DS - Modified to handle Chinese/Unicode | |
1498 | |
1499 *******************************************************************************/ | |
1500 static void sat_get_string_send_result (T_sat_get_string * data) | |
1501 { | |
1502 T_SAT_RES sat_res; | |
1503 T_sat_get_string_result * buf; | |
1504 U16 length; | |
1505 U16 size; | |
1506 T_SAT_INPUT* input; /* SPR#2321 - DS */ | |
1507 | |
1508 TRACE_FUNCTION("sat_get_string_send_result()"); | |
1509 | |
1510 /* allocate sufficient temporary space to return the result (avoid huge stack usage) */ | |
1511 if (((data->sat_command->qual & SAT_M_INPUT_ALPHA) == 1) /* 0=digits, 1=alpha */ | |
1512 && (data->sat_command->qual & SAT_M_INPUT_UCS2) /* Unicode input requested */ | |
1513 && (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)) | |
1514 { | |
1515 length = 2*ATB_string_UCLength((USHORT*)data->edt_buffer); | |
1516 } | |
1517 else /* Ascii */ | |
1518 { | |
1519 length = strlen(data->edt_buffer); | |
1520 } | |
1521 size = sizeof(T_sat_get_string_result) + length; | |
1522 buf = (T_sat_get_string_result *) ALLOC_MEMORY(size); | |
1523 | |
1524 /* update the output parameter */ | |
1525 | |
1526 /* set the required DCS for the result to be returned */ | |
1527 if ((data->sat_command->qual & SAT_M_INPUT_UCS2) NEQ 0) | |
1528 { | |
1529 buf->txt.code = MFW_DCS_UCS2; | |
1530 } | |
1531 else if ((data->sat_command->qual & SAT_M_INPUT_PACKING) NEQ 0) | |
1532 { | |
1533 buf->txt.code = MFW_DCS_7bits; /* use the packed SMS alphabet */ | |
1534 } | |
1535 else | |
1536 { | |
1537 buf->txt.code = MFW_DCS_8bits; /* use the SMS default alphabet */ | |
1538 } | |
1539 | |
1540 buf->txt.text = sizeof(T_SAT_TXT); | |
1541 buf->txt.len = length; | |
1542 | |
1543 /* convert and send the result */ | |
1544 if (((data->sat_command->qual & SAT_M_INPUT_ALPHA) == 1) /* 0=digits, 1=alpha */ | |
1545 && (data->sat_command->qual & SAT_M_INPUT_UCS2) /* Unicode input requested */ | |
1546 && (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)) | |
1547 { | |
1548 //Copy the data into the SAT txt buffer | |
1549 memcpy(buf->buffer, data->edt_buffer, length); | |
1550 } | |
1551 else | |
1552 { | |
1553 sat_ASCII_to_TEXT(&buf->txt, buf->buffer, (UBYTE *)data->edt_buffer); | |
1554 } | |
1555 | |
1556 /* SPR#2321 - DS - Check if an icon was supplied with SAT_STRING (Get Input) | |
1557 * command. If supplied, set the result to 0x04 'Command performed successfully, | |
1558 * but requested icon could not be displayed'. | |
1559 */ | |
1560 input = (T_SAT_INPUT*)&data->sat_command->c.inp; | |
1561 if (input->prompt.icon.qual == 0xFF && | |
1562 input->prompt.icon.id == 0xFF) | |
1563 { | |
1564 /* Icon not present */ | |
1565 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1566 } | |
1567 else | |
1568 { | |
1569 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1570 #ifdef FF_MMI_SAT_ICON | |
1571 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1572 #else | |
1573 /* Icon present but ME cannot display icon */ | |
1574 sat_res[SAT_ERR_INDEX] = SatResNoIcon; | |
1575 #endif | |
1576 } | |
1577 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1578 satString (data->sat_command, &buf->txt, sat_res, sizeof(T_SAT_RES)); | |
1579 | |
1580 FREE_MEMORY((U8 *)buf, size); | |
1581 } | |
1582 | |
1583 /******************************************************************************* | |
1584 | |
1585 $Function: sat_editor_cb | |
1586 | |
1587 $Description: Sat editor call back function. | |
1588 | |
1589 | |
1590 $Returns: none | |
1591 | |
1592 $Arguments: win - window | |
1593 Identifier - unique id | |
1594 event - event id | |
1595 | |
1596 *******************************************************************************/ | |
1597 /* SPR#1428 - SH - New Editor: minor change so function matches callback type */ | |
1598 #ifdef NEW_EDITOR | |
1599 static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, SHORT event) | |
1600 #else | |
1601 static void sat_editor_cb (T_MFW_HND win, USHORT Identifier, USHORT event) | |
1602 #endif | |
1603 { | |
1604 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1605 T_SAT_RES sat_res; | |
1606 | |
1607 TRACE_EVENT ("sat_editor_cb()"); | |
1608 | |
1609 TRACE_EVENT_P1("event number %d",event); | |
1610 | |
1611 if ((win EQ NULL) || (win_data EQ NULL)) | |
1612 return; | |
1613 | |
1614 switch (Identifier) | |
1615 { | |
1616 case SAT_GET_KEY: | |
1617 { | |
1618 T_sat_get_key * data = (T_sat_get_key *)win_data->user; | |
1619 | |
1620 if (data EQ NULL) | |
1621 return; | |
1622 | |
1623 switch(event) | |
1624 { | |
1625 case INFO_KCD_LEFT: /* OK or single digit key or YES */ | |
1626 /* update the output parameter */ | |
1627 if ((data->sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0) | |
1628 { | |
1629 data->edt_buffer[0] = 0x01; /* means YES */ | |
1630 data->edt_buffer[1] = 0x00; /* means YES */ | |
1631 } | |
1632 | |
1633 sat_get_key_send_result (data); | |
1634 break; | |
1635 case INFO_KCD_ALTERNATELEFT: /* help */ | |
1636 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_HELP; | |
1637 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1638 sat_done (data->sat_command, sat_res); | |
1639 break; | |
1640 case INFO_KCD_RIGHT: /* back or NO */ | |
1641 if ((data->sat_command->qual & SAT_M_INKEY_YES_NO) NEQ 0) | |
1642 { | |
1643 data->edt_buffer[0] = 0x00; /* means NO */ | |
1644 data->edt_buffer[1] = 0x00; /* means NO */ | |
1645 sat_get_key_send_result (data); | |
1646 } | |
1647 else | |
1648 { | |
1649 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK; | |
1650 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1651 sat_done (data->sat_command, sat_res); | |
1652 } | |
1653 break; | |
1654 case INFO_KCD_CLEAR: /* clear on empty buffer or long clear */ | |
1655 case INFO_KCD_HUP: | |
1656 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | |
1657 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1658 sat_done (data->sat_command, sat_res); | |
1659 break; | |
1660 case INFO_TIMEOUT: /* timeout */ | |
1661 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; | |
1662 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1663 sat_done (data->sat_command, sat_res); | |
1664 break; | |
1665 case INFO_KCD_CALL: /* SEND key */ | |
1666 /* SPR#2490 - DS - Explicitly ignore SEND key press */ | |
1667 TRACE_EVENT("SEND keypress ignored"); | |
1668 return; | |
1669 default: | |
1670 TRACE_EVENT("sat_editor_cb() unexp. event"); | |
1671 return; | |
1672 //break; | |
1673 } | |
1674 sat_get_key_destroy (data->win); | |
1675 } | |
1676 break; | |
1677 case SAT_GET_STRING: | |
1678 { | |
1679 T_sat_get_string * data = (T_sat_get_string *)win_data->user; | |
1680 | |
1681 if (data EQ NULL) | |
1682 return; | |
1683 | |
1684 switch(event) | |
1685 { | |
1686 case INFO_KCD_LEFT: /* OK */ | |
1687 sat_get_string_send_result (data); | |
1688 SEND_EVENT(data->win, SAT_DESTROY_WINDOW, 0, 0); /* SPR#1700 - DS - Destroy SAT string data */ | |
1689 break; | |
1690 case INFO_KCD_ALTERNATELEFT: /* help */ | |
1691 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_HELP; | |
1692 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1693 sat_done (data->sat_command, sat_res); | |
1694 break; | |
1695 case INFO_KCD_RIGHT: /* back */ | |
1696 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK; | |
1697 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1698 sat_done (data->sat_command, sat_res); | |
1699 break; | |
1700 case INFO_KCD_CLEAR: /* clear on empty buffer or long clear */ | |
1701 case INFO_KCD_HUP: /* SPR#2321 - DS - Handle hangup keypress */ | |
1702 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | |
1703 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1704 sat_done (data->sat_command, sat_res); | |
1705 break; | |
1706 case INFO_TIMEOUT: /* timeout */ | |
1707 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; | |
1708 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1709 sat_done (data->sat_command, sat_res); | |
1710 break; | |
1711 case INFO_KCD_CALL: /* SEND key */ | |
1712 /* SPR#2490 - DS - Explicitly ignore SEND key press */ | |
1713 TRACE_EVENT("SEND keypress ignored"); | |
1714 return; | |
1715 default: | |
1716 TRACE_EVENT("sat_editor_cb() unexp. event"); | |
1717 return; | |
1718 //break; | |
1719 } | |
1720 | |
1721 /* SPR#1700 - DS - Only destroy string if not already destroyed */ | |
1722 if (data->win) | |
1723 { | |
1724 sat_get_string_destroy (data->win); | |
1725 data->win = NULL; | |
1726 } | |
1727 } | |
1728 break; | |
1729 | |
1730 case SAT_DISPLAY_TEXT: | |
1731 { | |
1732 T_sat_display_text * data = (T_sat_display_text *)win_data->user; | |
1733 | |
1734 switch (event) | |
1735 { | |
1736 case INFO_KCD_RIGHT: /* back */ | |
1737 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK; | |
1738 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1739 sat_done (data->sat_command, sat_res); | |
1740 break; | |
1741 case INFO_TIMEOUT: /* timeout */ | |
1742 case INFO_KCD_LEFT: /* OK */ | |
1743 /* SPR#2340 - DS - Check if an icon was supplied with DISPLAY TEXT | |
1744 * command. If supplied, set the result to 0x04 'Command performed successfully, | |
1745 * but requested icon could not be displayed'. | |
1746 */ | |
1747 if (data->sat_command->c.text.icon.qual == 0xFF && | |
1748 data->sat_command->c.text.icon.id == 0xFF) | |
1749 { | |
1750 /* Icon not present */ | |
1751 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1752 } | |
1753 else | |
1754 { | |
1755 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1756 #ifdef FF_MMI_SAT_ICON | |
1757 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1758 #else | |
1759 /* Icon present but ME cannot display icon */ | |
1760 sat_res[SAT_ERR_INDEX] = SatResNoIcon; | |
1761 #endif | |
1762 } | |
1763 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1764 sat_done (data->sat_command, sat_res); | |
1765 break; | |
1766 case INFO_KCD_CLEAR: /* abort */ | |
1767 case INFO_KCD_HUP: | |
1768 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | |
1769 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1770 sat_done (data->sat_command, sat_res); | |
1771 break; | |
1772 case INFO_KCD_CALL: /* SEND key */ | |
1773 /* SPR#2490 - DS - Explicitly ignore SEND key press */ | |
1774 TRACE_EVENT("SEND keypress ignored"); | |
1775 return; | |
1776 default: | |
1777 TRACE_EVENT("sat_editor_cb() unexp. event"); | |
1778 return; | |
1779 //break; | |
1780 } | |
1781 sat_display_text_destroy (data->win); | |
1782 //Nov 09, 2005 REF: OMAPS00043190 - x0018858 | |
1783 // Re-initialize the global variable to NULL. | |
1784 satDisplayTextWin = NULL; | |
1785 } | |
1786 break; | |
1787 | |
1788 case SAT_DISPLAY_TEXT_WAIT: | |
1789 { | |
1790 T_sat_display_text * data = (T_sat_display_text *)win_data->user; | |
1791 | |
1792 switch (event) | |
1793 { | |
1794 case INFO_TIMEOUT: /* timeout */ | |
1795 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; | |
1796 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1797 sat_done (data->sat_command, sat_res); | |
1798 break; | |
1799 case INFO_KCD_LEFT: /* OK */ | |
1800 /* SPR#2340 - DS - Check if an icon was supplied with DISPLAY TEXT | |
1801 * command. If supplied, set the result to 0x04 'Command performed successfully, | |
1802 * but requested icon could not be displayed'. | |
1803 */ | |
1804 if (data->sat_command->c.text.icon.qual == 0xFF && | |
1805 data->sat_command->c.text.icon.id == 0xFF) | |
1806 { | |
1807 /* Icon not present */ | |
1808 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1809 } | |
1810 else | |
1811 { | |
1812 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460 | |
1813 #ifdef FF_MMI_SAT_ICON | |
1814 sat_res[SAT_ERR_INDEX] = SatResSuccess; | |
1815 #else | |
1816 /* Icon present but ME cannot display icon */ | |
1817 sat_res[SAT_ERR_INDEX] = SatResNoIcon; | |
1818 #endif | |
1819 } | |
1820 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1821 sat_done (data->sat_command, sat_res); | |
1822 break; | |
1823 case INFO_KCD_RIGHT: /* back */ | |
1824 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK; | |
1825 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1826 sat_done (data->sat_command, sat_res); | |
1827 break; | |
1828 case INFO_KCD_CLEAR: /* abort */ | |
1829 case INFO_KCD_HUP: | |
1830 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT; | |
1831 sat_res[SAT_AI_INDEX] = SatResAiNoCause; | |
1832 sat_done (data->sat_command, sat_res); | |
1833 break; | |
1834 /* SPR#2490 - DS - Explicitly ignore SEND key press */ | |
1835 case INFO_KCD_CALL: /* SEND key */ | |
1836 TRACE_EVENT("SEND keypress ignored"); | |
1837 return; | |
1838 default: | |
1839 TRACE_EVENT("sat_editor_cb() unexp. event"); | |
1840 return; | |
1841 //break; | |
1842 } | |
1843 sat_display_text_destroy (data->win); | |
1844 //Nov 09, 2005 REF: OMAPS00043190 - x0018858 | |
1845 // Re-initialize the global variable to NULL. | |
1846 satDisplayTextWin = NULL; | |
1847 } | |
1848 break; | |
1849 default: | |
1850 TRACE_EVENT("sat_editor_cb() unexp. Identifier"); | |
1851 break; | |
1852 } | |
1853 return; | |
1854 } | |
1855 // end c014 rsa |