📄 mmiaoc.c
字号:
data->aocInfo.acm_max = atol(data->edt_Buf);
// Password not necessary, Pin2 scenario done
PWD='\0';
result = cm_set_aoc_value(CM_AOC_ACMMAX,&data->aocInfo, &PWD); /* save ACMmax in AOC */
sprintf(buf, "%ld", data->aocInfo.acm_max);
TRACE_EVENT(buf);
sprintf(buf, "result of set aoc %d", result);
TRACE_EVENT(buf);
SEND_EVENT (win, SERVICES_LIMIT_CHANGED, 0, 0);
break;
case SERVICES_RESET_CHARGE:
/* MC 12/04/02: Changed ACMMAX to ACM (should fix "broken" SIM problem)*/
result = cm_set_aoc_value(CM_AOC_ACM,&data->aocInfo, &PWD); /* save ACMmax in AOC */
}
break;
case INFO_KCD_RIGHT:
case INFO_KCD_CLEAR:
case INFO_KCD_HUP: //hbh 2003-4-10
TRACE_EVENT ("INFO_KCD_RIGHT pressed");
switch( Identifier )
{
case SERVICES_LIMIT_CHANGE:
case SERVICES_ENTER_CURRENCY:
//go back to the previous screen
service_Exit (win);
break;
case SERVICES_ONE_UNIT:
if( data->edt_win )
{
editor_destroy(data->edt_win);
data->edt_win=NULL;
}
//go back to the previous screen
SEND_EVENT (win, SERVICES_ENTER_CURRENCY, 0, 0);
break;
default:
break;
}
default:
break;
}
}
//---------------------wufei modified------------------------------------------------
/*******************************************************************************
$Function: service
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void service (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
T_SERVICES * data = (T_SERVICES *)win_data->user;
char buf[60];
T_EDITOR_DATA editor_data;
T_DISPLAY_DATA display_info;
T_MFW_SIM_PIN_STATUS status;
UBYTE PWD, i, result;
/*2004/04/14,TALCON modify ,add static*/
static char line[MAX_LINE],line1[MAX_LINE],line2[MAX_LINE],line3[MAX_LINE];
TRACE_FUNCTION("service()");
switch( event )
{
#if 0
case SERVICES_CREDIT_REMAINING:
memset(line,'\0',sizeof(line));
//Get the ACM MAX
cm_get_aoc_value(CM_AOC_ACMMAX,&data->aocInfo);
//Get ACM
cm_get_aoc_value(CM_AOC_ACM,&data->aocInfo);
//Get currency and price per unit
cm_get_aoc_value(CM_AOC_PUCT,&data->aocInfo);
/* nm test only set the default */
// data->aocInfo.acm_max=100;
// data->aocInfo.acm=1;
// strcpy ((char *)data->aocInfo.cur, "DM");
// strcpy ((char *)data->aocInfo.ppu, "1.5");
/* nm test only set the default */
sprintf(buf, "ACMMAX: %ld", data->aocInfo.acm_max);
TRACE_FUNCTION(buf);
sprintf(buf, "ACM: %ld", data->aocInfo.acm);
TRACE_FUNCTION(buf);
sprintf(buf, "PPU:%s", data->aocInfo.ppu);
TRACE_FUNCTION(buf);
sprintf(buf, "CUR:%s", data->aocInfo.cur);
TRACE_FUNCTION(buf);
if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0)&& (data->aocInfo.acm NEQ '\0') )
//if ((data->aocInfo.acm_max NEQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* special case: It is not possible to have ACM > ACMMAX */
/* this case the mobile has to disconnect */
if( data->aocInfo.acm > data->aocInfo.acm_max )
{
strcpy(line, "????");
}
else
{
/* calculate the credit with ACMAX and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU !=0");
service_calc_balance (win,(char*)line);
}
}
else if( (data->aocInfo.acm_max EQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0)&& (data->aocInfo.acm NEQ '\0') )
//if ((data->aocInfo.acm_max EQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* calculate the cost with ACM and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX ==0 and PPU !=0");
service_calculate (win, (char*)line, data->aocInfo.acm);
}
else if( (data->aocInfo.acm_max EQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0)&& (data->aocInfo.acm NEQ '\0') )
// if ((data->aocInfo.acm_max EQ '\0') && (data->aocInfo.acm NEQ '\0') )
{
/* show only ACM */
TRACE_FUNCTION ("CREDIT :ACMMAX ==0 and PPU ==0");
sprintf(line, "%ld", data->aocInfo.acm); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0)&& (data->aocInfo.acm NEQ '\0') )
// if ((data->aocInfo.acm_max NEQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* show only ACMAX */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU ==0");
sprintf(line, "%ld", data->aocInfo.acm_max - data->aocInfo.acm); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0) && (data->aocInfo.acm EQ '\0') )
{
/* show only ACMAX */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU ==0");
sprintf(line, "%ld", data->aocInfo.acm_max); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0) && (data->aocInfo.acm EQ '\0') )
{
/* calculate the credit with ACMAX and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU !=0");
service_calculate (win, (char*)line, data->aocInfo.acm_max);
}
else
strcpy ((char *)line, "0");
//from ASCII to GSM default
for( i=0; i< MAX_LINE; i++ )
{
if( line[i] EQ 0x80 OR line[i] EQ 0xFF )
line[i] = '\0';
}
dialog_info_init(&display_info);//gdy add
//sprintf(buf, "line: %s", line);
//TRACE_FUNCTION(buf);
if( data->aocInfo.acm_max EQ 0 )
{
display_info.TextString="\x80\x8d\x39\x75\x28\x00\x00";//WUFEI MODIFY 0812
//display_info.TextId = TxtCost;//wufei modify 0812
}
else
{
display_info.TextString="\x80\x4f\x59\x98\x9d\x00\x00";//WUFEI MODIFY 0812
//display_info.TextId = TxtBalance;//WUFEI MODIFY 0812
}
display_info.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_HUP;
display_info.LeftSoftKey = '\0';
display_info.RightSoftKey = TxtSoftBack; //hu binhao 2003-2-27
//display_info.TextString1 = '\0';
if( strlen(line)<3 ) //for gudy dialog hu binhao 2002-2-27
{
strcat(line," ");
}
display_info.TextString2 = line; //hu binhao 2003-1-15
// display_info.TextId = ;
display_info.TextId2 = 0;
display_info.Time = FOREVER; //hu binhao 2003-1-27
display_info.Identifier = event;
display_info.iconindex =REMIND_NORECORD;
display_info.Callback = (T_VOID_FUNC)service_dialog_cb;
/*
* Call Info Screen
*/
info_dialog (win, &display_info);
break;
#endif
case SERVICES_AOC_STATISTICS:
memset(line1,'\0',sizeof(line1));
memset(line2,'\0',sizeof(line2));
memset(line3,'\0',sizeof(line3));
//Get the ACM MAX
cm_get_aoc_value(CM_AOC_ACMMAX,&data->aocInfo);
//Get ACM
cm_get_aoc_value(CM_AOC_ACM,&data->aocInfo);
//Get currency and price per unit
cm_get_aoc_value(CM_AOC_PUCT,&data->aocInfo);
/* nm test only set the default */
// data->aocInfo.acm_max=100;
// data->aocInfo.acm=1;
// strcpy ((char *)data->aocInfo.cur, "DM");
// strcpy ((char *)data->aocInfo.ppu, "1.5");
/* nm test only set the default */
sprintf(buf, "ACMMAX: %ld", data->aocInfo.acm_max);
TRACE_FUNCTION(buf);
sprintf(buf, "ACM: %ld", data->aocInfo.acm);
TRACE_FUNCTION(buf);
sprintf(buf, "PPU:%s", data->aocInfo.ppu);
TRACE_FUNCTION(buf);
sprintf(buf, "CUR:%s", data->aocInfo.cur);
TRACE_FUNCTION(buf);
if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0)&& (data->aocInfo.acm NEQ '\0') )
//if ((data->aocInfo.acm_max NEQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* special case: It is not possible to have ACM > ACMMAX */
/* this case the mobile has to disconnect */
if( data->aocInfo.acm > data->aocInfo.acm_max )
{
strcpy(line1, "????");
}
else
{
/* calculate the credit with ACMAX and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU !=0");
service_calc_balance (win,(char*)line1);
}
}
else if( (data->aocInfo.acm_max EQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0)&& (data->aocInfo.acm NEQ '\0') )
//if ((data->aocInfo.acm_max EQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* calculate the cost with ACM and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX ==0 and PPU !=0");
service_calculate (win, (char*)line1, data->aocInfo.acm);
}
else if( (data->aocInfo.acm_max EQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0)&& (data->aocInfo.acm NEQ '\0') )
// if ((data->aocInfo.acm_max EQ '\0') && (data->aocInfo.acm NEQ '\0') )
{
/* show only ACM */
TRACE_FUNCTION ("CREDIT :ACMMAX ==0 and PPU ==0");
sprintf(line1, "%ld", data->aocInfo.acm); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0)&& (data->aocInfo.acm NEQ '\0') )
// if ((data->aocInfo.acm_max NEQ '\0') && (data->aocInfo.acm NEQ '\0'))
{
/* show only ACMAX */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU ==0");
sprintf(line1, "%ld", data->aocInfo.acm_max - data->aocInfo.acm); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) EQ 0) && (data->aocInfo.acm EQ '\0') )
{
/* show only ACMAX */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU ==0");
sprintf(line1, "%ld", data->aocInfo.acm_max); /* */
}
else if( (data->aocInfo.acm_max NEQ '\0') && (strlen((char*)data->aocInfo.ppu) NEQ 0) && (data->aocInfo.acm EQ '\0') )
{
/* calculate the credit with ACMAX and PPU */
TRACE_FUNCTION ("CREDIT :ACMMAX !=0 and PPU !=0");
service_calculate (win, (char*)line1, data->aocInfo.acm_max);
}
else
strcpy ((char *)line1, "0");
//from ASCII to GSM default
for( i=0; i< MAX_LINE; i++ )
{
if( line1[i] EQ 0x80 OR line1[i] EQ 0xFF )
line1[i] = '\0';
}
dialog_info_init(&display_info);//gdy add
//sprintf(buf, "line: %s", line);
//TRACE_FUNCTION(buf);
/* if (data->aocInfo.acm_max EQ 0)
{
display_info.TextString="\x80\x8d\x39\x75\x28\x00\x00";//WUFEI MODIFY 0812
//display_info.TextId = TxtCost;//wufei modify 0812
}
else
{
display_info.TextString="\x80\x4f\x59\x98\x9d\x00\x00";//WUFEI MODIFY 0812
//display_info.TextId = TxtBalance;//WUFEI MODIFY 0812
}*/
if( data->aocInfo.acm_max EQ 0 )
{
display_info.TextId=TxtCost;//WUFEI MODIFY 0812
//display_info.TextId = TxtCost;//wufei modify 0812
}
else
{
display_info.TextId=TxtBalance;//WUFEI MODIFY 0812
//display_info.TextId = TxtBalance;//WUFEI MODIFY 0812
}
if( strlen(line1)<3 ) //for gudy dialog hu binhao 2002-2-27
{
strcat(line1," ");
}
display_info.TextString= line1; //hu binhao 2003-1-15
cm_get_aoc_value(CM_AOC_PUCT,&data->aocInfo); /* Get currency and price per unit */
cm_get_aoc_value(CM_AOC_PUCT,&data->aocInfo); /* Get currency and price per unit */
if( (strlen((char*)data->aocInfo.ppu) EQ 0) && (data->aocInfo.ccm NEQ '\0') ) //wufei
{
TRACE_EVENT ("get only :ACM ; PPU ==0 and ACM!=0");
//show only the units ACM from last call
sprintf(line2, "%ld", acm_last_call);
}
else if( (strlen((char*)data->aocInfo.ppu) NEQ 0) && (data->aocInfo.ccm NEQ '\0') ) //wufei
{
TRACE_FUNCTION ("get only :ACM ; PPU !=0 and ACM!=0");
// add currency
//sprintf(line, "%ld %s", acm_last_call, data->aocInfo.cur);
service_calculate (win, (char*)line2, data->aocInfo.ccm);
}
else //wufei
strcpy ((char *)line2, "0");
if( acm_last_call EQ '\0' )
strcpy ((char *)line2, "0");
display_info.TextId2=TxtLastCharge;
if( strlen(line2)<3 ) //for gudy dialog hu binhao 2002-2-27
{
strcat(line2," ");
}
display_info.TextString2 = line2;
cm_get_aoc_value(CM_AOC_ACM,&data->aocInfo); /* Get the ACM */
cm_get_aoc_value(CM_AOC_PUCT,&data->aocInfo); /* Get currency and price per unit */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -