comparison src/aci2/bmi/ATBWapAUI.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*******************************************************************************
2
3 CONDAT (UK)
4
5 ********************************************************************************
6
7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner.
9
10 ********************************************************************************
11
12 $Project name:
13 $Project code:
14 $Module:
15 $File: ATBWapAUI.c
16 $Revision:
17
18 $Author: Condat(UK)
19 $Date:
20
21 ********************************************************************************
22
23 Description:
24 Provides most of the functionality of the ATB, as well as an interface with the AUI.
25
26
27 ********************************************************************************
28
29 $History: ATBWapAUI.c
30
31 Sep 06 2005 REF: MMI-SPR-34048 x0012849, Jagan
32 Description : GIF is displayed as ?
33 Solution: Close the decoder once for each open
34 xreddymn Aug-03-2005 MMI-SPR-33058:
35 Handling of animated GIF images with transparency
36
37 xreddymn Jun-29-2005 MMI-ENH-32467:
38 Handling of animated GIF images
39
40 xrashmic 29 Jun, 2005 MMI-SPR-32462
41 Patch given by Kyle for display of table border
42
43 xreddymn Jun-21-2005 MMI-SPR-30291: Send one message for the entire profile,
44 instead of sending one parameter at a time, to the WAP adapter
45
46 Jun-08-2005 MMI-SPR-30291 xreddymn: Added patches from FG
47
48 May 11 2005 REF: MMI-SPR-29887 x0012849
49 To Implement the deferred MMS retrieval.
50
51 Apr 28 2005 REF: MMI-SPR-30400 x0012849
52 To display the contents of Drop down menu correctly when a page is browsed through D sample.
53
54 xreddymn Mar-22-2005 MMI-SPR-29767
55 Modified behaviour of SL push message handling in MMI
56
57 xrashmic 08 Feb, 2005 MMI-SPR-27853
58 Error handling in sending MMS and also displaying the progress value
59
60 Jan-24-2005 MMI-SPR-28135 - xreddymn: WAP_OTA settings saved in WAP profiles
61
62 xrashmic 21 Jan, 2005 MMI-SPR-28223
63 When a plugin image is displayed, we ignore the scroll key events
64
65 xrashmic 28 Jan, 2005 MMI-SPR-28166
66 Adding support for saving plugin images
67
68 xreddymn Jan-06-2005 MMI-SPR-27618:
69 Added end of string character to terminate strings in ATB_wap_entry_add
70
71 xrashmic 16 Dec, 2004 MMI-SPR-27622
72 To add support for deleting and adding Profiles
73
74 Dec-10-2003 MMI-SPR-26159 - xreddymn: Prevent duplicate entries in History List
75
76 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version.
77
78 $End
79
80 *******************************************************************************/
81 #ifndef MFW
82 #define MFW
83 #endif
84
85 #ifdef MFW
86 #define ENTITY_MFW
87 #else
88 #ifdef SMI
89 #define ENTITY_SMI
90 #else
91 #define ENTITY_ACI
92 #endif
93 #endif
94
95 #include <stdio.h>
96 #include <string.h>
97 #include <stdlib.h>
98
99 #include "typedefs.h"
100
101 /* BEGIN ADD: Sumit : Req ID: : 31-Mar-2005*/
102 #ifndef NEPTUNE_BOARD
103 /* END ADD: Sumit : Req ID: : 31-Mar-2005*/
104 #include "ffs/ffs.h"
105 /* BEGIN ADD: Sumit : Req ID: : 31-Mar-2005*/
106 #else
107 #include "ffs.h"
108 #endif
109 /* END ADD: Sumit : Req ID: : 31-Mar-2005*/
110
111 #include "MmiWapFfs.h"
112 #ifdef FF_GPF_TCPIP
113 #include "leconfig.h"
114 #include "capimic.h"
115 #include "aapimic.h"
116 #include "wapmic_types.h"
117 //kyle 29 Jun, 2005 MMI-SPR-32462
118 #include "tapimmi.h"
119 #else
120 #include "gledef.h"
121 #include "capiclnt.h"
122 #include "aapiclnt.h"
123 #include "wap_types.h"
124 #endif
125
126
127 #include "ATBWapACI.h"
128 #include "ATBData.h"
129 #include "ATBWapAUI.h"
130 #include "font_bitmaps.h"
131
132 #include "cus_aci.h"
133 #include "prim.h"
134 #ifndef PCM_2_FFS
135 #include "pcm.h"
136 #endif
137 #include "dspl.h"
138 #ifdef FF_GPF_TCPIP
139 #include "mfw_sms.h"
140 #endif
141
142 void long_IP_to_char_IP(ULONG IPs,char* IPd);
143 #define DEFAULT_PROFILE 0 /* The default starting profile */
144
145 static T_WAP_VIEW *View_header = 0; /* View header points to first element in the view chain */
146 static T_WAP_VIEW *Current_view = 0; /* Points to the current view */
147
148 #if defined (FF_MMI_MMS) && defined (FF_GPF_TCPIP)
149 // May 11 2005 REF: MMI-SPR-29887 x0012849
150 // MmsRetrievalType is used while Reading or writing Data from flash regarding retrieval type.
151 extern FlashDataMmsRetrievalType *MmsRetrievalType;
152 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
153 extern int MMSactive;
154 //xrashmic 08 Feb, 2005 MMI-SPR-27853
155 extern void AUI_mms_status_notify(int status);
156
157 #endif
158
159 #ifdef FF_GPF_TCPIP
160 // Apr 28 2005 REF: MMI-SPR-30400 x0012849
161 //This is added to see that check box is inline with the text.
162 #define OFFSET_CHECKBOX 4
163 //xrashmic 21 Jan, 2005 MMI-SPR-28223
164 extern BOOL pluginImageDisplayed;
165
166 // xreddymn Jan-25-2005 MMI-SPR-28135: WAP_OTA
167 #include "mfw_ss.h" // For definitions of MFW_ASCII, MFW_DCS_UCS2
168 int ATB_convert_String( char * ipString, UBYTE ipDataType, int ipLength,
169 char * opString, UBYTE opDataType, int opLength, UBYTE addNull);
170 extern void AUI_profile_list_redraw(S32 index);
171
172 #endif
173
174 /* LOCAL FUNCTION PROTOTYPES */
175
176 static void ATB_wap_buffer_image_scale(T_WAP_MMI_SEND_IMAGE_IND *image);
177 static void ATB_wap_buffer_text_draw(T_WAP_MMI_SEND_TEXT_IND *parameter);
178 static void ATB_wap_buffer_table_draw(T_WAP_MMI_SEND_TABLE_IND *parameter);
179 static void ATB_wap_buffer_line_draw(SHORT x1, SHORT y1, SHORT x2, SHORT y2);
180 static BOOL ATB_wap_buffer_onscreen(SHORT x, SHORT y, SHORT *deltaX, SHORT *deltaY);
181 static void ATB_wap_buffer_image_display(T_WAP_MMI_SEND_IMAGE_IND *image);
182
183 #if defined(TRACE_ATBWAPAUI) || defined(TRACE_ATBWAPACI)
184
185 /* Functions to display strings, for tracing purposes.
186 * SPR#1437 - SH - Fixed these so they won't overwrite array bounds */
187
188 void ATB_trace_string(char *String, USHORT length)
189 {
190 UBYTE stringIndex;
191 UBYTE trace_string[41];
192
193 for (stringIndex=0; (stringIndex<40 && stringIndex<length); stringIndex++)
194 trace_string[stringIndex] = String[stringIndex];
195
196 trace_string[stringIndex] = 0;
197
198 TRACE_EVENT_P2("%s (%d)", trace_string, length);
199
200 return;
201 }
202
203 void ATB_trace_ushort_string(USHORT *String, USHORT length)
204 {
205 USHORT stringIndex;
206 UBYTE trace_string[41];
207
208 for (stringIndex=0; (stringIndex<40 && stringIndex<length); stringIndex++)
209 trace_string[stringIndex] = (char) String[stringIndex];
210
211 trace_string[stringIndex] = 0;
212
213 TRACE_EVENT_P2("%s (%d)", trace_string, length);
214
215 return;
216 }
217
218 #endif
219
220
221 /*******************************************************************************
222
223 $Function: ATB_wap_start
224
225 $Description: Starts the WAP application and initialises the view chain
226
227 $Returns: None.
228
229 $Arguments: parameter - dummy empty parameter
230
231 *******************************************************************************/
232
233 #ifdef CO_UDP_IP
234 void ATB_wap_start(T_MMI_WAP_START_IND *parameter)
235 #else
236 void ATB_wap_start(T_MMI_WAP_START_USER_AGENT_REQ *parameter)
237 #endif
238 {
239 #ifdef TRACE_ATBWAPAUI
240 TRACE_FUNCTION("ATB_wap_start");
241 #endif
242
243 M_MMI_WAP_START_IND(parameter);
244
245 /* Initialise the pointer to the view chain */
246
247 View_header = NULL;
248 Current_view = NULL;
249
250 return;
251 }
252
253 #if defined (FF_MMI_MMS) && defined (FF_GPF_TCPIP)
254 //TISHMMS Project
255 /*******************************************************************************
256
257 $Function: ATB_mms_init_wap_data
258
259 $Description: init WapData and WapProfilesData
260
261 $Returns:
262
263 $Arguments: parameter
264
265 *******************************************************************************/
266 void ATB_mms_init_wap_data(void)
267 {
268
269 #ifdef TRACE_ATBWAPAUI
270 //TRACE_FUNCTION("ATB_mms_init_wap_data");
271 #endif
272
273 if (WapData == NULL)
274 {
275 WapData = (FlashDataWap *) AUI_wap_memory_alloc(sizeof(FlashDataWap)); // Allocate memory for flash data
276 }
277
278 if (WapProfilesData == NULL)
279 {
280 WapProfilesData = (FlashDataWapProfiles *) AUI_wap_memory_alloc(sizeof(FlashDataWapProfiles)); // Allocate memory for profiles data
281 }
282
283 /* read FFS file to get WapData */
284 if (flash_wap_read() == 0)
285 {
286 ATB_wap_profile_default_create();
287 }
288
289 return;
290 }
291
292 void ATB_mms_init_mms_data(void)
293 {
294 // May 11 2005 REF: MMI-SPR-29887 x0012849
295 // type will hold the current retrieval condition
296 BOOL Type;
297 if (MmsProfilesData == NULL)
298 {
299 MmsProfilesData = (FlashDataMmsProfiles *) AUI_wap_memory_alloc(sizeof(FlashDataMmsProfiles)); // Allocate memory for profiles data
300 }
301 // May 11 2005 REF: MMI-SPR-29887 x0012849
302 // Allocate memory for the MmsRetrievalType
303 // The memory allocated here freed in the function ATB_mms_free_wap_data
304 if ( NULL == MmsRetrievalType)
305 {
306 MmsRetrievalType = (FlashDataMmsRetrievalType *) AUI_wap_memory_alloc(sizeof(FlashDataMmsRetrievalType));
307 }
308
309 /* read FFS file to get WapData */
310 if (flash_mms_read() == 0)
311 {
312 ATB_mms_profile_default_create();
313 }
314 // May 11 2005 REF: MMI-SPR-29887 x0012849
315 //If the Information is stored on flash then do nothing, other wise create a file on Flash
316 // Initially MMS retrieval type is set to Immediate Retrieval.
317 if(flash_mms_retrieval_type_read(&Type)==0)
318 {
319 flash_mms_retrieval_type_write(0); // passed 0 indicates immediate
320 }
321 return;
322 }
323
324
325 /*******************************************************************************
326
327 $Function: ATB_mms_free_wap_data
328
329 $Description: free WapData
330
331 $Returns:
332
333 $Arguments: parameter
334
335 *******************************************************************************/
336 void ATB_mms_free_wap_data(void)
337 {
338
339 #ifdef TRACE_ATBWAPAUI
340 //TRACE_FUNCTION("ATB_mms_free_wap_data");
341 #endif
342
343 if (WapData)
344 {
345 AUI_wap_memory_free ((UBYTE *)WapData, sizeof(FlashDataWap));
346 WapData = NULL;
347 }
348
349 if (WapProfilesData)
350 {
351 AUI_wap_memory_free ((UBYTE *)WapProfilesData, sizeof(FlashDataWapProfiles));
352 WapProfilesData = NULL;
353 }
354
355 if (MmsProfilesData)
356 {
357 AUI_wap_memory_free ((UBYTE *)MmsProfilesData, sizeof(FlashDataMmsProfiles));
358 MmsProfilesData = NULL;
359 }
360 // May 11 2005 REF: MMI-SPR-29887 x0012849
361 // Memory is freed here for the MmsProfilesData
362 if (MmsRetrievalType)
363 {
364 AUI_wap_memory_free ((UBYTE *)MmsRetrievalType, sizeof(FlashDataMmsRetrievalType ));
365 MmsRetrievalType = NULL;
366 }
367
368 return;
369 }/* end of ATB_mms_free_wap_data */
370
371
372 char* ATB_mms_get_MmscAddress(void)
373 {
374 UBYTE ucProfileId;
375 char* MmscAddress;
376
377 ucProfileId = WapData->ProfileId;
378
379 MmscAddress = MmsProfilesData->Profile[ucProfileId].MmscAddress;
380
381 return MmscAddress;
382 }
383
384 void ATB_mms_get_wap_Profile(void ** MmsWapProfile)
385 {
386 UBYTE ucProfileId;
387
388 char TraceBuffer[100];
389
390 T_WAP_PROFILE * pTemp;
391
392
393 ucProfileId = WapData->ProfileId;
394
395 sprintf(TraceBuffer, "ATB_mms_get_wap_grofile called!ucProfileId = ");
396 //M4_DebugStringMessage( TraceBuffer,(strlen(TraceBuffer)), ucProfileId);
397
398 *MmsWapProfile = (void*)(&(WapProfilesData->Profile[ucProfileId]));
399
400 pTemp = &(WapProfilesData->Profile[ucProfileId]);
401
402 return;
403 }
404
405 void ATB_mms_profile_save(void)
406 {
407 flash_mms_write();
408
409 return;
410 }
411
412 //TISHMMS Project
413 //modification end
414 #endif
415 /*******************************************************************************
416
417 $Function: ATB_wap_new_view
418
419 $Description: Starts a new view, defining the graphical size of the screen to
420 be handled.
421
422 $Returns: Pointer to the data structure of the new view
423
424 $Arguments: parameter - width and height of the WAP view, etc.
425 UIdata - Optional generic pointer, for use by the AUI. This
426 can point to window information, etc, but is not used
427 by ATB.
428
429 *******************************************************************************/
430 #ifdef FF_GPF_TCPIP
431 T_WAP_VIEW* ATB_wap_new_view(T_MMI_WAP_NEW_VIEW_IND *parameter, void* UIdata)
432 {
433 T_WAP_VIEW *View = (T_WAP_VIEW *) AUI_wap_memory_alloc (sizeof(T_WAP_VIEW)); // Create the view
434 T_WAP_VIEW *ViewIndex;
435
436 #ifdef TRACE_ATBWAPAUI
437 TRACE_FUNCTION("ATB_wap_new_view");
438 #endif
439
440 /* SPR#2086 - SH - Changes to allow for multiple views */
441
442 View->URL = (char *)AUI_wap_memory_alloc ((URL_MAX_LEN+1)*sizeof(char));
443 /* SPR#1816 - SH - Card title is unicode */
444 View->Title = (USHORT *)AUI_wap_memory_alloc ((CARD_TITLE_MAX_LEN+1)*sizeof(USHORT)); // Title of card
445 View->cardWidth = WAP_SCREEN_WIDTH;
446 View->cardHeight = WAP_SCREEN_HEIGHT;
447 /* SPR#1816 - SH - Profiles list is unicode */
448 View->ProfilesList = ATB_wap_entry_list_create(WAP_PROFILES_LIST, MAX_PROFILES, PROFILENAME_MAX_LEN, TRUE); // ...profiles names list
449 View->object_id = parameter->object_id;
450 View->channel = WAP_CHANNEL_ID;
451 View->UIdata = UIdata;
452 View->ElementHeader = NULL; /* Element chain is as yet empty */
453 View->NextView = NULL;
454 View->browser_status = ATB_WAP_NO_STATUS; /* SPR#1547 - SH - Replaced 'status' with 'browser_status' */
455 View->CustSoftKeys = FALSE; /* Whether we have customised soft keys */
456
457 /* SPR#1816 - SH - Create entry lists. Now with unicode parameter */
458
459 View->Bookmarks = ATB_wap_entry_list_create(WAP_BOOKMARKS_LIST, MAX_BOOKMARKS, CARD_TITLE_MAX_LEN, TRUE);
460 View->BookmarksURL = ATB_wap_entry_list_create(WAP_URL_LIST, MAX_BOOKMARKS, URL_MAX_LEN, FALSE);
461 View->History = ATB_wap_entry_list_create(WAP_HISTORY_LIST, MAX_HISTORY, CARD_TITLE_MAX_LEN+NUMBER_PADDING, TRUE);
462 View->HistoryURL = ATB_wap_entry_list_create(WAP_URL_LIST, MAX_HISTORY, URL_MAX_LEN, FALSE);
463 View->cId = -1;
464
465 /* Check if WAP data exists */
466
467 if (!WapData)
468 {
469 WapData = (FlashDataWap *) AUI_wap_memory_alloc(sizeof(FlashDataWap)); // Allocate memory for flash data
470 WapProfilesData = (FlashDataWapProfiles *) AUI_wap_memory_alloc(sizeof(FlashDataWapProfiles)); // Allocate memory for profiles data
471
472 /* Default values are provided. If either of the files 'mmi/wapdata'
473 * or 'mmi/wapprof' aren't found, files are created with these defaults.
474 * The '0' size indicator indicates that one of the files was not present. */
475
476 if (flash_wap_read() == 0)
477 {
478 ATB_wap_profile_default_create();
479 }
480 }
481
482 View->ProfileId = WapData->ProfileId; // Default starting profile // Read in the current profile
483
484 if (View_header == NULL)
485 View_header = View; // This is the first entry
486 else
487 {
488 ViewIndex = View_header;
489 while (ViewIndex->NextView != NULL) // If not the last entry,
490 ViewIndex = ViewIndex->NextView; // find the next entry!
491 ViewIndex->NextView = View; // New entry is last entry in chain
492 }
493
494 Current_view = View;
495 ATB_wap_profile_names_read(View);
496 ATB_wap_profile_read(View, View->ProfileId);
497
498 M_MMI_WAP_NEW_VIEW_IND(parameter);
499
500 return View;
501 }
502
503 #else /* #ifdef FF_GPF_TCPIP */
504
505 T_WAP_VIEW* ATB_wap_new_view(T_MMI_WAP_NEW_VIEW_IND *parameter, void* UIdata)
506 {
507 T_WAP_VIEW *View;
508 T_WAP_VIEW *ViewIndex;
509
510 #ifdef TRACE_ATBWAPAUI
511 TRACE_FUNCTION("ATB_wap_new_view");
512 #endif
513
514 /* Create the view */
515
516 View = (T_WAP_VIEW *) AUI_wap_memory_alloc (sizeof(T_WAP_VIEW));
517
518 /* Allocate memory for two FFS files */
519
520 WapData = (FlashDataWap *) AUI_wap_memory_alloc(sizeof(FlashDataWap));
521 WapProfilesData = (FlashDataWapProfiles *) AUI_wap_memory_alloc(sizeof(FlashDataWapProfiles));
522
523 /* Allocate some arrays and lists */
524
525 View->URL = (char *)AUI_wap_memory_alloc ((URL_MAX_LEN+1)*sizeof(char));
526 View->Title = (USHORT *)AUI_wap_memory_alloc ((CARD_TITLE_MAX_LEN+1)*sizeof(USHORT));
527
528 /* Set up some default values */
529
530 View->cardWidth = WAP_SCREEN_WIDTH;
531 View->cardHeight = WAP_SCREEN_HEIGHT;
532 View->object_id = parameter->object_id;
533 View->channel = WAP_CHANNEL_ID;
534 View->UIdata = UIdata;
535 View->ElementHeader = NULL; /* Element chain is as yet empty */
536 View->NextView = NULL;
537 View->browser_status = ATB_WAP_NO_STATUS; /* Browser status is idle */
538 View->CustSoftKeys = FALSE; /* Whether we have customised soft keys */
539 View->cId = -1;
540
541 /* Create entry lists */
542
543 View->ProfilesList = ATB_wap_entry_list_create(WAP_PROFILES_LIST, MAX_PROFILES, PROFILENAME_MAX_LEN, TRUE);
544 View->Bookmarks = ATB_wap_entry_list_create(WAP_BOOKMARKS_LIST, MAX_BOOKMARKS, CARD_TITLE_MAX_LEN, TRUE);
545 View->BookmarksURL = ATB_wap_entry_list_create(WAP_URL_LIST, MAX_BOOKMARKS, URL_MAX_LEN, FALSE);
546 View->History = ATB_wap_entry_list_create(WAP_HISTORY_LIST, MAX_HISTORY, CARD_TITLE_MAX_LEN+NUMBER_PADDING, TRUE);
547 View->HistoryURL = ATB_wap_entry_list_create(WAP_URL_LIST, MAX_HISTORY, URL_MAX_LEN, FALSE);
548
549 /* Read in profile information from flash */
550
551 ATB_wap_profile_names_read(View);
552 ATB_wap_profile_read(View, View->ProfileId);
553 /* Add this view to the view chain */
554
555 if (View_header == NULL)
556 View_header = View; /* This is the first entry */
557 else
558 {
559 ViewIndex = View_header;
560 while (ViewIndex->NextView != NULL) /* If not the last entry, */
561 ViewIndex = ViewIndex->NextView; /* find the next entry! */
562 ViewIndex->NextView = View; /* New entry is last entry in chain */
563 }
564
565 Current_view = View;
566
567 /* Tell WAP Browser to create new view */
568
569 M_MMI_WAP_NEW_VIEW_IND(parameter);
570
571 return View;
572 }
573
574 #endif /* !#ifdef FF_GPF_TCPIP */
575
576 #ifdef FF_GPF_TCPIP
577 /*******************************************************************************
578
579 $Function: ATB_wap_new_view_invisible
580
581 $Description: Starts a new view that is not associated with a browser
582 SPR#2086 - SH - Added
583
584 $Returns: Pointer to the data structure of the new view
585
586 $Arguments: object_id - The object_id of the new view
587
588 *******************************************************************************/
589
590 T_WAP_VIEW* ATB_wap_new_view_invisible(UBYTE object_id)
591 {
592 T_WAP_VIEW *View = (T_WAP_VIEW *) AUI_wap_memory_alloc (sizeof(T_WAP_VIEW)); // Create the view
593 T_WAP_VIEW *ViewIndex;
594
595 #ifdef TRACE_ATBWAPAUI
596 TRACE_FUNCTION("ATB_wap_new_view_invisible");
597 #endif
598
599 memset((void *)View, 0, sizeof(T_WAP_VIEW));
600
601 /* Check if WAP data exists */
602
603 if (!WapData)
604 {
605 WapData = (FlashDataWap *) AUI_wap_memory_alloc(sizeof(FlashDataWap)); // Allocate memory for flash data
606 WapProfilesData = (FlashDataWapProfiles *) AUI_wap_memory_alloc(sizeof(FlashDataWapProfiles)); // Allocate memory for profiles data
607
608 /* Default values are provided. If either of the files 'mmi/wapdata'
609 * or 'mmi/wapprof' aren't found, files are created with these defaults.
610 * The '0' size indicator indicates that one of the files was not present. */
611
612 if (flash_wap_read() == 0)
613 {
614 ATB_wap_profile_default_create();
615 }
616 }
617
618 View->ProfileId = WapData->ProfileId; // Default starting profile
619 View->object_id = object_id;
620 View->channel = WAP_CHANNEL_ID;
621 View->browser_status = ATB_WAP_NO_STATUS;
622 View->cId = -1;
623 View->Title = (USHORT *)AUI_wap_memory_alloc ((CARD_TITLE_MAX_LEN+1)*sizeof(USHORT)); // Title of card
624
625
626 if (View_header == NULL)
627 View_header = View; /* This is the first entry */
628 else
629 {
630 ViewIndex = View_header;
631 while (ViewIndex->NextView != NULL) /* If not the last entry, */
632 ViewIndex = ViewIndex->NextView; /* find the next entry! */
633 ViewIndex->NextView = View; /* New entry is last entry in chain */
634 }
635
636 Current_view = View;
637
638 ATB_wap_profile_read(View, View->ProfileId); // Read in the current profile
639
640 return View;
641 }
642
643 #endif
644
645
646 /*******************************************************************************
647
648 $Function: ATB_wap_get_view
649
650 $Description: Returns a pointer to a view, given its object_id
651
652 $Returns: Pointer to the data structure of the specified view, or NULL if not found
653
654 $Arguments: object_id - the id of the view
655
656 *******************************************************************************/
657
658 T_WAP_VIEW* ATB_wap_get_view(UBYTE object_id)
659 {
660 T_WAP_VIEW *View = View_header;
661 UBYTE Index;
662
663 #ifdef TRACE_ATBWAPAUI
664 TRACE_FUNCTION("ATB_wap_get_view()");
665 #endif
666
667 if (!View_header)
668 {
669 return NULL;
670 }
671
672 /* SPR#1497 - SH - If object_id is 0, any view will do */
673
674 if (object_id==0)
675 return View;
676
677 /* Search for object_id */
678
679 for (Index = 0; View!=NULL && View->object_id!=object_id; Index++)
680 {
681 View = View->NextView;
682 }
683
684 return View;
685 }
686
687
688 #ifdef FF_GPF_TCPIP
689 /*******************************************************************************
690
691 $Function: ATB_wap_change_view
692
693 $Description: Change the view to the one specified
694 SPR#2086 - SH - Added
695
696 $Returns: None.
697
698 $Arguments: object_id - The identifier for the view
699
700 *******************************************************************************/
701
702 void ATB_wap_change_view(UBYTE object_id)
703 {
704 T_WAP_VIEW *View;
705
706 TRACE_FUNCTION("ATB_wap_change_view()");
707
708 if (!(View = ATB_wap_get_view(object_id)))
709 return;
710
711 Current_view = View;
712 AUI_wap_view_changed(View);
713
714 return;
715 }
716
717 #endif
718 /*******************************************************************************
719
720 $Function: ATB_wap_destroy
721
722 $Description: Destroys any open view. If no views are open, destroys the WAP
723 application by calling ATB_wap_terminate().
724
725 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
726
727 $Arguments: None.
728
729
730 *******************************************************************************/
731
732 #ifdef FF_GPF_TCPIP
733 T_WAP_RES ATB_wap_destroy()
734 {
735 T_MMI_WAP_CLOSE_VIEW_IND parameter1;
736 static T_MMI_WAP_TERMINATE_IND parameter2;
737 T_WAP_VIEW *ViewIndex;
738 T_WAP_VIEW *PrevView;
739
740 #ifdef TRACE_ATBWAPAUI
741 TRACE_FUNCTION("ATB_wap_destroy");
742 #endif
743 /* Destroys an open view each time it is called.
744 * if there are no open views, the WAP browser is terminated. */
745
746 /* Destroy the view chain.
747 * If views still exist, destroy the bottom one */
748
749 if (Current_view!=NULL) /*Until end of chain */
750 {
751 ViewIndex = View_header;
752 PrevView = NULL;
753
754 /* Find the next view, or go to the view header */
755
756 while (ViewIndex!=Current_view && ViewIndex!=NULL)
757 {
758 PrevView = ViewIndex;
759 ViewIndex = ViewIndex->NextView;
760 }
761
762 TRACE_EVENT_P2("Found current view as %X; previous view = %X", ViewIndex, PrevView);
763
764 if (ViewIndex==NULL)
765 {
766 TRACE_EVENT("**ERROR - cannot destroy view***");
767 return;
768 }
769
770 /* If we're at the view header, then there is no previous view */
771
772 if (ViewIndex==View_header)
773 {
774 View_header = View_header->NextView;
775 Current_view = View_header;
776 }
777 else
778 {
779 Current_view = PrevView;
780 Current_view->NextView = ViewIndex->NextView; /* Close gap in view chain */
781 }
782
783 TRACE_EVENT_P1("Current view is now %X", Current_view);
784
785 /* Notify MMI of new view */
786
787 AUI_wap_view_changed(Current_view);
788
789 parameter1.object_id = ViewIndex->object_id;
790
791 ATB_wap_entry_list_destroy(ViewIndex->ProfilesList); // Destroy profiles names list
792 ATB_wap_entry_list_destroy(ViewIndex->Bookmarks); // Destroy bookmarks
793 ATB_wap_entry_list_destroy(ViewIndex->BookmarksURL);
794 ATB_wap_entry_list_destroy(ViewIndex->History); // Destroy history list
795 ATB_wap_entry_list_destroy(ViewIndex->HistoryURL);
796
797 /* SPR#2086 - SH - Only delete memory that has been allocated */
798
799 if (ViewIndex->URL)
800 {
801 AUI_wap_memory_free ((UBYTE *)ViewIndex->URL, (URL_MAX_LEN+1)*sizeof(char)); // Delete URL string
802 }
803
804 if (ViewIndex->Title)
805 {
806 /* SPR#1816 - SH - Title is unicode */
807 AUI_wap_memory_free ((UBYTE *)ViewIndex->Title, (CARD_TITLE_MAX_LEN+1)*sizeof(USHORT)); // Delete card title
808 }
809
810 if (ViewIndex->ElementHeader)
811 {
812 ATB_wap_buffer_clear(ViewIndex); // Clear the element buffer
813 ViewIndex->ElementHeader = ViewIndex->NewElementHeader; // Just in case a new card is being created
814 ATB_wap_buffer_clear(ViewIndex); // Clear this too!
815 }
816
817 TRACE_EVENT_P1("Destroying view %X", ViewIndex);
818
819 AUI_wap_memory_free((UBYTE *)ViewIndex, sizeof(T_WAP_VIEW)); // Destroy the current entry
820
821 /* If the view is associated with a user agent, close that too */
822
823 if (parameter1.object_id<WAP_DOWNLOAD_VIEW)
824 {
825 M_MMI_WAP_CLOSE_VIEW_IND(&parameter1);
826 }
827 /* Otherwise, indicate this view is closed */
828
829 else
830 {
831 ATB_wap_close_view_done();
832 }
833
834 return WAP_OK;
835 }
836
837 else
838 {
839 /* SPR#1794 - SH - WAP data now split between two FFS files */
840 /* Destroy the RAM copy of the FFS data */
841
842 if (WapData)
843 {
844 AUI_wap_memory_free ((UBYTE *)WapData, sizeof(FlashDataWap));
845 WapData = NULL;
846 }
847
848 /* Destroy the RAM copy of the FFS profiles information */
849
850 if (WapProfilesData)
851 {
852 AUI_wap_memory_free ((UBYTE *)WapProfilesData, sizeof(FlashDataWapProfiles));
853 WapProfilesData = NULL;
854 }
855
856 View_header = NULL;
857 Current_view = NULL;
858
859 /* Shut down WAP Browser */
860
861 return ATB_wap_terminate(&parameter2);
862 }
863 }
864
865 #else /* #ifdef FF_GPF_TCPIP */
866
867 T_WAP_RES ATB_wap_destroy()
868 {
869 T_MMI_WAP_CLOSE_VIEW_IND parameter1;
870 static T_MMI_WAP_TERMINATE_IND parameter2;
871 T_WAP_VIEW *ViewIndex;
872 T_WAP_VIEW *NextView;
873
874 #ifdef TRACE_ATBWAPAUI
875 TRACE_FUNCTION("ATB_wap_destroy");
876 #endif
877
878 /* Destroy the view chain.
879 * If views still exist, destroy the bottom one */
880
881 if (View_header!=NULL) /* Until end of chain */
882 {
883 ViewIndex = View_header; /* Store the current entry pointer */
884 View_header = ViewIndex->NextView; /* Find the next entry */
885
886 parameter1.object_id = ViewIndex->object_id;
887
888 /* Destroy entry lists */
889
890 ATB_wap_entry_list_destroy(ViewIndex->ProfilesList);
891 ATB_wap_entry_list_destroy(ViewIndex->Bookmarks);
892 ATB_wap_entry_list_destroy(ViewIndex->BookmarksURL);
893 ATB_wap_entry_list_destroy(ViewIndex->History);
894 ATB_wap_entry_list_destroy(ViewIndex->HistoryURL);
895
896 /* Free strings */
897
898 AUI_wap_memory_free ((UBYTE *)ViewIndex->URL, (URL_MAX_LEN+1)*sizeof(char));
899 AUI_wap_memory_free ((UBYTE *)ViewIndex->Title, (CARD_TITLE_MAX_LEN+1)*sizeof(USHORT));
900
901 /* Clear the element buffer */
902
903 ATB_wap_buffer_clear(ViewIndex);
904
905 /* If a new card is being created, clear this too */
906
907 ViewIndex->ElementHeader = ViewIndex->NewElementHeader;
908 ATB_wap_buffer_clear(ViewIndex);
909
910 /* Free View memory */
911
912 AUI_wap_memory_free((UBYTE *)ViewIndex, sizeof(T_WAP_VIEW));
913
914 /* Tell WAP Browser to close the view */
915
916 M_MMI_WAP_CLOSE_VIEW_IND(&parameter1);
917
918 return WAP_OK;
919 }
920
921 else
922 {
923 /* Destroy the RAM copy of the FFS data */
924
925 if (WapData)
926 {
927 AUI_wap_memory_free ((UBYTE *)WapData, sizeof(FlashDataWap));
928 WapData = NULL;
929 }
930
931 /* Destroy the RAM copy of the FFS profiles information */
932
933 if (WapProfilesData)
934 {
935 AUI_wap_memory_free ((UBYTE *)WapProfilesData, sizeof(FlashDataWapProfiles));
936 WapProfilesData = NULL;
937 }
938
939 View_header = NULL;
940 Current_view = NULL;
941
942 /* Shut down WAP Browser */
943
944 return ATB_wap_terminate(&parameter2);
945 }
946 }
947
948 #endif /* !#ifdef FF_GPF_TCPIP */
949
950 /*******************************************************************************
951
952 $Function: ATB_wap_UIdata
953
954 $Description: Returns the UI pointer, for use by AUI
955
956 $Returns: The void pointer
957
958 $Arguments: None.
959
960 *******************************************************************************/
961
962 void * ATB_wap_UIdata()
963 {
964 if (View_header)
965 return View_header->UIdata;
966 else
967 return NULL;
968 }
969
970
971 /*******************************************************************************
972
973 $Function: ATB_wap_terminate
974
975 $Description: Closes the WAP application and frees all the memory allocated
976
977 $Returns: WAP_OK
978
979 $Arguments: parameter - see MMI_WAP_TERMINATE_IND
980
981 *******************************************************************************/
982
983 T_WAP_RES ATB_wap_terminate(T_MMI_WAP_TERMINATE_IND *parameter)
984 {
985 #ifdef TRACE_ATBWAPAUI
986 TRACE_FUNCTION("ATB_wap_terminate");
987 #endif
988
989 /* SPR#1850 - SH - No longer terminate call here */
990
991 M_MMI_WAP_TERMINATE_IND(parameter);
992
993 return WAP_OK;
994 }
995
996
997 /*******************************************************************************
998
999 $Function: ATB_wap_config_int
1000
1001 $Description: SPR#1921 - SH - Added
1002 Sends integer configuration information to the browser
1003
1004 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1005
1006 $Arguments: View - The current view
1007 param - ID of the configuration
1008 value - Integer value of the configuration
1009
1010 *******************************************************************************/
1011
1012 T_WAP_RES ATB_wap_config_int(T_WAP_VIEW *View, USHORT param, U32 value)
1013 {
1014 T_MMI_WAP_CONFIGURE_IND parameter;
1015 parameter.object_id = View->object_id;
1016 parameter.type = WAP_IntConfig;
1017 parameter.param = param;
1018 parameter.intvalue = value;
1019 parameter.strvalue = NULL;
1020 parameter.length = 0;
1021
1022 M_MMI_WAP_CONFIGURE_IND(&parameter);
1023
1024 return WAP_OK;
1025 }
1026
1027
1028 /*******************************************************************************
1029
1030 $Function: ATB_wap_config_str
1031
1032 $Description: SPR#1921 - SH - Added
1033 Sends string configuration information to the browser
1034
1035 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1036
1037 $Arguments: View - The current view
1038 param - ID of the configuration
1039 value - Integer value of the configuration
1040 string - String value of the configuration
1041 length - Length of the string value
1042
1043 *******************************************************************************/
1044
1045 T_WAP_RES ATB_wap_config_str(T_WAP_VIEW *View, USHORT param, char *string, U32 length)
1046 {
1047 T_MMI_WAP_CONFIGURE_IND parameter;
1048 parameter.object_id = View->object_id;
1049 parameter.type = WAP_StrConfig;
1050 parameter.param = param;
1051 parameter.intvalue = 0;
1052 parameter.strvalue = string;
1053 parameter.length = length;
1054
1055 M_MMI_WAP_CONFIGURE_IND(&parameter);
1056
1057 return WAP_OK;
1058 }
1059
1060
1061 /*******************************************************************************
1062
1063 $Function: ATB_wap_conn_config_int
1064
1065 $Description: SPR#1921 - SH - Added
1066 Sends integer configuration information to the browser
1067
1068 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1069
1070 $Arguments: View - The current view
1071 param - ID of the configuration
1072 value - Integer value of the configuration
1073
1074 *******************************************************************************/
1075
1076 T_WAP_RES ATB_wap_conn_config_int(T_WAP_VIEW *View, USHORT param, U32 value)
1077 {
1078 T_MMI_WAP_CONNECTION_CONFIGURE_IND parameter;
1079 parameter.object_id = View->object_id;
1080 parameter.type = WAP_IntConfig;
1081 parameter.channel_id = View->channel;
1082 parameter.param = param;
1083 parameter.intvalue = value;
1084 parameter.strvalue = NULL;
1085 parameter.length = 0;
1086
1087 M_MMI_WAP_CONNECTION_CONFIGURE_IND(&parameter);
1088
1089 return WAP_OK;
1090 }
1091
1092
1093 /*******************************************************************************
1094
1095 $Function: ATB_wap_conn_config_str
1096
1097 $Description: SPR#1921 - SH - Added
1098 Sends string configuration information to the browser
1099
1100 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1101
1102 $Arguments: View - The current view
1103 param - ID of the configuration
1104 value - Integer value of the configuration
1105 string - String value of the configuration
1106 length - Length of the string value
1107
1108 *******************************************************************************/
1109
1110 T_WAP_RES ATB_wap_conn_config_str(T_WAP_VIEW *View, USHORT param, char *string, U32 length)
1111 {
1112 T_MMI_WAP_CONNECTION_CONFIGURE_IND parameter;
1113 parameter.object_id = View->object_id;
1114 parameter.type = WAP_StrConfig;
1115 parameter.channel_id = View->channel;
1116 parameter.param = param;
1117 parameter.intvalue = 0;
1118 parameter.strvalue = string;
1119 parameter.length = length;
1120
1121 M_MMI_WAP_CONNECTION_CONFIGURE_IND(&parameter);
1122
1123 return WAP_OK;
1124 }
1125
1126
1127 /*******************************************************************************
1128
1129 $Function: ATB_wap_download_url
1130
1131 $Description: Requests the WAP browser to download a particular URL
1132
1133 $Returns: WAP_OK
1134
1135 $Arguments: View - The current view
1136 URL - The URL to download
1137 reload - TRUE if page is to be fetched from network, not cache.
1138
1139 *******************************************************************************/
1140
1141 T_WAP_RES ATB_wap_download_url(T_WAP_VIEW *View, char *URL, BOOL reload)
1142 {
1143 T_MMI_WAP_DOWNLOAD_URL_IND parameter;
1144
1145 #ifdef TRACE_ATBWAPAUI
1146 TRACE_FUNCTION("ATB_wap_download_url");
1147 #endif
1148
1149 parameter.object_id = View->object_id;
1150 parameter.Url = URL;
1151 parameter.url_length = (U32)(strlen(URL)+1);
1152 parameter.reload = reload;
1153 // Jun-08-2005 MMI-SPR-30291: Added patches from FG
1154 #ifdef FF_GPF_TCPIP
1155 parameter.view_height = View->cardHeight;
1156 parameter.view_width = View->cardWidth;
1157 #endif
1158 M_MMI_WAP_DOWNLOAD_URL_IND(&parameter);
1159
1160 return WAP_OK;
1161 }
1162
1163
1164 /*******************************************************************************
1165
1166 $Function: ATB_wap_stop_download
1167
1168 $Description: Requests the WAP browser to stop downloading a particular URL
1169
1170 $Returns: WAP_OK
1171
1172 $Arguments: View - the current view
1173
1174 *******************************************************************************/
1175
1176 T_WAP_RES ATB_wap_stop_download(T_WAP_VIEW *View)
1177 {
1178 T_MMI_WAP_BROWSE_CONTROL_IND parameter;
1179
1180 #ifdef TRACE_ATBWAPAUI
1181 TRACE_FUNCTION("ATB_wap_stop_download");
1182 #endif
1183
1184 parameter.object_id = View->object_id;
1185 parameter.browse_command = WAP_DOWNLOAD_STOP;
1186 M_MMI_WAP_BROWSE_CONTROL_IND(&parameter);
1187
1188 ATB_wap_status_change(View,ATB_WAP_NO_STATUS);
1189
1190 return WAP_OK;
1191 }
1192
1193
1194 /*******************************************************************************
1195
1196 $Function: ATB_wap_card_refresh
1197
1198 $Description: Requests the WAP browser to refresh the current card from the network
1199
1200 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1201
1202 $Arguments: View - the current view
1203
1204 *******************************************************************************/
1205
1206 T_WAP_RES ATB_wap_card_refresh(T_WAP_VIEW *View)
1207 {
1208 T_MMI_WAP_BROWSE_CONTROL_IND parameter;
1209
1210 #ifdef TRACE_ATBWAPAUI
1211 TRACE_FUNCTION("ATB_wap_card_refresh");
1212 #endif
1213
1214 parameter.object_id = View->object_id;
1215 parameter.browse_command = WAP_CARD_REFRESH;
1216 M_MMI_WAP_BROWSE_CONTROL_IND(&parameter);
1217
1218 return WAP_OK;
1219 }
1220
1221
1222 /*******************************************************************************
1223
1224 $Function: ATB_wap_card_display
1225
1226 $Description: Requests the WAP browser to redisplay a card held in the cache
1227
1228 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1229
1230 $Arguments: View - the current view
1231
1232 *******************************************************************************/
1233
1234 T_WAP_RES ATB_wap_card_display(T_WAP_VIEW *View)
1235 {
1236 T_MMI_WAP_BROWSE_CONTROL_IND parameter;
1237
1238 #ifdef TRACE_ATBWAPAUI
1239 TRACE_FUNCTION("ATB_wap_card_display");
1240 #endif
1241
1242 parameter.object_id = View->object_id;
1243 parameter.browse_command = WAP_CARD_DISPLAY;
1244 M_MMI_WAP_BROWSE_CONTROL_IND(&parameter);
1245
1246 return WAP_OK;
1247 }
1248
1249
1250 /*******************************************************************************
1251
1252 $Function: ATB_wap_card_go_back
1253
1254 $Description: Requests the WAP browser to go to the previous card
1255
1256 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1257
1258 $Arguments: View - the current view
1259
1260 *******************************************************************************/
1261
1262 T_WAP_RES ATB_wap_card_go_back(T_WAP_VIEW *View)
1263 {
1264 T_MMI_WAP_BROWSE_CONTROL_IND parameter;
1265
1266 #ifdef TRACE_ATBWAPAUI
1267 TRACE_FUNCTION("ATB_wap_card_go_back");
1268 #endif
1269
1270 parameter.object_id = View->object_id;
1271 parameter.browse_command = WAP_CARD_GO_BACK;
1272 M_MMI_WAP_BROWSE_CONTROL_IND(&parameter);
1273
1274 return WAP_OK;
1275 }
1276
1277
1278 /*******************************************************************************
1279
1280 $Function: ATB_wap_card_key_event
1281
1282 $Description: Requests the WAP browser react to a key event, up/down etc.
1283
1284 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1285
1286 $Arguments: View - the current view
1287 keyType - the type of key selected
1288
1289 *******************************************************************************/
1290
1291 T_WAP_RES ATB_wap_card_key_event(T_WAP_VIEW *View, WAP_CONTROL_TYPES keyType)
1292 {
1293 T_MMI_WAP_BROWSE_CONTROL_IND command;
1294 T_MMI_WAP_DRAW_CARD_REQ current_card;
1295
1296 #ifdef TRACE_ATBWAPAUI
1297 TRACE_FUNCTION("ATB_wap_card_key_event");
1298 #endif
1299
1300 #ifdef FF_GPF_TCPIP
1301 // xreddymn Jun-28-2005 MMI-SPR-32467
1302 ATB_animated_GIF_clear();
1303 #endif
1304
1305 command.object_id = View->object_id;
1306 command.browse_command = keyType;
1307 M_MMI_WAP_BROWSE_CONTROL_IND(&command);
1308
1309 /* For select, need to redraw card in order to update changed elements */
1310
1311 if (keyType == WAP_KEY_SELECT)
1312 {
1313 current_card.object_id = View->object_id;
1314 M_MMI_WAP_DRAW_CARD_REQ(&current_card);
1315 }
1316
1317 return WAP_OK;
1318 }
1319
1320
1321 /*******************************************************************************
1322
1323 $Function: ATB_wap_key_selected
1324
1325 $Description: Send the id of the selected WAP key to the AUS browser.
1326
1327 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1328
1329 $Arguments: View - the current view
1330 keyId - Key identifier
1331
1332 *******************************************************************************/
1333
1334 T_WAP_RES ATB_wap_key_selected(T_WAP_VIEW *View, USHORT keyId)
1335 {
1336
1337 T_MMI_WAP_KEY_SELECTED_IND parameter;
1338
1339 #ifdef TRACE_ATBWAPAUI
1340 TRACE_FUNCTION("ATB_wap_key_selected");
1341 #endif
1342
1343 parameter.object_id = View->object_id;
1344 parameter.keyId = keyId;
1345 M_MMI_WAP_KEY_SELECTED_IND(&parameter);
1346
1347 return WAP_OK;
1348 }
1349
1350
1351 /*******************************************************************************
1352
1353 $Function: ATB_wap_card scroll
1354
1355 $Description: Scroll to a y position on the current card
1356
1357 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1358
1359 $Arguments: View - the current view
1360 scrollPos - Y position on card to which to scroll
1361
1362 *******************************************************************************/
1363
1364 T_WAP_RES ATB_wap_card_scroll(T_WAP_VIEW *View, SHORT scrollPos)
1365 {
1366 T_MMI_WAP_BROWSE_CONTROL_IND parameter;
1367
1368 /* Make sure the scroll destination is on the card */
1369
1370 if (scrollPos > (View->cardHeight-WAP_SCREEN_HEIGHT))
1371 scrollPos = View->cardHeight-WAP_SCREEN_HEIGHT;
1372
1373 if (scrollPos<0)
1374 scrollPos = 0;
1375
1376 /* Send the event */
1377
1378 parameter.object_id = View->object_id;
1379 parameter.browse_command = WAP_KEY_SCROLL;
1380 parameter.browse_parameter = (USHORT)scrollPos;
1381
1382 M_MMI_WAP_BROWSE_CONTROL_IND(&parameter);
1383
1384 return WAP_OK;
1385 }
1386
1387
1388 /*******************************************************************************
1389
1390 $Function: ATB_wap_input_dialog_closed
1391
1392 $Description: Provides the answer of an input dialog.
1393
1394 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1395
1396 $Arguments: parameter - Dialog confirmation information
1397
1398 *******************************************************************************/
1399
1400 T_WAP_RES ATB_wap_input_dialog_closed(T_MMI_WAP_INPUT_DIALOG_CNF *parameter)
1401 {
1402 T_MMI_WAP_DRAW_CARD_REQ current_card;
1403
1404 #ifdef TRACE_ATBWAPAUI
1405 TRACE_FUNCTION("ATB_wap_input_dialog_closed");
1406 #endif
1407
1408 M_MMI_WAP_INPUT_DIALOG_CNF(parameter);
1409 current_card.object_id = parameter->object_id;
1410 M_MMI_WAP_DRAW_CARD_REQ(&current_card);
1411
1412 return WAP_OK;
1413 }
1414
1415
1416 /*******************************************************************************
1417
1418 $Function: ATB_wap_password_dialog_closed
1419
1420 $Description: Provides the answer of a password dialog.
1421
1422 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1423
1424 $Arguments: parameter - Dialog confirmation information
1425
1426 *******************************************************************************/
1427
1428 T_WAP_RES ATB_wap_password_dialog_closed(T_MMI_WAP_PASSWORD_DIALOG_CNF *parameter)
1429 {
1430 #ifdef TRACE_ATBWAPAUI
1431 TRACE_FUNCTION("ATB_wap_password_dialog_closed");
1432 #endif
1433
1434 M_MMI_WAP_PASSWORD_DIALOG_CNF(parameter);
1435
1436 return WAP_OK;
1437 }
1438
1439
1440 /*******************************************************************************
1441
1442 $Function: ATB_wap_confirm_dialog_closed
1443
1444 $Description: Provides the answer of a confirmation dialog.
1445
1446 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1447
1448 $Arguments: parameter - Dialog confirmation information
1449
1450 *******************************************************************************/
1451
1452 T_WAP_RES ATB_wap_confirm_dialog_closed(T_MMI_WAP_CONFIRM_DIALOG_CNF *parameter)
1453 {
1454 #ifdef TRACE_ATBWAPAUI
1455 TRACE_FUNCTION("ATB_wap_confirm_dialog_closed");
1456 #endif
1457
1458 M_MMI_WAP_CONFIRM_DIALOG_CNF(parameter);
1459
1460 return WAP_OK;
1461 }
1462
1463
1464 /*******************************************************************************
1465
1466 $Function: ATB_wap_info_dialog_closed
1467
1468 $Description: Provides the answer of an info dialog.
1469
1470 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1471
1472 $Arguments: parameter - Dialog confirmation information
1473
1474 *******************************************************************************/
1475
1476 T_WAP_RES ATB_wap_info_dialog_closed(T_MMI_WAP_INFO_DIALOG_CNF *parameter)
1477 {
1478 #ifdef TRACE_ATBWAPAUI
1479 TRACE_FUNCTION("ATB_wap_info_dialog_closed");
1480 #endif
1481
1482 M_MMI_WAP_INFO_DIALOG_CNF(parameter);
1483
1484 return WAP_OK;
1485 }
1486
1487
1488 /*******************************************************************************
1489
1490 $Function: ATB_wap_options_menu_select
1491
1492 $Description: The AUI will notify to the WAP.ATB the id of the selected item
1493
1494 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
1495
1496 $Arguments: View - the current view
1497
1498 *******************************************************************************/
1499
1500 T_WAP_RES ATB_wap_options_menu_select(T_WAP_VIEW *View)
1501 {
1502 #ifdef TRACE_ATBWAPAUI
1503 TRACE_FUNCTION("ATB_wap_options_menu_select");
1504 #endif
1505
1506 ATB_wap_card_key_event(View, WAP_KEY_SELECT);
1507
1508 return WAP_OK;
1509 }
1510
1511
1512 /*******************************************************************************
1513
1514 $Function: ATB_wap_buffer_add_element
1515
1516 $Description: Add a new element to the element chain
1517
1518 $Returns: Pointer to the element
1519
1520 $Arguments: SPR#1721 - SH - Modified parameters slightly
1521 View - the current view
1522 type - the type of element (text, fieldset, image)
1523
1524 *******************************************************************************/
1525
1526 T_WAP_ELEMENT * ATB_wap_buffer_add_element(T_WAP_VIEW *View, WAP_ELEMENT_TYPE type)
1527 {
1528 T_WAP_ELEMENT *Element;
1529 T_WAP_ELEMENT *ElementIndex;
1530 static USHORT elementCount = 0;
1531
1532 #ifdef TRACE_ATBWAPAUI
1533 TRACE_FUNCTION("ATB_wap_buffer_add_element");
1534 #endif
1535
1536 if (!View)
1537 return;
1538
1539 /* Create the element */
1540
1541 Element = (T_WAP_ELEMENT *)AUI_wap_memory_alloc(sizeof(T_WAP_ELEMENT));
1542
1543 /* If it's the first element in the chain, it forms the element chain header */
1544
1545 if (View->NewElementHeader == NULL)
1546 {
1547 View->NewElementHeader = Element;
1548 elementCount = 0;
1549 }
1550
1551 /* Otherwise, find its place in the chain and add it */
1552
1553 else
1554 {
1555 ElementIndex = View->NewElementHeader;
1556 while(ElementIndex->NextElement !=NULL)
1557 ElementIndex = ElementIndex->NextElement;
1558 ElementIndex->NextElement = Element;
1559 }
1560
1561 Element->type = type;
1562 Element->NextElement = NULL;
1563
1564 elementCount++;
1565
1566 return Element;
1567 }
1568
1569 // xreddymn Jun-28-2005 MMI-SPR-32467
1570 // Implementation for animated GIF image handling
1571
1572 #ifdef FF_GPF_TCPIP
1573
1574 // If value of WAP_MAX_ANIMATED_GIFS is changed, make sure
1575 // that ATB_animated_GIF_image_CB_list is also updated and
1576 // callbacks are added or removed as required.
1577
1578 #define WAP_MAX_ANIMATED_GIFS 8
1579
1580 // Structure that stores details about an animated GIF image
1581 typedef struct
1582 {
1583 T_WAP_MMI_SEND_IMAGE_IND *image_ind; // Pointer to image indication received from WAP adapter
1584 T_MFW_HND timer_handle; // Handle to timer created to animate the GIF image
1585 UBYTE disposal; // Disposal method for the current frame
1586 UBYTE frame; // Currently displayed frame number (1 to n_frames)
1587 UBYTE n_frames; // Total number of frames in the animation
1588 S16 x;
1589 S16 y;
1590 S16 width;
1591 S16 height;
1592 void *pGIFInfo;
1593
1594 } WAP_animated_GIF_image;
1595
1596 WAP_animated_GIF_image WAP_animated_GIF_images[WAP_MAX_ANIMATED_GIFS];
1597 S16 n_WAP_animated_GIF_elements = 0;
1598
1599 #include "mfw_tim.h"
1600 #include "mfw_win.h"
1601
1602 extern UBYTE wapmic_GIF_convert(void *pInfo, int frame, T_WAP_MMI_SEND_IMAGE_IND *input, T_WAP_MMI_SEND_IMAGE_IND *output, int *n_frames, UBYTE *delay, UBYTE *disposal);
1603 extern void wapmic_GIF_close_decoder(void *data);
1604 extern void *wapmic_GIF_open_decoder(void *data, int size);
1605
1606 extern T_MFW_HND AUI_wap_get_win(void);
1607 extern void ATB_animated_GIF_image_CB (int index, T_MFW_EVENT event, MfwTim *tc);
1608 extern U32 mfwCheckMemoryLeft(void);
1609 extern U32 wapmicCheckMemoryLeft(void);
1610 extern void AUI_wap_restore_background(S32 x1, S32 y1, S32 x2, S32 y2);
1611
1612 void WAP_FFS_log_message(char *s, int len);
1613
1614 /*******************************************************************************
1615
1616 $Function: ATB_animated_GIF_image_X_CB
1617
1618 $Description: Callback functions to handle animated image timer expiries.
1619
1620 $Returns: None.
1621
1622 $Arguments: event = MFW event structure
1623 tc = pointer to MFW timer element
1624
1625 *******************************************************************************/
1626
1627 void ATB_animated_GIF_image_0_CB (T_MFW_EVENT event, MfwTim *tc)
1628 {
1629 ATB_animated_GIF_image_CB(0, event, tc);
1630 }
1631
1632 void ATB_animated_GIF_image_1_CB (T_MFW_EVENT event, MfwTim *tc)
1633 {
1634 ATB_animated_GIF_image_CB(1, event, tc);
1635 }
1636
1637 void ATB_animated_GIF_image_2_CB (T_MFW_EVENT event, MfwTim *tc)
1638 {
1639 ATB_animated_GIF_image_CB(2, event, tc);
1640 }
1641
1642 void ATB_animated_GIF_image_3_CB (T_MFW_EVENT event, MfwTim *tc)
1643 {
1644 ATB_animated_GIF_image_CB(3, event, tc);
1645 }
1646
1647 void ATB_animated_GIF_image_4_CB (T_MFW_EVENT event, MfwTim *tc)
1648 {
1649 ATB_animated_GIF_image_CB(4, event, tc);
1650 }
1651
1652 void ATB_animated_GIF_image_5_CB (T_MFW_EVENT event, MfwTim *tc)
1653 {
1654 ATB_animated_GIF_image_CB(5, event, tc);
1655 }
1656
1657 void ATB_animated_GIF_image_6_CB (T_MFW_EVENT event, MfwTim *tc)
1658 {
1659 ATB_animated_GIF_image_CB(6, event, tc);
1660 }
1661
1662 void ATB_animated_GIF_image_7_CB (T_MFW_EVENT event, MfwTim *tc)
1663 {
1664 ATB_animated_GIF_image_CB(7, event, tc);
1665 }
1666
1667 // Array of callback functions
1668 void (*ATB_animated_GIF_image_CB_list[WAP_MAX_ANIMATED_GIFS]) (T_MFW_EVENT event, MfwTim *tc) =
1669 {
1670 ATB_animated_GIF_image_0_CB,
1671 ATB_animated_GIF_image_1_CB,
1672 ATB_animated_GIF_image_2_CB,
1673 ATB_animated_GIF_image_3_CB,
1674 ATB_animated_GIF_image_4_CB,
1675 ATB_animated_GIF_image_5_CB,
1676 ATB_animated_GIF_image_6_CB,
1677 ATB_animated_GIF_image_7_CB,
1678 };
1679
1680 /*******************************************************************************
1681
1682 $Function: ATB_animated_GIF_image_CB
1683
1684 $Description: Common callback function to handle animated image timer expiries.
1685
1686 $Returns: None.
1687
1688 $Arguments: index = When there is more than one animated GIF image being
1689 displayed, index is used to identify each image.
1690 event = MFW event structure
1691 tc = pointer to MFW timer element
1692
1693 *******************************************************************************/
1694
1695 void ATB_animated_GIF_image_CB (int index, T_MFW_EVENT event, MfwTim *tc)
1696 {
1697 T_WAP_MMI_SEND_IMAGE_IND converted_image;
1698 UBYTE delay;
1699 UBYTE disposal;
1700
1701 if(WAP_animated_GIF_images[index].frame == WAP_animated_GIF_images[index].n_frames)
1702 {
1703 WAP_animated_GIF_images[index].frame = 1;
1704 }
1705 else
1706 {
1707 WAP_animated_GIF_images[index].frame++;
1708 }
1709 // TRACE_EVENT_P1("\nATB_animated_GIF_image_CB, disposal = %d", WAP_animated_GIF_images[index].disposal);
1710 if((WAP_animated_GIF_images[index].disposal == 2) || (WAP_animated_GIF_images[index].disposal == 3))
1711 {
1712 AUI_wap_restore_background(WAP_animated_GIF_images[index].x,
1713 WAP_animated_GIF_images[index].y,
1714 WAP_animated_GIF_images[index].x + WAP_animated_GIF_images[index].width,
1715 WAP_animated_GIF_images[index].y + WAP_animated_GIF_images[index].height);
1716 }
1717 if(wapmic_GIF_convert(WAP_animated_GIF_images[index].pGIFInfo, WAP_animated_GIF_images[index].frame, WAP_animated_GIF_images[index].image_ind, &converted_image, NULL, &delay, &disposal))
1718 {
1719 WAP_animated_GIF_images[index].x = converted_image.pX + WAP_LEFT_BORDER;
1720 WAP_animated_GIF_images[index].y = converted_image.pY + WAP_TOP_BORDER;
1721 WAP_animated_GIF_images[index].width = converted_image.pWidth;
1722 WAP_animated_GIF_images[index].height = converted_image.pHeight;
1723 converted_image.bmpFormat = BMP_FORMAT_16BIT_LCD_COLOUR;
1724 if (ATB_wap_profile_setting(WAP_STATUS_SCALEIMAGES)) // Image is to be scaled
1725 {
1726 ATB_wap_buffer_image_scale((T_WAP_MMI_SEND_IMAGE_IND *)&converted_image);
1727 }
1728 else
1729 {
1730 ATB_wap_buffer_image_display((T_WAP_MMI_SEND_IMAGE_IND *)&converted_image);
1731 }
1732 micFree(converted_image.Image);
1733 WAP_animated_GIF_images[index].disposal = disposal;
1734 timSetTime(WAP_animated_GIF_images[index].timer_handle, delay * 10);
1735 timStart(WAP_animated_GIF_images[index].timer_handle);
1736 }
1737 else
1738 {
1739 timStop(WAP_animated_GIF_images[n_WAP_animated_GIF_elements].timer_handle);
1740 timDelete(WAP_animated_GIF_images[n_WAP_animated_GIF_elements].timer_handle);
1741 }
1742 }
1743
1744 /*******************************************************************************
1745
1746 $Function: ATB_animated_GIF_clear
1747
1748 $Description: Stops all animating images, image data is not released by this
1749 function. Image data is released when LEa_freeObject is called
1750 by the browser.
1751
1752 $Returns: None.
1753
1754 $Arguments: None.
1755
1756 *******************************************************************************/
1757
1758 void ATB_animated_GIF_clear(void)
1759 {
1760 S16 i;
1761 for(i = 0; i < n_WAP_animated_GIF_elements; i++)
1762 {
1763 timStop(WAP_animated_GIF_images[i].timer_handle);
1764 timDelete(WAP_animated_GIF_images[i].timer_handle);
1765 wapmic_GIF_close_decoder(WAP_animated_GIF_images[i].pGIFInfo);
1766 }
1767 n_WAP_animated_GIF_elements = 0;
1768 }
1769
1770 /*******************************************************************************
1771
1772 $Function: ATB_animate_GIF_image
1773
1774 $Description: Called after displaying the first frame of a GIF image, this
1775 function will start a timer to animate the image. It also adds
1776 the image details to the WAP_animated_GIF_images array.
1777
1778 $Returns: None.
1779
1780 $Arguments: image_ind = Image indication containing details of the input
1781 GIF image
1782 delay = duration after which the first frame must be removed
1783 disposal = disposal method to use for the first frame
1784 n_frames = Total number of frames (this is obtained when
1785 the first frame is decoded)
1786
1787 *******************************************************************************/
1788
1789 void ATB_animate_GIF_image(void *pGIFInfo, S16 x, S16 y, S16 width, S16 height, T_WAP_MMI_SEND_IMAGE_IND *image_ind, UBYTE delay, UBYTE disposal, UBYTE n_frames)
1790 {
1791 T_MFW_HND wap_win;
1792 S16 i;
1793
1794 for(i = 0; i < n_WAP_animated_GIF_elements; i++)
1795 {
1796 if(WAP_animated_GIF_images[i].image_ind == image_ind)
1797 {
1798 return;
1799 }
1800 }
1801 wap_win=AUI_wap_get_win();//mfwParent(mfwHeader());
1802 if(!wap_win) return;
1803 if(n_WAP_animated_GIF_elements < (WAP_MAX_ANIMATED_GIFS-1))
1804 {
1805 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].timer_handle = timCreate(wap_win, delay * 10, (MfwCb)ATB_animated_GIF_image_CB_list[n_WAP_animated_GIF_elements]);
1806 if(WAP_animated_GIF_images[n_WAP_animated_GIF_elements].timer_handle)
1807 {
1808 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].pGIFInfo = pGIFInfo;
1809 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].image_ind = image_ind;
1810 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].disposal = disposal;
1811 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].frame = 1;
1812 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].n_frames = n_frames;
1813 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].x=x+WAP_LEFT_BORDER;
1814 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].y=y+WAP_TOP_BORDER;
1815 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].width=width;
1816 WAP_animated_GIF_images[n_WAP_animated_GIF_elements].height=height;
1817 timStart(WAP_animated_GIF_images[n_WAP_animated_GIF_elements].timer_handle);
1818 n_WAP_animated_GIF_elements++;
1819 }
1820 }
1821 }
1822
1823 #endif // FF_GPF_TCPIP
1824
1825 /*******************************************************************************
1826
1827 $Function: ATB_wap_buffer_display
1828
1829 $Description: Displays the card from the buffer
1830
1831 $Returns: None.
1832
1833 $Arguments: View - the current view
1834
1835 *******************************************************************************/
1836
1837 void ATB_wap_buffer_display(T_WAP_VIEW *View)
1838 {
1839 T_WAP_ELEMENT *Element = View->ElementHeader;
1840 USHORT elementCount = 0; /* No. of element */
1841 SHORT titleX; /* Position of title to centre it */
1842 SHORT titleWidth; /* Width of the title in pixels */
1843 double doubleTemp; /* Temporary double value */
1844 SHORT scrollBarSize; /* Size of scroll bar in pixels */
1845 SHORT scrollBarPos; /* Y position of top of scroll bar */
1846 SHORT lineX; /* First X position of line */
1847 SHORT lineY; /* First Y position of line */
1848 USHORT *temp; /* Temporary storage for text strings */
1849 UBYTE scrollIndex; /* For drawing scrollbar */
1850 USHORT titleLen; /* Length of title */
1851
1852 #ifdef FF_GPF_TCPIP
1853 // xreddymn Jun-28-2005 MMI-SPR-32467
1854 T_WAP_MMI_SEND_IMAGE_IND *image_ind;
1855 T_WAP_MMI_SEND_IMAGE_IND converted_image;
1856 UBYTE delay;
1857 UBYTE disposal;
1858 int n_frames;
1859 SHORT dx, dy;
1860 #endif // FF_GPF_TCPIP
1861
1862 #ifdef TRACE_ATBWAPAUI
1863 TRACE_FUNCTION("ATB_wap_buffer_display");
1864 #endif
1865
1866 #ifdef FF_GPF_TCPIP
1867 // xreddymn Jun-28-2005 MMI-SPR-32467
1868 ATB_animated_GIF_clear();
1869 #endif // FF_GPF_TCPIP
1870
1871 /* Display the title of the card, centred, over the line */
1872
1873 temp = (USHORT *)AUI_wap_memory_alloc((CARD_TITLE_MAX_LEN+1)*sizeof(USHORT));
1874 /* SPR#1816 - SH - Obtain card title in MMI unicode */
1875
1876 if (ATB_wap_status_get(View, ATB_WAP_DOWNLOADING))
1877 {
1878 /* Card is downloading */
1879 titleLen = AUI_wap_stringID(temp, CARD_TITLE_MAX_LEN, WAP_STRING_DOWNLOADING);
1880 }
1881 else if (ATB_wap_status_get(View, ATB_WAP_CARD_READING))
1882 {
1883 /* Card is updating */
1884 titleLen = AUI_wap_stringID(temp, CARD_TITLE_MAX_LEN, WAP_STRING_UPDATING);
1885 }
1886 else
1887 {
1888 /* Normal card title */
1889 titleLen = ATB_uc_text_copy(temp, View->Title, CARD_TITLE_MAX_LEN);
1890 }
1891
1892 titleWidth = ATB_uc_text_width(temp, titleLen); /* Width of the title */
1893 titleX = (WAP_TOTAL_WIDTH - titleWidth)/2; /* Position of title to centre it */
1894 dspl_TextOut(titleX,0,DSPL_TXTATTR_SIGNED_COORDS | DSPL_TXTATTR_UNICODE, (char *)temp);
1895
1896 AUI_wap_memory_free((UBYTE *)temp, (CARD_TITLE_MAX_LEN+1)*sizeof(USHORT));
1897
1898 /* Horizontal scroll bar and top line */
1899
1900 dspl_DrawLine(titleX-2, WAP_TOP_BORDER/2, 0, WAP_TOP_BORDER/2); /* Line to left of title */
1901 dspl_DrawLine(WAP_TOTAL_WIDTH-titleX+1, WAP_TOP_BORDER/2,
1902 WAP_TOTAL_WIDTH-WAP_VSCROLLBAR_WIDTH, WAP_TOP_BORDER/2); /* Line to right of title */
1903
1904 if (View->cardWidth>WAP_SCREEN_WIDTH)
1905 {
1906 doubleTemp = WAP_HSCROLLBAR_WIDTH*(double)WAP_SCREEN_WIDTH/(double)View->cardWidth;
1907 scrollBarSize = (SHORT)(doubleTemp+0.5); /* Round to nearest int */
1908 if (scrollBarSize>WAP_HSCROLLBAR_WIDTH)
1909 scrollBarSize = WAP_HSCROLLBAR_WIDTH;
1910
1911 doubleTemp = WAP_HSCROLLBAR_WIDTH*(double)View->cardXPosition/(double)View->cardWidth;
1912 scrollBarPos = (SHORT)(doubleTemp+0.5); /* Round to nearest int */
1913
1914 for (scrollIndex=0; scrollIndex<scrollBarSize; scrollIndex++)
1915 {
1916 dspl_DrawLine(scrollBarPos+scrollIndex, 0,
1917 scrollBarPos+scrollIndex, WAP_TOP_BORDER/2);
1918 }
1919
1920 if (WAP_HSCROLLBAR_WIDTH<(titleX-1))
1921 dspl_DrawLine( WAP_HSCROLLBAR_WIDTH, 0, WAP_HSCROLLBAR_WIDTH, WAP_TOP_BORDER/2);
1922 }
1923 #ifdef FF_GPF_TCPIP
1924 //xrashmic 21 Jan, 2005 MMI-SPR-28223
1925 pluginImageDisplayed=FALSE;
1926 #endif
1927 /* Display the elements of the card one by one */
1928 while (Element!=NULL)
1929 {
1930 switch(Element->type)
1931 {
1932 case WAP_TEXT:
1933 /* Text Element */
1934 ATB_wap_buffer_text_draw((T_WAP_MMI_SEND_TEXT_IND *)Element->data);
1935 break;
1936
1937
1938 //kyle 29 Jun, 2005 MMI-SPR-32462
1939 case WAP_BORDER:
1940 #ifdef FF_GPF_TCPIP
1941 ATB_wap_buffer_border_draw((T_WAP_MMI_DRAW_BORDER_IND *)Element->data);
1942 #endif
1943 break;
1944
1945
1946 case WAP_TABLE:
1947 /* Table/Fieldset element */
1948 ATB_wap_buffer_table_draw((T_WAP_MMI_SEND_TABLE_IND *)Element->data);
1949 break;
1950 case WAP_IMAGE:
1951 /* Image element */
1952 #ifdef FF_GPF_TCPIP
1953 case WAP_PLUGIN_IMAGE://xrashmic 21 Jan, 2005 MMI-SPR-28223
1954 //xrashmic 21 Jan, 2005 MMI-SPR-28223
1955 //When there is a plugin image, we disable scroll. Storing this info in pluginImageDisplayed
1956 if(Element->type==WAP_IMAGE)
1957 pluginImageDisplayed=FALSE;
1958 else
1959 pluginImageDisplayed=TRUE;
1960 #endif
1961 // xreddymn Jun-28-2005 MMI-SPR-32467: Handling of GIF images
1962 #ifdef FF_GPF_TCPIP
1963 image_ind = Element->data;
1964 if(!image_ind) break;
1965 if((image_ind->image_length > 2) && (strncmp((char*)image_ind->Image, "GIF", 3) == 0))
1966 {
1967 void *pGIFInfo;
1968
1969 converted_image = *image_ind;
1970 pGIFInfo = wapmic_GIF_open_decoder(image_ind->Image, image_ind->image_length);
1971 if(wapmic_GIF_convert(pGIFInfo, 1, image_ind, &converted_image, &n_frames, &delay, &disposal))
1972 {
1973 // TRACE_EVENT_P2("GIF image converted (%d, %d)",converted_image.pWidth, converted_image.pHeight);
1974 // TRACE_EVENT_P3("GIF frames=%d, delay=%d, disposal=%d",n_frames, delay, disposal);
1975 // TRACE_EVENT_P1("GIF URL = %s", wapmic_image_URL(image_ind->ImageReq));
1976 converted_image.bmpFormat = BMP_FORMAT_16BIT_LCD_COLOUR;
1977 if (ATB_wap_profile_setting(WAP_STATUS_SCALEIMAGES)) // Image is to be scaled
1978 {
1979 ATB_wap_buffer_image_scale((T_WAP_MMI_SEND_IMAGE_IND *)&converted_image);
1980 }
1981 else
1982 {
1983 ATB_wap_buffer_image_display((T_WAP_MMI_SEND_IMAGE_IND *)&converted_image);
1984 }
1985 micFree(converted_image.Image);
1986 if(n_frames > 1)
1987 {
1988 if((converted_image.pX >= 0) &&
1989 ((converted_image.pX + converted_image.pWidth - 1) < (WAP_LEFT_BORDER + WAP_SCREEN_WIDTH - 1)) &&
1990 (converted_image.pY >= 0) &&
1991 ((converted_image.pY + converted_image.pHeight - 1) < (WAP_TOP_BORDER + WAP_SCREEN_HEIGHT - 1)))
1992 {
1993 ATB_animate_GIF_image(pGIFInfo, converted_image.pX, converted_image.pY, converted_image.pWidth, converted_image.pHeight,
1994 image_ind, delay, disposal, n_frames);
1995 }
1996 else if(image_ind->pluginImage)
1997 {
1998 ATB_animate_GIF_image(pGIFInfo, converted_image.pX, converted_image.pY, converted_image.pWidth, converted_image.pHeight,
1999 image_ind, delay, disposal, n_frames);
2000 }
2001 }
2002 // Sep 06 2005 REF: MMI-SPR-34048 x0012849
2003 //The ? symbol is appeared for pictures with single frame because decoder is not closed at all and after
2004 // few instances of deocder are opened, trying to open further will result in memory error.
2005 // To avoid this close the decoder each time its opened
2006 else
2007 {
2008 wapmic_GIF_close_decoder(pGIFInfo);
2009 }
2010 }
2011 else
2012 {
2013 USHORT elementX1, elementY1, elementX2, elementY2;
2014 elementX1 = (USHORT)image_ind->pX+WAP_LEFT_BORDER;
2015 elementY1 = (USHORT)image_ind->pY+WAP_TOP_BORDER;
2016 if(image_ind->pWidth < 14)
2017 {
2018 elementX2 = (USHORT)14 + elementX1 - 1;
2019 }
2020 else
2021 {
2022 elementX2 = (USHORT)image_ind->pWidth + elementX1 - 1;
2023 }
2024 if(image_ind->pHeight < 14)
2025 {
2026 elementY2 = (USHORT)14 + elementY1 - 1;
2027 }
2028 else
2029 {
2030 elementY2 = (USHORT)image_ind->pHeight + elementY1 - 1;
2031 }
2032 dspl_DrawRect(elementX1,elementY1, elementX2, elementY2);
2033 dspl_TextOut(elementX1 + 6, elementY1 + 0, DSPL_TXTATTR_SIGNED_COORDS, "?");
2034 }
2035 }
2036 else
2037 #endif // FF_GPF_TCPIP
2038 {
2039 #ifdef FF_GPF_TCPIP
2040 ((T_WAP_MMI_SEND_IMAGE_IND *)Element->data)->transparency_flag = 0;
2041 #endif
2042 #ifdef FF_GPF_TCPIP
2043 if (ATB_wap_profile_setting(WAP_STATUS_SCALEIMAGES)) // Image is to be scaled
2044 #else
2045 if (View->Status & WAP_STATUS_SCALEIMAGES)
2046 #endif
2047 ATB_wap_buffer_image_scale((T_WAP_MMI_SEND_IMAGE_IND *)Element->data);
2048 else
2049 ATB_wap_buffer_image_display((T_WAP_MMI_SEND_IMAGE_IND *)Element->data);
2050 }
2051 break;
2052 }
2053 elementCount++;
2054 Element = Element->NextElement; /* Find the next element */
2055 }
2056
2057 /* Vertical scroll bar and right frame */
2058
2059 scrollBarSize = WAP_SCREEN_HEIGHT*WAP_SCREEN_HEIGHT/View->cardHeight;
2060 if (scrollBarSize>WAP_SCREEN_HEIGHT)
2061 scrollBarSize = WAP_SCREEN_HEIGHT;
2062
2063 scrollBarPos = WAP_SCREEN_HEIGHT*View->cardYPosition/View->cardHeight;
2064
2065 dspl_DrawLine(WAP_TOTAL_WIDTH-WAP_VSCROLLBAR_WIDTH, WAP_TOP_BORDER/2,
2066 WAP_TOTAL_WIDTH-WAP_VSCROLLBAR_WIDTH, WAP_SCREEN_BOTTOM); /* Line to top of bar */
2067
2068 for (scrollIndex=1; scrollIndex<WAP_VSCROLLBAR_WIDTH; scrollIndex++)
2069 {
2070 dspl_DrawLine(WAP_TOTAL_WIDTH-WAP_VSCROLLBAR_WIDTH+scrollIndex, scrollBarPos+WAP_TOP_BORDER,
2071 WAP_TOTAL_WIDTH-WAP_VSCROLLBAR_WIDTH+scrollIndex, scrollBarPos+WAP_TOP_BORDER+scrollBarSize);
2072 }
2073
2074 return;
2075 }
2076
2077
2078 /*******************************************************************************
2079
2080 $Function: ATB_wap_buffer_text_draw
2081
2082 $Description: Draws text
2083
2084 $Returns: None.
2085
2086 $Arguments: parameter - the send text event
2087
2088 *******************************************************************************/
2089
2090 static void ATB_wap_buffer_text_draw(T_WAP_MMI_SEND_TEXT_IND *parameter)
2091 {
2092 USHORT *temp; /* SPR#1816 - SH - Unicode string storage */
2093 SHORT elementX; /* X position of element on-screen */
2094 SHORT elementY; /* Y position of element on-screen */
2095 USHORT textWidth; /* Width of text to draw */
2096 USHORT textLength; /* SPR#1816 - SH - Length of text */
2097
2098 textWidth = parameter->pWidth;
2099 if ((textWidth + parameter->pX)>WAP_SCREEN_WIDTH) /* if text goes off the screen, */
2100 textWidth = WAP_SCREEN_WIDTH-parameter->pX; /* cut it down to size */
2101
2102 elementX = (USHORT)parameter->pX+WAP_LEFT_BORDER; /* Absolute position of text */
2103 elementY = (USHORT)parameter->pY+WAP_TOP_BORDER; /* on screen */
2104
2105 /* Draw special text features */
2106
2107 switch(parameter->type)
2108 {
2109 case WAP_TEXT_OPTION:
2110 // Apr 28 2005 REF: MMI-SPR-30400 x0012849
2111 // To see that box aligns with the text.
2112 #ifdef FF_GPF_TCPIP
2113 elementY+=OFFSET_CHECKBOX;
2114 #endif
2115 /* An options menu item - draw checkbox */
2116 dspl_DrawRect(elementX,
2117 elementY+WAP_CHECKBOX_TOP, \
2118 elementX+WAP_CHECKBOX_WIDTH-1, \
2119 elementY+WAP_CHECKBOX_TOP+WAP_CHECKBOX_HEIGHT-1);
2120
2121 /* Draw check if item is selected */
2122
2123 if (parameter->selected)
2124 {
2125 dspl_DrawRect(elementX+WAP_CHECKBOX_INDENT, \
2126 elementY+WAP_CHECKBOX_TOP+WAP_CHECKBOX_INDENT, \
2127 elementX+WAP_CHECKBOX_WIDTH-1-WAP_CHECKBOX_INDENT, \
2128 elementY+WAP_CHECKBOX_TOP+WAP_CHECKBOX_HEIGHT-1-WAP_CHECKBOX_INDENT);
2129 }
2130
2131 /* Shift text to right to make space for checkbox */
2132
2133 elementX += (WAP_CHECKBOX_WIDTH+WAP_CHECKBOX_RIGHT);
2134 textWidth -= (WAP_CHECKBOX_WIDTH+WAP_CHECKBOX_RIGHT);
2135 // Apr 28 2005 REF: MMI-SPR-30400 x0012849
2136 // To see that box aligns with the text.
2137 #ifdef FF_GPF_TCPIP
2138 elementY-=OFFSET_CHECKBOX;
2139 #endif
2140 break;
2141
2142 case WAP_TEXT_OPTIONGROUP:
2143 /* Option group titles are currently not distinguished from normal text */
2144 break;
2145 }
2146
2147 /* SPR#1816 - SH - Allocate memory for unicode string */
2148
2149 temp = (USHORT *)AUI_wap_memory_alloc((parameter->text_length+1)*sizeof(USHORT));
2150
2151 /* SPR#1816 - SH - Copy text and convert to MMI unicode */
2152
2153 ATB_uc_text_copy(temp, parameter->Text, (USHORT)parameter->text_length);
2154 ATB_uc_text_convert(temp, (USHORT)parameter->text_length); /* SPR#1816 - SH - Swap bytes of unicode */
2155
2156 /* SPR#1816 - SH - Crop text to fit width */
2157 // Apr 28 2005 REF: MMI-SPR-30400 x0012849
2158 // For the text of the Drop down menu , no need to crop the text, instead call
2159 // ATB_uc_text_cut, which will return the text that will fit to the screen, otherwise scroll bar will be
2160 // overwritten with the text.
2161 if(WAP_TEXT_OPTION == parameter->type )
2162 textLength = ATB_uc_text_cut(temp, parameter->text_length, textWidth);
2163 else
2164 textLength = ATB_uc_text_crop(temp, parameter->text_length, textWidth);
2165
2166 if (!parameter->invert)
2167 dspl_TextOut((USHORT)elementX,(USHORT)elementY,DSPL_TXTATTR_SIGNED_COORDS | DSPL_TXTATTR_UNICODE,(char*)temp);
2168 else
2169 dspl_TextOut((USHORT)elementX,(USHORT)elementY,DSPL_TXTATTR_INVERS | DSPL_TXTATTR_SIGNED_COORDS | DSPL_TXTATTR_UNICODE, (char*)temp);
2170
2171 AUI_wap_memory_free((UBYTE *)temp, (parameter->text_length+1)*sizeof(USHORT));
2172
2173 return;
2174 }
2175
2176 /*******************************************************************************
2177
2178 $Function: ATB_wap_buffer_border_draw
2179
2180 $Description: Draws border
2181 //kyle 29 Jun, 2005 MMI-SPR-32462
2182
2183 $Returns: None.
2184
2185 $Arguments:
2186
2187 *******************************************************************************/
2188 #ifdef FF_GPF_TCPIP
2189 static void ATB_wap_buffer_border_draw(T_WAP_MMI_DRAW_BORDER_IND *parameter)
2190 {
2191
2192 LAYOUT_BORDER bottom, left, right, top;
2193
2194 #ifdef TRACE_ATBWAPAUI
2195 TRACE_FUNCTION("ATB_wap_buffer_border_draw");
2196 #endif
2197
2198 bottom = parameter->borderBottom;
2199 left = parameter->borderLeft;
2200 right = parameter->borderRight;
2201 top = parameter->borderTop;
2202
2203 if (bottom.cssPropCode != CSS_VALUE_NONE)
2204 {
2205 bottom.pX += WAP_LEFT_BORDER;
2206 bottom.pY += WAP_TOP_BORDER;
2207 dspl_DrawFilledRect(bottom.pX, bottom.pY, bottom.pX + bottom.pWidth, bottom.pY + bottom.pHeight);
2208 }
2209
2210 if (left.cssPropCode != CSS_VALUE_NONE)
2211 {
2212 left.pX += WAP_LEFT_BORDER;
2213 left.pY += WAP_TOP_BORDER;
2214 dspl_DrawFilledRect(left.pX, left.pY, left.pX + left.pWidth, left.pY + left.pHeight);
2215 }
2216
2217 if (right.cssPropCode != CSS_VALUE_NONE)
2218 {
2219 right.pX += WAP_LEFT_BORDER;
2220 right.pY += WAP_TOP_BORDER;
2221 dspl_DrawFilledRect(right.pX, right.pY, right.pX + right.pWidth, right.pY + right.pHeight);
2222 }
2223
2224 if (top.cssPropCode != CSS_VALUE_NONE)
2225 {
2226 top.pX += WAP_LEFT_BORDER;
2227 top.pY += WAP_TOP_BORDER;
2228 dspl_DrawFilledRect(top.pX, top.pY, top.pX + top.pWidth, top.pY + top.pHeight);
2229 }
2230
2231 return;
2232 }
2233 #endif
2234
2235 /*******************************************************************************
2236
2237 $Function: ATB_wap_buffer_table_draw
2238
2239 $Description: Draws a table, or a fieldset
2240
2241 $Returns: None.
2242
2243 $Arguments: parameter - the send table event
2244
2245 *******************************************************************************/
2246
2247 static void ATB_wap_buffer_table_draw(T_WAP_MMI_SEND_TABLE_IND *parameter)
2248 {
2249 SHORT elementX = parameter->pX+WAP_LEFT_BORDER; /* Left edge position of table/fieldset */
2250 SHORT elementY = parameter->pY+WAP_TOP_BORDER; /* Top edge position of table/fieldset */
2251 SHORT top = elementY+WAP_CHAR_HEIGHT/2; /* Top of fieldset */
2252 SHORT bottom = elementY+parameter->pHeight-1; /* Bottom of table/fieldset */
2253 SHORT right = elementX+parameter->pWidth-1; /* Right side of table/fieldset */
2254 SHORT lineX; /* X position of column line */
2255 SHORT lineY; /* Y position of row line */
2256 USHORT *temp; /* Temp storage for title. */
2257 USHORT titleWidth; /* Width of the title in pixels */
2258 USHORT titleLength; /* Length of title */
2259 USHORT index; /* Index for columns and rows */
2260
2261 #ifdef TRACE_ATBWAPAUI
2262 TRACE_FUNCTION("ATB_wap_buffer_table_draw");
2263 TRACE_EVENT_P4( "Fieldset/table pX, pY, pWidth, pHeight: %d, %d, %d, %d",
2264 parameter->pX, parameter->pY, parameter->pWidth, parameter->pHeight);
2265 #endif
2266
2267 /* Convert title to MMI Unicode */
2268
2269 temp = (USHORT *)AUI_wap_memory_alloc((parameter->title_length+1)*sizeof(USHORT));
2270 titleLength = parameter->title_length;
2271 ATB_uc_text_copy(temp, parameter->Title, titleLength);
2272 ATB_uc_text_convert(temp, titleLength); /* Convert to MMI unicode */
2273
2274 /* Crop title if it overshoots screen */
2275
2276 if ((parameter->pX+gle_fieldset_spaceLeft+ATB_uc_text_width(temp, titleLength)) > WAP_SCREEN_WIDTH)
2277 {
2278 titleLength = ATB_uc_text_crop(temp, titleLength, WAP_SCREEN_WIDTH-parameter->pX-gle_fieldset_spaceLeft);
2279 }
2280
2281 /* Crop title if it overshoots edge of fieldset */
2282
2283 if ((gle_fieldset_spaceLeft+ATB_uc_text_width(temp, titleLength)+gle_fieldset_spaceRight) > parameter->pWidth)
2284 {
2285 titleLength = ATB_uc_text_crop(temp, titleLength, parameter->pWidth-gle_fieldset_spaceLeft-gle_fieldset_spaceRight);
2286 }
2287
2288 titleWidth = ATB_uc_text_width(temp, titleLength); /* Width of the title */
2289
2290 /* Display title if it's onscreen */
2291
2292 if (parameter->pY >= 0 && parameter->pY < WAP_TEXT_LOWEST)
2293 {
2294 dspl_TextOut(elementX+gle_fieldset_spaceLeft, elementY, DSPL_TXTATTR_SIGNED_COORDS | DSPL_TXTATTR_UNICODE, (char *)temp);
2295 }
2296 AUI_wap_memory_free((UBYTE *)temp, (parameter->title_length+1)*sizeof(USHORT));
2297
2298 /* Horizontal lines */
2299
2300 lineY = elementY+gle_cell_vBefore;
2301 ATB_wap_buffer_line_draw(elementX, bottom, right, bottom); /* Bottom line of table */
2302
2303 if (parameter->rows_length > 0)
2304 ATB_wap_buffer_line_draw(elementX, lineY, right, lineY); /* Line under title */
2305 else
2306 {
2307 ATB_wap_buffer_line_draw(elementX+gle_fieldset_spaceLeft-2, top, elementX, top); /* Line to left of title */
2308 ATB_wap_buffer_line_draw(elementX+gle_fieldset_spaceLeft+titleWidth+2, top, right, top); /* right */
2309 }
2310
2311 /* Row lines */
2312
2313 if (parameter->rows_length > 1)
2314 {
2315 for (index=0; index<(parameter->rows_length-1); index++)
2316 {
2317 lineY += parameter->RowHeight[index]+gle_cell_spaceToBorder;
2318 ATB_wap_buffer_line_draw(elementX, lineY, right, lineY);
2319 lineY += gle_cell_borderExtent+gle_cell_spaceToBorder;
2320 }
2321 }
2322
2323 /* Vertical lines */
2324
2325 lineX = elementX+gle_cell_hBefore;
2326
2327 if (parameter->rows_length == 0)
2328 lineY = top; /* For fieldset */
2329 else
2330 lineY = elementY+gle_cell_vBefore; /* For table */
2331
2332 ATB_wap_buffer_line_draw(elementX, lineY, elementX, bottom); /* Left hand line */
2333
2334 /* Column lines */
2335
2336 if (parameter->cols_length > 1)
2337 {
2338 for (index=0; index<(parameter->cols_length-1); index++)
2339 {
2340 lineX += parameter->ColWidth[index]+gle_cell_spaceToBorder;
2341 ATB_wap_buffer_line_draw(lineX, lineY, lineX, bottom);
2342 lineX += gle_cell_borderExtent+gle_cell_spaceToBorder;
2343 }
2344 }
2345 ATB_wap_buffer_line_draw(right, lineY, right, bottom); /* Right hand line */
2346
2347 return;
2348 }
2349
2350
2351 /*******************************************************************************
2352
2353 $Function: ATB_wap_buffer_line_draw
2354
2355 $Description: Draws a line, making sure it fits on-screen
2356
2357 $Returns: None.
2358
2359 $Arguments: x1,y1 - Coordinates of the start of the line
2360 x2,y2 - Coordinates of the end of the line
2361
2362 *******************************************************************************/
2363
2364 static void ATB_wap_buffer_line_draw(SHORT x1, SHORT y1, SHORT x2, SHORT y2)
2365 {
2366 SHORT deltaX1;
2367 SHORT deltaY1;
2368 SHORT deltaX2;
2369 SHORT deltaY2;
2370 double m;
2371
2372 ATB_wap_buffer_onscreen(x1,y1, &deltaX1, &deltaY1);
2373 ATB_wap_buffer_onscreen(x2,y2, &deltaX2, &deltaY2);
2374
2375 if (x2==x1)
2376 {
2377 if (deltaX1)
2378 return;
2379 y1+=deltaY1;
2380 y2+=deltaY2;
2381 }
2382 else if (y2==y1)
2383 {
2384 if (deltaY1)
2385 return;
2386 x1+=deltaX1;
2387 x2+=deltaX2;
2388 }
2389 else
2390 {
2391 m = (y2-y1)/(x2-x1);
2392 if (deltaX1 || deltaY1)
2393 {
2394 x1 += deltaX1;
2395 y1 += m*deltaX1;
2396 if (!ATB_wap_buffer_onscreen(x1,y1,&deltaX1,&deltaY1))
2397 return;
2398 }
2399 if (deltaX2 || deltaY2)
2400 {
2401 x2 += deltaX2;
2402 y2 += m*deltaX2;
2403 if (!ATB_wap_buffer_onscreen(x2,y2,&deltaX2,&deltaY2))
2404 return;
2405 }
2406 }
2407
2408 dspl_DrawLine(x1,y1,x2,y2);
2409 return;
2410 }
2411
2412
2413 /*******************************************************************************
2414
2415 $Function: ATB_wap_buffer_onscreen
2416
2417 $Description: Returns TRUE if the point supplied is on-screen
2418
2419 $Returns: TRUE if point is onscreen
2420
2421 $Arguments: x,y - coordinates of the point
2422 deltaX, deltaY - returns offset from screen
2423
2424 *******************************************************************************/
2425
2426 static BOOL ATB_wap_buffer_onscreen(SHORT x, SHORT y, SHORT *deltaX, SHORT *deltaY)
2427 {
2428 BOOL outcome = TRUE;
2429 *deltaX = 0;
2430 *deltaY = 0;
2431
2432 if (x<WAP_LEFT_BORDER)
2433 {
2434 outcome = FALSE;
2435 *deltaX = WAP_LEFT_BORDER-x;
2436 }
2437 if (x>(WAP_SCREEN_RIGHT-1))
2438 {
2439 outcome = FALSE;
2440 *deltaX = (WAP_SCREEN_RIGHT-1)-x;
2441 }
2442 if (y<WAP_TOP_BORDER)
2443 {
2444 outcome = FALSE;
2445 *deltaY = WAP_TOP_BORDER-y;
2446 }
2447 if (y>(WAP_SCREEN_BOTTOM-1))
2448 {
2449 outcome = FALSE;
2450 *deltaY = (WAP_SCREEN_BOTTOM-1)-y;
2451 }
2452
2453 return outcome;
2454 }
2455
2456
2457 /*******************************************************************************
2458
2459 $Function: ATB_wap_buffer_image_display
2460
2461 $Description: Trims an image to fit into the specified space, then displays it
2462
2463 $Returns: None.
2464
2465 $Arguments: image - the image to display
2466
2467 *******************************************************************************/
2468
2469 #ifdef FF_GPF_TCPIP
2470 #define RGB16(r,g,b) (( ((b & 0xf8) >> 3) | ((g & 0xfc) << 3) | ((r & 0xf8) << 8) ))
2471 #define RGB32(r,g,b) (( (r << 16) & 0x00FF0000) | ((g << 8) & 0x0000FF00) | ( b & 0x000000FF))
2472 #endif
2473
2474 static void ATB_wap_buffer_image_display(T_WAP_MMI_SEND_IMAGE_IND *image)
2475 {
2476 UBYTE *Region; /* Pointer to trimmed image */
2477 SHORT offsetX = 0; /* Offsets from origin of original image... */
2478 SHORT offsetY = 0; /* ...where trimmed image starts */
2479 SHORT scrWidth = image->pWidth; /* Width of trimmed image on screen */
2480 SHORT scrHeight = image->pHeight; /* Height of trimmed image on screen */
2481 SHORT elementX; /* Its x position on the screen */
2482 SHORT elementY; /* Its y position on the screen */
2483 USHORT byteWidth; /* Width of original in bytes */
2484 USHORT scrByteWidth; /* Width of screen image in bytes */
2485 USHORT offsetByteWidth;
2486 USHORT heightIndex;
2487 USHORT widthIndex;
2488 USHORT memIndex = 0;
2489 UBYTE *Image = image->Image; /* The image data */
2490 UBYTE pixShift; /* Pixel shift, shift bytes by this amount */
2491
2492 #ifdef TRACE_ATBWAPAUI
2493 TRACE_FUNCTION("ATB_wap_buffer_image_display");
2494 #endif
2495
2496 byteWidth = image->pWidth/8;
2497 if (image->pWidth % 8)
2498 byteWidth++;
2499
2500 elementX = image->pX;
2501 elementY = image->pY;
2502
2503 /* If image starts off the left of the screen */
2504
2505 if (elementX < 0)
2506 {
2507 offsetX = -elementX; /* Set the X offset so it is trimmed appropriately */
2508 scrWidth -= offsetX; /* Change its width */
2509 elementX = 0; /* And place it at the left of the screen */
2510 }
2511
2512 /* If image starts above the top of the screen */
2513
2514 if (image->pY < 0)
2515 {
2516 offsetY = -elementY; /* Set the Y offset so it is trimmed appropriately */
2517 scrHeight -= offsetY; /* Change its height */
2518 elementY = 0; /* And place it at the top of the screen */
2519 }
2520
2521 /* If the image goes off the right of the screen, reduce its width */
2522
2523 if ((elementX+scrWidth)>WAP_SCREEN_WIDTH)
2524 scrWidth = WAP_SCREEN_WIDTH-elementX;
2525
2526 /* If the image goes off the bottom of the screen, trim its height */
2527
2528 if ((elementY+scrHeight)>WAP_SCREEN_HEIGHT)
2529 scrHeight = WAP_SCREEN_HEIGHT-elementY;
2530
2531 scrByteWidth = scrWidth/8; /* Work out the width of the trimmed image in bytes */
2532 if (scrWidth % 8)
2533 scrByteWidth++;
2534
2535 #ifdef FF_GPF_TCPIP
2536
2537 if (image->bmpFormat == BMP_FORMAT_16BIT_LCD_COLOUR) {
2538 long ColorVal;
2539 UINT32 clr;
2540 unsigned char* p;
2541 int x, y;
2542 #if 0
2543 for (x = 0; x < image->pWidth; x++) {
2544 for (y = 0; y < image->pHeight; y++) {
2545 p = (unsigned char*)(image->Image + ((y * image->pWidth + x) * 2));
2546 ColorVal = 256*(p[0]) + (p[1]);
2547 clr = RGB32( (((0xf800 & ColorVal)>>11) << 3), (((0x07e0 & ColorVal)>>5) << 2), ((0x1f & ColorVal) << 3) );
2548 scrPoint(image->pX + WAP_LEFT_BORDER + x, image->pY + WAP_TOP_BORDER + y, clr);
2549 }
2550 }
2551 #else
2552 if((scrWidth > 0) && (scrHeight > 0))
2553 {
2554 int offset = (offsetY * image->pWidth + offsetX) << 1;
2555 int old_offset;
2556 UINT16 col16;
2557 UBYTE *data = image->Image;
2558 int imageX = image->pX;
2559 int imageY = image->pY;
2560 if(imageX < 0) imageX = 0;
2561 if(imageY < 0) imageY = 0;
2562 imageX += WAP_LEFT_BORDER;
2563 imageY += WAP_TOP_BORDER;
2564 if(image->transparency_flag)
2565 {
2566 for(y = 0; y < scrHeight; y++)
2567 {
2568 old_offset = offset;
2569 for(x = 0; x < scrWidth; x++)
2570 {
2571 col16 = data[offset++] << 8;
2572 col16 |= data[offset++];
2573 if(col16 != 0xAAAA)
2574 {
2575 clr = RGB32( (((0xf800 & col16)>>11) << 3), (((0x07e0 & col16)>>5) << 2), ((0x1f & col16) << 3) );
2576 scrPoint(imageX + x, imageY + y, clr);
2577 }
2578 }
2579 offset = old_offset + (image->pWidth << 1);
2580 }
2581 }
2582 else
2583 {
2584 for(y = 0; y < scrHeight; y++)
2585 {
2586 old_offset = offset;
2587 for(x = 0; x < scrWidth; x++)
2588 {
2589 col16 = data[offset++] << 8;
2590 col16 |= data[offset++];
2591 clr = RGB32( (((0xf800 & col16)>>11) << 3), (((0x07e0 & col16)>>5) << 2), ((0x1f & col16) << 3) );
2592 scrPoint(imageX + x, imageY + y, clr);
2593 }
2594 offset = old_offset + (image->pWidth << 1);
2595 }
2596 }
2597 }
2598 #endif
2599 // dspl_BitBlt2(image->pX + WAP_LEFT_BORDER, image->pY + WAP_TOP_BORDER, image->pWidth, image->pHeight, (void *)image->Image, 0, image->bmpFormat);
2600 return;
2601 }
2602 #endif
2603 /* Allocate memory for the trimmed image */
2604
2605 Region = (UBYTE *)AUI_wap_memory_alloc(scrByteWidth*scrHeight);
2606
2607 offsetByteWidth = offsetX/8;
2608 pixShift = offsetX % 8; /* Offset within the byte of the first pixel */
2609
2610 Image += (offsetY*byteWidth)+offsetByteWidth; /* Point to the first byte of the region to be isolated */
2611
2612 /* Copy the trimmed region of the image into our allocated memory,
2613 * inverting it as necessary */
2614
2615 for (heightIndex = 0; heightIndex<scrHeight; heightIndex++)
2616 {
2617 for (widthIndex = 0; widthIndex<scrByteWidth; widthIndex++)
2618 {
2619 Region[memIndex] = Image[widthIndex] << pixShift;
2620 if ((offsetByteWidth+scrByteWidth)<byteWidth || widthIndex<(scrByteWidth-1))
2621 Region[memIndex] |= Image[widthIndex+1] >> (8-pixShift);
2622
2623 if (!image->invert)
2624 Region[memIndex] ^= 0xFF; /* De-invert it if not selected */
2625
2626 memIndex++;
2627 }
2628 Image += byteWidth; /* Move down one line */
2629 }
2630
2631 #ifdef TRACE_ATBWAPAUI
2632 TRACE_EVENT_P2( "byteWidth: %d, scrByteWidth: %d", byteWidth, scrByteWidth);
2633 TRACE_EVENT_P4( "pX: %d, pY: %d, pWidth: %d, pHeight: %d", image->pX, image->pY, image->pWidth, image->pHeight);
2634 TRACE_EVENT_P4( "offsetX: %d, offsetY: %d, scrWidth: %d, scrHeight: %d", offsetX, offsetY, scrWidth, scrHeight);
2635 TRACE_EVENT_P2( "elementX: %d, elementY: %d", elementX, elementY);
2636 TRACE_EVENT_P2( "Region size: %d, should be: %d", memIndex, scrByteWidth*scrHeight);
2637 #endif
2638
2639 /* Display the image */
2640
2641 dspl_BitBlt (elementX+WAP_LEFT_BORDER, elementY+WAP_TOP_BORDER, scrWidth, scrHeight, 0, (void *)Region, 0);
2642
2643 /* Free the memory */
2644
2645 AUI_wap_memory_free(Region, scrByteWidth*scrHeight);
2646
2647 return;
2648 }
2649
2650
2651 /*******************************************************************************
2652
2653 $Function: ATB_wap_buffer_image_scale
2654
2655 $Description: Scales an image to fit into a specified space
2656
2657 $Returns: None.
2658
2659 $Arguments: View - pointer to the appropriate view
2660
2661 *******************************************************************************/
2662
2663 static void ATB_wap_buffer_image_scale(T_WAP_MMI_SEND_IMAGE_IND *image)
2664 {
2665 T_WAP_MMI_SEND_IMAGE_IND *Scaled = NULL;
2666 SHORT newWidth;
2667 SHORT newHeight;
2668 USHORT heightIndex;
2669 USHORT widthIndex;
2670 USHORT oldIndex;
2671 USHORT newIndex;
2672 USHORT byteWidth;
2673 USHORT scrByteWidth;
2674 UBYTE *Image = image->Image;
2675 UBYTE oldMask; /* Pixel shift, shift bytes by this amount */
2676 UBYTE newMask;
2677 UBYTE pixel;
2678 USHORT xScale;
2679 USHORT xScaleOld;
2680 USHORT yScale;
2681 USHORT yScaleOld;
2682
2683 #ifdef TRACE_ATBWAPAUI
2684 TRACE_FUNCTION("ATB_wap_buffer_image_scale");
2685 #endif
2686
2687 #ifdef FF_GPF_TCPIP
2688 if (image->bmpFormat == BMP_FORMAT_16BIT_LCD_COLOUR) {
2689 ATB_wap_buffer_image_display(image);
2690 return;
2691 }
2692 #endif
2693 Scaled = (T_WAP_MMI_SEND_IMAGE_IND *)AUI_wap_memory_alloc(sizeof(T_WAP_MMI_SEND_IMAGE_IND)); // Pointer to scaled image
2694
2695 /* Squash to fit horizontally */
2696
2697 if (image->pWidth > WAP_SCREEN_WIDTH)
2698 newWidth = WAP_SCREEN_WIDTH;
2699 else
2700 newWidth = image->pWidth;
2701
2702 /* Squash to fit vertically */
2703
2704 if (image->pHeight > WAP_SCREEN_HEIGHT)
2705 newHeight = WAP_SCREEN_HEIGHT;
2706 else
2707 newHeight = image->pHeight;
2708
2709 /* Work out the width of the original image in bytes */
2710
2711 byteWidth = image->pWidth/8;
2712 if (image->pWidth % 8)
2713 byteWidth++;
2714
2715 /* Work out the width of the scaled image in bytes */
2716 scrByteWidth = newWidth/8;
2717 if (newWidth % 8)
2718 scrByteWidth++;
2719
2720 /* Allocate memory for the scaled image */
2721
2722 Scaled->Image = (UBYTE *)AUI_wap_memory_alloc(scrByteWidth*newHeight);
2723
2724 oldIndex = -1;
2725 newIndex = -1;
2726 yScaleOld = 0;
2727
2728 /* Scale the image */
2729
2730 for (heightIndex = 0; heightIndex<image->pHeight; heightIndex++)
2731 {
2732 yScale = (USHORT) (heightIndex+1)*newHeight/image->pHeight;
2733
2734 if (yScale != yScaleOld)
2735 {
2736 oldMask = 1; /* Mask within the byte of the first pixel */
2737 newMask = 1;
2738 xScaleOld = 0;
2739
2740 for (widthIndex = 0; widthIndex<image->pWidth; widthIndex++)
2741 {
2742 xScale = (USHORT) (widthIndex+1)*newWidth/image->pWidth;
2743
2744 if (oldMask == 1)
2745 {
2746 oldMask = 128;
2747 oldIndex++;
2748 }
2749 else
2750 oldMask /= 2;
2751
2752 if (xScale != xScaleOld)
2753 {
2754 if (newMask == 1)
2755 {
2756 newMask = 128;
2757 newIndex++;
2758 Scaled->Image[newIndex] = 0;
2759 }
2760 else
2761 newMask /= 2;
2762
2763 if (Image[oldIndex] & oldMask) /* If old pixel set, */
2764 Scaled->Image[newIndex] |= newMask; /* set new pixel */
2765 }
2766
2767 xScaleOld = xScale;
2768 }
2769 }
2770 else
2771 {
2772 oldIndex += byteWidth;
2773 }
2774 yScaleOld = yScale;
2775 }
2776
2777 #ifdef TRACE_ATBWAPAUI
2778 TRACE_EVENT_P2( "byteWidth: %d, scrByteWidth: %d", byteWidth, scrByteWidth);
2779 TRACE_EVENT_P4( "pX: %d, pY: %d, pWidth: %d, pHeight: %d",
2780 image->pX, image->pY, image->pWidth, image->pHeight);
2781 TRACE_EVENT_P2( "newWidth: %d, newHeight: %d", newWidth, newHeight);
2782
2783 #endif
2784
2785 /* Display the image */
2786
2787 Scaled->object_id = image->object_id;
2788 Scaled->image_length = scrByteWidth*newHeight;
2789 Scaled->invert = image->invert;
2790 Scaled->pX = image->pX;
2791 Scaled->pY = image->pY;
2792 Scaled->pWidth = newWidth;
2793 Scaled->pHeight = newHeight;
2794 Scaled->selected = image->selected;
2795
2796 ATB_wap_buffer_image_display(Scaled);
2797
2798 /* Free the memory */
2799
2800 AUI_wap_memory_free(Scaled->Image, scrByteWidth*newHeight);
2801 AUI_wap_memory_free((UBYTE *)Scaled, sizeof(T_WAP_MMI_SEND_IMAGE_IND));
2802
2803 return;
2804 }
2805
2806
2807 /*******************************************************************************
2808
2809 $Function: ATB_wap_buffer_clear
2810
2811 $Description: Clears the element buffer
2812
2813 $Returns: None.
2814
2815 $Arguments: View - pointer to the appropriate view
2816
2817 *******************************************************************************/
2818
2819 void ATB_wap_buffer_clear(T_WAP_VIEW *View)
2820 {
2821 T_WAP_ELEMENT *Element = View->ElementHeader;
2822 T_WAP_ELEMENT *NextElement;
2823 T_WAP_MMI_SEND_TEXT_IND *TextElement;
2824 T_WAP_MMI_SEND_TABLE_IND *TableElement;
2825 T_WAP_MMI_SEND_IMAGE_IND *ImageElement;
2826 USHORT elementCount = 0;
2827
2828 #ifdef TRACE_ATBWAPAUI
2829 TRACE_FUNCTION("ATB_wap_buffer_clear");
2830 #endif
2831
2832 #ifdef FF_GPF_TCPIP
2833 // xreddymn Jun-28-2005 MMI-SPR-32467
2834 ATB_animated_GIF_clear();
2835 #endif // FF_GPF_TCPIP
2836
2837 while (Element != NULL)
2838 {
2839 switch (Element->type)
2840 {
2841 case WAP_TEXT:
2842 /* Delete a text element */
2843 TextElement = (T_WAP_MMI_SEND_TEXT_IND *)Element->data;
2844 if (TextElement->text_length != 0)
2845 AUI_wap_memory_free((UBYTE *)TextElement->Text, TextElement->text_length*sizeof(USHORT));
2846 if (TextElement->formatstring_length != 0)
2847 {
2848 AUI_wap_memory_free((UBYTE *)TextElement->Formatstring,
2849 TextElement->formatstring_length*sizeof(USHORT));
2850 }
2851 AUI_wap_memory_free((UBYTE *)TextElement, sizeof(T_WAP_MMI_SEND_TEXT_IND));
2852 break;
2853
2854 case WAP_TABLE:
2855 /* Delete a table/fieldset element */
2856 TableElement = (T_WAP_MMI_SEND_TABLE_IND *)Element->data;
2857 if (TableElement->title_length != 0)
2858 AUI_wap_memory_free((UBYTE *)TableElement->Title, TableElement->title_length*sizeof(USHORT));
2859 if (TableElement->cols_length != 0)
2860 AUI_wap_memory_free((UBYTE *)TableElement->ColWidth, TableElement->cols_length*sizeof(SHORT));
2861 if (TableElement->rows_length != 0)
2862 AUI_wap_memory_free((UBYTE *)TableElement->RowHeight, TableElement->rows_length*sizeof(SHORT));
2863 AUI_wap_memory_free((UBYTE *)TableElement, sizeof(T_WAP_MMI_SEND_TABLE_IND));
2864 break;
2865
2866 case WAP_IMAGE:
2867 /* Delete an image element */
2868 ImageElement = (T_WAP_MMI_SEND_IMAGE_IND *)Element->data;
2869 if (ImageElement->image_length != 0)
2870 AUI_wap_memory_free((UBYTE *)ImageElement->Image, ImageElement->image_length*sizeof(UBYTE));
2871 AUI_wap_memory_free((UBYTE *)ImageElement, sizeof(T_WAP_MMI_SEND_IMAGE_IND));
2872 break;
2873 }
2874
2875 NextElement = Element->NextElement;
2876 AUI_wap_memory_free((UBYTE *)Element, sizeof(T_WAP_ELEMENT));
2877 Element = NextElement;
2878 elementCount++;
2879 }
2880
2881 /* Element chain is now empty */
2882
2883 View->ElementHeader = NULL;
2884
2885 return;
2886 }
2887
2888
2889 /*******************************************************************************
2890
2891 $Function: ATB_wap_buffer_identify_element
2892
2893 $Description: Identifies which element is selected (based on the invert property) and
2894 returns an appropriate type.
2895
2896 $Returns: The type of the element that is selected, or NULL if none
2897
2898 $Arguments: View - pointer to the view
2899
2900 *******************************************************************************/
2901
2902 UBYTE ATB_wap_buffer_identify_element(T_WAP_VIEW *View)
2903 {
2904 T_WAP_ELEMENT *Element = View->ElementHeader;
2905 T_WAP_MMI_SEND_TEXT_IND *TextElement;
2906 T_WAP_MMI_SEND_IMAGE_IND *ImageElement;
2907
2908 #ifdef TRACE_ATBWAPAUI
2909 TRACE_FUNCTION("ATB_wap_buffer_identify_element");
2910 #endif
2911
2912 while (Element!=NULL)
2913 {
2914 switch (Element->type)
2915 {
2916 case WAP_TEXT:
2917 TextElement = (T_WAP_MMI_SEND_TEXT_IND *)Element->data;
2918 if (TextElement->invert)
2919 {
2920 return TextElement->type;
2921 }
2922 break;
2923
2924 case WAP_IMAGE:
2925 #ifdef FF_GPF_TCPIP
2926 case WAP_PLUGIN_IMAGE:
2927 //xrashmic 21 Jan, 2005 MMI-SPR-28223
2928 ImageElement = (T_WAP_MMI_SEND_IMAGE_IND *)Element->data;
2929 //xrashmic 28 Jan, 2005 MMI-SPR-28166
2930 //When the card contains the plugin Image, we need to send this
2931 //indication, so that Save can be provided in the option menu
2932 if(ImageElement->pluginImage)
2933 {
2934 return WAP_PLUGINIMAGE;
2935 }
2936 else if (ImageElement->invert)
2937 {
2938 return WAP_SELECTABLE_IMAGE;
2939 }
2940 #else
2941 if (ImageElement->invert)
2942 {
2943 return WAP_SELECTABLE_IMAGE;
2944 }
2945 #endif
2946 break;
2947 }
2948 Element = Element->NextElement;
2949 }
2950
2951 /* Element not identified */
2952
2953 return NULL;
2954 }
2955
2956
2957 /*******************************************************************************
2958
2959 $Function: ATB_wap_profile_read
2960
2961 $Description: Reads in the specified profile and changes the ProfileId
2962
2963 $Returns: WAP_OK
2964
2965 $Arguments: View - Pointer to the current view
2966 ProfileId - the id of the profile to read from the flash
2967
2968 *******************************************************************************/
2969 #ifdef FF_GPF_TCPIP
2970
2971 T_WAP_RES ATB_wap_profile_read(T_WAP_VIEW *View, UBYTE ProfileId)
2972 {
2973 T_WAP_VIEW *ViewIndex;
2974 T_WAP_PROFILE *Profile = &(WapProfilesData->Profile[ProfileId]);
2975 #ifdef TRACE_ATBWAPAUI
2976 TRACE_FUNCTION("ATB_wap_profile_read");
2977 #endif
2978
2979 if (View_header==NULL || Profile==NULL)
2980 {
2981 return WAP_FAIL;
2982 }
2983
2984 WapData->ProfileId = ProfileId;
2985
2986 /* SPR#2086 - SH - Change the profile for all open views */
2987
2988 ViewIndex = View_header;
2989 while (ViewIndex!=NULL)
2990 {
2991 ViewIndex->ProfileId = ProfileId;
2992 ViewIndex->Profile = Profile;
2993 /* Go to next view */
2994 ViewIndex = ViewIndex->NextView;
2995 }
2996
2997 return WAP_OK;
2998 }
2999
3000 #else /* #ifdef FF_GPF_TCPIP */
3001
3002 T_WAP_RES ATB_wap_profile_read(T_WAP_VIEW *View, UBYTE ProfileId)
3003 {
3004 T_WAP_PROFILE *Profile = View->Profile;
3005 UBYTE entryIndex;
3006 char *Entry;
3007 char *URL;
3008
3009 #ifdef TRACE_ATBWAPAUI
3010 TRACE_FUNCTION("ATB_wap_profile_read");
3011 #endif
3012
3013 View->ProfileId = ProfileId;
3014 View->Profile = &(WapProfilesData->Profile[View->ProfileId]);
3015
3016 #ifndef GPRS
3017 /* SPR#2324 - SH - Ensure that all profiles are of dialup type if GPRS is off */
3018 if (View->Profile->AccessType==WAP_GPRS_DATA)
3019 {
3020 View->Profile->AccessType = WAP_CS_DATA;
3021 }
3022 #endif
3023
3024 return WAP_OK;
3025 }
3026
3027 #endif /* !#ifdef FF_GPF_TCPIP */
3028 /*******************************************************************************
3029
3030 $Function: ATB_wap_profile_names_read
3031
3032 $Description: Reads into RAM the names of all profiles stored in flash, also
3033 the global bookmarks and history lists
3034
3035 $Returns: WAP_OK
3036
3037 $Arguments: Profile - Pointer to the current profile
3038
3039 *******************************************************************************/
3040
3041 T_WAP_RES ATB_wap_profile_names_read(T_WAP_VIEW *View)
3042 {
3043 T_WAP_PROFILE *Profile;
3044 T_WAP_LIST *ProfilesList = View->ProfilesList;
3045 USHORT no_of_bookmarks;
3046 T_WAP_LIST *Bookmarks = View->Bookmarks;
3047 T_WAP_LIST *BookmarksURL = View->BookmarksURL;
3048 USHORT no_of_history;
3049 T_WAP_LIST *History = View->History;
3050 T_WAP_LIST *HistoryURL = View->HistoryURL;
3051 UBYTE entryIndex;
3052 char *Entry;
3053 char *URL;
3054 UBYTE no_of_profiles;
3055
3056 #ifdef TRACE_ATBWAPAUI
3057 TRACE_FUNCTION("ATB_wap_profile_names_read");
3058 #endif
3059
3060 /* SPR#2086 - SH - FFS files now read when view created.
3061 * Read in number of profiles. */
3062 #ifdef CO_UDP_IP
3063 /* Default values are provided. If either of the files 'mmi/wapdata'
3064 * or 'mmi/wapprof' aren't found, files is created with these defaults.
3065 * The '0' size indicator indicates that one of the files was not present. */
3066
3067 if (flash_wap_read() == 0)
3068 {
3069 ATB_wap_profile_default_create(FALSE); /* SPR#2324 */
3070 }
3071
3072 View->Status = WapData->Status; /* Status flags for settings */
3073 View->ProfileId = WapData->ProfileId; /* Default starting profile */
3074
3075 /* Read in profiles list */
3076 #endif
3077
3078
3079 no_of_profiles = WapData->no_of_profiles;
3080 ProfilesList->no_of_entries = no_of_profiles;
3081 /* Get list of profile names */
3082
3083 for (entryIndex = 0; entryIndex<MAX_PROFILES; entryIndex++)
3084 {
3085 ProfilesList->Entry[entryIndex] = (char *)WapProfilesData->Profile[entryIndex].Title;
3086 }
3087
3088 /* Read in bookmarks */
3089
3090 no_of_bookmarks = WapData->no_of_bookmarks;
3091 Bookmarks->no_of_entries = no_of_bookmarks;
3092 BookmarksURL->no_of_entries = no_of_bookmarks;
3093
3094 /* SPR#1816 - SH - Cast to char */
3095
3096 for (entryIndex = 0; entryIndex<MAX_BOOKMARKS; entryIndex++)
3097 {
3098 Bookmarks->Entry[entryIndex] = (char *)WapData->Bookmarks[entryIndex];
3099 BookmarksURL->Entry[entryIndex] = WapData->BookmarksURL[entryIndex];
3100 }
3101
3102 /* Read in history entries */
3103
3104 no_of_history = WapData->no_of_history;
3105 History->no_of_entries = no_of_history;
3106 HistoryURL->no_of_entries = no_of_history;
3107
3108 for (entryIndex = 0; entryIndex<MAX_HISTORY; entryIndex++)
3109 {
3110 History->Entry[entryIndex] = (char *)WapData->History[entryIndex];
3111 HistoryURL->Entry[entryIndex] = WapData->HistoryURL[entryIndex];
3112 }
3113
3114 return WAP_OK;
3115 }
3116
3117
3118 /*******************************************************************************
3119
3120 $Function: ATB_wap_profile_save
3121
3122 $Description: Store the current updated profile in flash
3123
3124 $Returns: WAP_OK
3125
3126 $Arguments: View - Pointer to the current view
3127
3128 *******************************************************************************/
3129
3130 #ifdef FF_GPF_TCPIP
3131 T_WAP_RES ATB_wap_profile_save(T_WAP_VIEW *View)
3132 {
3133
3134 #ifdef TRACE_ATBWAPAUI
3135 TRACE_FUNCTION("ATB_wap_profile_save");
3136 #endif
3137
3138 /* SPR#2086 - SH - Write bookmarks information only if this is
3139 * a browser view */
3140
3141 if (View->Bookmarks)
3142 {
3143 WapData->no_of_bookmarks = View->Bookmarks->no_of_entries;
3144 }
3145 if (View->History)
3146 {
3147 WapData->no_of_history = View->History->no_of_entries;
3148 }
3149
3150 WapData->ProfileId = View->ProfileId;
3151 //xrashmic 16 Dec, 2004 MMI-SPR-27622
3152 // Save the total number of profiles to flash.
3153 WapData->no_of_profiles = View->ProfilesList->no_of_entries;
3154 flash_wap_write();
3155
3156 return WAP_OK;
3157 }
3158
3159 /*******************************************************************************
3160
3161 $Function: ATB_wap_profile_delete
3162
3163 $Description: Deletes a profile, and shifts other profiles up to fill the gap
3164 //xrashmic 16 Dec, 2004 MMI-SPR-27622
3165
3166 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
3167
3168 $Arguments: View - Pointer to the current view
3169 ProfileId - ID of the profile to delete
3170
3171 *******************************************************************************/
3172
3173 T_WAP_RES ATB_wap_profile_delete(T_WAP_VIEW *View, UBYTE ProfileId)
3174 {
3175 UBYTE profileIndex;
3176
3177 #ifdef TRACE_ATBWAPAUI
3178 TRACE_FUNCTION("ATB_wap_profile_save");
3179 #endif
3180
3181 if (ProfileId >= View->ProfilesList->no_of_entries)
3182 {
3183 return WAP_FAIL;
3184 }
3185
3186 View->ProfilesList->no_of_entries--;
3187
3188 for (profileIndex = ProfileId; profileIndex < View->ProfilesList->no_of_entries; profileIndex++)
3189 {
3190 memcpy((void *)&WapProfilesData->Profile[profileIndex],
3191 (void *)&WapProfilesData->Profile[profileIndex+1],
3192 sizeof(T_WAP_PROFILE));
3193 }
3194 return WAP_OK;
3195 }
3196
3197 #else /* #ifdef FF_GPF_TCPIP */
3198
3199 T_WAP_RES ATB_wap_profile_save(T_WAP_VIEW *View)
3200 {
3201
3202 #ifdef TRACE_ATBWAPAUI
3203 TRACE_FUNCTION("ATB_wap_profile_save");
3204 #endif
3205
3206 WapData->ProfileId = View->ProfileId;
3207 WapData->Status = View->Status;
3208 WapData->no_of_bookmarks = View->Bookmarks->no_of_entries;
3209 WapData->no_of_history = View->History->no_of_entries;
3210 WapData->no_of_profiles = View->ProfilesList->no_of_entries; /*SPR#2324 - SH - Save no. of profiles */
3211 flash_wap_write();
3212
3213 return WAP_OK;
3214 }
3215
3216 /*******************************************************************************
3217
3218 $Function: ATB_wap_profile_delete
3219
3220 $Description: Deletes a profile, and shifts other profiles up to fill the gap
3221 SPR#2324 - SH - Added
3222
3223 $Returns: WAP_OK if successful, WAP_FAIL if otherwise
3224
3225 $Arguments: View - Pointer to the current view
3226 ProfileId - ID of the profile to delete
3227
3228 *******************************************************************************/
3229
3230 T_WAP_RES ATB_wap_profile_delete(T_WAP_VIEW *View, UBYTE ProfileId)
3231 {
3232 UBYTE profileIndex;
3233
3234 #ifdef TRACE_ATBWAPAUI
3235 TRACE_FUNCTION("ATB_wap_profile_save");
3236 #endif
3237
3238 if (ProfileId >= View->ProfilesList->no_of_entries)
3239 {
3240 return WAP_FAIL;
3241 }
3242
3243 View->ProfilesList->no_of_entries--;
3244
3245 for (profileIndex = ProfileId; profileIndex < View->ProfilesList->no_of_entries; profileIndex++)
3246 {
3247 memcpy((void *)&WapProfilesData->Profile[profileIndex],
3248 (void *)&WapProfilesData->Profile[profileIndex+1],
3249 sizeof(T_WAP_PROFILE));
3250 }
3251
3252 return WAP_OK;
3253 }
3254
3255
3256 #endif /* !#ifdef FF_GPF_TCPIP */
3257
3258
3259
3260 /*******************************************************************************
3261
3262 $Function: ATB_wap_profile_default_create
3263
3264 $Description: Creates a default profile in the flash if one isn't already there
3265 SPR#1794 - SH - There's now a third default profile.
3266 SPR#1816 - SH - Convert all defaults to MMI unicode
3267 $Returns:
3268
3269 $Arguments:
3270
3271 *******************************************************************************/
3272 #ifdef FF_GPF_TCPIP
3273 //TISHMMS Project
3274 T_WAP_RES ATB_wap_profile_default_create()
3275 {
3276 UBYTE no_of_bookmarks = 9;
3277 char *bookmarksList[] =
3278 {
3279 "ZgFg wml",
3280 "ZgFg html",
3281 "Google",
3282 "Yahoo!",
3283 "Financial Times",
3284 "Cnet tech news",
3285 "T-Mobile UK",
3286 "WEB.DE",
3287 "El Pais"
3288 };
3289
3290 char *bookURLList[] =
3291 {
3292 "http://wap.fgmicrotec.hr",
3293 "http://www.fgmicrotec.hr/test/dsample.htm",
3294 "http://wap.google.com",
3295 "http://wap.yahoo.com",
3296 "http://wap.ft.com",
3297 "http://wap.cnet.com",
3298 "http://wap.t-mobile.co.uk",
3299 "http://wap.web.de",
3300 "http://wap.elpais.es"
3301 };
3302
3303 UBYTE no_of_history = 0;
3304 char *historyList[] = { "dummy" };
3305 char *histURLList[] = { "www.dummy.org" };
3306
3307 UBYTE no_of_profiles = 8;
3308 char *profilesDefault[] = { "fg.vip.gprs", "vip.gprs", "fg.ht.gprs", "ht.gprs", "D1.gprs", "D2.gprs", "E-Plus.gprs", "O2.gprs", "Empty"};
3309 char *homepageURL[] = { "http://wap.fgmicrotec.hr", "http://wap.vip.hr", "http://wap.fgmicrotec.hr", "http://wap.fgmicrotec.hr", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com"};
3310 char *IPAddress1[] = { "217.014.220.081", "212.091.099.091", "217.014.220.081", "010.012.000.003", "193.254.160.002", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3311 char *IPAddress2[] = { "217.014.220.081", "212.091.099.091", "217.014.220.081", "000.000.000.000", "193.254.160.002", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3312 char *DialupNumber[] = { "00448704290000", "00448704290000", "00448704290000", "00448704290000", "17266", "00491722290100", "00448456609561", "00448456609561", ""};
3313 char *APN[] = { "gprs5.vipnet.hr", "gprs5.vipnet.hr", "www.htgprs.hr", "www.htgprs.hr", "wap.t-d1.de", "wap.vodafone.de", "wap.eplus.de", "wap.viaginterkom.de", ""};
3314 char *Username[] = { "38591", "38591", "", "", "t-d1", "", "eplus", "", ""};
3315 char *Password[] = { "38591", "38591", "", "", "wap", "", "wap", "", ""};
3316 UBYTE AccessType[] = { WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_CS_DATA};
3317 UBYTE ConnectionSpeed[] = { WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600};
3318 USHORT ResponseTimer[] = {60, 60, 60, 60, 60, 60, 60, 60, 60};
3319 USHORT Port1[] = {9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201};
3320 USHORT Port2[] = {9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201};
3321 //xpradipg - Aug 4: Added the default values for the WAP2.0 Menu Items
3322 //Need to confirm these default values
3323
3324 char *NameServer1[] = { "000.000.000.000", "000.000.000.000", "000.000.000.000", "000.000.000.000", "000.000.000.000", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3325 char *NameServer2[] = { "000.000.000.000", "000.000.000.000", "000.000.000.000", "000.000.000.000", "000.000.000.000", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3326 BOOL PPGAuthentication[] = {FALSE, FALSE, FALSE,FALSE,FALSE,FALSE,FALSE,FALSE};
3327 BOOL WirelessProfiledHTTP[]={ TRUE,TRUE, TRUE, TRUE, TRUE,TRUE, TRUE, TRUE};
3328
3329 /*
3330 // Germany MMS settings from Tristan (?)
3331 UBYTE no_of_profiles = 4;
3332 char *profilesDefault[] = { "T-Mobile", "Vodafone", "E-Plus","O2"};
3333 char *IPAddress1[] = { "193.254.160.003", "139.007.029.017", "212.023.097.153", "195.182.114.052"};
3334 char *IPAddress2[] = { "000.000.000.000", "139.007.029.017", "212.023.097.153", "195.182.114.052"};
3335 char *DialupNumber[] = { "17266", "00447836900808", "00448456609561","00448456609561" };
3336 char *APN[] = { "mms.t-d1.de", "event.vodafone.de", "mms.eplus.de", "wap.viaginterkom.de"};
3337 char *Username[] = { "t-mobil", "", "mms", "" };
3338 char *Password[] = { "mms", "", "eplus", "" };
3339 UBYTE AccessType[] = { WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA };
3340 UBYTE ConnectionSpeed[] = { WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600};
3341 USHORT ResponseTimer[] = {180,60,120, 120};
3342 USHORT Port1[] = {9201,9201,9201, 9201};
3343 USHORT Port2[] = {9201,9201,9201, 9201};
3344 // MMS settings from Tristan (?)
3345 UBYTE no_of_profiles = 3;
3346 char *profilesDefault[] = { "CNMobile", "Orange", "Magic4"};
3347 char *homepageURL[] = { "http://wap.yahoo.com", "http://plus.orangehk.com", "http://plus.orangehk.com"};
3348 char *IPAddress1[] = { "010.000.000.172", "010.030.003.151", "010.030.003.151"};
3349 char *IPAddress2[] = { "010.000.000.172", "010.030.003.151", "010.030.003.151"};
3350 char *DialupNumber[] = { "17266", "00447836900808", "00448456609561" };
3351 char *APN[] = { "CMWAP", "web.orangehk.com", "web.orangehk.com"};
3352 char *Username[] = { "WAP", "", "" };
3353 char *Password[] = { "WAP", "", "" };
3354 UBYTE AccessType[] = { WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA }; /* SPR#1189 - SH - Added
3355 UBYTE ConnectionSpeed[] = { WAP_ISDN9600, WAP_ISDN14400, WAP_ISDN14400};/* SPR#1827 - SH - Default connection speed values
3356 USHORT ResponseTimer[] = {180,60,120};
3357 USHORT Port1[] = {9201,9201,9201};
3358 USHORT Port2[] = {9201,9201,9201};
3359 */
3360
3361 USHORT entryIndex;
3362 USHORT profile;
3363 char number[NUMBER_PADDING+1]; /* SPR#1816 -SH */
3364
3365 #ifdef TRACE_ATBWAPAUI
3366 TRACE_FUNCTION("ATB_wap_profile_default_create");
3367 #endif
3368
3369 WapData->ProfileId = 0;
3370 WapData->Status = WAP_STATUS_SAVEHISTORY | WAP_STATUS_SCALEIMAGES;
3371
3372 /* Copy bookmarks into WapData structure */
3373
3374 WapData->no_of_bookmarks = no_of_bookmarks;
3375
3376 for (entryIndex = 0; entryIndex<no_of_bookmarks; entryIndex++)
3377 {
3378 ATB_char_to_uc(WapData->Bookmarks[entryIndex], bookmarksList[entryIndex]);
3379 strcpy(WapData->BookmarksURL[entryIndex], bookURLList[entryIndex]);
3380 }
3381
3382 /* Copy history list into WapData structure */
3383
3384 WapData->no_of_history = no_of_history;
3385
3386 for (entryIndex = 0; entryIndex<no_of_history; entryIndex++)
3387 {
3388 sprintf(number,"%2d. ",entryIndex+1); /* store number */
3389 ATB_char_to_uc(WapData->History[entryIndex], number);
3390 ATB_char_to_uc(&WapData->History[entryIndex][NUMBER_PADDING], historyList[entryIndex]);
3391 strcpy(WapData->HistoryURL[entryIndex], histURLList[entryIndex]);
3392 }
3393
3394 /* Copy profile data into WapData and WapProfilesData structures */
3395
3396 WapData->no_of_profiles = no_of_profiles;
3397
3398 for (profile = 0; profile<no_of_profiles; profile++)
3399 {
3400 ATB_char_to_uc(WapProfilesData->Profile[profile].Title, profilesDefault[profile]);
3401 strcpy(WapProfilesData->Profile[profile].Homepage, homepageURL[profile]);
3402
3403 WapProfilesData->Profile[profile].ConnectionType = WAP_CONTINUOUS;
3404 WapProfilesData->Profile[profile].ConnectionSpeed = ConnectionSpeed[profile]; /* SPR#1827 - SH - Assign connection speed values */
3405 WapProfilesData->Profile[profile].Security = FALSE;
3406 WapProfilesData->Profile[profile].AccessType = AccessType[profile]; /* SPR#1189 - SH - Now correctly assigned*/
3407 WapProfilesData->Profile[profile].ResponseTimer = ResponseTimer[profile];
3408 WapProfilesData->Profile[profile].Port1 = Port1[profile];
3409 WapProfilesData->Profile[profile].Port2 = Port2[profile];
3410 strcpy(WapProfilesData->Profile[profile].IPAddress1, IPAddress1[profile]);
3411 strcpy(WapProfilesData->Profile[profile].IPAddress2, IPAddress2[profile]);
3412 strcpy(WapProfilesData->Profile[profile].DialupNumber, DialupNumber[profile]);
3413 strcpy(WapProfilesData->Profile[profile].APN, APN[profile]);
3414 strcpy(WapProfilesData->Profile[profile].Username, Username[profile]);
3415 strcpy(WapProfilesData->Profile[profile].Password, Password[profile]);
3416 //xpradipg - Aug 4: changes for the WAP2.0: Populating the default values
3417
3418 strcpy(WapProfilesData->Profile[profile].NameServer1, NameServer1[profile]);
3419 strcpy(WapProfilesData->Profile[profile].NameServer2, NameServer2[profile]);
3420 WapProfilesData->Profile[profile].PPGAuthentication=PPGAuthentication[profile];
3421 WapProfilesData->Profile[profile].WirelessProfiledHTTP=WirelessProfiledHTTP[profile];
3422
3423 }
3424
3425 /* Write data to flash */
3426
3427 if (flash_wap_write()==EFFS_OK) // Make sure flash data is written OK
3428 return WAP_OK;
3429 else
3430 return WAP_FAIL;
3431 }
3432
3433
3434 void ATB_wap_profile_default(UBYTE ProfileId)
3435 {
3436 char *profilesDefault[] = { "fg.vip.gprs", "vip.gprs", "fg.ht.gprs", "ht.gprs", "D1.gprs", "D2.gprs", "E-Plus.gprs", "O2.gprs", "Empty"};
3437 char *homepageURL[] = { "http://wap.fgmicrotec.hr", "http://wap.vip.hr", "http://wap.fgmicrotec.hr", "http://wap.fgmicrotec.hr", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com"};
3438 UBYTE ConnectionSpeed[] = { WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600, WAP_ISDN9600};
3439
3440 UBYTE AccessType[] = { WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_GPRS_DATA, WAP_CS_DATA};
3441
3442 USHORT ResponseTimer[] = {60, 60, 60, 60, 60, 60, 60, 60, 60};
3443 USHORT Port1[] = {9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201};
3444 USHORT Port2[] = {9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201, 9201};
3445 char *IPAddress1[] = { "217.014.220.081", "212.091.099.091", "217.014.220.081", "010.012.000.003", "193.254.160.002", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3446 char *IPAddress2[] = { "217.014.220.081", "212.091.099.091", "217.014.220.081", "000.000.000.000", "193.254.160.002", "139.007.029.001", "212.023.097.009", "195.182.114.052", "000.000.000.000"};
3447 char *DialupNumber[] = { "00448704290000", "00448704290000", "00448704290000", "00448704290000", "17266", "00491722290100", "00448456609561", "00448456609561", ""};
3448 char *APN[] = { "gprs5.vipnet.hr", "gprs5.vipnet.hr", "www.htgprs.hr", "www.htgprs.hr", "wap.t-d1.de", "wap.vodafone.de", "wap.eplus.de", "wap.viaginterkom.de", ""};
3449 char *Username[] = { "38591", "38591", "", "", "t-d1", "", "eplus", "", ""};
3450 char *Password[] = { "38591", "38591", "", "", "wap", "", "wap", "", ""};
3451
3452 ATB_char_to_uc(WapProfilesData->Profile[ProfileId].Title, profilesDefault[ProfileId]);
3453 strcpy(WapProfilesData->Profile[ProfileId].Homepage, homepageURL[ProfileId]);
3454 WapProfilesData->Profile[ProfileId].ConnectionType = WAP_CONTINUOUS;
3455 WapProfilesData->Profile[ProfileId].ConnectionSpeed = ConnectionSpeed[ProfileId]; /* SPR#1827 - SH - Assign connection speed values */
3456 WapProfilesData->Profile[ProfileId].Security = FALSE;
3457 WapProfilesData->Profile[ProfileId].AccessType = AccessType[ProfileId]; /* SPR#1189 - SH - Now correctly assigned*/
3458 WapProfilesData->Profile[ProfileId].ResponseTimer = ResponseTimer[ProfileId];
3459 WapProfilesData->Profile[ProfileId].Port1 = Port1[ProfileId];
3460 WapProfilesData->Profile[ProfileId].Port2 = Port2[ProfileId];
3461 strcpy(WapProfilesData->Profile[ProfileId].IPAddress1, IPAddress1[ProfileId]);
3462 strcpy(WapProfilesData->Profile[ProfileId].IPAddress2, IPAddress2[ProfileId]);
3463 strcpy(WapProfilesData->Profile[ProfileId].DialupNumber, DialupNumber[ProfileId]);
3464 strcpy(WapProfilesData->Profile[ProfileId].APN, APN[ProfileId]);
3465 strcpy(WapProfilesData->Profile[ProfileId].Username, Username[ProfileId]);
3466 strcpy(WapProfilesData->Profile[ProfileId].Password, Password[ProfileId]);
3467 return;
3468
3469 }
3470
3471
3472 #else
3473
3474 T_WAP_RES ATB_wap_profile_default_create(UBYTE only_reset_profiles)
3475 {
3476 UBYTE no_of_bookmarks = 10;
3477 char *bookmarksList[] =
3478 {
3479 "Yahoo!",
3480 "AOL",
3481 "O2",
3482 "Financial Times",
3483 "Cnet tech news",
3484 "T-Mobile UK",
3485 "Ents24",
3486 "WEB.DE",
3487 "Vizzavi",
3488 "El Pais"
3489 };
3490
3491 char *bookURLList[] =
3492 {
3493 "http://wap.yahoo.com",
3494 "http://wap.aol.co.uk",
3495 "http://wap.o2.co.uk/",
3496 "http://wap.ft.com",
3497 "http://wap.cnet.com",
3498 "http://wap.t-mobile.co.uk",
3499 "http://wap.ents24.co.uk",
3500 "http://wap.web.de",
3501 "http://wap.vizzavi.co.uk",
3502 "http://wap.elpais.es"
3503 };
3504
3505 UBYTE no_of_history = 0;
3506 char *historyList[] = { "dummy" };
3507 char *histURLList[] = { "www.dummy.org" };
3508
3509 /* SPR#2324 - SH
3510 * - Only need 3 profiles now, as extra ones can be added by user
3511 * - Only create first 2 if there's no GPRS */
3512 #ifdef GPRS
3513 UBYTE no_of_profiles = 3;
3514 #else
3515 UBYTE no_of_profiles = 2;
3516 #endif
3517
3518 char *profilesDefault[] = { "Breathe", "Vodaf.CSD", "Vodaf.GPRS", "Empty", "Empty"};
3519 char *homepageURL[] = { "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com", "http://wap.yahoo.com"};
3520 char *IPAddress1[] = { "062.024.128.014", "212.183.137.012", "212.183.137.012", "000.000.000.000", "000.000.000.000"};
3521 char *IPAddress2[] = { "062.024.128.014", "212.001.130.132", "212.001.130.132", "000.000.000.000", "000.000.000.000"};
3522 char *DialupNumber[] = { "00448704290000", "00447836900808", "00448456609561", "", "" };
3523 char *APN[] = { "none", "none", "wap.vodafone.co.uk", "", ""};
3524 char *Username[] = { "breathe", "user@vodafone.net", "user@vodafone.net", "", "" };
3525 char *Password[] = { "breathewap", "user", "user", "", ""};
3526 UBYTE AccessType[] = { WAP_CS_DATA, WAP_CS_DATA, WAP_GPRS_DATA, WAP_CS_DATA, WAP_CS_DATA };
3527
3528 /* SPR#2324 - SH - Some defaults moved to ATB_wap_profile_default */
3529 USHORT entryIndex;
3530 USHORT profile;
3531 char number[NUMBER_PADDING+1];
3532
3533 #ifdef TRACE_ATBWAPAUI
3534 TRACE_FUNCTION("ATB_wap_profile_default_create");
3535 #endif
3536
3537 WapData->ProfileId = 0;
3538
3539 /* SPR#2324 - SH - If this flag is set, don't reset settings and bookmarks */
3540
3541 if (!only_reset_profiles)
3542 {
3543 WapData->Status = WAP_STATUS_SAVEHISTORY | WAP_STATUS_SCALEIMAGES;
3544
3545 /* Copy bookmarks into WapData structure */
3546
3547 WapData->no_of_bookmarks = no_of_bookmarks;
3548
3549 for (entryIndex = 0; entryIndex<no_of_bookmarks; entryIndex++)
3550 {
3551 ATB_char_to_uc(WapData->Bookmarks[entryIndex], bookmarksList[entryIndex]);
3552 strcpy(WapData->BookmarksURL[entryIndex], bookURLList[entryIndex]);
3553 }
3554
3555 /* Copy history list into WapData structure */
3556
3557 WapData->no_of_history = no_of_history;
3558
3559 for (entryIndex = 0; entryIndex<no_of_history; entryIndex++)
3560 {
3561 sprintf(number,"%2d. ",entryIndex+1); /* store number */
3562 ATB_char_to_uc(WapData->History[entryIndex], number);
3563 ATB_char_to_uc(&WapData->History[entryIndex][NUMBER_PADDING], historyList[entryIndex]);
3564 strcpy(WapData->HistoryURL[entryIndex], histURLList[entryIndex]);
3565 }
3566 }
3567
3568 /* Copy profile data into WapData and WapProfilesData structures */
3569
3570 WapData->no_of_profiles = no_of_profiles;
3571
3572 for (profile = 0; profile<MAX_PROFILES; profile++)
3573 {
3574 /* SPR#2324 - SH - Set up "blank" profile first, then configure
3575 * WAP gateway settings */
3576
3577 ATB_wap_profile_default(profile);
3578 if (profile<no_of_profiles)
3579 {
3580 ATB_char_to_uc(WapProfilesData->Profile[profile].Title, profilesDefault[profile]);
3581 strcpy(WapProfilesData->Profile[profile].Homepage, homepageURL[profile]);
3582 WapProfilesData->Profile[profile].AccessType = AccessType[profile];
3583 strcpy(WapProfilesData->Profile[profile].IPAddress1, IPAddress1[profile]);
3584 strcpy(WapProfilesData->Profile[profile].IPAddress2, IPAddress2[profile]);
3585 strcpy(WapProfilesData->Profile[profile].DialupNumber, DialupNumber[profile]);
3586 strcpy(WapProfilesData->Profile[profile].APN, APN[profile]);
3587 strcpy(WapProfilesData->Profile[profile].Username, Username[profile]);
3588 strcpy(WapProfilesData->Profile[profile].Password, Password[profile]);
3589 }
3590 }
3591
3592 /* Write data to flash */
3593
3594 if (flash_wap_write()==EFFS_OK) /* Make sure flash data is written OK */
3595 return WAP_OK;
3596 else
3597 return WAP_FAIL;
3598 }
3599
3600 /*******************************************************************************
3601
3602 $Function: ATB_wap_profile_default
3603
3604 $Description: Sends the configuration information of the current profile to the WAP task.
3605 SPR#2324 - SH - Added
3606
3607 $Returns: None.
3608
3609 $Arguments: ProfileId - Profile identifier
3610
3611 *******************************************************************************/
3612
3613 void ATB_wap_profile_default(UBYTE ProfileId)
3614 {
3615 AUI_wap_stringID(WapProfilesData->Profile[ProfileId].Title, CARD_TITLE_MAX_LEN, WAP_STRING_UNTITLED);
3616 strcpy(WapProfilesData->Profile[ProfileId].Homepage, "");
3617 WapProfilesData->Profile[ProfileId].ConnectionType = WAP_TEMPORARY;
3618 WapProfilesData->Profile[ProfileId].ConnectionSpeed = WAP_ANALOGUE; /* SPR#1827 - SH - Assign connection speed values */
3619 WapProfilesData->Profile[ProfileId].Security = FALSE;
3620 WapProfilesData->Profile[ProfileId].AccessType = WAP_GPRS_DATA; /* SPR#1189 - SH - Now correctly assigned*/
3621 WapProfilesData->Profile[ProfileId].ResponseTimer = WAP_DEFAULT_RESPONSE_TIME;
3622 WapProfilesData->Profile[ProfileId].Port1 = WAP_DEFAULT_PORT;
3623 WapProfilesData->Profile[ProfileId].Port2 = WAP_DEFAULT_PORT;
3624 strcpy(WapProfilesData->Profile[ProfileId].IPAddress1, "000.000.000.000");
3625 strcpy(WapProfilesData->Profile[ProfileId].IPAddress2, "000.000.000.000");
3626 strcpy(WapProfilesData->Profile[ProfileId].DialupNumber, "");
3627 strcpy(WapProfilesData->Profile[ProfileId].APN, "");
3628 strcpy(WapProfilesData->Profile[ProfileId].Username, "");
3629 strcpy(WapProfilesData->Profile[ProfileId].Password, "");
3630
3631 return;
3632 }
3633
3634 #endif
3635
3636 #if defined (FF_MMI_MMS) && defined (FF_GPF_TCPIP)
3637 T_WAP_RES ATB_mms_profile_default_create()
3638 {
3639 UBYTE no_of_profiles = 8;
3640 USHORT profile;
3641 char *MmscAddress[] = { "http://mms.fgmicrotec.hr:8888/mms=fgmicro", "http://mms.vipnet.hr/servlets/mms", "http://mms.fgmicrotec.hr:8888/mms=fgmicro", "http://mms.htmobile.hr/servlets/mms", "http://mms.t-mobile.de/servlets/mms", "http://139.7.24.1/servlets/mms", "http://mms/eplus", "http://10.81.0.7:8002"};
3642
3643 /* Copy profile data into MmsProfilesData structures */
3644 for (profile = 0; profile<no_of_profiles; profile++)
3645 {
3646 strcpy(MmsProfilesData->Profile[profile].MmscAddress, MmscAddress[profile]);
3647 }
3648
3649 /* Write data to flash */
3650 if (flash_mms_write()==EFFS_OK) // Make sure flash data is written OK
3651 return WAP_OK;
3652 else
3653 return WAP_FAIL;
3654 }
3655 #endif
3656
3657 /*******************************************************************************
3658
3659 $Function: ATB_wap_profile_send
3660
3661 $Description: Sends the configuration information of the current profile to the WAP task.
3662
3663 $Returns: None.
3664
3665 $Arguments: View - the current view
3666
3667 *******************************************************************************/
3668
3669 #ifdef FF_GPF_TCPIP
3670 #if 0
3671 void ATB_wap_profile_send(T_WAP_VIEW *View)
3672 {
3673 T_WAP_PROFILE *Profile = View->Profile;
3674 ULONG IPAddressLong;
3675
3676 #ifdef TRACE_ATBWAPAUI
3677 TRACE_FUNCTION("ATB_wap_profile_send");
3678 #endif
3679
3680 /* Set bearer for data channel */
3681 switch(Profile->AccessType)
3682 {
3683 case WAP_GPRS_DATA:
3684 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_GPRS);
3685 break;
3686 case WAP_CS_DATA:
3687 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_CSD);
3688 break;
3689 case WAP_SMS:
3690 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_SMS);
3691 break;
3692 }
3693
3694 /* Setup timeout */
3695 ATB_wap_conn_config_int(View, configTIMEOUT, Profile->ResponseTimer);
3696 /* Setup stack mode */
3697 /* This part is used only for browser */
3698 if (View->object_id == 1)
3699 {
3700 if (Profile->Port1 == 9201)
3701 {
3702 ATB_wap_conn_config_int(View, configCONNECTION_TYPE, CONNECTION_TYPE_WSP_CO);
3703 TRACE_EVENT("CONNECTION_TYPE_WSP_CO at the location 1 called");
3704 }
3705 else
3706 {
3707 ATB_wap_conn_config_int(View, configCONNECTION_TYPE, CONNECTION_TYPE_TCP);
3708 TRACE_EVENT("CONNECTION_TYPE_TCP at the location 1 called");
3709 }
3710 }
3711
3712 if( (Profile->WirelessProfiledHTTP) || (Profile->Port1 == 9201) )
3713 {
3714 /* Set IP address
3715 * Trying first IP address, so set flag accordingly */
3716 View->secondaryIP = FALSE;
3717 ATB_conv_str_to_IP(Profile->IPAddress1, strlen(Profile->IPAddress1), &IPAddressLong);
3718 ATB_wap_conn_config_str(View, configPROXY_ADDRESS, (CHAR *)&IPAddressLong, sizeof(ULONG));
3719 }
3720
3721 // Config security
3722 ATB_wap_conn_config_int(View, configALWAYS_SECURE, 0);
3723 ATB_wap_conn_config_int(View, configNEVER_SECURE, 1);
3724
3725 /* Set WAP host */
3726 //ATB_wap_conn_config_str(View, configADD_HOST, Profile->Homepage, strlen(Profile->Homepage));
3727
3728 /* Set connection port 1 */
3729 ATB_wap_conn_config_int(View, configPROXY_PORT, Profile->Port1);
3730 ATB_wap_conn_config_int(View, WAP_setPort1, Profile->Port1);
3731 ATB_wap_conn_config_int(View, configPROXY_SECURE_PORT, 0);
3732
3733 /* Set connection port 2 */
3734 ATB_wap_conn_config_int(View, WAP_setPort2, Profile->Port2);
3735
3736 // Set proxy credentials
3737 ATB_wap_conn_config_str(View, WAP_transLongIP, (char*) &IPAddressLong, 4);
3738 ATB_wap_conn_config_str(View, WAP_transUsername, Profile->Username, strlen(Profile->Username));
3739 ATB_wap_conn_config_str(View, WAP_transPassword, Profile->Password, strlen(Profile->Password));
3740
3741
3742 /* SPR#2086 - SH - Set connection port for PUSH */
3743 // ATB_wap_conn_config_int(View, WAP_setPortPush, WAP_DEFAULT_PORT_PUSH); FG ?
3744
3745
3746 return;
3747 }
3748 #else
3749
3750 // xreddymn Jun-21-2005 MMI-SPR-30291: Changed method of sending WAP profile
3751 // from MMI to WAP adapter.
3752
3753 extern void *micAlloc(int size);
3754
3755 void ATB_wap_profile_send(T_WAP_VIEW *View)
3756 {
3757 T_WAP_PROFILE *Profile = View->Profile;
3758 ULONG IPAddressLong;
3759 T_MMI_WAP_PROFILE_DATA *profile_data;
3760 T_MMI_WAP_SEND_PROFILE_IND send_profile_ind;
3761
3762 #ifdef TRACE_ATBWAPAUI
3763 TRACE_FUNCTION("ATB_wap_profile_send");
3764 #endif
3765
3766 profile_data = micAlloc(sizeof(T_MMI_WAP_PROFILE_DATA));
3767 if(profile_data == NULL)
3768 {
3769 return;
3770 }
3771
3772 /* Set bearer for data channel */
3773 switch(Profile->AccessType)
3774 {
3775 case WAP_GPRS_DATA:
3776 profile_data->configACCESS_TYPE = BEARER_GSM_GPRS;
3777 break;
3778 case WAP_CS_DATA:
3779 profile_data->configACCESS_TYPE = BEARER_GSM_CSD;
3780 break;
3781 case WAP_SMS:
3782 profile_data->configACCESS_TYPE = BEARER_GSM_SMS;
3783 break;
3784 }
3785
3786 /* Setup timeout */
3787 profile_data->configTIMEOUT = Profile->ResponseTimer;
3788 ATB_wap_conn_config_int(View, configTIMEOUT, Profile->ResponseTimer);
3789
3790 /* Setup stack mode */
3791 /* This part is used only for browser */
3792 profile_data->configCONNECTION_TYPE = -1;
3793 if (View->object_id == 1)
3794 {
3795 if (Profile->Port1 == 9201)
3796 {
3797 profile_data->configCONNECTION_TYPE = CONNECTION_TYPE_WSP_CO;
3798 TRACE_EVENT("CONNECTION_TYPE_WSP_CO at the location 1 called");
3799 }
3800 else
3801 {
3802 profile_data->configCONNECTION_TYPE = CONNECTION_TYPE_TCP;
3803 TRACE_EVENT("CONNECTION_TYPE_TCP at the location 1 called");
3804 }
3805 }
3806
3807 profile_data->configPROXY_ADDRESS[0] = 0;
3808 if( (Profile->WirelessProfiledHTTP) || (Profile->Port1 == 9201) )
3809 {
3810 /* Set IP address
3811 * Trying first IP address, so set flag accordingly */
3812 View->secondaryIP = FALSE;
3813 ATB_conv_str_to_IP(Profile->IPAddress1, strlen(Profile->IPAddress1), &IPAddressLong);
3814 memcpy(profile_data->configPROXY_ADDRESS, (CHAR *)&IPAddressLong, sizeof(ULONG));
3815 }
3816
3817 // Config security
3818 profile_data->configALWAYS_SECURE = 0;
3819 profile_data->configNEVER_SECURE = 1;
3820
3821 /* Set connection port 1 */
3822 profile_data->configPROXY_PORT = Profile->Port1;
3823 profile_data->WAP_setPort1 = Profile->Port1;
3824 profile_data->configPROXY_SECURE_PORT = 0;
3825
3826 /* Set connection port 2 */
3827 profile_data->WAP_setPort2 = Profile->Port2;
3828
3829 // Set proxy credentials
3830 memcpy(profile_data->WAP_transLongIP, (CHAR *)&IPAddressLong, sizeof(ULONG));
3831 strncpy(profile_data->WAP_transUsername, Profile->Username, 20);
3832 strncpy(profile_data->WAP_transPassword, Profile->Password, 20);
3833
3834 send_profile_ind.data = (UBYTE*)profile_data;
3835 send_profile_ind.object_id = View->object_id;
3836 send_profile_ind.channel_id = View->channel;
3837 M_MMI_WAP_SEND_PROFILE_IND(&send_profile_ind);
3838
3839 return;
3840 }
3841
3842 #endif
3843 #else /* #ifdef FF_GPF_TCPIP */
3844
3845 void ATB_wap_profile_send(T_WAP_VIEW *View)
3846 {
3847 T_WAP_PROFILE *Profile = View->Profile;
3848 ULONG IPAddressLong;
3849
3850 #ifdef TRACE_ATBWAPAUI
3851 TRACE_FUNCTION("ATB_wap_profile_send");
3852 #endif
3853
3854 /* Set bearer for data channel */
3855 switch(Profile->AccessType)
3856 {
3857 case WAP_GPRS_DATA:
3858 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_GPRS);
3859 break;
3860 case WAP_CS_DATA:
3861 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_CSD);
3862 break;
3863 case WAP_SMS:
3864 ATB_wap_conn_config_int(View, configACCESS_TYPE, BEARER_GSM_SMS);
3865 break;
3866 }
3867
3868 /* Setup timeout */
3869 ATB_wap_conn_config_int(View, configTIMEOUT, Profile->ResponseTimer);
3870
3871 /* Set IP address
3872 * Trying first IP address, so set flag accordingly */
3873 View->secondaryIP = FALSE;
3874 ATB_conv_str_to_IP(Profile->IPAddress1, strlen(Profile->IPAddress1), &IPAddressLong);
3875 ATB_wap_conn_config_str(View, configUDP_IP_GW, (CHAR *)&IPAddressLong, sizeof(ULONG));
3876
3877 /* Set WAP Server Authentification name */
3878 ATB_wap_conn_config_str(View, configAUTH_ID_GW, Profile->Username, strlen(Profile->Username));
3879
3880 /* Set WAP Server Authentification password */
3881 ATB_wap_conn_config_str(View, configAUTH_PASS_GW, Profile->Password, strlen(Profile->Password));
3882
3883 /* Set WAP host */
3884 ATB_wap_conn_config_str(View, configADD_HOST, Profile->Homepage, strlen(Profile->Homepage));
3885
3886 /* Set connection port 1 */
3887 ATB_wap_conn_config_int(View, WAP_setPort1, Profile->Port1);
3888
3889 /* Set connection port 2 */
3890 ATB_wap_conn_config_int(View, WAP_setPort2, Profile->Port2);
3891
3892 return;
3893 }
3894
3895 #endif /* !#ifdef FF_GPF_TCPIP */
3896
3897 #ifdef FF_GPF_TCPIP
3898 /*******************************************************************************
3899
3900 $Function: ATB_wap_profile_setting_get
3901
3902 $Description: Returns the status of a particular setting
3903
3904 $Returns: 1 if the setting is on, 0 otherwise
3905
3906 $Arguments: The setting to check
3907
3908 *******************************************************************************/
3909
3910 UBYTE ATB_wap_profile_setting(UBYTE setting)
3911 {
3912 #ifdef TRACE_ATBWAPAUI
3913 TRACE_FUNCTION("ATB_wap_profile_setting_get");
3914 #endif
3915
3916 if (WapData->Status & setting)
3917 {
3918 return 1;
3919 }
3920 else
3921 {
3922 return 0;
3923 }
3924 }
3925
3926
3927 /*******************************************************************************
3928
3929 $Function: ATB_wap_profile_setting_change
3930
3931 $Description: Switches a setting on or off
3932
3933 $Returns: None
3934
3935 $Arguments: setting - The setting to change
3936 value - The new value (1 = on, 0 = off)
3937
3938 *******************************************************************************/
3939
3940 void ATB_wap_profile_setting_change(UBYTE setting, UBYTE value)
3941 {
3942 #ifdef TRACE_ATBWAPAUI
3943 TRACE_FUNCTION("ATB_wap_profile_setting_get");
3944 #endif
3945
3946 if (value)
3947 {
3948 WapData->Status ^= setting;
3949 }
3950 else
3951 {
3952 WapData->Status &= ~setting;
3953 }
3954 return;
3955 }
3956
3957 /*******************************************************************************
3958
3959 $Function: ATB_wap_profile_add
3960
3961 $Description: Add a new profile with the given data
3962
3963 $Returns: none
3964
3965 $Arguments: p: Points to the structure containing the new profile data
3966
3967 xreddymn Jan-20-2005 MMI-SPR-28135: WAP_OTA
3968
3969 *******************************************************************************/
3970
3971 void ATB_wap_profile_add(T_WAP_PROFILE *p)
3972 {
3973 if (WapData->no_of_profiles==MAX_PROFILES)
3974 {
3975 /* Overwrite currently selected profile. But the correct method would be:
3976 * Ask user if the currently selected profile can be overwritten
3977 */
3978 memcpy(&WapProfilesData->Profile[WapData->ProfileId],p,sizeof(T_WAP_PROFILE));
3979 flash_wap_write();
3980 }
3981 else
3982 {
3983 memcpy(&WapProfilesData->Profile[WapData->no_of_profiles],p,sizeof(T_WAP_PROFILE));
3984 WapData->ProfileId=WapData->no_of_profiles;
3985 WapData->no_of_profiles++;
3986 flash_wap_write();
3987 }
3988 #if(0)
3989 if (View_header!=NULL)
3990 {
3991 ATB_wap_entry_list_destroy(View_header->ProfilesList);
3992 View_header->ProfilesList = ATB_wap_entry_list_create(WAP_PROFILES_LIST, MAX_PROFILES, PROFILENAME_MAX_LEN, TRUE);
3993 }
3994 #endif
3995 AUI_profile_list_redraw(WapData->ProfileId);
3996 }
3997
3998 #endif
3999 /*******************************************************************************
4000
4001 $Function: ATB_wap_secondary_IP
4002
4003 $Description: SPR#1688 - SH - Added this function
4004 If first IP address fails, try using secondary one.
4005
4006 $Returns: None.
4007
4008 $Arguments: View - the current view
4009
4010 *******************************************************************************/
4011
4012 void ATB_wap_secondary_IP(T_WAP_VIEW *View)
4013 {
4014 ULONG IPAddressLong;
4015
4016 #ifdef TRACE_ATBWAPAUI
4017 TRACE_FUNCTION("ATB_wap_secondary_IP()");
4018 #endif
4019
4020 /* We're now using secondary IP */
4021
4022 View->secondaryIP = TRUE;
4023
4024 /* Send IP configuration to WAP browser */
4025
4026 ATB_conv_str_to_IP(View->Profile->IPAddress2, strlen(View->Profile->IPAddress2), &IPAddressLong);
4027 #ifdef FF_GPF_TCPIP
4028 ATB_wap_conn_config_str(View, configPROXY_ADDRESS, (CHAR *)&IPAddressLong, sizeof(ULONG));
4029 #else
4030 ATB_wap_conn_config_str(View, configUDP_IP_GW, (CHAR *)&IPAddressLong, sizeof(ULONG));
4031 #endif
4032
4033
4034 /* Reload the requested page */
4035
4036 ATB_wap_download_url(View, View->URL, TRUE);
4037
4038 return;
4039 }
4040
4041
4042 /*******************************************************************************
4043
4044 $Function: ATB_wap_entry_list_create
4045
4046 $Description: Creates an entries list
4047
4048 $Returns: Pointer to entry list
4049
4050 $Arguments: type - type of list
4051 max_entries - maximum number of entries in list
4052 entry_size - size of entries in characters
4053 unicode - TRUE if entries are unicode
4054
4055 *******************************************************************************/
4056
4057 T_WAP_LIST * ATB_wap_entry_list_create(WAP_LIST_TYPE type, UBYTE max_entries, UBYTE entry_size, BOOL unicode)
4058 {
4059 T_WAP_LIST *EntryList;
4060
4061 #ifdef TRACE_ATBWAPAUI
4062 TRACE_FUNCTION("ATB_wap_entry_list_create");
4063 #endif
4064
4065 /* Allocate memory */
4066
4067 EntryList = (T_WAP_LIST *)AUI_wap_memory_alloc(sizeof(T_WAP_LIST));
4068 EntryList->Entry = (char **)AUI_wap_memory_alloc(max_entries*sizeof(char*));
4069
4070 /* Assign list parameters */
4071
4072 EntryList->type = type;
4073 EntryList->max_entries = max_entries;
4074 EntryList->entry_size = entry_size;
4075 EntryList->no_of_entries = 0;
4076 EntryList->unicode = unicode;
4077
4078 return EntryList;
4079 }
4080
4081
4082 /*******************************************************************************
4083
4084 $Function: ATB_wap_entry_list_destroy
4085
4086 $Description: Destroys an entries list
4087
4088 $Returns: WAP_OK
4089 WAP_FAIL if list does not exist
4090
4091 $Arguments: EntryList - pointer to entry list data
4092
4093 *******************************************************************************/
4094
4095 T_WAP_RES ATB_wap_entry_list_destroy(T_WAP_LIST *EntryList)
4096 {
4097 #ifdef TRACE_ATBWAPAUI
4098 TRACE_FUNCTION("AUI_wap_entry_list_destroy");
4099 #endif
4100
4101 /* Ensure list exists */
4102
4103 if (EntryList==NULL)
4104 return WAP_FAIL;
4105
4106 /* Destroy structure */
4107
4108 AUI_wap_memory_free((UBYTE *)EntryList->Entry, EntryList->max_entries*sizeof(char *));
4109 AUI_wap_memory_free((UBYTE *)EntryList,sizeof(T_WAP_LIST));
4110
4111 return WAP_OK;
4112 }
4113
4114
4115 /*******************************************************************************
4116
4117 $Function: ATB_wap_entry_add
4118
4119 $Description: Adds an entry to an entry list
4120
4121 $Returns: WAP_OK if added successfully
4122 WAP_FAIL if the list is full
4123
4124 $Arguments: Entrylist - Pointer to entries table
4125 Entry - Entry to add
4126
4127 *******************************************************************************/
4128
4129 T_WAP_RES ATB_wap_entry_add(T_WAP_LIST *EntryList, char *Entry)
4130 {
4131 UBYTE entryIndex = EntryList->no_of_entries; /* Where the new entry should go */
4132
4133 #ifdef TRACE_ATBWAPAUI
4134 TRACE_FUNCTION("ATB_wap_entry_add");
4135 ATB_trace_string(Entry, strlen(Entry));
4136 #endif
4137
4138 /* Check if the list is full */
4139
4140 if (entryIndex==EntryList->max_entries)
4141 return WAP_FAIL;
4142
4143 /* Add the entry */
4144
4145 if (EntryList->unicode)
4146 {
4147 ATB_uc_text_copy((USHORT *)EntryList->Entry[entryIndex], (USHORT *)Entry, EntryList->entry_size);
4148 // xreddymn Jan-06-2005 MMI-SPR-27618: Added End Of String character
4149 *((USHORT *)((USHORT *)EntryList->Entry[entryIndex]+EntryList->entry_size))='\0';
4150 }
4151 else
4152 {
4153 strncpy(EntryList->Entry[entryIndex], Entry, EntryList->entry_size);
4154 // xreddymn Jan-06-2005 MMI-SPR-27618: Added End Of String character
4155 *((char *)((char *)EntryList->Entry[entryIndex]+EntryList->entry_size))='\0';
4156 }
4157
4158 EntryList->no_of_entries++; /* Increase list count */
4159
4160 return WAP_OK;
4161 }
4162
4163
4164 /*******************************************************************************
4165
4166 $Function: ATB_wap_entry_change
4167
4168 $Description: Changes an entry in an entry list, destroying the old entry and
4169 creating a new one.
4170
4171 $Returns: WAP_OK
4172
4173 $Arguments: Entrylist - Pointer to entries table
4174 Entry - New entry text
4175 entryIndex - Number of entry to change
4176
4177 *******************************************************************************/
4178
4179 #ifdef FF_GPF_TCPIP
4180 T_WAP_RES ATB_wap_entry_change(WAP_LIST_TYPE type, T_WAP_LIST *EntryList, char *Entry, UBYTE entryIndex)
4181 #else
4182 T_WAP_RES ATB_wap_entry_change(T_WAP_LIST *EntryList, char *Entry, UBYTE entryIndex)
4183 #endif
4184
4185 {
4186 char number[NUMBER_PADDING+1];
4187 USHORT *EntryUC;
4188
4189 #ifdef TRACE_ATBWAPAUI
4190 TRACE_FUNCTION("ATB_wap_entry_change");
4191 #endif
4192
4193 #ifdef FF_GPF_TCPIP
4194 if (type==WAP_HISTORY_LIST)
4195 #else
4196 if (EntryList->type==WAP_HISTORY_LIST)
4197 #endif
4198 {
4199 sprintf(number, "%2d. ", entryIndex+1); /* Add "xx. " number at start */
4200
4201 if (EntryList->unicode)
4202 {
4203 EntryUC = (USHORT *)EntryList->Entry[entryIndex];
4204 ATB_char_to_uc(EntryUC, number);
4205 ATB_uc_text_copy(&EntryUC[NUMBER_PADDING], (USHORT *)Entry, EntryList->entry_size-NUMBER_PADDING);
4206 }
4207 else
4208 {
4209 strcpy(EntryList->Entry[entryIndex], number);
4210 strncpy(&EntryList->Entry[entryIndex][NUMBER_PADDING], Entry, EntryList->entry_size-NUMBER_PADDING);
4211 }
4212 }
4213 else
4214 {
4215 /* SPR#1816 - SH - Modified for unicode */
4216
4217 if (EntryList->unicode)
4218 {
4219 ATB_uc_text_copy((USHORT *)EntryList->Entry[entryIndex], (USHORT *)Entry, EntryList->entry_size);
4220 }
4221 else
4222 {
4223 strncpy(EntryList->Entry[entryIndex], Entry, EntryList->entry_size);
4224 }
4225 }
4226
4227 return WAP_OK;
4228 }
4229
4230
4231 /*******************************************************************************
4232
4233 $Function: ATB_wap_entry_insert
4234
4235 $Description: Insert an entry into an entry list, shifting all subsequent entries up one.
4236 If the maximum limit of the entry list is reached, the last entry is
4237 deleted.
4238
4239 $Returns: WAP_OK if inserted successfully
4240 WAP_FAIL if list is full, or if request does not make sense
4241
4242 $Arguments: Entrylist - Pointer to entries table
4243 Entry - Entry to insert
4244 entryIndex - Position at which to insert the new entry
4245
4246 *******************************************************************************/
4247
4248 #ifdef FF_GPF_TCPIP
4249 T_WAP_RES ATB_wap_entry_insert(WAP_LIST_TYPE type, T_WAP_LIST *EntryList, char *Entry, UBYTE entryIndex)
4250 #else
4251 T_WAP_RES ATB_wap_entry_insert(T_WAP_LIST *EntryList, char *Entry, UBYTE entryIndex)
4252 #endif
4253 {
4254 USHORT entryIndex2 = EntryList->no_of_entries;
4255 USHORT *EntryUC;
4256
4257 #ifdef TRACE_ATBWAPAUI
4258 TRACE_FUNCTION("ATB_wap_entry_insert()");
4259 #endif
4260
4261 /* Check for errors */
4262
4263 if (EntryList==NULL || entryIndex>EntryList->no_of_entries
4264 || EntryList->no_of_entries>EntryList->max_entries)
4265 {
4266 return WAP_FAIL;
4267 }
4268
4269 /* xreddymn Dec-10-2004 MMI-SPR-26159: Duplicate check for history list */
4270 #ifdef FF_GPF_TCPIP
4271
4272 // If set to 0, will allow duplicate entries in the History List
4273 if(type==WAP_URL_LIST)
4274 {
4275 S32 i, length;
4276 BOOL already_exists=FALSE;
4277
4278 if (EntryList->unicode)
4279 {
4280 length=ATB_uc_text_len((USHORT*)Entry);
4281 for(i=0;i<entryIndex2;i++)
4282 {
4283 if(ATB_uc_text_compare((USHORT*)EntryList->Entry[i],(USHORT*)Entry,length)==0)
4284 {
4285 already_exists=TRUE;
4286 break;
4287 }
4288 }
4289 }
4290 else
4291 {
4292 // length=strlen((const char*)Entry);
4293 for(i=0;i<entryIndex2;i++)
4294 {
4295 if(strcmp((const char*)EntryList->Entry[i],(const char*)Entry)==0)
4296 {
4297 already_exists=TRUE;
4298 break;
4299 }
4300 }
4301 }
4302 if(already_exists==TRUE)
4303 {
4304 return WAP_FAIL;
4305 }
4306 }
4307 #endif
4308
4309 if (EntryList->no_of_entries == EntryList->max_entries) /* If the list is full... */
4310 {
4311 entryIndex2--; /* Start shifting from second last entry */
4312 }
4313 else
4314 {
4315 EntryList->no_of_entries++; /* Increase bookmark count */
4316 }
4317
4318 while (entryIndex2>entryIndex) /* Work back from end of table */
4319 {
4320 /* Shift the table down to make space */
4321
4322 if (EntryList->unicode)
4323 {
4324 ATB_uc_text_copy((USHORT *)EntryList->Entry[entryIndex2],
4325 (USHORT *)EntryList->Entry[entryIndex2-1],
4326 EntryList->entry_size);
4327 }
4328 else
4329 {
4330 strncpy(EntryList->Entry[entryIndex2],
4331 EntryList->Entry[entryIndex2-1],
4332 EntryList->entry_size);
4333 }
4334
4335 entryIndex2--;
4336 }
4337
4338 /* For history list, need to include space for number at start */
4339
4340 #ifdef FF_GPF_TCPIP
4341 if (type==WAP_HISTORY_LIST) // For history list, need to include space for number at start
4342 #else
4343 if (EntryList->type==WAP_HISTORY_LIST)
4344 #endif
4345 {
4346 if (EntryList->unicode)
4347 {
4348 EntryUC = (USHORT *)EntryList->Entry[entryIndex];
4349 ATB_uc_text_copy(&EntryUC[NUMBER_PADDING],
4350 (USHORT *)Entry,
4351 EntryList->entry_size-NUMBER_PADDING);
4352 }
4353 else
4354 {
4355 strncpy(&EntryList->Entry[entryIndex][NUMBER_PADDING],
4356 Entry,
4357 EntryList->entry_size-NUMBER_PADDING);
4358 }
4359 ATB_wap_renumber_history(EntryList);
4360 }
4361 else
4362 {
4363 /* SPR#1816 - SH - Modified for unicode */
4364
4365 if (EntryList->unicode)
4366 {
4367 ATB_uc_text_copy((USHORT *)EntryList->Entry[entryIndex],
4368 (USHORT *)Entry,
4369 EntryList->entry_size);
4370 }
4371 else
4372 {
4373 strncpy(EntryList->Entry[entryIndex],
4374 Entry,
4375 EntryList->entry_size);
4376 }
4377 }
4378
4379 return WAP_OK;
4380 }
4381
4382
4383 /*******************************************************************************
4384
4385 $Function: ATB_wap_entry_remove
4386
4387 $Description: Removes an entry from the bookmarks or history list and moves
4388 other entries up to close the gap.
4389
4390 $Returns: WAP_OK if entry successfully removed
4391 WAP_FAIL if request does not make sense
4392
4393 $Arguments: Entrylist - Pointer to entries table
4394 entryIndex - Number of the entry to delete
4395
4396 *******************************************************************************/
4397
4398 T_WAP_RES ATB_wap_entry_remove(T_WAP_LIST *EntryList, UBYTE entryIndex)
4399 {
4400 #ifdef TRACE_ATBWAPAUI
4401 TRACE_FUNCTION("ATB_wap_entry_remove");
4402 #endif
4403
4404 /* Make sure request is meaningful */
4405
4406 if (EntryList==NULL || entryIndex>EntryList->no_of_entries)
4407 {
4408 return WAP_FAIL;
4409 }
4410
4411 EntryList->no_of_entries--; /* Decrease list count */
4412
4413 while (entryIndex<(EntryList->no_of_entries))
4414 {
4415 /* If we haven't reached end of table, move entries up */
4416
4417 if (EntryList->unicode)
4418 {
4419 ATB_uc_text_copy((USHORT *)EntryList->Entry[entryIndex],
4420 (USHORT *)EntryList->Entry[entryIndex+1],
4421 EntryList->entry_size);
4422 }
4423 else
4424 {
4425 strncpy(EntryList->Entry[entryIndex],
4426 EntryList->Entry[entryIndex+1],
4427 EntryList->entry_size);
4428 }
4429 entryIndex++;
4430 }
4431
4432 return WAP_OK;
4433 }
4434
4435
4436 /*******************************************************************************
4437
4438 $Function: ATB_wap_entry_remove_all
4439
4440 $Description: Removes all entries from a Entry List
4441
4442 $Returns: WAP_OK if successful
4443 WAP_FAIL if entry list does not exist
4444
4445 $Arguments: EntryList - Pointer to bookmarks table
4446
4447 *******************************************************************************/
4448
4449 T_WAP_RES ATB_wap_entry_remove_all(T_WAP_LIST *EntryList)
4450 {
4451 UBYTE entryIndex;
4452
4453 #ifdef TRACE_ATBWAPAUI
4454 TRACE_FUNCTION("ATB_wap_entry_remove_all");
4455 #endif
4456
4457 /* Make sure request is meaningful */
4458 if (EntryList==NULL)
4459 {
4460 return WAP_FAIL;
4461 }
4462
4463 EntryList->no_of_entries = 0;
4464 return WAP_OK;
4465 }
4466
4467
4468 /*******************************************************************************
4469
4470 $Function: ATB_wap_renumber_history
4471
4472 $Description: Renumber history list, changing prefixes to all entries
4473
4474 $Returns: WAP_OK
4475
4476 $Arguments: EntryList - pointer to history list
4477
4478 *******************************************************************************/
4479
4480 #ifdef FF_GPF_TCPIP
4481 int ATB_wap_renumber_history(T_WAP_LIST *EntryList)
4482 #else
4483 T_WAP_RES ATB_wap_renumber_history(T_WAP_LIST *EntryList)
4484 #endif
4485 {
4486 UBYTE entryIndex;
4487 char number[NUMBER_PADDING+1];
4488 USHORT *EntryUC;
4489
4490 #ifdef TRACE_AUIWAP
4491 TRACE_FUNCTION("ATB_wap_renumber_history");
4492 #endif
4493
4494 for (entryIndex = 0; entryIndex<(EntryList->no_of_entries); entryIndex++)
4495 {
4496 sprintf(number, "%2d.", entryIndex+1); /* Add "xx. " number at start */
4497
4498 if (EntryList->unicode)
4499 {
4500 EntryUC = (USHORT *)EntryList->Entry[entryIndex];
4501 ATB_char_to_uc(EntryUC, number);
4502 /* Overwrite terminating 0 after prefix with space */
4503 EntryUC[NUMBER_PADDING-1] = (USHORT)(' '<<8);
4504 }
4505 else
4506 {
4507 /* Overwrite the number prefix */
4508 strcpy(EntryList->Entry[entryIndex],number);
4509 /* Overwrite terminating 0 after prefix with space */
4510 EntryList->Entry[entryIndex][NUMBER_PADDING-1] = ' ';
4511 }
4512 }
4513
4514 return WAP_OK;
4515 }
4516
4517
4518 /*******************************************************************************
4519
4520 $Function: ATB_wap_status_change
4521
4522 $Description: Called to change WAP Application status, i.e. downloading, updating, etc
4523
4524 $Returns: None.
4525
4526 $Arguments: View - The current view
4527 status - New status
4528
4529 *******************************************************************************/
4530
4531 void ATB_wap_status_change(T_WAP_VIEW *View, USHORT status)
4532 {
4533 #ifdef TRACE_ATBWAPAUI
4534 TRACE_FUNCTION("ATB_wap_status_change");
4535 #endif
4536
4537 View->browser_status = status;
4538
4539 /* Inform AUI of status change */
4540 #if defined (FF_MMI_MMS) && defined (FF_GPF_TCPIP)
4541 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
4542 //The status information is handled by MMS module separatly.
4543 if(MMSactive)
4544 {
4545 //xrashmic 08 Feb, 2005 MMI-SPR-27853
4546 //Modified the parameters for this function.
4547 AUI_mms_status_notify(status);
4548 }
4549 else
4550 {
4551 AUI_wap_status_notify(View, status);
4552 }
4553
4554 #endif
4555
4556 #ifdef CO_UDP_IP
4557 AUI_wap_status_notify(View, status);
4558 #endif
4559
4560 return;
4561 }
4562
4563
4564 /*******************************************************************************
4565
4566 $Function: ATB_wap_status_get
4567
4568 $Description: Return TRUE if the browser is in the supplied status.
4569
4570 $Returns: TRUE/FALSE
4571
4572 $Arguments: View - The current view
4573 status - Is the browser in this state?
4574
4575 *******************************************************************************/
4576
4577 BOOL ATB_wap_status_get(T_WAP_VIEW *View, USHORT status)
4578 {
4579 #ifdef TRACE_ATBWAPAUI
4580 TRACE_FUNCTION("ATB_wap_status_get");
4581 #endif
4582
4583 if (View->browser_status==status)
4584 return (TRUE);
4585 else
4586 return (FALSE);
4587 }
4588
4589
4590 /*******************************************************************************
4591
4592 $Function: ATB_uc_text_charsInWidth
4593
4594 $Description: Returns number of characters of the string that can fit into the given
4595 width in pixels.
4596
4597 $Returns: Number of characters
4598
4599 $Arguments: str - the string (unicode, converted)
4600 length - the length of string to attempt to display
4601 width - the width in pixels into which the string must fit
4602
4603 *******************************************************************************/
4604
4605 USHORT ATB_uc_text_charsInWidth(USHORT *str, USHORT length, SHORT width)
4606 {
4607 USHORT strIndex;
4608 USHORT textwidth = 0;
4609 USHORT character;
4610
4611 #ifdef TRACE_ATBWAPAUI
4612 TRACE_FUNCTION("ATB_charsInWidth");
4613 #endif
4614
4615 for (strIndex = 0; strIndex<=length && textwidth<=width; strIndex++)
4616 {
4617 character = ((str[strIndex] & 0xFF)<<8) | ((str[strIndex] & 0xFF00)>>8);
4618 textwidth += font_getCharWidth(character);
4619 }
4620
4621 return strIndex-1;
4622 }
4623
4624
4625 #ifdef FF_GPF_TCPIP
4626 /*******************************************************************************
4627
4628 $Function: ATB_uc_text_len
4629
4630 $Description: SPR#1816 - SH - Added
4631 Returns length of unicode string
4632
4633 $Returns: Length of string
4634
4635 $Arguments: str - the string
4636
4637 *******************************************************************************/
4638
4639 USHORT ATB_uc_text_len(USHORT *str)
4640 {
4641 USHORT length;
4642
4643 #ifdef TRACE_ATBWAPAUI
4644 TRACE_EVENT("ATB_uc_text_len");
4645 #endif
4646
4647 length = 0;
4648
4649 while (str[length]!=0)
4650 {
4651 length++;
4652 }
4653
4654 return length;
4655 }
4656
4657
4658 #endif
4659 /*******************************************************************************
4660
4661 $Function: ATB_uc_text_copy
4662
4663 $Description: SPR#1816 - SH - Added
4664 Copies unicode string src into dst
4665
4666 $Returns: Length of string copied
4667
4668 $Arguments: dst - the destination string
4669 src - the source string
4670 destlen - the maximum string length to copy
4671
4672 *******************************************************************************/
4673
4674 USHORT ATB_uc_text_copy(USHORT *dst, USHORT *src, USHORT destlen)
4675 {
4676 USHORT length;
4677
4678 #ifdef TRACE_ATBWAPAUI
4679 TRACE_EVENT("ATB_uc_text_copy");
4680 #endif
4681
4682 length = 0;
4683
4684 while (src[length]!=NULL && length<destlen)
4685 {
4686 dst[length] = src[length];
4687 length++;
4688 }
4689
4690 dst[length] = NULL; /* Add terminating NULL */
4691
4692 return length;
4693 }
4694
4695
4696 /*******************************************************************************
4697
4698 $Function: ATB_uc_text_width
4699
4700 $Description: Returns width of unicode string in pixels
4701
4702 $Returns: Width of string in pixels
4703
4704 $Arguments: str - the string
4705 length - the length of string to measure
4706
4707 *******************************************************************************/
4708
4709 USHORT ATB_uc_text_width(USHORT *str, USHORT length)
4710 {
4711 USHORT width;
4712 USHORT index;
4713 USHORT character;
4714
4715 #ifdef TRACE_ATBWAPAUI
4716 TRACE_FUNCTION("ATB_uc_text_width");
4717 #endif
4718
4719 width = 0;
4720
4721 for (index=0; str[index]!=0 && index<length; index++)
4722 {
4723 character = ((str[index] & 0xFF)<<8) | ((str[index] & 0xFF00)>>8);
4724 width += font_getCharWidth(character);
4725 }
4726
4727 return width;
4728 }
4729
4730 // Apr 28 2005 REF: MMI-SPR-30400 x0012849
4731 // Thos function is called to see that text is not displayed on the scroll bar space
4732 /*******************************************************************************
4733 $Function: ATB_uc_text_cut
4734
4735 $Description: To see that the displayed string wont appear on the scroll bar space.
4736 This function is same as ATB_uc_text_crop but it wont put .. at the end.
4737 $Returns: Length of the cropped string in unicode characters.
4738
4739 $Arguments: str - the string (unicode, converted)
4740 length - the original length
4741 width - the maximum pixel width of the new string
4742
4743 *******************************************************************************/
4744
4745 USHORT ATB_uc_text_cut(USHORT *str, USHORT length, SHORT width)
4746 {
4747 USHORT maxlen = ATB_uc_text_charsInWidth(str, length, width); /* Maximum length of string that will fit */
4748
4749 #ifdef TRACE_ATBWAPAUI
4750 TRACE_FUNCTION("ATB_uc_text_cut");
4751 #endif
4752
4753 if (length>maxlen)
4754 {
4755 length = maxlen;
4756 str[length] = NULL;
4757 }
4758 return length;
4759 }
4760
4761 /*******************************************************************************
4762
4763 $Function: ATB_uc_text_crop
4764
4765 $Description: Crops a unicode string if necessary to fit the supplied pixel width
4766
4767 $Returns: Length of the cropped string in unicode characters.
4768
4769 $Arguments: str - the string (unicode, converted)
4770 length - the original length
4771 width - the maximum pixel width of the new string
4772
4773 *******************************************************************************/
4774
4775 USHORT ATB_uc_text_crop(USHORT *str, USHORT length, SHORT width)
4776 {
4777 USHORT maxlen = ATB_uc_text_charsInWidth(str, length, width); /* Maximum length of string that will fit */
4778
4779 #ifdef TRACE_ATBWAPAUI
4780 TRACE_FUNCTION("ATB_crop_text");
4781 #endif
4782
4783 if (length>maxlen)
4784 {
4785 length = maxlen;
4786 str[length] = NULL;
4787
4788 /* Add '..' to indicate text is cropped */
4789
4790 if (length>0)
4791 str[length-1] = '.';
4792 if (length>1)
4793 str[length-2] = '.';
4794 }
4795
4796 return length;
4797 }
4798
4799
4800 /*******************************************************************************
4801
4802 $Function: ATB_uc_text_convert
4803
4804 $Description: Swap the upper and lower bytes of each unicode character in a string
4805 (Converts standard unicode to MMI unicode)
4806
4807 $Returns: the string
4808
4809 $Arguments: str - the source/destination string
4810 strlen - the length of the string
4811
4812 *******************************************************************************/
4813
4814 USHORT* ATB_uc_text_convert (USHORT *str, USHORT strlen)
4815 {
4816 USHORT length;
4817
4818 #ifdef TRACE_ATBWAPAUI
4819 TRACE_FUNCTION("ATB_uc_text_convert()");
4820 #endif
4821
4822 for (length = 0; str[length]!=0 && length < strlen; length++)
4823 {
4824 str[length] = ((str[length]&0xFF)<<8) | ((str[length]&0xFF00)>>8);
4825 }
4826
4827 str[length] = NULL; /* Add terminating NULL */
4828
4829 return str;
4830 }
4831
4832
4833 /*******************************************************************************
4834
4835 $Function: ATB_uc_to_char
4836
4837 $Description: Converts a MMI-converted unicode string to a char string
4838
4839 $Returns: The length in unicode characters of the destination string
4840
4841 $Arguments: dst - the destination string
4842 src - the source string
4843 srclen - the length of the source string
4844
4845 *******************************************************************************/
4846
4847 USHORT ATB_uc_to_char(char *dst, USHORT *src, USHORT srclen)
4848 {
4849 USHORT length;
4850
4851 #ifdef TRACE_ATBWAPAUI
4852 TRACE_FUNCTION("ATB_uc_to_char()");
4853 #endif
4854
4855 for (length = 0; length < srclen && src[length]!=0; length++)
4856 {
4857 dst[length] = (char)(src[length]>>8);
4858 }
4859
4860 dst[length] = 0; /* Add terminating NULL */
4861
4862 return length;
4863 }
4864
4865
4866 /*******************************************************************************
4867
4868 $Function: ATB_char_to_uc
4869
4870 $Description: Converts a char string to a MMI-converted unicode string
4871
4872 $Returns: The length in unicode characters of the destination string
4873
4874 $Arguments: dst - the destination string
4875 src - the source string
4876
4877 *******************************************************************************/
4878
4879 USHORT ATB_char_to_uc (USHORT *dst, char *src)
4880 {
4881 USHORT length = 0;
4882
4883 #ifdef TRACE_ATBWAPAUI
4884 TRACE_FUNCTION("ATB_char_to_uc()");
4885 #endif
4886
4887 while (src[length]!=NULL)
4888 {
4889 dst[length] = (USHORT) (src[length]<<8);
4890 length++;
4891 }
4892
4893 dst[length] = 0; /* Add terminating NULL */
4894
4895 return length;
4896 }
4897
4898 /*******************************************************************************
4899
4900 $Function: ATB_uc_text_copy
4901
4902 $Description: Compares unicode strings
4903
4904 $Returns: zero if strings match, non zero otherwise
4905
4906 $Arguments: dst - the destination string
4907 src - the source string
4908 len - Number of UCS2 characters to compare
4909
4910 xreddymn Dec-10-2004 for MMI-SPR-26159
4911 *******************************************************************************/
4912
4913 USHORT ATB_uc_text_compare(USHORT *dst, USHORT *src, USHORT len)
4914 {
4915 S32 i=0;
4916
4917 if((dst==NULL)||(src==NULL))
4918 {
4919 return(len);
4920 }
4921 while ((src[i]==dst[i]) && (len>0))
4922 {
4923 len--;
4924 i++;
4925 }
4926
4927 return len;
4928 }
4929
4930 /*******************************************************************************
4931
4932 $Function: ATB_conv_str_to_IP
4933
4934 $Description: Converts a string IP address to a long type IP address
4935
4936 $Returns: None.
4937
4938 $Arguments: str - the string
4939 len - the original length
4940 ip - pointer to where the result will be placed
4941
4942 *******************************************************************************/
4943
4944 GLOBAL const void ATB_conv_str_to_IP(const char* str, USHORT len, ULONG* ip)
4945 {
4946 char buf[16];
4947 char *p, *pLast;
4948 ULONG i, j, k, m;
4949
4950 #ifdef TRACE_ATBWAPAUI
4951 TRACE_FUNCTION("ATB_conv_str_to_IP");
4952 #endif
4953
4954 if (len >= 16)
4955 {
4956 *ip = 0;
4957 return;
4958 }
4959
4960 memcpy (buf, str, len);
4961 buf[len] = '\0';
4962
4963 p = buf;
4964
4965 pLast = buf;
4966 k = 0;
4967 j = 0;
4968 m = 1;
4969 for (i=0; i<len; i++)
4970 {
4971 if (*p=='.')
4972 {
4973 *p = '\0';
4974 k |= (atoi(pLast) & 0xFF) * m;
4975 m*=0x100;
4976 j++;
4977 p++;
4978 pLast = p;
4979 if (j EQ 3)
4980 break;
4981 }
4982 else
4983 p++;
4984 }
4985
4986 if (j NEQ 3 OR p EQ &buf[len])
4987 {
4988 *ip = 0;
4989 return;
4990 }
4991
4992 k |= (atoi(pLast) & 0xFF) * m;
4993
4994 *ip = k;
4995
4996 return;
4997 }
4998
4999 #ifdef FF_GPF_TCPIP
5000 /*******************************************************************************
5001
5002 $Function: ATB_wap_data_call_connect
5003
5004 $Description: Connect the specified view
5005 SPR#2086 - SH - Added
5006
5007 $Returns: None
5008
5009 $Arguments: View - The current view
5010
5011 *******************************************************************************/
5012
5013 void ATB_wap_data_call_connect(T_WAP_VIEW *View)
5014 {
5015 #ifdef TRACE_ATBWAPAUI
5016 TRACE_FUNCTION("ATB_wap_data_call_connect()");
5017 #endif
5018
5019 if (View)
5020 {
5021 connect(View->object_id);
5022 }
5023
5024 return;
5025 }
5026 #endif
5027
5028 /*******************************************************************************
5029 $Function: ATB_data_call_connected
5030
5031 $Description: Confirms that a data call has been connected
5032
5033 $Returns: None.
5034
5035 $Arguments: View - The current view
5036
5037 *******************************************************************************/
5038 #ifdef FF_GPF_TCPIP
5039 void ATB_data_call_connected(T_WAP_VIEW *View)
5040 {
5041 T_MMI_WAP_CONNECT_CNF parameter;
5042
5043 #ifdef TRACE_ATBWAPAUI
5044 TRACE_FUNCTION("ATB_data_call_connected");
5045 #endif
5046
5047 /* SPR#2086 - SH - Use Current_view rather than View_header */
5048
5049 if (View != NULL)
5050 {
5051 parameter.object_id = View->object_id;
5052 parameter.channel = View->channel;
5053 parameter.success = TRUE;
5054 M_MMI_WAP_CONNECT_CNF(&parameter);
5055 }
5056
5057
5058 if (View->object_id==WAP_PUSH_VIEW)
5059 {
5060 ATB_wap_status_change(View, ATB_WAP_NO_STATUS);
5061 }
5062
5063
5064 return;
5065 }
5066
5067 #else /* #ifdef FF_GPF_TCPIP */
5068 void ATB_data_call_connected(void)
5069 {
5070 T_MMI_WAP_CONNECT_CNF parameter;
5071
5072 #ifdef TRACE_ATBWAPAUI
5073 TRACE_FUNCTION("ATB_data_call_connected");
5074 #endif
5075
5076 if (View_header != NULL)
5077 {
5078 parameter.object_id = View_header->object_id;
5079 parameter.channel = View_header->channel;
5080
5081
5082 parameter.success = TRUE;
5083 M_MMI_WAP_CONNECT_CNF(&parameter);
5084 }
5085
5086 return;
5087 }
5088
5089 #endif /* ! #ifdef FF_GPF_TCPIP */
5090
5091 #ifdef FF_GPF_TCPIP
5092 /*******************************************************************************
5093
5094 $Function: ATB_wap_data_call_disconnected
5095
5096 $Description: Confirms that a data call has been disconnected
5097 SPR#2086 - SH - Added
5098
5099 $Returns: None
5100
5101 $Arguments: View - The current view
5102
5103 *******************************************************************************/
5104
5105 void ATB_wap_data_call_disconnected(T_WAP_VIEW *View)
5106 {
5107 T_MMI_WAP_CONNECT_CNF parameter;
5108
5109 #ifdef TRACE_ATBWAPAUI
5110 TRACE_FUNCTION("ATB_wap_data_call_disconnected()");
5111 #endif
5112
5113 //xmzhou_trace_string("ATB_wap_data_call_disconnected called");
5114
5115 if (View != NULL)
5116 {
5117 parameter.object_id = View->object_id;
5118 parameter.channel = View->channel;
5119 parameter.success = FALSE;
5120 M_MMI_WAP_CONNECT_CNF(&parameter);
5121 }
5122
5123 return;
5124 }
5125
5126 #endif /* #ifdef FF_GPF_TCPIP */
5127 /*******************************************************************************
5128
5129 $Function: ATB_wap_start_done
5130
5131 $Description: Confirms that WAP_START has completed
5132
5133 $Returns: None.
5134
5135 $Arguments: None.
5136
5137 *******************************************************************************/
5138
5139 void ATB_wap_start_done(void)
5140 {
5141 AUI_wap_start_done();
5142
5143 return;
5144 }
5145
5146
5147 /*******************************************************************************
5148
5149 $Function: ATB_wap_new_view_done
5150
5151 $Description: Confirms that WAP_NEW_VIEW has completed
5152 Also ends configuration information to WAP browser.
5153 Only send parameters that will not be modified during this
5154 session.
5155
5156 $Returns: None.
5157
5158 $Arguments: None.
5159
5160 *******************************************************************************/
5161
5162 #ifdef FF_GPF_TCPIP
5163 void ATB_wap_new_view_done(void)
5164 {
5165 T_WAP_VIEW *View = Current_view;
5166
5167 /* Set max no. of history entries */
5168 ATB_wap_config_int(View, configHISTORY_SIZE, MAX_HISTORY);
5169
5170 ATB_wap_config_int(View, configCACHE_SIZE, WAP_cache_size);
5171
5172 /* Display Images */
5173 //ATB_wap_config_int(View, configDISPLAY_IMAGES, 1);
5174
5175 /* Don't update images */
5176 //ATB_wap_config_int(View, configUPDATE_IMAGES, 0);
5177
5178 /* Set default channel */
5179 ATB_wap_config_int(View, configDEFAULT_CHANNEL, View->channel);
5180
5181 /* Set connection port */
5182 ATB_wap_conn_config_int(View, configCLIENT_PORT, 3);
5183
5184 /* Set online status (FALSE = not always online) */
5185 //ATB_wap_conn_config_int(View, configONLINE, FALSE);
5186
5187
5188 /* SPR#2086 - SH */
5189 ATB_wap_config_int(View, configPPG_AUTHENTICATION_REQUIRED, 0);
5190
5191
5192 AUI_wap_new_view_done();
5193
5194 return;
5195 }
5196
5197 #else /* #ifdef FF_GPF_TCPIP */
5198
5199 void ATB_wap_new_view_done(void)
5200 {
5201 T_WAP_VIEW *View = Current_view;
5202
5203 /* Set max no. of history entries */
5204 ATB_wap_config_int(View, configHISTORY_SIZE, MAX_HISTORY);
5205
5206 /* Display Images */
5207 ATB_wap_config_int(View, configDISPLAY_IMAGES, 1);
5208
5209 /* Don't update images */
5210 ATB_wap_config_int(View, configUPDATE_IMAGES, 0);
5211
5212 /* Set default channel */
5213 ATB_wap_config_int(View, configDEFAULT_CHANNEL, View->channel);
5214
5215 /* Setup stack mode */
5216 ATB_wap_conn_config_int(View, configSTACKMODE, MODE_CO_WSP);
5217
5218 /* Set connection port */
5219 ATB_wap_conn_config_int(View, configCLIENT_LOCAL_PORT, 3);
5220
5221 /* Set online status (FALSE = not always online) */
5222 ATB_wap_conn_config_int(View, configONLINE, FALSE);
5223
5224 AUI_wap_new_view_done();
5225
5226 return;
5227 }
5228
5229 #endif /* ! #ifdef FF_GPF_TCPIP */
5230 /*******************************************************************************
5231
5232 $Function: ATB_wap_close_view_done
5233
5234 $Description: Confirms that WAP_CLOSE_VIEW has completed
5235
5236 $Returns: None.
5237
5238 $Arguments: None.
5239
5240 *******************************************************************************/
5241
5242 void ATB_wap_close_view_done(void)
5243 {
5244 AUI_wap_close_view_done();
5245
5246 return;
5247 }
5248
5249 /*******************************************************************************
5250
5251 $Function: ATB_wap_cache_prepare
5252
5253 $Description: Tell WAP Browser to prepare the cache for shutdown
5254
5255 $Returns: None.
5256
5257 $Arguments: None.
5258
5259 *******************************************************************************/
5260
5261 void ATB_wap_cache_prepare(void)
5262 {
5263 T_MMI_WAP_CACHE_PREPARE_IND parameter;
5264
5265 M_MMI_WAP_CACHE_PREPARE_IND(&parameter);
5266
5267 return;
5268 }
5269
5270
5271 /*******************************************************************************
5272
5273 $Function: ATB_wap_cache_prepare_done
5274
5275 $Description: Confirms that WAP_CACHE_PREPARE has completed
5276
5277 $Returns: None.
5278
5279 $Arguments: None.
5280
5281 *******************************************************************************/
5282
5283 void ATB_wap_cache_prepare_done(void)
5284 {
5285 AUI_wap_cache_prepare_done();
5286
5287 return;
5288 }
5289
5290
5291 /*******************************************************************************
5292
5293 $Function: ATB_wap_terminate_done
5294
5295 $Description: Confirms that WAP_TERMINATE has completed
5296
5297 $Returns: None.
5298
5299 $Arguments: None.
5300
5301 *******************************************************************************/
5302
5303 void ATB_wap_terminate_done(void)
5304 {
5305 AUI_wap_terminate_done();
5306
5307 return;
5308 }
5309
5310
5311 /*******************************************************************************
5312
5313 $Function: ATB_wap_disconnect
5314
5315 $Description: Informs WAP browser that a disconnection has occurred
5316
5317 $Returns: None.
5318
5319 $Arguments: View - the current View
5320
5321 *******************************************************************************/
5322
5323 void ATB_wap_disconnect(T_WAP_VIEW *View)
5324 {
5325 T_MMI_WAP_DISCONNECT_IND parameter;
5326
5327 TRACE_FUNCTION("ATB_wap_disconnect()");
5328
5329 parameter.object_id = View->object_id;
5330 parameter.channel = View->channel;
5331
5332 M_MMI_WAP_DISCONNECT_IND(&parameter);
5333
5334 return;
5335 }
5336
5337 #ifdef FF_GPF_TCPIP
5338 /*******************************************************************************
5339
5340 $Function: ATB_wap_content_get
5341
5342 $Description: Fetches content
5343 SPR#2086 - SH - Added
5344
5345 $Returns: WAP_FAIL if invalid request
5346 WAP_OK otherwise.
5347
5348 $Arguments: urlID - A distinct ID for this request. Returned in ATB_wap_content().
5349 Url - The URL of the content to download.
5350 reload - If TRUE, any version of the requested content in the cache
5351 will be ignored, and the content will be fetched from the network.
5352 acceptHeader - Specifies if any Accept-Header fields will be sent with
5353 the request. Can be NULL.
5354
5355 *******************************************************************************/
5356
5357 T_WAP_RES ATB_wap_content_get(UBYTE urlID, char *Url, BOOL reload, char *acceptHeader)
5358 {
5359 T_MMI_WAP_CONTENT_REQ parameter;
5360
5361 TRACE_FUNCTION("ATB_wap_content_get()");
5362
5363 if (!parameter.Url)
5364 return WAP_FAIL;
5365
5366 parameter.Url = Url;
5367 parameter.url_length = strlen(Url);
5368 parameter.urlID = urlID;
5369 parameter.reload = reload;
5370 parameter.AcceptHeader = acceptHeader;
5371 if (acceptHeader!=NULL)
5372 {
5373 parameter.acceptHeader_length = strlen(acceptHeader);
5374 }
5375 else
5376 {
5377 parameter.acceptHeader_length = 0;
5378 }
5379
5380 //xmzhou_trace_string("****M_MMI_WAP_CONTENT_REQ****");
5381
5382 M_MMI_WAP_CONTENT_REQ(&parameter);
5383
5384 return WAP_OK;
5385 }
5386
5387
5388 /*******************************************************************************
5389
5390 $Function: ATB_wap_content
5391
5392 $Description: The requested content.
5393 SPR#2086 - SH - Added
5394
5395 $Returns: None.
5396
5397 $Arguments: urlID - A distinct ID for this request, provided by ATB_wap_content_get().
5398 Data - The downloaded data.
5399 data_length - The length of the downloaded data in bytes.
5400 moreData - If TRUE, there is more data to come.
5401 (This is just an indicator; the request for further data is made by the
5402 function M_WAP_MMI_CONTENT_IND.
5403 ContentType - The type of the downloaded data.
5404 contentType_length - The length of the downloaded data type, in bytes.
5405 totalSize - If the data comes in more than one chunk, this will give
5406 the total size of the assembled chunks. However, this information may
5407 not be provided by the WAP gateway.
5408 errorNo - Error code. If this is nonzero, it is reported to the AUI in
5409 the function AUI_error_dialog().
5410
5411 *******************************************************************************/
5412
5413 void ATB_wap_content(UBYTE urlID,
5414 char *Data,
5415 ULONG data_length,
5416 BOOL moreData,
5417 char *ContentType,
5418 ULONG contentType_length,
5419 ULONG totalSize,
5420 SHORT errorNo)
5421 {
5422 TRACE_FUNCTION("ATB_wap_content()");
5423
5424 /* Check if an error has occurred */
5425 if (Data==NULL || errorNo>0)
5426 {
5427 AUI_error_dialog(Current_view, errorNo);
5428 return;
5429 }
5430 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
5431 //The download data should not be displayed for MMS module
5432 if(!MMSactive)
5433 {
5434
5435 AUI_wap_content(
5436 urlID,
5437 Data,
5438 data_length,
5439 moreData,
5440 ContentType,
5441 contentType_length,
5442 totalSize);
5443 }
5444 return;
5445 }
5446
5447
5448 /*******************************************************************************
5449
5450 $Function: ATB_wap_content_cancel
5451
5452 $Description: Cancel receipt of content.
5453 SPR#2086 - SH - Added
5454
5455 $Returns: None.
5456
5457 $Arguments: urlID - The ID of the download.
5458
5459 *******************************************************************************/
5460
5461 void ATB_wap_content_cancel(UBYTE urlID)
5462 {
5463 T_MMI_WAP_CONTENT_CANCEL_IND parameter;
5464
5465 TRACE_FUNCTION("ATB_wap_content_cancel()");
5466
5467 parameter.urlID = urlID;
5468 M_MMI_WAP_CONTENT_CANCEL_IND(&parameter);
5469
5470 return;
5471 }
5472
5473
5474 /*******************************************************************************
5475
5476 $Function: ATB_wap_content_post
5477
5478 $Description: Post content
5479 SPR#2086 - SH - Added
5480
5481 $Returns: WAP_FAIL if invalid request
5482 WAP_OK otherwise.
5483
5484 $Arguments: urlID - A distinct ID for this request. Returned in ATB_wap_content().
5485 Url - The URL of the content to download.
5486 reload - If TRUE, any version of the requested content in the cache
5487 will be ignored, and the content will be fetched from the network.
5488 acceptHeader - Specifies if any Accept-Header fields will be sent with
5489 the request (NULL terminated). Can be NULL.
5490 Data - The data to post.
5491 data_length - The length of the data to post, in bytes.
5492 moreData - TRUE if there are more chunks to be sent after this one.
5493 contentType - May contain the content type of the data
5494 (NULL terminated string).
5495 sendMode - one of WAP_SENDMODE_URL_ENCODED,
5496 WAP_SENDMODE_MULTIPART_FORMDATA, WAP_SENDMODE_BINARY
5497 contentDisp - when sendMode is WAP_SENDMODE_MULTIPART_FORMDATA,
5498 contentDisp can be set to e.g. filename for the content. Can be NULL.
5499 totalSize - If moreData is TRUE, this may indicate the total size of
5500 the data to be sent.
5501
5502 *******************************************************************************/
5503
5504 T_WAP_RES ATB_wap_content_post(
5505 UBYTE urlID,
5506 char *Url,
5507 BOOL reload,
5508 char *acceptHeader,
5509 char *Data,
5510 ULONG data_length,
5511 BOOL moreData,
5512 char *ContentType,
5513 UBYTE sendMode,
5514 char *ContentDisp,
5515 ULONG totalSize)
5516 {
5517 T_MMI_WAP_CONTENT_POST_REQ parameter;
5518
5519 TRACE_FUNCTION("ATB_wap_content_post()");
5520 //xmzhou_trace_string("ATB_wap_content_post called!!!!");
5521
5522 //if (!parameter.Url || !parameter.Data)
5523 // return WAP_FAIL;
5524
5525 parameter.Url = Url;
5526 parameter.url_length = strlen(Url);
5527 parameter.urlID = urlID;
5528 parameter.reload = reload;
5529 parameter.AcceptHeader = acceptHeader;
5530 if (acceptHeader!=NULL)
5531 {
5532 parameter.acceptHeader_length = strlen(acceptHeader);
5533 }
5534 else
5535 {
5536 parameter.acceptHeader_length = 0;
5537 }
5538 parameter.Data = Data;
5539 parameter.data_length = data_length;
5540 parameter.moreData = moreData;
5541 parameter.ContentType = ContentType;
5542 if (ContentType!=NULL)
5543 {
5544 parameter.contentType_length = strlen(ContentType);
5545 }
5546 else
5547 {
5548 parameter.contentType_length = 0;
5549 }
5550 parameter.sendMode = sendMode;
5551 parameter.ContentDisp = ContentDisp;
5552 if (ContentDisp!=NULL)
5553 {
5554 parameter.contentDisp_length = strlen(ContentDisp);
5555 }
5556 else
5557 {
5558 parameter.contentDisp_length = 0;
5559 }
5560 parameter.totalSize = totalSize;
5561 //xmzhou_trace_string("ATB_wap_content_post call M_MMI_WAP_CONTENT_POST_REQ!!!!");
5562 M_MMI_WAP_CONTENT_POST_REQ(&parameter);
5563
5564 return WAP_OK;
5565 }
5566
5567
5568 /*******************************************************************************
5569
5570 $Function: ATB_wap_content_post_more
5571
5572 $Description: Post more content (after the first chunk has been sent)
5573 SPR#2086 - SH - Added
5574
5575 $Returns: WAP_FAIL if invalid request
5576 WAP_OK otherwise.
5577
5578 $Arguments: urlID - A distinct ID for this request, sent in ATB_wap_content_post().
5579 Data - The data to post.
5580 data_length - The length of the data to post, in bytes.
5581 moreData - TRUE if there are more chunks to be sent after this one.
5582
5583 *******************************************************************************/
5584
5585 T_WAP_RES ATB_wap_content_post_more(
5586 UBYTE urlID,
5587 char *Data,
5588 ULONG data_length,
5589 BOOL moreData)
5590 {
5591 T_MMI_WAP_CONTENT_POST_MORE_REQ parameter;
5592
5593 TRACE_FUNCTION("ATB_wap_content_post_more()");
5594 //xmzhou_trace_string("ATB_wap_content_post_more called");
5595
5596 //if (!parameter.Data)
5597 // return WAP_FAIL;
5598
5599 parameter.urlID = urlID;
5600 parameter.Data = Data;
5601 parameter.data_length = data_length;
5602 parameter.moreData = moreData;
5603
5604 M_MMI_WAP_CONTENT_POST_MORE_REQ(&parameter);
5605
5606 return WAP_OK;
5607
5608 }
5609
5610
5611
5612 /*******************************************************************************
5613
5614 $Function: ATB_wap_push_load_SI
5615
5616 $Description: Load the requested service indication.
5617 SPR#2086 - SH - Added
5618
5619 $Returns: None.
5620
5621 $Arguments: View - The current view
5622 id - The identifier of the SI.
5623
5624 *******************************************************************************/
5625
5626 void ATB_wap_push_load_SI(T_WAP_VIEW *View, SHORT id)
5627 {
5628 T_MMI_WAP_PUSH_LOAD_SI_IND parameter;
5629
5630 #ifdef TRACE_ATBWAPAUI
5631 TRACE_FUNCTION("ATB_wap_push_load_SI()");
5632 #endif
5633
5634 parameter.object_id = View->object_id;
5635 parameter.id = id;
5636
5637 M_MMI_WAP_PUSH_LOAD_SI_IND(&parameter);
5638
5639 return;
5640 }
5641
5642 /*******************************************************************************
5643
5644 $Function: ATB_wap_push_delete_SI
5645
5646 $Description: Delete the requested service indication.
5647 SPR#2086 - SH - Added
5648
5649 $Returns: None.
5650
5651 $Arguments: id - The identifier of the SI to delete.
5652 selection - Parameter specifying which SI to delete (used if id is -1).
5653 Can be WAP_PUSH_DEL_ALL, WAP_PUSH_DEL_EXP,
5654 WAP_PUSH_DEL_NON_EXP, WAP_PUSH_DEL_LOADED,
5655 WAP_PUSH_DEL_NON_LOADED
5656
5657 *******************************************************************************/
5658
5659 void ATB_wap_push_delete_SI(SHORT id, UBYTE selection)
5660 {
5661 T_MMI_WAP_PUSH_DELETE_SI_IND parameter;
5662
5663 #ifdef TRACE_ATBWAPAUI
5664 TRACE_FUNCTION("ATB_wap_push_delete_SI()");
5665 #endif
5666
5667 parameter.id = id;
5668 parameter.selection = selection;
5669
5670 M_MMI_WAP_PUSH_DELETE_SI_IND(&parameter);
5671
5672 return;
5673 }
5674
5675 /*******************************************************************************
5676
5677 $Function: ATB_wap_push_get_SI_info
5678
5679 $Description: Request info on the specified SI.
5680 SPR#2086 - SH - Added
5681
5682 $Returns: None.
5683
5684 $Arguments: id - The identifier of the SI to delete.
5685 selection - Parameter specifying for which SI to get info (used if id is -1).
5686 Can be WAP_PUSH_SHOW_ALL, WAP_PUSH_SHOW_EXP,
5687 WAP_PUSH_SHOW_NON_EXP, WAP_PUSH_SHOW_LOADED,
5688 WAP_PUSH_SHOW_NON_LOADED
5689
5690 *******************************************************************************/
5691
5692 void ATB_wap_push_get_SI_info(SHORT id, UBYTE selection)
5693 {
5694 T_MMI_WAP_PUSH_GET_SI_INFO_REQ parameter;
5695
5696 #ifdef TRACE_ATBWAPAUI
5697 TRACE_FUNCTION("ATB_wap_push_get_SI_info()");
5698 #endif
5699
5700 parameter.id = id;
5701 parameter.selection = selection;
5702
5703 M_MMI_WAP_PUSH_GET_SI_INFO_REQ(&parameter);
5704
5705 return;
5706 }
5707
5708
5709 /*******************************************************************************
5710
5711 $Function: ATB_wap_push_save_repository
5712
5713 $Description: Save the push repository to flash
5714 SPR#2086 - SH - Added
5715
5716 $Returns: None.
5717
5718 $Arguments: None
5719
5720 *******************************************************************************/
5721
5722 void ATB_wap_push_save_to_flash(void)
5723 {
5724 T_MMI_WAP_PUSH_SAVE_TO_FLASH_IND parameter;
5725
5726 #ifdef TRACE_ATBWAPAUI
5727 TRACE_FUNCTION("ATB_wap_push_load_SI()");
5728 #endif
5729
5730 M_MMI_WAP_PUSH_SAVE_TO_FLASH_IND(&parameter);
5731
5732 return;
5733 }
5734
5735
5736 /*******************************************************************************
5737
5738 $Function: ATB_wap_push_SI_new
5739
5740 $Description: A new SI has been received
5741 SPR#2086 - SH - Added
5742
5743 $Returns: None.
5744
5745 $Arguments: id - identifier for the SI
5746 created - Date and time of when SI was created in UTC format
5747 expires - Date and time of when SI expires in UTC format
5748 Message - The description of the received SI, to be presented to the
5749 end-user
5750 message_length - Length of Message in Unicode characters
5751 expired - TRUE if SI has expired, FALSE otherwise
5752 Url - The URL of the service to retrieve, or NULL if not provided
5753 url_length - Length of Url in characters
5754 priority - Priority of SI. Can be: WAP_PUSH_LOW_PRIO,
5755 WAP_PUSH_HIGH_PRIO, WAP_PUSH_CACHE_PRIO.
5756 InitURL - Identifies the push initiator. NULL if not provided
5757 initURL_length - Length of InitURL in characters
5758 applicationType - Allows application to map message to right user
5759 agent. Can be WAP_APPLICATION_WML, WAP_APPLICATON_WTA.
5760 newChannelId - For Bluetooth support
5761
5762 *******************************************************************************/
5763
5764 void ATB_wap_push_SI_new(
5765 SHORT id,
5766 ULONG created,
5767 ULONG expires,
5768 USHORT *Message,
5769 ULONG message_length,
5770 BOOL expired,
5771 char *Url,
5772 ULONG url_length,
5773 UBYTE priority,
5774 char *InitURL,
5775 ULONG initURL_length,
5776 UBYTE applicationType,
5777 UBYTE newChannelId
5778 )
5779 {
5780 #ifdef TRACE_ATBWAPAUI
5781 TRACE_FUNCTION("ATB_wap_push_SI_new()");
5782 #endif
5783
5784 /* Save the current push repository to flash */
5785
5786 ATB_wap_push_save_to_flash();
5787
5788 /* Indicate to the user that a new push message has arrived
5789 * (only if the appropriate setting is set to TRUE) */
5790
5791 if (ATB_wap_profile_setting(WAP_STATUS_PUSHMESSAGES))
5792 {
5793 AUI_wap_push_show(
5794 Message,
5795 (USHORT)message_length,
5796 id,
5797 (char *)Url,
5798 (USHORT)url_length);
5799 }
5800
5801 return;
5802 }
5803
5804 /*******************************************************************************
5805
5806 $Function: ATB_wap_push_SL_new
5807
5808 $Description: A new SL has been received
5809
5810 $Returns: void
5811
5812 $Arguments: id - identifier for the SL
5813 Url - The URL of the service to retrieve, or NULL if not provided
5814 url_length - Length of Url in characters
5815 priority - Priority of SL. Can be: WAP_PUSH_LOW_PRIO,
5816 WAP_PUSH_HIGH_PRIO, WAP_PUSH_CACHE_PRIO.
5817 InitURL - Identifies the push initiator. NULL if not provided
5818 initURL_length - Length of InitURL in characters
5819 applicationType - Allows application to map message to right user
5820 agent. Can be WAP_APPLICATION_WML, WAP_APPLICATON_WTA.
5821 newChannelId - For Bluetooth support
5822
5823 xreddymn Mar-16-2005 MMI-SPR-29767
5824
5825 *******************************************************************************/
5826
5827 void ATB_wap_push_SL_new(
5828 SHORT id,
5829 char *Url,
5830 ULONG url_length,
5831 UBYTE priority,
5832 char *InitURL,
5833 ULONG initURL_length,
5834 UBYTE applicationType,
5835 UBYTE newChannelId
5836 )
5837 {
5838 #ifdef TRACE_ATBWAPAUI
5839 TRACE_FUNCTION("ATB_wap_push_SL_new()");
5840 #endif
5841
5842 // Save the current push repository to flash
5843
5844 ATB_wap_push_save_to_flash();
5845
5846 // Launch WAP with the URL received in the SL message
5847
5848 AUI_wap_push_load_SL(id, Url, url_length);
5849
5850 return;
5851 }
5852
5853 /*******************************************************************************
5854
5855 $Function: ATB_wap_push_SI_info
5856
5857 $Description: Returns info about the specified SI.
5858 SPR#2086 - SH - Added
5859
5860 $Returns: None.
5861
5862 $Arguments: id - identifier for the SI
5863 status - Status of the SI. Can be WAP_PUSH_STATUS_NON_LOADED,
5864 WAP_PUSH_STATUS_LOADED.
5865 created - Date and time of when SI was created in UTC format
5866 expires - Date and time of when SI expires in UTC format
5867 Message - The description of the received SI, to be presented to the
5868 end-user
5869 message_length - Length of Message in Unicode characters
5870 expired - TRUE if SI has expired, FALSE otherwise
5871 Url - The URL of the service to retrieve, or NULL if not provided
5872 url_length - Length of Url in characters
5873 priority - Priority of SI. Can be: WAP_PUSH_LOW_PRIO,
5874 WAP_PUSH_HIGH_PRIO, WAP_PUSH_CACHE_PRIO.
5875 InitURL - Identifies the push initiator. NULL if not provided
5876 initURL_length - Length of InitURL in characters
5877
5878 *******************************************************************************/
5879
5880 void ATB_wap_push_SI_info(
5881 SHORT id,
5882 UBYTE status,
5883 ULONG created,
5884 ULONG expires,
5885 USHORT *Message,
5886 ULONG message_length,
5887 BOOL expired,
5888 char *Url,
5889 ULONG url_length,
5890 UBYTE priority,
5891 char *InitURL,
5892 ULONG initURL_length
5893 )
5894 {
5895 #ifdef TRACE_ATBWAPAUI
5896 TRACE_FUNCTION("ATB_wap_push_SI_info()");
5897 #endif
5898
5899 AUI_wap_push_info(
5900 Message,
5901 message_length,
5902 id,
5903 (char *)Url,
5904 (USHORT)url_length,
5905 status,
5906 created,
5907 expired,
5908 priority);
5909 }
5910
5911 char WAPServiceCentre[30] = {0};
5912 T_MFW_PHB_TON addr_type;
5913 T_MFW_PHB_TON sc_type;
5914
5915 /*******************************************************************************
5916
5917 $Function: ATB_wap_push_SMS_received
5918
5919 $Description: Notifies WAP that a WAP SMS has been received
5920 SPR#2086 - SH - Added
5921
5922 $Returns: None.
5923
5924 $Arguments: smsc - The service centre address (NULL terminated)
5925 tosca - Service centre T.O.N.
5926 number - The address of the sender
5927 toa - Sender addresss T.O.N.
5928 Data - data of message
5929 data_length - Length of the message in bytes
5930
5931 *******************************************************************************/
5932
5933 void ATB_wap_push_SMS_received(
5934 char *Smsc,
5935 UBYTE tosca,
5936 char *number,
5937 UBYTE toa,
5938 char *Udh,
5939 ULONG udh_length,
5940 char *Data,
5941 ULONG data_length)
5942 {
5943 T_MMI_WAP_PUSH_SMS_RECEIVED_IND parameter;
5944 USHORT totalsize;
5945 char *sms_data;
5946
5947 #ifdef TRACE_ATBWAPAUI
5948 TRACE_FUNCTION("ATB_wap_push_SMS_received");
5949 TRACE_EVENT_P2("udh_length %d, data_length: %d", udh_length, data_length);
5950 #endif
5951
5952 /* Concatenate the UDH and data */
5953
5954 totalsize = udh_length+data_length+1;
5955 sms_data = (char *)AUI_wap_memory_alloc(totalsize);
5956
5957 sms_data[0] = udh_length;
5958 memcpy((void *)&sms_data[1], Udh, udh_length);
5959 memcpy((void *)&sms_data[udh_length+1], Data, data_length);
5960
5961 /* Store WAP Service Centre */
5962
5963 memset((void *)WAPServiceCentre, 0, sizeof(WAPServiceCentre));
5964
5965 if (Smsc)
5966 {
5967 strcpy(WAPServiceCentre, Smsc);
5968 TRACE_EVENT_P1("smsc: %s", WAPServiceCentre);
5969 }
5970
5971 addr_type = toa;
5972 sc_type = tosca;
5973
5974 parameter.Source = number;
5975 parameter.source_length = (ULONG)strlen(number);
5976 parameter.Data = sms_data;
5977 parameter.data_length = (ULONG)totalsize;
5978
5979 M_MMI_WAP_PUSH_SMS_RECEIVED_IND(&parameter);
5980
5981 AUI_wap_memory_free((void *)sms_data, totalsize);
5982
5983 return;
5984 }
5985
5986
5987 /*******************************************************************************
5988
5989 $Function: ATB_wap_push_SMS_send
5990
5991 $Description: WAP requests MMI to send an SMS
5992 SPR#2086 - SH - Added
5993
5994 $Returns: None.
5995
5996 $Arguments: Smsc - The service centre address
5997 smsc_length - Length of the service centre in characters
5998 Destination - The address of the destination
5999 destination_length - The length of the destination
6000 toa - Sender addresss T.O.N.
6001 Data - data of message
6002 data_length - Length of the message in bytes
6003
6004 *******************************************************************************/
6005
6006 void ATB_wap_push_SMS_send(
6007 char *Smsc,
6008 ULONG smsc_length,
6009 char *Destination,
6010 ULONG destination_length,
6011 char *Data,
6012 ULONG data_length)
6013 {
6014 char *Destination_ascii;
6015 char dummy[] = "Test";
6016 #ifdef TRACE_AUIWAP
6017 TRACE_FUNCTION("ATB_wap_push_SMS_send");
6018 #endif
6019
6020 /* Ensure address is null-terminated */
6021
6022 Destination_ascii = (char *)AUI_wap_memory_alloc(destination_length+1);
6023 memcpy((void *)Destination_ascii, (void *)Destination, destination_length);
6024 Destination_ascii[destination_length] = 0;
6025
6026 sms_submit_wap_sms(MFW_SMS_REPLY,
6027 (CHAR *)Destination_ascii,
6028 addr_type,
6029 (UBYTE *)Data,
6030 (USHORT)data_length,
6031 WAPServiceCentre,
6032 sc_type);
6033
6034 AUI_wap_memory_free((void *)Destination_ascii,destination_length+1);
6035
6036 return;
6037 }
6038
6039
6040 /*******************************************************************************
6041
6042 $Function: ATB_wap_push_SMS_sent
6043
6044 $Description: Notifies WAP that a WAP SMS has been sent
6045 SPR#2086 - SH - Added
6046
6047 $Returns: None.
6048
6049 $Arguments: None
6050
6051 *******************************************************************************/
6052
6053 void ATB_wap_push_SMS_sent(void)
6054 {
6055 T_MMI_WAP_PUSH_SMS_SENT_IND parameter;
6056
6057 #ifdef TRACE_AUIWAP
6058 TRACE_FUNCTION("ATB_wap_push_SMS_sent");
6059
6060 #endif
6061
6062 parameter.dummy = 0;
6063
6064 M_MMI_WAP_PUSH_SMS_SENT_IND(&parameter);
6065
6066 return;
6067 }
6068
6069
6070 /*******************************************************************************
6071
6072 $Function: ATB_wap_push_SMS_error
6073
6074 $Description: Notifies WAP that a WAP SMS has not been sent
6075 SPR#2086 - SH - Added
6076
6077 $Returns: None.
6078
6079 $Arguments: error - an ID for the error
6080
6081 *******************************************************************************/
6082
6083 void ATB_wap_push_SMS_error(UBYTE error)
6084 {
6085 T_MMI_WAP_PUSH_SMS_ERROR_IND parameter;
6086
6087 #ifdef TRACE_AUIWAP
6088 TRACE_FUNCTION("ATB_wap_push_SMS_error");
6089 TRACE_EVENT_P1("**ERROR: %d**",error);
6090 #endif
6091
6092 parameter.message = error;
6093
6094 M_MMI_WAP_PUSH_SMS_ERROR_IND(&parameter);
6095
6096 return;
6097 }
6098
6099 #endif /* #ifdef FF_GPF_TCPIP */
6100
6101
6102 /*******************************************************************************
6103
6104 $Function: long_IP_to_char_IP
6105
6106 $Description: Converts a ULONG IP address into an IP address string suitable for an
6107 editor.
6108
6109 $Returns: None.
6110
6111 $Arguments: IPs - The IP address
6112 IPd - The string in which to store the result
6113
6114 *******************************************************************************/
6115
6116 void long_IP_to_char_IP(ULONG IPs,char* IPd)
6117 {
6118 ULONG tempLong;
6119 char tempChar;
6120 int i;
6121 char temp[50];
6122
6123 #ifdef TRACE_ATBWAPAUI
6124 sprintf(temp,"IP Address %X",(int)IPs);
6125 TRACE_EVENT(temp);
6126 #endif
6127
6128 for (i=3;i>=0;i--)
6129 {
6130 tempLong=((IPs)>>8*i)&(0xFF);
6131 *IPd = (char)tempLong;
6132 #ifdef TRACE_ATBWAPAUI
6133 sprintf(temp,"IP %d %X",i,(int)*IPd);
6134 TRACE_EVENT(temp);
6135 #endif
6136 IPd++;
6137 }
6138
6139
6140 }
6141
6142
6143 /*******************************************************************************
6144
6145 $Function: rAT_WAP_PPP_connected
6146
6147 $Description: Indication from ACI that PPP is connected
6148
6149 $Returns: None.
6150
6151 $Arguments: cId - Id of the WAP call
6152 IPAddress - Dynamically assigned IP address
6153
6154 *******************************************************************************/
6155 #ifdef FF_GPF_TCPIP
6156 //TISHMMS Project
6157 extern void M4_DebugStringMessage(char *in_string, UINT8 ucNumber,unsigned long para);
6158
6159 void rAT_WAP_PPP_connected(SHORT cId,ULONG IPAddress)
6160 {
6161 char charIP[5];
6162
6163 TRACE_FUNCTION("rAT_WAP_PPP_connected");
6164
6165 /* SPR#1569 - SH - If there are no open views, disconnect and exit */
6166
6167 if (!View_header)
6168 {
6169 TRACE_EVENT("** WAP has closed, disconnecting call **");
6170 /* SPR#1575 - SH - Call this function to end a GPRS or CSD call */
6171 AUI_end_call(0); /* SPR#1850 - SH - Call ID 0, disconnect any call */
6172 return;
6173 }
6174
6175 /* SPR#1189 - SH - If the browser is not in the correct state, disconnect */
6176
6177 if (ATB_wap_status_get(Current_view, ATB_WAP_ONLINE_CONNECTION_CLOSED))
6178 {
6179 TRACE_EVENT("** WAP is not in correct status, disconnecting call **");
6180 AUI_end_call(0);
6181 return;
6182 }
6183
6184 /* Send new IP address as config information */
6185
6186 if (IPAddress)
6187 {
6188 charIP[4]='\0';
6189
6190 long_IP_to_char_IP(IPAddress,(char*)charIP);
6191
6192 /* Set IP address host */
6193 ATB_wap_conn_config_str(Current_view, WAP_transCharIP, charIP, 4);
6194 }
6195
6196 /* SPR#1574 - SH - Removed parameter */
6197
6198 ATB_wap_status_change(Current_view,ATB_WAP_CONNECTING);
6199
6200 ATB_data_call_connected(Current_view);
6201 return;
6202 }
6203
6204 #else /* #ifdef FF_GPF_TCPIP */
6205
6206 void rAT_WAP_PPP_connected(SHORT cId,ULONG IPAddress)
6207 {
6208 char charIP[5];
6209
6210 TRACE_FUNCTION("rAT_WAP_PPP_connected");
6211
6212 /* If there are no open views, disconnect and exit */
6213
6214 if (!View_header)
6215 {
6216 TRACE_EVENT("** WAP has closed, disconnecting call **");
6217 AUI_wap_end_call(0); /* Call ID 0, disconnect any call */
6218 return;
6219 }
6220
6221 /* If the browser is not in the correct state, disconnect */
6222
6223 if (ATB_wap_status_get(Current_view, ATB_WAP_ONLINE_CONNECTION_CLOSED))
6224 {
6225 TRACE_EVENT("** WAP is not in correct status, disconnecting call **");
6226 AUI_wap_end_call(0);
6227 return;
6228 }
6229
6230 /* Send new IP address as config information */
6231
6232 if (IPAddress)
6233 {
6234 charIP[4]='\0';
6235
6236 long_IP_to_char_IP(IPAddress,(char*)charIP);
6237
6238 /* Set IP address host */
6239 ATB_wap_conn_config_str(Current_view, configUDP_IP_SRC, charIP, 4);
6240 }
6241
6242 /* Set new MMI status */
6243
6244 ATB_wap_status_change(Current_view,ATB_WAP_CONNECTING);
6245
6246 /* Send connection confirmation to WAP Browser */
6247
6248 ATB_data_call_connected();
6249
6250 return;
6251 }
6252
6253 #endif /* ! #ifdef FF_GPF_TCPIP */
6254
6255 /*******************************************************************************
6256
6257 $Function: rAT_WAP_start_login
6258
6259 $Description: Login has begun for CSD
6260
6261 $Returns: None.
6262
6263 $Arguments: None.
6264
6265 *******************************************************************************/
6266
6267 void rAT_WAP_start_login(void)
6268 {
6269 UBYTE temp;
6270
6271 TRACE_FUNCTION("rAT_WAP_start_login");
6272
6273 temp = dspl_Enable(0);
6274
6275 /* SPR#1569 - SH - Only change status if current view exists */
6276
6277 if (Current_view)
6278 {
6279 /* SPR#1574 - SH - Removed parameter */
6280 ATB_wap_status_change(Current_view, ATB_WAP_LOGGING_IN);
6281 }
6282
6283 dspl_Enable(temp);
6284
6285 return;
6286 }
6287
6288
6289 /*******************************************************************************
6290
6291 $Function: rAT_WAP_start_gprs_login
6292
6293 $Description: Login has started over GPRS
6294
6295 $Returns: None.
6296
6297 $Arguments: None.
6298
6299 *******************************************************************************/
6300
6301 //NM take it out #ifdef MMI_WAP_ENABLED
6302
6303 void rAT_WAP_start_gprs_login(void)
6304 {
6305 UBYTE temp;
6306
6307 TRACE_FUNCTION("rAT_WAP_start_gprs_login");
6308
6309 temp = dspl_Enable(0);
6310
6311 /* SPR#1569 - SH - Only change status if current view exists */
6312
6313 if (View_header && Current_view)
6314 {
6315 /* SPR#1982 - SH - Only change status if we are ATTACHING */
6316 if (ATB_wap_status_get(Current_view, ATB_WAP_ATTACHING))
6317 {
6318 ATB_wap_status_change(Current_view, ATB_WAP_CONNECTING);
6319 }
6320 }
6321
6322 dspl_Enable(temp);
6323
6324 return;
6325 }
6326
6327 //NM #endif
6328
6329 /*******************************************************************************
6330
6331 $Function: rAT_WAP_call_disconnected
6332
6333 $Description: Callback - disconnection occurred
6334
6335 $Returns: None.
6336
6337 $Arguments: cId - ID of the WAP call
6338
6339 *******************************************************************************/
6340
6341 #ifdef FF_GPF_TCPIP
6342 void rAT_WAP_call_disconnected(SHORT cId)
6343 {
6344 UBYTE temp;
6345 T_MMI_WAP_CONNECT_CNF parameter;
6346
6347 TRACE_FUNCTION("rAT_WAP_call_disconnected");
6348
6349 temp = dspl_Enable(0);
6350
6351 /* SPR#1569 - SH - If there are no open views, do nothing */
6352
6353
6354 if (Current_view)
6355 {
6356 /* SPR#1574 - SH - Removed parameter */
6357 ATB_wap_status_change(Current_view, ATB_WAP_ONLINE_CONNECTION_CLOSED);
6358
6359 parameter.object_id = Current_view->object_id;
6360 parameter.channel = Current_view->channel;
6361 parameter.success = FALSE;
6362 M_MMI_WAP_CONNECT_CNF(&parameter);
6363 }
6364
6365 dspl_Enable(temp);
6366
6367 return;
6368 }
6369
6370 #else /* #ifdef FF_GPF_TCPIP */
6371
6372 void rAT_WAP_call_disconnected(SHORT cId)
6373 {
6374 UBYTE temp;
6375 T_MMI_WAP_CONNECT_CNF parameter;
6376
6377 TRACE_FUNCTION("rAT_WAP_call_disconnected");
6378
6379 temp = dspl_Enable(0);
6380
6381 /* If there are no open views, do nothing */
6382
6383 if (View_header != NULL)
6384 {
6385 /* Inform MMI of connection closed */
6386
6387 if (Current_view)
6388 {
6389 ATB_wap_status_change(Current_view, ATB_WAP_ONLINE_CONNECTION_CLOSED);
6390 }
6391
6392 /* Inform WAP Broswer of connection closed */
6393
6394 parameter.object_id = View_header->object_id;
6395 parameter.channel = View_header->channel;
6396 parameter.success = FALSE;
6397 M_MMI_WAP_CONNECT_CNF(&parameter);
6398 Current_view = View_header;
6399 }
6400
6401 dspl_Enable(temp);
6402
6403 return;
6404 }
6405
6406 #endif /* ! #ifdef FF_GPF_TCPIP */
6407 /*******************************************************************************
6408
6409 $Function: writeerrorFFS/writeflagFFS
6410
6411 $Description: These functions are provided for debugging purposes
6412
6413 $Returns: None.
6414
6415 $Arguments:
6416
6417 *******************************************************************************/
6418
6419 void writeerrorFFS(short error)
6420 {
6421 UBYTE errordigits[6];
6422 sprintf((char *)errordigits, "%d", error);
6423 ffs_file_write("/mmi/errormmi", &errordigits, sizeof(errordigits), FFS_O_TRUNC | FFS_O_CREATE);
6424 }
6425
6426 void writeflagFFS(UBYTE flag)
6427 {
6428 ffs_file_write("/mmi/flag", &flag, sizeof(flag), FFS_O_TRUNC | FFS_O_CREATE);
6429 }
6430
6431