⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmismsidle.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 2 页
字号:
					Display_1_2_1_vm_icon = FALSE;
					iconsDeleteState(iconIdVoice); 
				}
			}
			else
			{	iconsSetState(iconIdVoice);      /*  display voice mail icon.*/
			}
			idleEvent(IdleUpdate);		/*  update the idle screen.*/
	    	//Play the Voice Mail tone.
		}
		else if(urd_count > 0 && urd_msg_list[0].stat == MFW_SMS_UNREAD && (event != E_SMS_MT))
		{
		    /* set the status: The sms icon and  the string*/
	    	/* "message(s) received" will be displayed     */
	    	iconsSetState(iconIdSMS);      /* Indicate SMS delivery to MS-User. */
		    idleEvent(IdleNewSmsMessage);
		    currentSMSTone = getcurrentSMSTone();
		    audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, 0 );
			mme_backlightEvent(BL_INCOMING_SMS);
		}	
		/*NM p029*/
		/* API - Implemented NM changes from 3.3.3 mainline to show class 0 SMS on idle screen */
		else if(event == E_SMS_MT) /* this sms identifier "E_SMS_MT" is not saved on the SIM */
		{
			/* take the SMS data from MFW  */
            T_MFW_SMS_MT *Message = (T_MFW_SMS_MT *) w;

            /* Marcus: Issue 1650: 28/01/2003: Start */
            TRACE_EVENT ("E_SMS_MT");
            /* check for the class 0 message */
            TRACE_EVENT_P1("dcs: 0x%02X", Message->dcs);

            if ((Message->dcs & TEXT_CLASS_GIVEN) &&
                ((Message->dcs & TEXT_CLASS_MASK) == TEXT_CLASS_0))
            {
                TRACE_EVENT ("Class 0 message");

				/*
				** SPR#1745 NDH Text from ACI may be compressed. if so
				** the text will need to be converted to ASCII before it can
				** be displayed properly
				*/
				if (Message->dcs & TEXT_COMPRESSED)
				{			 
				    char* temp_buffer_sms = (char*)ALLOC_MEMORY(MAX_MSG_LEN_ARRAY);
					TRACE_EVENT ("text_compressed");	

					/*
					ACI already (in case of 7bit-dcs!) extract the 7 bit to 8 bit,
					so this is what we get and we have just only to decode from
					7Bit-Default to ASCII
					*/   
				   //convert in the right format
				   SmsRead_convertSMSmsg(Message->sms_msg, MFW_DCS_8bits, Message->msg_len,
									 temp_buffer_sms, MFW_ASCII, MAX_MSG_LEN, FALSE);

					memcpy(Message->sms_msg, temp_buffer_sms, MAX_MSG_LEN_ARRAY);
					
					addCBCH(Message->sms_msg, IdleNewSmsMessage);

					FREE_MEMORY((void*)temp_buffer_sms,MAX_MSG_LEN_ARRAY);
				}
				else
				{
					TRACE_EVENT ("text_uncompressed");

					/*
				     assume uncompressed message is ASCII
					*/

					addCBCH(Message->sms_msg, IdleNewSmsMessage);
				}
				/*
				** SPR#1745 - End
				*/

    		    //display now on the idle screen
    			statusCBCH(TRUE);
            }
            /* Marcus: Issue 1650: 28/01/2003: End */

            iconsDeleteState(iconIdVoice);      /* Delete voice mail icon.*/
            idleEvent(IdleUpdate);		/*  update the idle screen.*/	
        }
		/*NM p029 end*/
 
	    break;
	case E_SMS_CB: /* new CBCH received */
	{
		USHORT i;
		SHORT geograhical_scope = (SHORT)0xC000;

		T_MFW_SMS_CB *Message = (T_MFW_SMS_CB *)w;

	    TRACE_EVENT ("E_SMS_CB");

		memset(temp_buffer, '\0', MAX_CBMSG_LEN);

		//check: does the incoming CB indicates a immediate scope
		if (! (Message->sn & geograhical_scope) )
	     {
		 //Immediate scope
		 // API - 859 - German characters were not visable in the CB message
		 TRACE_EVENT("Immediate Scope");

		 // API - 859 - Convert the the incoming GSM Text to ASCII
		 SmsRead_convertSMSmsg(Message->cb_msg, MFW_DCS_8bits, Message->msg_len,
								  temp_buffer, MFW_ASCII, MAX_CBMSG_LEN, FALSE);
	     	
			 for(i=0;i <= Message->msg_len;i++)
			 {
				//check now for the termination "0x00D"
				//the message is NOT terminated with '\0'
				if (temp_buffer[i] EQ 0x0d)
				{
					temp_buffer[i]='\0';
				 }
			 }

#ifdef MMI_HOMEZONE_ENABLED		// SH 11/12/01
			/* SPR759 - SH - Homezone: check to see if CB gives us the coordinates of the centre of the current cell */

			if (Message->msg_id==HZ_IDENTIFIER)
			{
				homezoneCBData(Message->cb_msg);
			}
			else
			{
#endif // HOMEZONE

		     //display now on the idle screen
		     
		     addCBCH(temp_buffer, IdleNewCBImmediateMessage);
		    statusCBCH(TRUE);
#ifdef MMI_HOMEZONE_ENABLED
			} /* SPR759 - SH */
#endif
		}
		else //Normal scope
		{
			TRACE_EVENT("Normal Scope");
			//only for single- and the last page of mulitpages
			//other pages have not the termination "0x00D"
			
			// API - 859 - Convert the the incoming GSM Text to ASCII
			SmsRead_convertSMSmsg(Message->cb_msg, MFW_DCS_8bits, Message->msg_len,
					temp_buffer, MFW_ASCII, MAX_MSG_LEN, FALSE);

			memcpy(Message->cb_msg, temp_buffer, MAX_CBMSG_LEN);
			
			if( (Message->pages) EQ (Message->page) )
			{
				 for(i=0;i <= (Message->msg_len);i++)
				 {
					//check now for the termination "0x00D"
					//the message is NOT terminated with '\0'
					if (Message->cb_msg[i] EQ 0x0d)
					{
						Message->cb_msg[i]='\0';
					}
				 }
			}
			else
			{
				Message->cb_msg[MAX_CBMSG_LEN]='\0';
			}

			//indicate on the idle screen the new incoming cb
		    addCBCH( NULL, IdleNewCBNormalMessage );
			statusCBCH(TRUE);
			
			//save the incoming cb messages in the fifo
			sms_new_incoming_cb (Message);
			
		}
	}
	break;

  case E_SMS_MEM_FULL:
        /* the memory of SMS is FULL !!*/
	    data->sms_store_free = FALSE;
	    
	    /* 	    sendevent IDLE_UPDATE; */
	    SEND_EVENT(idle_get_window(),IDLE_UPDATE,0,0);
	    break;
	case E_SMS_MEM_FREE:
	    /* the memory of SMS is FREE */
 	    data->sms_store_free = TRUE;
 	    
	    /* 	    sendevent IDLE_UPDATE; */
	    SEND_EVENT(idle_get_window(),IDLE_UPDATE,0,0);
		/* ??? */

	    break;
	case E_SMS_STATUS: /* status report from service center */
	    
	    break;
	case E_SMS_MEM: /* indicates status of memory */
	    /* not used */
	    break;
	case E_SMS_MO: /* SMS sending has started */
	    /* not used */
	case E_SMS_OK:
		/* Only happens when an SMS message is deleted. */

		break;
    case E_SMS_BUSY:
	    TRACE_EVENT ("E_SMS_BUSY");    
		break;
	case E_SMS_SAVE_AVAIL:
		break;
	case E_SMS_CMD_AVAIL:
		break;
    case E_SMS_ERR:
	    TRACE_EVENT ("E_SMS_ERR");    
	    break;
        default:
	    TRACE_EVENT("unhandled event in smsidle_sms_cb()");
        result = MFW_EVENT_PASSED;
	    break;
	}

    FREE_MEMORY((void*)msg_list,MAX_MESSAGES*sizeof(T_MFW_SMS_IDX));
    FREE_MEMORY((void*)urd_msg_list,MAX_MESSAGES*sizeof(T_MFW_SMS_IDX));
    FREE_MEMORY((void*)temp_buffer,MAX_CBMSG_LEN);

    return result;
}

/*******************************************************************************

 $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)
{
    return (smsidle_data.sms_initialised);
}

//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())
    {
    	//API - 14-01-03 - 1403 - Remove the call to iconsSetState(iconIdSMS) to indicate new SMS incall
		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);
		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;
	
    if (smsidle_get_ready_state())
	{
	    SmsVmailCount = sms_message_count(MFW_SMS_VOICE);


	    SmsMsgCount = sms_message_count (MFW_SMS_UNREAD);

	    /* Envelope icon and text only appear if a non-Voicemail SMS exists. */

	    if (smsidle_get_memory_full())
		{
			txtMsg =  TxtSmsListFull;
		} 
	    else if ((SmsMsgCount > 0) && (SmsMsgCount > SmsVmailCount))
		{
			txtMsg = TxtNewMessage;
			*noOfMsgs = SmsMsgCount;

		}
	    else
		{
		    iconsDeleteState(iconIdSMS);   /* Turn off SMS icon. */
			txtMsg = TxtNull;
		}

	    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);      /* Indicate SMS delivery to MS-User. */

	}
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -