📄 mmismsread.c
字号:
opString[i*2] = 0x00;
opString[i*2+1] = ipString[i];
}
if( len*2+1 < opLength )
{
opString[len*2] = 0x00;
opString[len*2+1] = 0x00;
}
}
else if( opDataType == MFW_DCS_8bits )
{ //Data already in correct format - copy
if( ipLength < opLength )
len = ipLength;
else
len = opLength;
for( i=0;i<len;i++ )
opString[i] = ipString[i];
if( len<opLength )
opString[len] = 0x00;
}
else if( opDataType == MFW_ASCII )
{
TRACE_EVENT_P2("ipLength: %d, oplength: %d", ipLength, opLength);
if( ipLength < opLength )
len = ipLength;
else
len = opLength;
for( i = 0; i < len; i++ )
{
opString[i] = g_translation_ascii_table[/*UBYTEToChar*/(ipString[i])];
}
// opLength = ipLength;
}
else // convert data to 7bit
{
TRACE_EVENT("ELSE 7bit convertion");
len = utl_cvt8To7 ((UBYTE *)ipString , ipLength, (UBYTE*)opString, 0);
}
break;
case MFW_DCS_7bits:
if( opDataType == MFW_DCS_7bits ) //text string is already in this format
{
//Data already in correct format - copy
if( ipLength < opLength )
len = ipLength;
else
len = opLength;
for( i=0;i<len;i++ )
opString[i] = ipString[i];
if( len<opLength )
opString[len] = 0x00;
}
else if( opDataType == MFW_DCS_8bits )
{
len = utl_cvt7To8 ((UBYTE *)ipString , ipLength, text_8bit, 0 );
if( len > opLength )
len = opLength;
for( i = 0; i < len; i++ )
{
opString[i] = g_translation_ascii_table[UBYTEToChar(text_8bit[i])];
}
if( len <opLength )
opString[len] = 0x00;
else
opString[opLength]=0x00;
}
else if( opDataType == MFW_ASCII )
{
for( i = 0; i < len; i++ )
{
opString[i] = g_translation_ascii_table[/*UBYTEToChar*/(ipString[i])];
}
// opLength = ipLength;
}
else
{ //Convert to unicode
len = utl_cvt7To8 ((UBYTE *)ipString , ipLength, text_8bit, 0 );
if( len*2 > opLength )
len = opLength/2;
for( i = 0; i < len; i++ )
{
opString[i*2] = 0x00;
opString[i*2+1] = g_translation_ascii_table[UBYTEToChar(text_8bit[i])];
}
if( len*2+1 < opLength )
{
opString[len*2] = 0x00;
opString[len*2+1] = 0x00;
}
}
break;
case MFW_ASCII:
{ if( opDataType == MFW_DCS_8bits )
{
int i, j;
if( ipLength < opLength )
len = ipLength;
else
len = opLength;
for( i=0; i<len; i++ )/*for each char*/
{
/*if character same in ASCII as GSM, just copy char*/
if( ipString[i] == g_translation_ascii_table[ipString[i]] )
{
opString[i] = ipString[i];
}
else/*find match in table and copy index of match*/
{
for( j=0; j<128; j++ )
{
if( ipString[i] == g_translation_ascii_table[j] )
{
opString[i] = j;
}
break;
}
}
}
}
break;
}
}
if( addNull )
{ //Add 0x00 (or 0x00,0x00) to end of array
opString[opLength-1] = 0x00;
if( opDataType == MFW_DCS_UCS2 )
{
opString[opLength-2] = 0x00;
}
}
return TRUE;
}
/*******************************************************************************
$Function: ChangeTime
$Description: change the input time
$Returns: return 0
$Arguments:
*******************************************************************************/
void ChangeTime( char * text,T_MFW_SMS_SCTP* rctp)
{
int index=0;
MMI_TRACE_EVENT(("ChangeTime()"));
text[index++]='0'+rctp->month[0];
text[index++]='0'+rctp->month[1];
text[index++]='/';
text[index++]='0'+rctp->day[0];
text[index++]='0'+rctp->day[1];
text[index++]=',';
text[index++] ='0'+rctp->hour[0];
text[index++]='0'+rctp->hour[1];
text[index++]=':';
text[index++]='0'+rctp->minute[0];
text[index++]='0'+rctp->minute[1];
return;
//text[index++]='\n';
}
/*******************************************************************************
$Function: ComTime
$Description: compare the input time
$Returns: if time1>time2 return 1 else return 0
$Arguments:
*******************************************************************************/
int ComTime(UINT16 y1,UINT16 m1,UINT16 d1,UINT16 h1,UINT16 mi1,
UINT16 y2,UINT16 m2,UINT16 d2,UINT16 h2,UINT16 mi2)
{
TRACE_FUNCTION ("ComTime()");
if( y1>y2 )
return 1;
else if( y1==y2 && m1>m2 )
return 1;
else if( y1==y2 && m1==m2 && d1>d2 )
return 1;
else if( y1==y2 && m1==m2 && d1==d2 && h1>h2 )
return 1;
else if( y1==y2 && m1==m2 && d1==d2 && h1==h2 && mi1>mi2 )
return 1;
else
return 0;
}
/*******************************************************************************
$Function: SortSms
$Description: sort the sms by its time stamp
$Returns: the sorted sms list
$Arguments:
*******************************************************************************/
void SortSms(SHORT l_found,T_MFW_SMS_MSG * msg_list)
{
UINT16 year,month,day,hour,minute,year0,month0,day0,hour0,minute0;
UINT8 i,j;
T_MFW_SMS_MSG temp;
TRACE_FUNCTION ("SortSms()");
for( i=1;i<l_found;i++ )
for( j=0;j<l_found-i;j++ )
{
year=((msg_list[j].rctp.year[0])%13)*10+(msg_list[j].rctp.year[1])%13;
month=(msg_list[j].rctp.month[0]%13)*10+msg_list[j].rctp.month[1]%13;
day=(msg_list[j].rctp.day[0]%32)*10+msg_list[j].rctp.day[1]%32;
hour=(msg_list[j].rctp.hour[0]%24)*10+msg_list[j].rctp.hour[1]%24;
minute=(msg_list[j].rctp.minute[0]%60)*10+msg_list[j].rctp.minute[1]%60;
year0=((msg_list[j+1].rctp.year[0])%13)*10+(msg_list[j+1].rctp.year[1])%13;
month0=(msg_list[j+1].rctp.month[0]%13)*10+msg_list[j+1].rctp.month[1]%13;
day0=(msg_list[j+1].rctp.day[0]%32)*10+msg_list[j+1].rctp.day[1]%32;
hour0=(msg_list[j+1].rctp.hour[0]%24)*10+msg_list[j+1].rctp.hour[1]%24;
minute0=(msg_list[j+1].rctp.minute[0]%60)*10+msg_list[j+1].rctp.minute[1]%60;
if( ComTime(year0,month0,day0,hour0,minute0,year,month,day,hour,minute) )
{
memset(&temp, 0, sizeof(T_MFW_SMS_MSG));
memcpy(&temp,&msg_list[j],sizeof(T_MFW_SMS_MSG));
memcpy(&msg_list[j],&msg_list[j+1],sizeof(T_MFW_SMS_MSG));
memcpy(&msg_list[j+1],&temp,sizeof(T_MFW_SMS_MSG));
}
}
}
/*******************************************************************************
$Function: ShowTime
$Description: show mt sms time
$Returns:
$Arguments:
*******************************************************************************/
void ShowTime(char* text)
{
int old_color;
MMI_TRACE_EVENT(("wangyan ShowTime()"));
dspl_Clear(0, VIEWLIST_MENU_VERTICAL_SIZE-LINE_HEIGHT, SCREEN_SIZE_X, VIEWLIST_MENU_VERTICAL_SIZE);
old_color=dspl_GetBkgColor();
dspl_SetBkgColor(0xF8E0EE);
dspl_Clear(0, VIEWLIST_MENU_VERTICAL_SIZE-LINE_HEIGHT, SCREEN_SIZE_X, VIEWLIST_MENU_VERTICAL_SIZE);
dspl_SetBkgColor(old_color);
/* 2004/06 sunsj modify for picture manage */
DRAW_ICON(ICON_SMSMTTIME);
//dspl_BitBlt(1, VIEWLIST_MENU_VERTICAL_SIZE-LINE_HEIGHT, 20, 12, 0, (void *)Mtsmstime, 0);
set_font_type(UNI12X12_FONT);
dspl_colorTextOut(25,VIEWLIST_MENU_VERTICAL_SIZE-LINE_HEIGHT,DSPL_TXTATTR_TRANSPARENT,(char*)text,0x000000);
set_font_type(NORMAL_FONT);
}
/*******************************************************************************
$Function: ExtractNumber
$Description: extract number from sms,remove"+86"
$Returns:
$Arguments:
*******************************************************************************/
void ExtractNumber(T_MFW_SMS_ADDR * tmp,char * Buffer)
{
if( tmp->ton == MFW_TON_INTERNATIONAL )
{
if( tmp->number[0] == '+' )
{
if( tmp->number[1] == '8' && tmp->number[2] == '6' )
strcpy(Buffer,(char *)tmp->number+3);
else
strcpy(Buffer,(char *)tmp->number);
}
else
{
if( tmp->number[0] == '8'&& tmp->number[1] == '6' )
strcpy((char *)Buffer,(char *)tmp->number+2);
else
{
//strcpy((char *)Buffer,(char *)tmp->number);
strcpy((char *)Buffer,"+");
strncat((char *)Buffer,(char *)tmp->number,sizeof(tmp->number)-2);
}
}
}
else
strcpy((char *)Buffer,(char *)tmp->number);
}
/**/
/*******************************************************************************
$Function: SmsRead_R_start
$Description: Start the creation of the main window for SMS reading
$Returns: mfw window handler
$Arguments: parent_window - Parent window handler
menuAttr - Menu attributes.
*******************************************************************************/
T_MFW_HND SmsRead_R_start(T_MFW_HND parent_window, T_MFW_SMS_STAT* menuAttr)
{
T_MFW_HND win;
TRACE_FUNCTION ("SmsRead_R_start()");
win = SmsRead_R_create (parent_window);
if( win NEQ NULL )
{
/* We transmit to the SMS editor the address of the data buffer */
SEND_EVENT (win, E_INIT, SmsRead_R_ID, (void *)menuAttr);
}
return win;
}
/*******************************************************************************
$Function: SmsRead_R_create
$Description: create the SMS read window (dynamic list of all the SMS)
$Returns: mfw window handler
$Arguments: parent_window - Parent window handler
*******************************************************************************/
static T_MFW_HND SmsRead_R_create(MfwHnd parent_window)
{
T_SMSREAD_R * data = (T_SMSREAD_R *)ALLOC_MEMORY (sizeof (T_SMSREAD_R));
T_MFW_WIN * win;
TRACE_FUNCTION ("SmsRead_R_create()");
/* Create window handler */
data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)SmsRead_R_win_cb);
if( data->win EQ NULL )
{
return NULL;
}
/* connect the dialog data to the MFW-window */
data->mmi_control.dialog = (T_DIALOG_FUNC)SmsRead_R_exec_cb;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent = parent_window;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -