GBC_mtk_net_conf.c
19.5 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
/************************************************************
GBC_mtk_net_conf.c
MTK网络外部配置
************************************************************/
//#include "GBC_mtk_option.h"
#if (defined __GBC_LOAD_APP_SWITCH_ON__ && defined __MTK_TARGET__)||(defined(__GBC_DEV_MODIS__))
#include "kal_release.h"
#include "soc_api.h"
#include "MMI_include.h"
#include "med_global.h"
#include "med_struct.h"
#include "med_utility.h"
#include "GBC_mtk_option.h"
#if !defined(__GBC_MTK_11B) && !defined(__GBC_MTK_12A)
//#ifndef __GBC_MTK_11B
#include "SimDetectionGprot.h"
#include "SimDetectionDef.h"
#endif
#include "SmsGuiInterfaceProt.h"
#include "SmsGuiInterfaceType.h"
#include "ProtocolEvents.h"
#include "TimerEvents.h"
#define __NEWSIMULATOR
//liu add very guiyi head
#include "GBC_all_in.h"
#include "GBC_mtk_option.h"/*平台总宏*/
#include "GBC_mtk_net_conf.h"
#include "GBC_sim_interface.h"
#include "DataAccountCommon.h"
#include "DataAccountDef.h"
#include "custom_data_account.h"
#include "DataAccountEnum.h"
#include "wndrv_cnst.h"
#include "DataAccountStruct.h"
#include "abm_soc_enums.h"
#if !defined(__GBC_MTK_11B) && !defined(__GBC_MTK_12A)
//#ifndef __GBC_MTK_11B
#include "mtpnp_ad_master_common_def.h"
#endif
#if defined (__GBC_MTK_11A) || defined (__GBC_MTK_11B)
#include "NetSetSrvGprot.h"
#include "DtcntSrvGprot.h"
#include "mmi_l3_enums.h"
#endif
#include "mmi_rp_app_gbc_def.h"
/* GPRS module */
S32 GBC_cmwap_gprs_account = 0;/*CMWAP上网账号ID*/
S32 GBC_cmnet_gprs_account = 0;/*CMNET上网账号ID*/
kal_uint8 GBC_app_id = 0;
U32 GBC_account_id = 0 ;
int GBC_hold_bear = -1; /**/
#if !defined(__GBC_MTK_11B) && !defined(__GBC_MTK_12A)
//#ifndef __GBC_MTK_11B
#if defined (__GBC_MTK_10A) || defined (__GBC_MTK_11A)
static mmi_dtcnt_gprs_acct_node_struct g_GPRS_DataAccount[MAX_DATA_ACCOUNT_GPRS_LIMIT];
#else
//MTK变量的外部引用
extern GPRSDataAccountNode g_GPRS_DataAccount[MAX_DATA_ACCOUNT_GPRS_LIMIT];
extern DataAccountNodeDisplay g_DataAccount_Display;
#endif
#endif
GBC_NW_CHOOSE_INFO GBC_nw_choose = {0};
int GBC_get_host_status = 0;
/**************************************************************************
* 函数名称:GBC_open_bearer
* 功能描述:打开链接--物理层
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
void GBC_open_bearer(void)
{
int data_account = 0 ;
U32 account_id = 0 ;
kal_int8 ret = 0;
U16 connect_type = 0;
if (GBC_app_id == 0)
{
#if defined (__GBC_MTK_09A) || defined(__GBC_MTK_09B) || defined(__GBC_MTK_08B)
data_account = GBC_get_using_data_account();
GBC_account_id = account_id = GBC_get_gprs_account_id(GBC_CMWAP);
GBC_app_id = cbm_register_app_id(SCR_ID_IDLE_END, 0);//注册
ret = cbm_open_bearer(MOD_MMI, account_id);//打开
#elif defined (__GBC_MTK_10A) || defined (__GBC_MTK_11A) || defined(__GBC_MTK_11B)
cbm_register_app_id(&GBC_app_id);
if (GBC_CMWAP == GBC_get_using_net_type())
{
connect_type = GBC_CMWAP;
}
else
{
connect_type = GBC_CMNET;
}
#if !defined (__GBC_MTK_11A) && !defined(__GBC_MTK_11B) && !defined(__GBC_MTK_12A) //add by hunk
GBC_account_id = account_id = GBC_get_gprs_account_id(connect_type);
#else
#ifndef __GBC_MRE_SUPPORT
GBC_account_id = account_id = GBC_mre_unsupport_get_gprs_account_id(connect_type);
#else
GBC_account_id = account_id = GBC_get_gprs_account_id_ext(connect_type);
#endif
#endif
ret = cbm_open_bearer(account_id);
#endif
GBCTRACE("打开链接--物理层=%d,ret = %d,account_id= %d\n",GBC_app_id,ret,account_id);
}
else
{
kal_int32 bearer_status = cbm_get_bearer_status(GBC_account_id);
GBCTRACE("打开链接--物理层无需重新打开=%d",bearer_status);
if( bearer_status!=CBM_ACTIVATING && bearer_status!=CBM_ACTIVATED)
{
ret = cbm_open_bearer(GBC_account_id);
GBCTRACE("重新打开链接--物理层=%d,ret = %d,account_id= %d\n",GBC_app_id,ret,GBC_account_id);
}
}
}
/**************************************************************************
* 函数名称:GBC_hold_bearer
* 功能描述:保持网络帐号,当关闭Socket的时候,保持网络连接不被关闭
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
void GBC_hold_bearer(void)
{
GBCTRACE("保持网络帐号 GBC_hold_bear=%d\n",GBC_hold_bear);
// if(-1 == GBC_hold_bear)
{
#if defined (__GBC_MTK_09A) || defined(__GBC_MTK_09B) || defined(__GBC_MTK_08B)
cbm_hold_bearer(MOD_MMI, GBC_app_id);
#elif defined (__GBC_MTK_10A) || defined (__GBC_MTK_11A) || defined (__GBC_MTK_11B)
cbm_hold_bearer(GBC_app_id);
#endif
GBC_hold_bear = 0;
}
}
/**************************************************************************
* 函数名称:GBC_release_bearer
* 功能描述: 释放网络链接
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
void GBC_release_bearer(void)
{
GBCTRACE("释放网络链接 GBC_hold_bear=%d\n",GBC_hold_bear);
if(0 == GBC_hold_bear)
{
#if defined (__GBC_MTK_09A) || defined(__GBC_MTK_09B) || defined(__GBC_MTK_08B)
cbm_release_bearer(MOD_MMI, GBC_app_id);
#elif defined (__GBC_MTK_10A) || defined (__GBC_MTK_11A) || defined (__GBC_MTK_11B)
cbm_release_bearer(GBC_app_id);
cbm_deregister_app_id(GBC_app_id);
#endif
GBC_hold_bear = -1;
GBC_app_id = 0;
}
}
/**************************************************************************
* 函数名称:GBC_gprs_set_account_rsp
* 功能描述:设置帐号ID接收函数
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
void GBC_gprs_set_account_rsp(void* info)
{
//kill by lees1019:优化空间
#if 0
mmi_ps_set_gprs_data_account_rsp_struct *localPtr;
localPtr = (mmi_ps_set_gprs_data_account_rsp_struct *)info;
GBCTRACE( "GBC_gprs_set_account_rsp: localPtr->result=%d\n", localPtr->result);
if (localPtr != NULL && localPtr->result == KAL_TRUE)
{
;
}
else
{
;
}
#endif
}
/**************************************************************************
* 函数名称:GBC_set_net_account
* 功能描述:设置帐号ID
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
kal_int32 GBC_set_net_account(char *account_name,char *link_point, int account_number)
{
#if !defined(__GBC_MTK_10A ) && !defined(__GBC_MTK_11A) && !defined(__GBC_MTK_11B) && !defined(__GBC_MTK_12A)
#ifdef __GBC_MTK35__
mmi_ps_set_gprs_data_account_req_struct *myMsgPtr;
U8 ref_count;
U16 msg_len;
MYQUEUE Message;
U8 i=0;
myMsgPtr = (mmi_ps_set_gprs_data_account_req_struct*) OslConstructDataPtr(sizeof(mmi_ps_set_gprs_data_account_req_struct));
if (myMsgPtr == NULL)
{
return -1;
}
ref_count = myMsgPtr->ref_count;
msg_len = myMsgPtr->msg_len;
memset(myMsgPtr,'\0',sizeof(mmi_ps_set_gprs_data_account_req_struct));
myMsgPtr->ref_count = ref_count;
myMsgPtr->msg_len = msg_len;
myMsgPtr->gprs_account.context_id = account_number;//MTK wap 数据中心从1开始
myMsgPtr->gprs_account.authentication_type = 0;
myMsgPtr->gprs_account.name_dcs = 0;
myMsgPtr->gprs_account.name_length = strlen(account_name);
strcpy((char*)myMsgPtr->gprs_account.name, account_name);
strcpy((char*)myMsgPtr->gprs_account.apn, link_point);
myMsgPtr->gprs_account.apn_length = strlen(link_point);
Message.oslSrcId=MOD_MMI;
Message.oslDestId=MOD_L4C;
Message.oslMsgId = PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_REQ;
Message.oslDataPtr = (oslParaType *)myMsgPtr;
Message.oslPeerBuffPtr= NULL;
SetProtocolEventHandler(GBC_gprs_set_account_rsp, PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_RSP);
OslMsgSendExtQueue(&Message);
#else
#ifdef __MMI_GPRS_FEATURES__
mmi_ps_set_gprs_data_account_req_struct *myMsgPtr;
/* micha0820 */
U8 ref_count;
U16 msg_len;
MYQUEUE Message;
U8 DataAccountName_ASCII[(MAX_GPRS_DATAACCOUNT_NAME + 1) * ENCODING_LENGTH];
U8 DataAccountAPN_ASCII[MAX_APN_LEN];
U8 i = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
memset(DataAccountName_ASCII, '\0', (MAX_GPRS_DATAACCOUNT_NAME + 1) * ENCODING_LENGTH);
memset(DataAccountAPN_ASCII, '\0', MAX_APN_LEN);
myMsgPtr =
(mmi_ps_set_gprs_data_account_req_struct*)
OslConstructDataPtr(sizeof(mmi_ps_set_gprs_data_account_req_struct));
/* micha0820 */
ref_count = myMsgPtr->ref_count;
msg_len = myMsgPtr->msg_len;
memset(myMsgPtr, '\0', sizeof(mmi_ps_set_gprs_data_account_req_struct));
myMsgPtr->ref_count = ref_count;
myMsgPtr->msg_len = msg_len;
myMsgPtr->gprs_account.context_id = account_number;
myMsgPtr->gprs_account.authentication_type = 0;
myMsgPtr->gprs_account.name_dcs = DATA_ACCOUNT_ASCII;
myMsgPtr->gprs_account.name_length = strlen((PS8) account_name);
memcpy(myMsgPtr->gprs_account.name, account_name, strlen((PS8) account_name));
/* micha0202 */
memcpy(myMsgPtr->gprs_account.apn, /*__GBC_CMWAP_LINK_POINT__*/link_point, strlen((PS8)link_point/* __GBC_CMWAP_LINK_POINT__*/) + 1);
myMsgPtr->gprs_account.apn_length = strlen((PS8)link_point/* __GBC_CMWAP_LINK_POINT__*/);
for (i = 0; i < 4; i++)
{
myMsgPtr->gprs_account.dns[i] = 0;
myMsgPtr->gprs_account.sec_dns[i] = 0;
}
#ifdef __MMI_CCA_OMACP_BOOTSTRAP_UPDATE_SUPPORT__
myMsgPtr->gprs_account.account_type = DTCNT_USER_CONFIGURED_ACCT;
#endif /* __MMI_CCA_OMACP_BOOTSTRAP_UPDATE_SUPPORT__ */
myMsgPtr->gprs_account.read_only = MMI_FALSE;
/* revised for GPRS profile default value */
myMsgPtr->gprs_account.dcomp_algo = 0x02;
myMsgPtr->gprs_account.hcomp_algo = 0x02;
myMsgPtr->gprs_account.pdp_type = 0x21;
myMsgPtr->gprs_account.pdp_addr_len = 0x01;
myMsgPtr->profile_type = DATA_ACCT_GPRS_PROF;
Message.oslSrcId = MOD_MMI;
Message.oslDestId = MOD_L4C;
Message.oslMsgId = PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_REQ;
Message.oslDataPtr = (oslParaType*) myMsgPtr;
Message.oslPeerBuffPtr = NULL;
SetProtocolEventHandler(GBC_gprs_set_account_rsp, PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_RSP);
OslMsgSendExtQueue(&Message);
#endif /* __MMI_GPRS_FEATURES__ */
#endif
#endif
}
/**************************************************************************
* 函数名称:GBC_get_apn
* 功能描述:获取接入点
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
**************************************************************************/
kal_bool GBC_get_apn(U32 account_id, S8 *dest, U8 len, U32 *index)
{
kal_uint8 bearer;
kal_uint8 id;
U8 length, length_str, i;
length = (len < (MAX_GPRS_MMI_APN_LEN+ 1) * ENCODING_LENGTH) ? len : (MAX_GPRS_MMI_APN_LEN + 1) * ENCODING_LENGTH;
length_str = length / ENCODING_LENGTH;
#if defined (__GBC_MTK_09A ) || defined (__GBC_MTK_09B) || defined(__GBC_MTK_08B)
if (abm_nw2bearer_id(account_id, &bearer, &id) == KAL_TRUE)
{
if(bearer == ABM_E_SOCKET_BEARER_GSM_GPRS)
{
//53平台获取APN
#if defined(__GBC_MTK53__)
for(i = 0; i < g_DataAccount_Display.GPRS_acct_num; i++)
{
if (id - 1 == g_GPRS_DataAccount[i].org_acct_id)
{
*index = i;
mmi_ucs2ncpy((S8 *)dest, (const S8 *)g_GPRS_DataAccount[i].APN, length_str);
return KAL_TRUE;
}
}
#else
*index = id - 1;
mmi_ucs2ncpy((S8 *)dest, (const S8 *)g_GPRS_DataAccount[id - 1].APN, length_str);
return KAL_TRUE;
#endif
}
}
#endif
memset(dest, 0, len);
return KAL_FALSE;
}
/**************************************************************************
* 函数名称:GBC_get_gprs_account
* 功能描述:获取gprs帐号
需要访问网络的时候必须获取GPRS账号
* 访问的表:
* 修改的表:
* 输入参数:
account_name--GPRS账号名
link_point------GPRS连接点名称
约定如下:
使用CMWAP:
account_name = CMWAP
link_point =cmwap
使用CMNET:
account_name = CMNET
link_point = cmnet
区分大小写
* 输出参数:gprs_account_id---账号ID
* 返 回 值: S32
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
#if defined (__GBC_MTK_10A) || defined (__GBC_MTK_11A) || defined (__GBC_MTK_11B)
#include "DataAccountStruct.h"
#include "dtcntsrviprot.h" //SRV_DTCNT_SIM_TYPE_2
#include "DataAccountGProt.h" //mmi_dtcnt_get_gprs_profile
#include "DataAccountDef.h" //MAX_GPRS_MMI_APN_LEN
//extern U8 GBC_mobile_card_status;
extern U32 GBC_get_sim_card_index(void);
#ifndef __GBC_MTK_11A
extern U32 g_mmi_dtcnt_acct_num;
extern mmi_dtcnt_list_disp_struct g_mmi_dtcnt_list_item[SRV_DTCNT_PROF_MAX_ACCOUNT_NUM];
#endif
#endif
extern void mmi_dtcnt_set_gprs_account(void);
S32 GBC_get_gprs_account(char *account_name,char * link_point)
{
#if defined (__GBC_MTK_09B) || defined (__GBC_MTK_09A) || defined(__GBC_MTK_08B)
kal_int32 i;
U16 vs_apn[20] = {0};
S8 temp[20] = {0};
U32 index = 0;
kal_bool bHaveFind = KAL_FALSE;
S32 emptyApnIdx = 0;
//返回的GPRS账号ID
S32 gprs_account_id = -1;
GBCTRACE("获取gprs帐号---MAX_DATA_ACCOUNT_GSM_LIMIT = %d \n",MAX_DATA_ACCOUNT_GSM_LIMIT);
GBCTRACE("获取gprs帐号---MAX_DATA_ACCOUNT_GPRS_LIMIT = %d \n",MAX_DATA_ACCOUNT_GPRS_LIMIT);
//先查找账号
for (i = MAX_DATA_ACCOUNT_GSM_LIMIT; i < (MAX_DATA_ACCOUNT_GPRS_LIMIT + MAX_DATA_ACCOUNT_GSM_LIMIT); i++)
{
memset(vs_apn, 0, 40);
memset(temp, 0, 20);
//获取接入点
GBC_get_apn((U32)i, (S8 *)vs_apn, 40, &index);
mmi_ucs2_to_asc((S8*)temp, (S8*)vs_apn);
GBCTRACE( "i=%d vs_apn = %s temp = %s \n", i,vs_apn,temp);
//上海旭为移植修改
/*
if (strcmp(temp,link_point) == 0
&& g_GPRS_DataAccount[index].AuthType == 0
&& strlen((char*)g_GPRS_DataAccount[index].UserName) == 0
&& strlen((char*)g_GPRS_DataAccount[index].Passwd) == 0)
*/
if (strcmp(temp,link_point) == 0
&& g_GPRS_DataAccount[index].AuthType == 0
&& strlen((char*)g_GPRS_DataAccount[index].UserName) == 0
&& strlen((char*)g_GPRS_DataAccount[index].Passwd) == 0)
{
bHaveFind = TRUE;
gprs_account_id = i;
GBCTRACE( "找得到gprs_account_id = %d\n", gprs_account_id);
break;
}
}
//找不到账号---设置GPRS账号
if (!bHaveFind)
{
//写入的位置,可修改
emptyApnIdx = 0;
if (strcmp(account_name,"CMNET")==0 || strcmp(account_name,"UNIWAP")==0)
{
//往下递增1
GBC_set_net_account(account_name, link_point,emptyApnIdx + 2);
gprs_account_id = CUSTOM_DEFINED_MAX_CSD_PROFILE_NUM + emptyApnIdx+1;
}
else if (strcmp(account_name,"CMWAP")==0 || strcmp(account_name,"UNINET")==0)
{
GBC_set_net_account(account_name, link_point, emptyApnIdx + 1);
gprs_account_id = CUSTOM_DEFINED_MAX_CSD_PROFILE_NUM + emptyApnIdx;
}
}
return gprs_account_id;
#elif defined(__GBC_MTK_10A)
//extern U8 GBC_mobile_card_status;
kal_int32 i;
//返回的GPRS账号ID
S32 gprs_account_id = -1;
kal_bool bHaveFind = KAL_FALSE;
//char *account_name,char * link_point
mmi_dtcnt_gprs_acct_node_struct g_data_account_gprs_profile_temp;
GBCTRACE("GBC_get_gprs_account %s,%s",account_name,link_point);
memset(&g_data_account_gprs_profile_temp,0,sizeof(mmi_dtcnt_gprs_acct_node_struct));
for (i = 0; i < g_mmi_dtcnt_acct_num; i++)
{
//获取接入点
mmi_dtcnt_get_gprs_profile(g_mmi_dtcnt_list_item[i].profile_id, &g_data_account_gprs_profile_temp);
/* if(((GBC_set_active_sim_card() == MTPNP_AD_CARD1)&&(g_mmi_dtcnt_list_item[i].sim_info== SRV_DTCNT_SIM_TYPE_2))
|| ((GBC_set_active_sim_card() == MTPNP_AD_CARD2)&&(g_mmi_dtcnt_list_item[i].sim_info == SRV_DTCNT_SIM_TYPE_1))
)
{
GBCTRACE("10A--get_gprs_account\n");
GBCTRACE("i = %d \n", i);
continue;
}
*/
GBCTRACE("\n10A取帐号 i= %d apn %s, sim_info %d",i, g_data_account_gprs_profile_temp.apn,g_mmi_dtcnt_list_item[i].sim_info);
if (strcmp(g_data_account_gprs_profile_temp.apn, link_point) == 0 &&
g_mmi_dtcnt_list_item[i].sim_info == GBC_get_sim_card_index() )
{
GBCTRACE("\n10A获取得到--get gprs count = %s\n", g_data_account_gprs_profile_temp.apn);
GBCTRACE("i = %d\n", i);
return i;
}
}
#else
return 12;
#endif
}
//设置为CMWAP连接方式
void GBC_nw_set_cmwap(void)
{
GBCTRACE("GBC_nw_set_cmwap--设置为CMWAP联网\n");
GBC_nw_choose.data_account = GBC_cmwap_gprs_account;
GBC_nw_choose.net_type = GBC_CMWAP;
}
//设置为CMNET方式连接
void GBC_nw_set_cmnet(void)
{
GBC_nw_choose.data_account = GBC_cmnet_gprs_account;
GBC_nw_choose.net_type = GBC_CMNET;
}
//获取正在使用的数据账户
int GBC_get_using_data_account(void)
{
return (GBC_nw_choose.data_account);
}
//获取网络类型
U8 GBC_get_using_net_type(void)
{
return (GBC_nw_choose.net_type);
}
//从URL 中获取HOST
char strHost[64] = {0};
char* GBC_get_host_from_url(char* url)
{
char *pstart = NULL, *pend = NULL;
pstart = strstr( (char*)url, "http://");
if( pstart == NULL )
{
pstart = strstr( (char*)url, "HTTP://");
}
if( pstart )
{
pstart += strlen( "http://" );
}
else
{
pstart = url;
}
pend = strchr( pstart, '/' );
if( !pend )
{
pend = pstart + strlen(pstart);
}
memset(strHost, 0x00, sizeof(strHost));
memcpy( strHost, pstart, pend - pstart );
return strHost;
}
kal_bool net_work_is_init = KAL_FALSE;
/**************************************************************************
* 函数名称:GBC_net_work_dns_init
* 功能描述:DNS
* 访问的表:
* 修改的表:
* 输入参数:
* 输出参数:
* 返 回 值: void
* 其它说明:
* 修改日期 版本号 修改人 修改内容
* -----------------------------------------------
*
**************************************************************************/
void GBC_net_work_dns_init(void)
{
GBCTRACE("GBC_net_work_dns_init\n");
StopTimer(TTS_EVENT_CLOSE_NETWORK_TIMER);
#ifdef GBC_SWITCH_CMNET_ON
if (0)//GBC_CMWAP == GBC_get_using_net_type())
{
GBC_nw_set_cmwap();
}
else
{
//默认使用CMNET--可以修改
GBC_nw_set_cmnet();
}
#else
GBC_nw_set_cmwap();
#endif
#if 0
// if (!net_work_is_init || GBC_cmwap_gprs_account <= 0)
{
//如果使用移动卡
if(GBC_mobile_card_notify())
//移动与联通默认取cmwap帐号
//if (1)
{
GBC_cmwap_gprs_account = GBC_get_gprs_account("CMWAP","cmwap");
GBC_cmnet_gprs_account = GBC_get_gprs_account("CMNET","cmnet");
}
else
{
GBC_cmwap_gprs_account = GBC_get_gprs_account("UNIWAP","uniwap");
GBC_cmnet_gprs_account = GBC_get_gprs_account("UNINET","uninet");
}
net_work_is_init = TRUE;
}
#endif
//if (!net_work_is_init )
{
GBC_open_bearer();
GBC_hold_bearer();
net_work_is_init = TRUE;
}
GBCTRACE("GBC_net_work_dns_init--cmwap account id = %d\n",GBC_cmwap_gprs_account);
GBCTRACE("GBC_net_work_dns_init--cmnet account id = %d\n",GBC_cmnet_gprs_account);
GBCTRACE("使用的网络账号: %d,网络类型:%d",GBC_nw_choose.data_account,GBC_nw_choose.net_type);
}
#endif