HcCallIn_UI.c
31.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
#if defined(__MMI_DSM_NEW__) && defined( __HC_CALL_NEW__)
/*-------------------------------------------------------------------------------*
--------------------------------------------------------------------------------*/
#include "dsm_datatype.h"
#include "GlobalMenuItems.h"
#include "GlobalDefs.h"
#include "GlobalConstants.h" //KEY_EVENT_UP
#include "HistoryGprot.h" //extern void GoBackHistory()
#include "HcCallDef.h"
#include "HcCallIn_UI.h"
#include "MainMenuDef.h"
#include "wgui_inline_edit.h"
#include "HcFileAdapter.h"
#include "CommonScreens.h"
#include "app_datetime.h"
#include "timerEvents.h"
#include "UCMGProt.h"
#include "PhoneBookTypes.h"
#include "MTPNP_AD_resdef.h"
#include "PhoneBookProt.h"
#include "PhoneBookResDef.h"
#include "Mtpnp_ad_common_def.h"
#include "ems.h"
#include "SmsGuiInterfaceType.h"
#ifdef __MMI_DUAL_SIM_MASTER__
#include "MTPNP_AD_master_if.h"
#endif
#include "SMSApi.h"
#include "MessagesresourceData.h"
#include "SettingProfile.h"
#include "PixtelDatatypes.h"
#include "SimDetectionDef.h"
#include "USBDeviceGprot.h"
#include "FileManagerGProt.h"
#include "UCMResDef.h"
#include "mrp_unet.h"
#include "mrp_sms.h"
#include "mrp_sysinfo.h"
#include "hccall_net.h"
#include "Section_Data.h"
#include "ldzs.h"
#include "mmi_rp_app_hccall_def.h"
#include "mrp_features.h"
#include "IdleAppResDef.h"
#define HELP_LIST_COUNT (3)
//////////////////////////////////////////////////////////////////////
//extern functions:
//////////////////////////////////////////////////////////////////////
extern void HighlightDsmGame(void);
extern int LocationData_Init_ex(void);
extern int GetLocation_ex( char *area, int size, char *tel );
extern void hccall_set_firmdatabase(const unsigned char* pFirmDatabase, uint32 firmDatabase);
extern int HC_get_driver_char(int type);
extern void mmi_mtpnp_entry_menu(U16 scr_id, FuncPtr exit_func, FuncPtr entry_func, U16 menu_id, U16 str_id, U16 img_id);
extern void ShowCategory401Screen(U16 percentage);
extern void mmi_phb_entry_main_menu(void);
//USB
#ifdef __USB_IN_NORMAL_MODE__
extern pBOOL mmi_usb_is_in_mass_storage_mode(void);
#ifndef WIN32
extern void mmi_usb_app_unavailable_popup(U16 stringId);
#endif
#endif
extern void hccall_start_host_timer(U32 delay, FuncPtr funcPtr);
extern void hccall_stop_host_timer(void);
//////////////////////////////////////////////////////////////////////
//global variables:
//////////////////////////////////////////////////////////////////////
extern HCCALL_NETSTATE g_hccall_netstate;
extern const U16 gIndexIconsImageList[];
//section
char g_HCNumber[HCNUMBER_LEN];
char g_HCStrLocation[HCSTRLOCATION_LEN];
char g_HCStrGsdLocation[HCSTRLOCATION_LEN];
char g_HcStr_Number[HCNUMBER_LEN];
static U16 Hc_func_setting_item = 0;
/********************************************************************
Function: hccall_load_userconfig
Description: load the user's config setting
Input: void
Output: g_HcUserConfig_p
Return: 1: success; 0:failed
Notice:
*********************************************************************/
int hccall_load_userconfig(HCCALL_CONFIG *g_HcUserConfig_p)
{
int32 fhandle = 0;
uint32 readCount;
int32 result = 0;
result = HcFile_Open(&fhandle, (int8*)HCUSER_CONFIG_F ,PO_RDONLY, 0);
if( !result )
{
if( fhandle > 0 )
{
HcFile_Close(fhandle, 0);
}
return result;
}
HcFile_Read(fhandle, g_HcUserConfig_p, sizeof(HCCALL_CONFIG), &readCount, 0);
if(readCount == sizeof(HCCALL_CONFIG))
{
result = 1;
}
else
{
result = 0;
}
HcFile_Close(fhandle, 0);
return result;
}
/********************************************************************
Function: hccall_save_userconfig
Description: save the user's config setting
Input: user's config setting
Output: void
Return: 1: success; 0:failed
Notice:
*********************************************************************/
int hccall_save_userconfig(HCCALL_CONFIG *g_HcUserConfig_p)
{
int32 fhandle = 0;
uint32 writeCount;
int32 result = 0;
result = HcFile_Open(&fhandle, (int8*)HCUSER_CONFIG_F ,PO_WRONLY, 0);
if( !result )
{
if( fhandle > 0 )
{
HcFile_Close(fhandle, 0);
}
return result;
}
HcFile_Write(fhandle, g_HcUserConfig_p, sizeof(HCCALL_CONFIG), &writeCount);
if(writeCount == sizeof(HCCALL_CONFIG))
{
result = 1;
}
else
{
result = 0;
}
HcFile_Close(fhandle, 0);
return result;
}
/********************************************************************
Function: HcCall_CheckUsbIsInMassStorageMode
Description: check whether the sd card is in mass storage mode
Input: bPopupTip: wheather show the tip info
Output:
Return: TURE:yes, FALSE:no
Notice:
*********************************************************************/
BOOL HcCall_CheckUsbIsInMassStorageMode()
{
#ifdef __USB_IN_NORMAL_MODE__
if (mmi_usb_is_in_mass_storage_mode())
{
return TRUE;
}
else
{
return FALSE;
}
#else
return FALSE;
#endif
}
/********************************************************************
Function: HcCall_CheckSDCard
Description: check whether the sd card is exist
Input: bPopupTip: whether show the tip info
Output:
Return: TURE:exist, FALSE:not exist
Notice:
*********************************************************************/
BOOL HcCall_CheckSDCard()
{
#ifdef __USB_IN_NORMAL_MODE__
if ((FS_NO_ERROR != FS_GetDevStatus(MMI_CARD_DRV,FS_MOUNT_STATE_ENUM)))
{
return FALSE;
}
else
{
return TRUE;
}
#else
return TRUE;
#endif
}
/********************************************************************
Function: HcCall_CheckSDCardNoMemory
Description: check whether our sd card has enough momery for downloading
Input: void
Output:
Return: TURE:No memory;
FALSE:enough momory
Notice: 500K
*********************************************************************/
BOOL HcCall_CheckSDCardNoMemory()
{
U16 path[20];
S8 buf[20];
S32 fs_ret;
U64 disk_free_space;
U64 disk_total_space;
FS_DiskInfo disk_info;
sprintf(buf, "%c:\\", HC_get_driver_char(HC_DRIVER_CARD));
mmi_asc_to_ucs2((S8*)path, (S8*)buf);
fs_ret = FS_GetDiskInfo(path, &disk_info, FS_DI_BASIC_INFO | FS_DI_FREE_SPACE);
disk_free_space = 0;
disk_total_space = 0;
if (fs_ret >= 0)
{
disk_free_space = (U64)disk_info.FreeClusters * disk_info.SectorsPerCluster * disk_info.BytesPerSector;
disk_total_space = (U64)disk_info.TotalClusters * disk_info.SectorsPerCluster * disk_info.BytesPerSector;
if(disk_free_space<512000)
{
return TRUE;
}
}
return FALSE;
}
BOOL hccall_check_simcard(void)
{
if (mr_getNetworkID() == MR_NET_ID_NONE)
{
return FALSE;
}
else
{
return TRUE;
}
}
/********************************************************************
Function: Hccall_Update_Database_Cancle
Description: cancel the database updating
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void Hccall_Update_Database_Cancle(void)
{
hccall_stop_host_timer();
hccall_net_close();
GoBackHistory();
}
int g_dldpercent = 0;
U8 g_str_buffer[512] = {0};
extern UI_string_type MMI_message_string;
/********************************************************************
Function: hccall_ui_update_dldprocess
Description: updating the downloading process window
Input: percent: the downloading percent
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_update_dldprocess(int percent)
{
g_dldpercent = percent;
if (HcCall_CheckUsbIsInMassStorageMode())
{
hccall_net_close();
if ((GetActiveScreenId() == SCR_ID_HCCALL_UPDATE_DOWNLOADING) ||
(GetActiveScreenId() == SCR_ID_HCCALL_UPDATE_CONNECTING))
{
GoBackHistory();
}
else
{
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_DOWNLOADING);
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_CONNECTING);
}
return;
}
if (GetActiveScreenId() == SCR_ID_HCCALL_UPDATE_DOWNLOADING)
{
memset(g_str_buffer, 0, sizeof(g_str_buffer));
kal_wsprintf((kal_wchar*)g_str_buffer, "%w%d%w", (kal_wchar*)GetString(STR_ID_HCCALL_DOWNLOADING), percent, L"%");
MMI_message_string = (UI_string_type)g_str_buffer;
cat66_update_progress_string();
if (g_dldpercent >= 100)
{
GoBackHistory();
}
}
else
{
if (g_dldpercent >= 100)
{
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_DOWNLOADING);
}
}
}
/********************************************************************
Function: hccall_ui_handle_endkey
Description: handle the end key event
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_handle_endkey(void)
{
FILE_TRACE("HCCALLUI :: hccall_ui_handle_endkey");
hccall_stop_host_timer();
hccall_net_close();
DisplayIdleScreen();
}
/********************************************************************
Function: hccall_ui_exit_downloading
Description:
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
static void hccall_ui_exit_downloading(void)
{
//dsmTurnOffBackLight();
TurnOffBacklight();
}
/********************************************************************
Function: Hccall_ui_enter_downloadingwnd
Description: the downding process window's entrence
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void Hccall_ui_enter_downloadingwnd(void)
{
EntryNewScreen(SCR_ID_HCCALL_UPDATE_DOWNLOADING, hccall_ui_exit_downloading, Hccall_ui_enter_downloadingwnd, NULL);
//dsmTurnOnBackLight();
TurnOnBacklight(0);
memset(g_str_buffer, 0, sizeof(g_str_buffer));
kal_wsprintf((kal_wchar*)g_str_buffer, "%w%d%w", (kal_wchar*)GetString(STR_ID_HCCALL_DOWNLOADING), g_dldpercent, L"%");
ShowCategory165Screen(0, 0,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(UI_string_type)g_str_buffer,
0,
NULL);
SetRightSoftkeyFunction(Hccall_Update_Database_Cancle, KEY_EVENT_UP);
SetKeyHandler(hccall_ui_handle_endkey, KEY_END, KEY_EVENT_DOWN);
}
/********************************************************************
Function: hccall_ui_enter_connecting
Description:
Input:
Output:
Return:
Notice:
*********************************************************************/
void hccall_ui_enter_connecting(void)
{
EntryNewScreen(SCR_ID_HCCALL_UPDATE_CONNECTING, NULL, hccall_ui_enter_connecting, NULL);
ShowCategory165Screen(0, 0,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(UI_string_type)GetString(STR_ID_HCCALL_CHECKUPDATE),
0,
NULL);
SetRightSoftkeyFunction(Hccall_Update_Database_Cancle ,KEY_EVENT_UP);
SetKeyHandler(hccall_ui_handle_endkey, KEY_END, KEY_EVENT_DOWN);
}
void hccall_ui_enter_findnewwnd(void);
/********************************************************************
Function: hccall_ui_handle_download_evt
Description:
Input:
Output:
Return:
Notice:
*********************************************************************/
void hccall_ui_handle_download_evt(int event)
{
if (event == HC_DLD_FINDNEW)
{
if (HcCall_CheckUsbIsInMassStorageMode())
{
hccall_net_close();
}
else
{
Hccall_ui_enter_downloadingwnd();
}
}
else if (event == HC_DLD_ISNEW)
{
DisplayPopup((PU8) GetString(STR_ID_HCCALL_ISNEW), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
}
else if (event == HC_DLD_CONERROR)
{
DisplayPopup((PU8) GetString(STR_ID_HCCALL_TIMEOUT), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
}
else if (event == HC_DLD_NETERROR)
{
DisplayPopup((PU8) GetString(STR_ID_HCCALL_NETERROR), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_DOWNLOADING);
}
else if (event == HC_DLD_SERVERERROR)
{
DisplayPopup((PU8) GetString(STR_ID_HCCALL_SERVERERROR), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
}
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_CONNECTING);
}
//#ifdef __SKYENGINE_V2__
extern void mr_sim_initialize(void);
//#else
//extern void dsmInitSimInfo(void);
//#endif
/********************************************************************
Function: Hccall_Update_Database
Description:
Input:
Output:
Return:
Notice:
*********************************************************************/
void hccall_ui_start_download(void)
{
GoBackHistory();
FILE_TRACE("HCCALLUI :: hccall_ui_start_download start");
//#ifdef __SKYENGINE_V2__
mr_sim_initialize();
//#else
// dsmInitSimInfo();
//#endif
if (!hccall_check_simcard())
{
FILE_TRACE("HCCALLUI :: have no sim card!");
DisplayPopup((PU8) GetString(STR_ID_HCCALL_INSERTSIM), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
return;
}
if (!HcCall_CheckSDCard())
{
FILE_TRACE("HCCALLUI :: have no sd card");
DisplayPopup((PU8) GetString(STR_ID_HCCALL_INSERTSD),IMG_GLOBAL_WARNING, 0, UI_POPUP_NOTIFYDURATION_TIME, WARNING_TONE);
return;
}
if (HcCall_CheckUsbIsInMassStorageMode())
{
FILE_TRACE("HCCALLUI :: in usb massstorage mode");
#ifndef WIN32
mmi_usb_app_unavailable_popup(0);
#endif
return;
}
if(HcCall_CheckSDCardNoMemory())
{
FILE_TRACE("HCCALLUI :: sd card have no memory");
DisplayPopup((PU8) GetString(STR_ID_HCCALL_NOMEMORY), IMG_GLOBAL_WARNING, 1, UI_POPUP_NOTIFYDURATION_TIME, 0);
return;
}
FILE_TRACE("HCCALLUI :: start dial");
g_dldpercent = 0;
hccall_ui_enter_connecting();
hccall_net_dial(16793108);
}
/********************************************************************
Function: hccall_ui_enter_gprs_alert
Description: update
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_enter_gprs_alert(void)
{
EntryNewScreen(SCR_ID_HCCALL_UPDATE_GPRSALERT, NULL, hccall_ui_enter_gprs_alert, NULL);
ShowCategory165Screen(STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(UI_string_type)GetString(STR_ID_HCCALL_TIP),
0,
NULL);
DeleteScreenIfPresent(SCR_ID_HCCALL_UPDATE_NEWVERSION);
SetLeftSoftkeyFunction(hccall_ui_start_download,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory ,KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_start_download, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
}
/********************************************************************
Function: Hccall_Update_Database
Description:
Input:
Output:
Return:
Notice:
*********************************************************************/
void hccall_ui_enter_findnewwnd(void)
{
EntryNewScreen(SCR_ID_HCCALL_UPDATE_NEWVERSION, NULL, hccall_ui_enter_findnewwnd, NULL);
#ifndef __HCCALL_DATABASE_FIRM__
if (FALSE == HcFile_IsExist((int8*)INDEX_DATA))
{
ShowCategory165Screen(STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(UI_string_type)GetString(STR_ID_HCCALL_NODATABASE),
0,
NULL);
}
else
#endif
{
ShowCategory165Screen(STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
(UI_string_type)GetString(STR_ID_HCCALL_NEWVERSION),
0,
NULL);
}
SetLeftSoftkeyFunction(hccall_ui_enter_gprs_alert, KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory ,KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_enter_gprs_alert, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
return;
}
/********************************************************************
Function: hccall_ui_enter_mainmenu
Description: main menu window
Input: void
Output: void
Return: void
Notice: void
*********************************************************************/
void hccall_ui_enter_mainmenu(void)
{
U16 nNumofItem = 0;
U8* guiBuffer = NULL;
U16 ImageList[MAX_SUB_MENUS];
U16 nStrItemList[MAX_SUB_MENUS];
EntryNewScreen(SCR_ID_HCCALL, NULL, hccall_ui_enter_mainmenu, NULL);
guiBuffer = GetCurrGuiBuffer(SCR_ID_HCCALL);
nNumofItem = GetNumOfChild(MENU_ID_HCCALL);
GetSequenceStringIds(MENU_ID_HCCALL,nStrItemList);
GetSequenceImageIds(MENU_ID_HCCALL, ImageList);
SetParentHandler(MENU_ID_HCCALL);
RegisterHighlightHandler(ExecuteCurrHiliteHandler);
ShowCategory15Screen(STR_ID_HCCALL, IMG_ID_HCCALL_MAIN, STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK, nNumofItem, nStrItemList, ImageList, LIST_MENU, 0, guiBuffer);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
}
/********************************************************************
Function: Hccall_Update_Database
Description:
Input:
Output:
Return:
Notice:
*********************************************************************/
void hccall_ui_mianmunu_onleftkey(void)
{
HcFile_CreateHccallDir();
hccall_ui_enter_mainmenu();
if (g_hccall_netstate != HCCALL_NET_STATE_IDLE)
{
hccall_net_close();
}
#ifndef __HCCALL_DATABASE_FIRM__
if (FALSE == HcFile_IsExist((int8*)INDEX_DATA))
{
hccall_ui_enter_findnewwnd();
}
#endif
}
/********************************************************************
Function: HighlightHcCallMainMenu
Description:
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void HighlightHcCallMainMenu(void)
{
SetLeftSoftkeyFunction(hccall_ui_mianmunu_onleftkey,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_mianmunu_onleftkey, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
}
/********************************************************************
Function: HighlightUpdateDatabase
Description: update
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void HighlightUpdateDatabase(void)
{
SetLeftSoftkeyFunction(hccall_ui_enter_gprs_alert,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_enter_gprs_alert, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
}
void hccall_ui_enter_search_input(void);
/********************************************************************
Function: hccall_ui_enter_search_result
Description: search a number's eara name
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_enter_search_result(void)
{
U8* guiBuffer; /* Buffer holding history data */
S8* buffer;
S32 bufferSize;
static S8 newbuffer[200];
S8* gsdbuffer;
memset(newbuffer, 0, sizeof(newbuffer));
EntryNewScreen(SCR_ID_HCCALL_SHOWRESULT_LOCSEARCH, NULL, hccall_ui_enter_search_result, NULL);
//DeleteScreenIfPresent(SCR_ID_HCCALL_LOC_SEARCH);
HistoryReplace(SCR_ID_HCCALL_LOC_SEARCH,SCR_ID_HCCALL_LOC_SEARCH, hccall_ui_enter_search_input);
guiBuffer = GetCurrGuiBuffer(SCR_ID_HCCALL_SHOWRESULT_LOCSEARCH);
if(mmi_ucs2strlen((const S8 *)g_HCStrGsdLocation) > 0)
{
buffer=(S8* )g_HCStrGsdLocation;
gsdbuffer=GetString(STR_ID_HCCALL_GUISHUDI);
mmi_ucs2cpy(newbuffer,g_HcStr_Number);
mmi_ucs2cat(newbuffer, gsdbuffer);
mmi_ucs2cat(newbuffer, buffer);
}
else
{
buffer=(S8* )GetString(STR_ID_HCCALL_LOC_SEARCHERROR);//change
if(mmi_ucs2strlen((const S8 *)g_HcStr_Number) > 0)
{
mmi_ucs2cpy(newbuffer,g_HcStr_Number);
mmi_ucs2cat(newbuffer, buffer);
}
else
{
mmi_ucs2cpy(newbuffer,buffer);
}
}
bufferSize=mmi_ucs2strlen((const S8 *)newbuffer);
ShowCategory74Screen(STR_ID_HCCALL_LOC_SEARCH,
0/*MAIN_MENU_TITLE_NETPHB_ICON*/,
0,
0,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
(PU8)newbuffer,
bufferSize,
guiBuffer);
memset(g_HCNumber,0,HCNUMBER_LEN*sizeof(char));
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}
/********************************************************************
Function: hccall_ui_start_search
Description: search a number's eara name
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_start_search(void)
{
char str_num[HCNUMBER_LEN];
char str_phNum[7];
int pos = 0;
memset(str_num, 0, sizeof(str_num));
memset(str_phNum, 0, sizeof(str_phNum));
memset(g_HCStrGsdLocation, 0, sizeof(g_HCStrGsdLocation));
memset(g_HcStr_Number, 0, sizeof(g_HcStr_Number));
if(mmi_ucs2strlen((const S8 *)g_HCNumber) > 0 )
{
mmi_ucs2_to_asc((S8 *)str_num, (S8 *)g_HCNumber);
memset(g_HcStr_Number, 0, sizeof(g_HcStr_Number));
mmi_ucs2cpy(g_HcStr_Number, g_HCNumber);
memset(g_HCNumber, 0, sizeof(g_HCNumber));
memset(&(wgui_inline_items[1]), 0, sizeof(InlineItem));
if(strlen((const char*)str_num) > 0)
{
if ((strlen((const char*)str_num) >= 2)
&& (str_num[0]=='8')&&(str_num[1]=='6'))
{
pos=2;
}
else if ((strlen((const char*)str_num) >= 4)
&& (str_num[0]=='0') && (str_num[1]=='0') && (str_num[2]=='8') && (str_num[3]=='6'))
{
pos=4;
}
else
{
pos=0;
}
memcpy(str_phNum,str_num+pos,7);
GetLocation_ex( g_HCStrGsdLocation,sizeof(g_HCStrGsdLocation),str_phNum );
}
hccall_ui_enter_search_result();
}
else
{
DisplayPopup((PU8) GetString(STR_GLOBAL_EMPTY),
IMG_GLOBAL_EMPTY,
1,
1000,
WARNING_TONE);
}
}
/********************************************************************
Function: hccall_ui_exit_search_input
Description: exit the search input window
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_exit_search_input(void)
{
history h;
U16 inputBufferSize;
CloseCategory57Screen();
h.scrnID = SCR_ID_HCCALL_LOC_SEARCH;
h.entryFuncPtr = hccall_ui_enter_search_input;
GetCategoryHistory(h.guiBuffer);
inputBufferSize = (U16) GetCategory57DataSize();
GetCategory57Data((U8*) h.inputBuffer);
AddNHistory(h, inputBufferSize);
}
/********************************************************************
Function: HighlightHcCallHistoryMenu
Description: search
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_enter_search_input(void)
{
U8* guiBuffer;
U8* inputBuffer;
U16 inputBufferSize;//added for inline edit history
memset(g_HCNumber,0,HCNUMBER_LEN*sizeof(char));
memset(g_HCStrLocation, 0, HCSTRLOCATION_LEN*sizeof(char));
EntryNewScreen(SCR_ID_HCCALL_LOC_SEARCH, hccall_ui_exit_search_input, NULL, NULL);
InitializeCategory57Screen();
guiBuffer = GetCurrGuiBuffer(SCR_ID_HCCALL_LOC_SEARCH);
inputBuffer = GetCurrNInputBuffer(SCR_ID_HCCALL_LOC_SEARCH, &inputBufferSize);
SetInlineItemActivation(&wgui_inline_items[0],INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemCaption(&wgui_inline_items[0],(U8*) GetString(STR_ID_HCCALL_LOC_SEARCH_TITLE));
SetInlineItemActivation(&wgui_inline_items[1],INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
SetInlineItemTextEdit(&wgui_inline_items[1], (PU8)g_HCNumber,16,IMM_INPUT_TYPE_NUMERIC);
if(inputBuffer!=NULL)//added for inline edit history
{
SetCategory57Data(wgui_inline_items, 2, inputBuffer);//sets the data
}
DisableCategory57ScreenDone();
ShowCategory57Screen(STR_ID_HCCALL_LOC_SEARCH,0,
STR_GLOBAL_OK,NULL,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
2,NULL,wgui_inline_items,0,guiBuffer);
SetCategory57RightSoftkeyFunctions(hccall_ui_start_search, GoBackHistory);
}
/********************************************************************
Function: HighlightHcCallLocSearchMenu
Description: search phone number's area
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void HighlightHcCallLocSearchMenu(void)
{
memset(g_HCNumber, 0, sizeof(g_HCNumber));
SetLeftSoftkeyFunction(hccall_ui_enter_search_input, KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_enter_search_input, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
}
/********************************************************************
Function: hccall_get_sectiondatabase_md5
Description:
Input: void
Output: void
Return:
Notice:
*********************************************************************/
int32 hccall_get_sectiondatabase_md5(char *pbuffer, int32 bufsize)
{
int32 ret = 0;
int32 filehandle = 0;
uint32 readcount = 0;
uint16 filemode = 0;
if (pbuffer == NULL)
{
return 0;
}
memset(pbuffer, 0, bufsize);
ret = HcFile_Open(&filehandle, (int8*)SETION_DATAFILE, 0, 0);
if(ret == FALSE)
{
HcFile_Close(filehandle, 0);
if(HcFile_Open(&filehandle, (int8*)mr_section, (uint32)sizeof(mr_section), 1))
{
filemode=1;
}
else
{
return FALSE;
}
}
ret = HcFile_Seek(filehandle, 8, PSEEK_SET, filemode);
if (ret == FALSE)
{
HcFile_Close(filehandle, filemode);
return 0;
}
ret = HcFile_Read(filehandle, pbuffer, bufsize>32?32:bufsize, &readcount, filemode);
if (ret == FALSE)
{
HcFile_Close(filehandle, filemode);
return 0;
}
HcFile_Close(filehandle, filemode);
return 1;
}
extern T_DSM_DUALSIM_SET dsmDualSim;
/********************************************************************
Function: hccall_ui_start_save_func_setting
Description: save function settings
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_start_save_func_setting(void)
{
g_hccall_confg.functionset = Hc_func_setting_item;
hccall_save_userconfig(&g_hccall_confg);
DisplayPopup((PU8) GetString(STR_GLOBAL_DONE),
IMG_GLOBAL_ACTIVATED,
1,
1000,
WARNING_TONE);
DeleteScreenIfPresent(SCR_ID_HCCALL_FUNC_SETTING);
return;
}
/********************************************************************
Function: hccall_ui_func_set_hilightindex
Description:
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_func_set_hilightindex(S32 nIndex)
{
Hc_func_setting_item = (U16) nIndex;
return;
}
/********************************************************************
Function: hccall_ui_enter_func_setting
Description: open or close the hccall function
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_ui_enter_func_setting(void)
{
U16 nStrItemList[] = {STR_ID_HCCALL_FUNCTION_SETTING_ON,
STR_ID_HCCALL_FUNCTION_SETTING_OFF};
U8 nNumofItem = 2;
U8 *guiBuffer;
EntryNewScreen(SCR_ID_HCCALL_FUNC_SETTING, NULL, hccall_ui_enter_func_setting, NULL);
guiBuffer = GetCurrGuiBuffer(SCR_ID_HCCALL_FUNC_SETTING);
RegisterHighlightHandler(hccall_ui_func_set_hilightindex);
ShowCategory11Screen(STR_ID_HCCALL_FUNCTION_SETTING,
0,
STR_GLOBAL_OK,
0,
STR_GLOBAL_BACK,
0,
nNumofItem,
nStrItemList,
g_hccall_confg.functionset,
guiBuffer);
SetLeftSoftkeyFunction(hccall_ui_start_save_func_setting, KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_start_save_func_setting, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
return;
}
/********************************************************************
Function: HighlightHcCallSettingMenu
Description: setting
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void HighlightHcCallFuncSettingMenu(void)
{
SetLeftSoftkeyFunction(hccall_ui_enter_func_setting,KEY_EVENT_UP);
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);
SetCenterSoftkeyFunction(hccall_ui_enter_func_setting, KEY_EVENT_UP);
ChangeCenterSoftkey(NULL, IMG_GLOBAL_COMMON_CSK);
}
/********************************************************************
Function: hccall_ui_init_globalvalue
Description: init the global values
Input: void
Output: void
Return: void
Notice:
*********************************************************************/
void hccall_init_globalvalue(void)
{
int i = 0;
int ret = 0;
ret = hccall_load_userconfig(&g_hccall_confg);
if(ret == 0)
{
g_hccall_confg.functionset = 0;
hccall_save_userconfig(&g_hccall_confg);
}
FILE_TRACE("hccall_init_globalvalue :: functionset=%d",
g_hccall_confg.functionset );
Hc_func_setting_item = 0;
memset(g_HCNumber, 0, sizeof(g_HCNumber));
memset(g_HCStrLocation, 0, sizeof(g_HCStrLocation));
hccall_set_firmdatabase((const unsigned char*)mr_ldzs, (uint32)sizeof(mr_ldzs));
LocationData_Init_ex();
}
/********************************************************************
Function: InitHcCallApp
Description: the entrence function of the hccall application
Input: void
Output: void
Return: void
Notice: this function is called when the phone is powered on
*********************************************************************/
void InitHcCallApp(void)
{
FILE_TRACE("HCCALL :: InitHcCallApp");
SetHiliteHandler( MENU_ID_HCCALL, HighlightHcCallMainMenu );
SetHiliteHandler( MENU_ID_HCCALL_LOC_SEARCH, HighlightHcCallLocSearchMenu );
SetHiliteHandler( MENU_ID_HCCALL_FUNCTION_SETTING, HighlightHcCallFuncSettingMenu);
SetHiliteHandler( MENU_ID_HCCALL_UPDATEMANUAL, HighlightUpdateDatabase);
HcFile_CreateHccallDir();
gui_start_timer(1000, hccall_init_globalvalue);
}
#define ELSE else
#define IF_STRCMP(des,des_len) if(strncmp((const char*)g_HCNumber+pos, des, des_len) == 0) \
{ \
pos += des_len; \
} \
/********************************************************************
Function: HcCall_hist_populate_call_list
Description: get the city's name from a phone number
Input: city_number: cellphone or telephone number
Output: city_name: the city name
Return: the length of the city's name
Notice:
*********************************************************************/
int HcCall_hist_populate_call_list(char *city_name, int city_name_size, char *city_number)
{
int ret_len=0;
FILE_TRACE("HCCALLUI :: HcCall_hist_populate_call_list-----start");
if (city_name==NULL || city_number==NULL)
{
return 0;
}
FILE_TRACE("HCCALLUI :: HcCall_hist_populate_call_list-----functionset=%d, city_number=%s", g_hccall_confg.functionset, city_number);
memset(city_name, 0, city_name_size);
if(0 == g_hccall_confg.functionset)
{
int pos = 0;
int len = 0;
memset(g_HCNumber, 0, sizeof(g_HCNumber));
memset(g_HCStrLocation,0,sizeof(g_HCStrLocation));
if( strlen( ( const char * )city_number) > 10 && strlen( ( const char * )city_number ) < 62 )
{
strcpy(g_HCNumber, ( const char * )city_number);
IF_STRCMP("17951",5)
ELSE IF_STRCMP("12593",5)
ELSE IF_STRCMP("17969",5)
ELSE IF_STRCMP("17909",5)
IF_STRCMP("+86",3)
IF_STRCMP("0086",4)
len = GetLocation_ex( g_HCStrLocation,sizeof(g_HCStrLocation),g_HCNumber + pos );
FILE_TRACE("HCCALLUI :: HcCall_hist_populate_call_list----len=%d", len);
if(len > 0 )
{
mmi_ucs2cat((S8 *)city_name , (const S8 *) L"~~");
mmi_ucs2ncat((S8 *)city_name , (const S8 *)g_HCStrLocation, city_name_size-4);
ret_len = mmi_ucs2strlen((const S8 *)city_name);
}
memset(g_HCStrLocation,0,sizeof(g_HCStrLocation));
memset(g_HCNumber, 0, sizeof(g_HCNumber));
}
}
FILE_TRACE("HCCALLUI :: HcCall_hist_populate_call_list----ret_len=%d", ret_len);
return ret_len;
}
e_unet_sim_type hccall_get_simId(void)
{
int32 DsmSimId = dsmDualSim.simId[dsmDualSim.curActive];
if (DSM_SLAVE_SIM == DsmSimId)
{
return UNET_SIM_SLAVE;
}
#ifdef __MR_CFG_MULTI_SIM_CARD__
#if defined(__RAGENT_SIM3_SUPPORT__)
else if (DSM_THIRD_SIM == DsmSimId)
{
return UNET_SIM_THIRD;
}
#endif
#if defined(__RAGENT_SIM4_SUPPORT__)
else if (DSM_FOURTH_SIM == DsmSimId)
{
return UNET_SIM_FOURTH;
}
#endif
#endif
else
{
return UNET_SIM_MASTER;
}
}
void hccall_start_host_timer(U32 delay, FuncPtr funcPtr)
{
StartTimer(HCCALL_UI_TIMER, delay, funcPtr);
return;
}
void hccall_stop_host_timer(void)
{
StopTimer(HCCALL_UI_TIMER);
return;
}
#endif // __HC_CALL_NEW__