📄 mmismsidle.c
字号:
display_info.TextId = TxtToShow;
display_info.TextString2 = buf;
display_info.RightSoftKey = TxtSoftBack;
display_info.Time = THREE_SECS;//FOREVER;
/* Call Info Screen */
info_dialog( data->win, &display_info );}
#endif
}
break;
case E_SMS_MO: /* SMS sending has started */
{
/* not used */
//hxl add for pc get the msg 20021030----------------------------
T_MFW_SMS_MO *MoMessage = (T_MFW_SMS_MO *) w;
char *tmpsms;
if (PcCmdStatus.isPcCmdRun)
{
PcCmdStatus.isPcCmdRun=0;
MmiTrace("read_sms_mo");
memset(sms_text_ascii, 0, sizeof(sms_text_ascii));
if (MoMessage->dcs==0x08 ||MoMessage->dcs==0x18)
{
tmpsms=mmi_Sim_Sys(MoMessage->sms_msg,MoMessage->msg_len, MFW_DCS_UCS2,MAX_MSG_LEN);
memcpy(sms_text_ascii,tmpsms,MAX_MSG_LEN);
}
else
{
//windy modify here according NOKIA's short message ,if sms is all ASCII it must be 8bits code.
tmpsms=mmi_Sim_Sys(MoMessage->sms_msg,MoMessage->msg_len,MFW_DCS_8bits,MAX_MSG_LEN);
memcpy(sms_text_ascii,tmpsms,MAX_MSG_LEN);
}
Get_sms_info(sms_text_ascii,&(MoMessage->dest_addr), &(MoMessage->vp_abs), MoMessage->sc_addr, 0);
break;
}
break;
}
case E_SMS_MO_AVAIL:
MmiTrace("e_sms_ok");
if (PcCmdStatus.isPcCmdRun)
{
PcCmdStatus.isPcCmdRun=0;
save_send_sms(MFW_SMS_SUBMIT_SENT);
}
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
else if (QQsend.QQsendmsg)
{
SentQQ_CB(send_ok);
}
#endif
break;
//end of hxl add---------------------------------------
case E_SMS_OK:
/* Only happens when an SMS message is deleted. */
MmiTrace("e_sms_ok");
if (PcCmdStatus.isPcCmdRun)
{
PcCmdStatus.isPcCmdRun=0;
PcCmdStatus.isdelsmsok=1;
}
break;
case E_SMS_BUSY:
TRACE_EVENT ("E_SMS_BUSY");
break;
case E_SMS_SAVE_AVAIL:
MmiTrace("e_sms_save_ok");
if (PcCmdStatus.isPcCmdRun)
{
PcCmdStatus.isPcCmdRun=0;
if (command==SAVE_SEND_SMS)
send_sms_cb();
}
break;
case E_SMS_CMD_AVAIL:
break;
case E_SMS_ERR:
TRACE_EVENT ("E_SMS_ERR");
MmiTrace("e_sms_err");
if (PcCmdStatus.isPcCmdRun)
{
PcCmdStatus.isPcCmdRun=0;
PcCmdStatus.iscmdreterr=1;
if (command==SEND_SMS_CMD)
save_send_sms(MFW_SMS_SUBMIT);
else if (command==SAVE_SEND_SMS)
send_sms_cb();
}
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
else if (QQsend.QQsendmsg)
{
SentQQ_CB(send_fail);
}
#endif
break;
default:
TRACE_EVENT("unhandled event in smsidle_sms_cb()");
return MFW_EVENT_PASSED;
}
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: smsidle_get_memory_full
$Description: Call back function for the sms Idle window.
$Returns: sms memory status.
$Arguments: none
*******************************************************************************/
BOOL smsidle_get_memory_full(void)
{
return(!smsidle_data.sms_store_free);
}
/*******************************************************************************
$Function: smsidle_get_new_cb_messages_count
$Description: Call back function for the sms Idle window.
$Returns: sms count.
$Arguments: none
*******************************************************************************/
SHORT smsidle_get_new_cb_messages_count(void)
{
if (smsidle_get_ready_state())
{
return smscb_get_new_cb_messages_count();
}
else
{
return 0;
}
}
/*******************************************************************************
$Function: smsidle_get_ready_state
$Description: This function can be call from anywhere to get the information
about the "sms_initialised"
$Returns: sms status
$Arguments: none
*******************************************************************************/
BOOL smsidle_get_ready_state(void)
{
#ifdef _VIRTUAL_SIM_
return TRUE;
#endif
if (smsidle_data.sms_initialised )//&& !no_wait)//added by windy for wait phonebook's ready
return TRUE;
else
return FALSE;
}
//GW SPR#1035 - Added SAT changes
/*******************************************************************************
$Function: smsidle_unset_ready_state
$Description: this unset the flat "sms_initialised"
$Returns: sms status
$Arguments: none
*******************************************************************************/
void smsidle_unset_ready_state(void)
{
smsidle_data.sms_initialised = FALSE;
}
/*******************************************************************************
$Function: smsidle_get_unread_sms_available
$Description: This function allows an external process to determine the
received and unread SMS PP message status.
$Returns: sms status.
$Arguments: none
*******************************************************************************/
BOOL smsidle_get_unread_sms_available(void)
{ SHORT unread_sms_count;
TRACE_FUNCTION("smsidle_get_unread_sms_available() ");
if (smsidle_get_ready_state())
{
iconsSetState(iconIdSMS);//2004/03/11 Sunny add
unread_sms_count = sms_message_count(MFW_SMS_UNREAD);
return(unread_sms_count > 0 && (unread_sms_count > sms_message_count(MFW_SMS_VOICE)));
}
else
{
iconsDeleteState(iconIdSMS);//2004/03/11 Sunny add
return FALSE;
}
}
/*******************************************************************************
$Function: smsidle_display_sms_status
$Description: Interogates the SMS unread message count and displays
the result using the SMS icon and an information text.
$Returns: id of text string to be displayed
$Arguments: noOfMsgs - returns number of unread messages (or 0 if there are no
messages or the memory is full).
GW 02/10/01 - Modified code to work with chinese unicode text.
*******************************************************************************/
int smsidle_display_sms_status(int* noOfMsgs)
{
SHORT SmsMsgCount;
SHORT SmsVmailCount;
int txtMsg;
TRACE_FUNCTION("smsidle_display_sms_status() ");
*noOfMsgs = 0;
txtMsg = TxtNull;
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
if ((QQsend.QQCheck)||(QQReadNewSms))//hxl add for forbid when qq is check ,show sms2002-1-7
return(txtMsg);
#endif
if (smsidle_get_ready_state())
{
SmsVmailCount = sms_message_count(MFW_SMS_VOICE);
//sms_get_memset();
// if ((SmsVmailCount != 0) /* || (SmsData.ReceivedSmsPp.dcs == SET_VMAIL_ACTIVE) rsa??? */)
// {
// iconsSetState(iconIdVoice);
// }
// else
// {
// iconsDeleteState(iconIdVoice);
// }
SmsMsgCount = sms_message_count (MFW_SMS_UNREAD);
//2004-04-21 Sunny add for changing the prority of the new sms and sms full
if (smsidle_get_memory_full()||(memory.used==memory.total && memory.total != 0))//
{
txtMsg = TxtSmsFull;
if(SmsMsgCount > 0)
{
iconsSetState(iconIdSMS);
}else
{
iconsDeleteState(iconIdSMS);
}
}
else if ((SmsMsgCount > 0) && (SmsMsgCount > SmsVmailCount))
{
if (playdelaysmstone)
{
StartPlayByReason(SMSPLAY,0);
playdelaysmstone=0;
}
txtMsg = TxtNewMessage;
iconsSetState(iconIdSMS);
*noOfMsgs = SmsMsgCount;
}
else
{
iconsDeleteState(iconIdSMS);
txtMsg = TxtNull;
}
//2004-04-21 Sunny add for changing the prority of the new sms and sms full
#if 0 //2004-04-20 Sunny remove
if ((SmsMsgCount > 0) && (SmsMsgCount > SmsVmailCount))
{
// sprintf(TextString,"%d ", SmsMsgCount);
if (playdelaysmstone)
{
StartPlayByReason(SMSPLAY,0);
playdelaysmstone=0;
}
txtMsg = TxtNewMessage;
iconsSetState(iconIdSMS);//2004/03/11 Sunny add
*noOfMsgs = SmsMsgCount;
}
else if (smsidle_get_memory_full()||(memory.used==memory.total && memory.total != 0))//
{
//iconsSetState(iconIdSMS);//2004/04/15 Sunny remove
txtMsg = TxtSmsFull;
}
else
{
iconsDeleteState(iconIdSMS);//2004/03/11 Sunny add
txtMsg = TxtNull;
}
#endif
// iconsShow();
}
return(txtMsg);
}
/*******************************************************************************
$Function: smsidle_get_unread_smscb_available
$Description: This function allows an external process to determine the
received SMS CB message status.
$Returns: execution status
$Arguments: none
*******************************************************************************/
BOOL smsidle_get_unread_smscb_available(void)
{
if (smsidle_get_ready_state())
return(smsidle_get_new_cb_messages_count() > 0);
else
return FALSE;
}
/*******************************************************************************
$Function: smsidle_display_smscb_status
$Description: Interogates the SMS CB message received status and
returns the resulting string to the caller.
$Returns: none
$Arguments: TextString - Text String
*******************************************************************************/
void smsidle_display_smscb_status(char *TextString)
{
SHORT count;
/* count the unread cb messagesc */
count = smsidle_get_new_cb_messages_count();
/* the unread CB should have a high priority than */
/* the class 0 CB */
if (count > 0)
{
sprintf(TextString, "%d %s\0",count, GET_TEXT(TxtNewCbMessage));
iconsSetState(iconIdSMS); //2004/03/11 Sunny add
}
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : BMI_RDSM |
| STATE : code ROUTINE : |
+--------------------------------------------------------------------+
PURPOSE : module entry point
*/
int GetCurrentMemory(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfwParent(mfw_header());
int TxtToShow;
char buf[20];
T_DISPLAY_DATA display_info;
MMI_TRACE_EVENT(("<<<talcon,GetCurrentMemory"));
/* retrieve he status of the book, and create a string for output based on the status */
if (!smsidle_get_ready_state())
{
MMI_TRACE_EVENT(("<<<talcon,GetCurrentMemory--1"));
info_screen(win, TxtSimNot, TxtPleaseWait, NULL,REMIND_WAITTING);
/*dialog_info_init(&display_info);//gdy add
SmsMenu_loadDialogDefault(&display_info);
display_info.TextId2 = TxtPleaseWait;
// Generic function for info messages
display_info.Time = ONE_SECS;
display_info.iconindex =REMIND_WAITTING;//REMIND_NORECORD;
info_dialog(win, &display_info);*/
}
else
{
MMI_TRACE_EVENT(("<<<talcon,GetCurrentMemory--2"));
sms_get_memset();
// clrobert modify, timestamp 2003-9-22 21:04
// from
/*
buf == '\0';
*/
// to
buf[0] = '\0';
// modify end
TxtToShow = TxtUsed;
sprintf( buf, "%d/%d", (int)memory.used,(int)memory.total );
dialog_info_init(&display_info);//gdy add
display_info.KeyEvents = KEY_RIGHT|KEY_CLEAR|KEY_HUP; /* 2004/03/31 sunsj modify */
display_info.TextId = NULL;//TxtToShow;
display_info.TextString2 = NULL;//buf;
display_info.RightSoftKey = TxtSoftBack;
display_info.Time = FOREVER;
display_info.Identifier=MMI_MESSAGE_MEMORYSTATE;
/* Call Info Screen */
info_dialog( win, &display_info );
}
//TRACE_FUNCTION("bmi_rdsm.GetCurrentMemory");
//if(sms_set_pref_memory(MFW_MEM_SIM)==MFW_SMS_OK)
//if(sms_get_memset()==MFW_SMS_FAIL)
//sms_set_pref_memory(MFW_MEM_ME);
//sms_set_mt_ind(MT_IND_IDX);
//sms_get_memset();
return 0;
}
/*******************************************************************************
$Function: SetSmsFull
$Description:
$Returns:
$Arguments:
*******************************************************************************/
void SetSmsFull()
{
smsidle_data.sms_store_free = FALSE;
// show the info about full sms list on the idle screen
//idle_data.clean_screen = FALSE;
}
/* Marcus: Issue 1170: 07/10/2002: Start */
/*******************************************************************************
$Function: smsidle_sr_status_to_text_id
$Description: Returns the text ID for the given status report status
$Returns: int : text ID
$Arguments: UBYTE: SMS-STATUS-REPORT status
*******************************************************************************/
static int smsidle_sr_status_to_text_id(UBYTE status)
{
int ret = TxtError;
UBYTE group = ((status & 0x60) >> 5);
UBYTE value = (status & 0x1F);
switch (group)
{
case 0: // Short message transaction completed
if ((value >= 3) && (value <= 0x0F))
ret = TxtError;
else
ret = TxtDelivered;
break;
case 1: // Temporary error, SC still trying to transfer SM
if ((value >= 6) && (value <= 0x0F))
ret = TxtError;
else
ret = TxtTempError;
break;
case 2: // Permanent error, SC is not making any more transfer attempts
case 3: // Temporary error, SC is not making any more transfer attempts
ret = TxtError;
break;
}
return ret;
}
/* Marcus: Issue 1170: 07/10/2002: End */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -