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