mmigprs.c
来自「GSM手机设计软件代码」· C语言 代码 · 共 1,772 行 · 第 1/3 页
C
1,772 行
case INFO_KCD_RIGHT: if (mmi_gprs->gprsHandle) { if (identifier==MMI_GPRS_COUNTER_UPLINK) { mmi_gprs->uplink_counter = 0; } else { mmi_gprs->downlink_counter = 0; } mmiGprsShowCounter(win, identifier); } break; } return;}/******************************************************************************* $Function: GPRSIncomingDataCount $Description: Show data counter for last incoming call $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSIncomingDataCount(MfwMnu* m, MfwMnuItem* i){ T_MFW_HND win = mfw_parent(mfw_header()); T_MFW_RES result; TRACE_FUNCTION("GPRSIncomingDataCount()"); mmi_gprs->counter_type = MMI_GPRS_COUNTER_DOWNLINK; /* SPR#1875 - SH - Now DOWNLINK */ mmi_gprs->display = TRUE; mmi_gprs->status = MMI_GPRS_STATUS_DATA_COUNTER; mmiPleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */ /* If a data call is in progress, counter is now reset every * time we check it - MMI keeps track of total. * If a data call is not in progress, display current total from MMI */ result = gprs_counter(TRUE); switch(result) { /* Waiting for rAT_PercentSNCNT callback, don't update display yet */ case MFW_RES_OK: #ifdef TRACE_MMIGPRS TRACE_EVENT("gprs_counter executing, awaiting confirmation."); #endif break; /* We're not connected - display current total */ case MfwResDone: mmiPleaseWaitDestroy(); mmi_gprs->display = FALSE; mmiGprsShowCounter(win, mmi_gprs->counter_type); break; /* Error has occurred */ default: mmiPleaseWaitDestroy(); mmi_gprs->display = FALSE; info_screen(win, TxtGPRS,TxtError, NULL); break; } return;}/******************************************************************************* $Function: GPRSOutgoingDataCount $Description: Show data counter for last incoming call $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSOutgoingDataCount(MfwMnu* m, MfwMnuItem* i){ T_MFW_HND win = mfw_parent(mfw_header()); T_MFW_RES result; TRACE_FUNCTION("GPRSOutgoingDataCount()"); mmi_gprs->counter_type = MMI_GPRS_COUNTER_UPLINK; /* SPR#1875 - SH - Now UPLINK */ mmi_gprs->display = TRUE; mmi_gprs->status = MMI_GPRS_STATUS_DATA_COUNTER; mmiPleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */ /* If a data call is in progress, counter is now reset every * time we check it - MMI keeps track of total. * If a data call is not in progress, display current total from MMI */ result = gprs_counter(TRUE); switch(result) { /* Waiting for rAT_PercentSNCNT callback, don't update display yet */ case MFW_RES_OK: #ifdef TRACE_MMIGPRS TRACE_EVENT("gprs_counter executing, awaiting confirmation."); #endif break; /* We're not connected - display current total */ case MfwResDone: mmiPleaseWaitDestroy(); mmi_gprs->display = FALSE; mmiGprsShowCounter(win, mmi_gprs->counter_type); break; /* Error has occurred */ default: mmiPleaseWaitDestroy(); mmi_gprs->display = FALSE; info_screen(win, TxtGPRS,TxtError, NULL); break; } return;}/******************************************************************************* $Function: GPRSselectSms $Description: Sets cursor position for this menu based on the current settings $Returns: $Arguments: menu - pointer to the current menu item - pointer to the current menu item*******************************************************************************/int GPRSselectSms(MfwMnu* menu, MfwMnuItem* item){ T_MFW_HND parent_win = mfwParent( mfw_header()); // WAP menu window T_MFW_WIN *win_data = ((T_MFW_HDR *)parent_win)->data; tBookStandard *parent_data = (tBookStandard *)win_data->user; // data for WAP menu window T_MFW_HND win = parent_data->parent_win; // WAP data window T_MFW_GPRS *gprs; TRACE_FUNCTION("GPRSselectSms()"); if (mmi_gprs->gprsHandle) { gprs = mmi_gprs->gprsHandle->data; gprs->data.SMSService = gprs_getServiceSMS(); mmi_gprs->SMSService = gprs->data.SMSService; } mmi_gprs->menu_win = bookMenuStart(win, SMSServiceAttributes(), 0); SEND_EVENT(mmi_gprs->menu_win, DEFAULT_OPTION, NULL, &mmi_gprs->SMSService); // Add our own callback return;}/******************************************************************************* $Function: GPRSselectSms_set $Description: Send SMS by GPRS/CSD $Returns: $Arguments: menu - pointer to the current menu item - pointer to the current menu item*******************************************************************************/int GPRSselectSms_set(MfwMnu* menu, MfwMnuItem* item){ T_MFW_HND parent_win = mfwParent( mfw_header()); // WAP menu window T_MFW_WIN *win_data = ((T_MFW_HDR *)parent_win)->data; tBookStandard *parent_data = (tBookStandard *)win_data->user; // data for WAP menu window T_MFW_HND win = parent_data->parent_win; // WAP data window TRACE_FUNCTION("GPRSselectSms_set()"); mmi_gprs->SMSService = menu->lCursor[menu->level]; if (mmi_gprs->gprsHandle) { mmi_gprs->display = TRUE; if(gprs_setServiceSMS(mmi_gprs->SMSService) != MFW_RES_OK) { info_screen(win, TxtFailed, NULL, NULL); } } else { info_screen(win, TxtWillChangeOn, TxtAttach, NULL); // Changed in memory, will set when attach } return 1;}void GPRStest(MfwMnu* m, MfwMnuItem* i){ T_GPRS_CONT_REC context; T_ACI_RETURN ret1,ret2; UBYTE minsize; memset(&context.apn,'\0',MAX_APN_LEN); strcpy((char *)&context.apn,"INTERNET"); strcpy((char*)context.pdp_type,"IP"); memset(&context.pdp_addr,'\0',MAX_PDP_ADDR_LEN); context.d_comp = CGDCONT_D_COMP_OMITTED; context.h_comp = CGDCONT_H_COMP_OMITTED; memset(&context.qos,0,sizeof(T_QOS)); memset(&context.min_qos,0,sizeof(T_QOS)); ret1 = sAT_PlusCGDCONT(CMD_SRC_LCL,1,&context); { TRACE_EVENT_P1("ret1 %d",ret1); } switch (ret1) { case (AT_CMPL): /*operation completed*/ case (AT_EXCT): sAT_PercentCGPCO (CMD_SRC_LCL,1,ACI_PCO_AUTH_PROT_PAP,"web", "web", NULL, NULL); ret2 = sAT_Dn(CMD_SRC_LCL,"*98**1*1#",D_CLIR_OVRD_Default,D_CUG_CTRL_NotPresent,D_TOC_Data); switch (ret2) { case (AT_CMPL): /*operation completed*/ case (AT_EXCT): default: break; } }}/* SH - Only included for GPRS testing */#ifdef TEST_MMIGPRSstatic T_GPRS_CONT_REC inputCtxt = { "", "", "", CGDCONT_D_COMP_OMITTED, CGDCONT_H_COMP_OMITTED,GPRS_QOS_OMITTED, GPRS_QOS_OMITTED};enum{ QOS_PRECED_HIGH = 1, QOS_PRECED_NORMAL, QOS_PRECED_LOW};enum{ QOS_BEST = 1};/******************************************************************************* $Function: GPRSContextDefine $Description: Define a context! $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSContextDefine(MfwMnu* m, MfwMnuItem* i){ SHORT *cids; SHORT count; T_MFW_GPRS *gprs; SHORT numContexts; T_MFW_HND win = mfw_parent(mfw_header()); T_QOS Qos = {QOS_PRECED_NORMAL, QOS_BEST, QOS_BEST, QOS_BEST, QOS_BEST}; T_QOS Min_Qos = {QOS_PRECED_LOW, QOS_BEST, QOS_BEST, QOS_BEST, QOS_BEST};#ifdef TRACE_MMIGPRS TRACE_FUNCTION("GPRSContextDefine()");#endif /* Check to make sure gprs handle exists */ if (!mmi_gprs->gprsHandle) { info_screen(win, TxtNotAttached, NULL, NULL); return; } gprs = ((T_MFW_HDR *) mmi_gprs->gprsHandle)->data; numContexts = gprs->data.numContexts; strcpy(inputCtxt.apn, "Vizzavi UK"); strcpy(inputCtxt.pdp_addr, "212.183.137.012"); strcpy(inputCtxt.pdp_type, "ISDN"); inputCtxt.d_comp = NULL; inputCtxt.h_comp = NULL; memcpy(&inputCtxt.qos, &Qos, sizeof(Qos)); memcpy(&inputCtxt.min_qos, &Min_Qos, sizeof(Qos)); if (gprs_definePDPContext(GPRS_CID_1, &inputCtxt)==MFW_RES_OK) { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSContextDefine: Activated OK."); #endif info_screen(win, TxtActivated, NULL, NULL); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSContextDefine: Failed."); #endif info_screen(win, TxtFailed, NULL, NULL); } return 0;}/******************************************************************************* $Function: GPRSActivate $Description: $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSActivate(MfwMnu* m, MfwMnuItem* i){ SHORT *cids; SHORT count; T_MFW_GPRS *gprs; SHORT numContexts; T_MFW_HND win = mfw_parent(mfw_header()); TRACE_FUNCTION("GPRSActivate()"); // Check to make sure gprs handle exists if (!mmi_gprs->gprsHandle) { info_screen(win, TxtNotAttached, NULL, NULL); return; } gprs = ((T_MFW_HDR *) mmi_gprs->gprsHandle)->data; numContexts = gprs->data.numContexts;#ifdef TRACE_MMIGPRS TRACE_EVENT_P1("GPRSActivate: No. of contexts: %d", numContexts);#endif if (numContexts>0) { cids = (SHORT *) mfwAlloc(sizeof(SHORT)*numContexts); for (count=0; count<numContexts; count++) cids[count] = gprs->data.contexts[count].id; mmiPleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */ if (gprs_contextActivation(CGACT_STATE_ACTIVATED, cids)==MFW_RES_OK) { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSActivate: Activation executing, awaiting confirmation."); #endif } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSActivate: Failed."); #endif mmiPleaseWaitDestroy(); info_screen(win, TxtFailed, NULL, NULL); } mfwFree((U8 *) cids, sizeof(SHORT)*numContexts); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSActivate: No contexts to activate."); #endif info_screen(win, TxtFailed, NULL, NULL); } return 0;}/******************************************************************************* $Function: GPRSDeactivate $Description: $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSDeactivate(MfwMnu* m, MfwMnuItem* i){ SHORT *cids; SHORT count; T_MFW_GPRS *gprs; SHORT numContexts; T_MFW_HND win = mfw_parent(mfw_header()); TRACE_FUNCTION("GPRSDeactivate()"); if (!mmi_gprs->gprsHandle) { info_screen(win, TxtNotAttached, NULL, NULL); return; } gprs = ((T_MFW_HDR *) mmi_gprs->gprsHandle)->data; numContexts = gprs->data.numContexts; if (numContexts>0) { cids = (SHORT *) mfwAlloc(sizeof(SHORT)*numContexts); for (count=0; count<numContexts; count++) cids[count] = gprs->data.contexts[count].id; if (gprs_contextActivation(CGACT_STATE_DEACTIVATED, cids)==MFW_RES_OK) { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSDeactivate: Deactivated OK."); #endif info_screen(win, TxtDeActivated, NULL, NULL); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSDeactivate: Failed."); #endif info_screen(win, TxtFailed, NULL, NULL); } mfwFree((U8 *) cids, sizeof(SHORT)*numContexts); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSDeactivate: No contexts to deactivate."); #endif info_screen(win, TxtFailed, NULL, NULL); } return 0;}/******************************************************************************* $Function: GPRSsetQos $Description: Set quality of service $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSsetQos(MfwMnu* m, MfwMnuItem* i){ T_MFW_HND win = mfw_parent(mfw_header()); T_QOS Qos = {QOS_PRECED_NORMAL, QOS_BEST, QOS_BEST, QOS_BEST, QOS_BEST}; TRACE_FUNCTION("GPRSsetQos()"); if (gprs_setQOS(mmi_gprs->cid, &Qos)==MFW_RES_OK) { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSsetQos: OK"); #endif info_screen(win, TxtActivated, NULL, NULL); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSsetQos: Failed"); #endif info_screen(win, TxtFailed, NULL, NULL); } return;}/******************************************************************************* $Function: GPRSsetMinQos $Description: Set minimum quality of service $Returns: $Arguments: Standard menu option parameters*******************************************************************************/int GPRSsetMinQos(MfwMnu* m, MfwMnuItem* i){ T_MFW_HND win = mfw_parent(mfw_header()); T_QOS Qos = {QOS_PRECED_LOW, QOS_BEST, QOS_BEST, QOS_BEST, QOS_BEST}; TRACE_FUNCTION("GPRSsetMinQos()"); if (gprs_setQOSMin(mmi_gprs->cid, &Qos)==MFW_RES_OK) { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSsetMinQos: OK"); #endif info_screen(win, TxtActivated, NULL, NULL); } else { #ifdef TRACE_MMIGPRS TRACE_EVENT("GPRSsetMinQos: Failed"); #endif info_screen(win, TxtFailed, NULL, NULL); } return;}int csdConnection(MfwMnu* m, MfwMnuItem* i){}int setClassBConnection(MfwMnu* m, MfwMnuItem* i){}int setClasCConnection(MfwMnu* m, MfwMnuItem* i){}int showIPAddress(MfwMnu* m, MfwMnuItem* i){}int GPRSCompressionStatus(MfwMnu* m, MfwMnuItem* i){}int GPRSCompressionOn(MfwMnu* m, MfwMnuItem* i){}int GPRSCompressionOff(MfwMnu* m, MfwMnuItem* i){}int setClassCVoice(MfwMnu* m, MfwMnuItem* i){}int setClassCData(MfwMnu* m, MfwMnuItem* i){}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?