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

📄 mmismsidle.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
					if (iconsGetState(iconIdVoice) == ICON_VISIBLE && Display_1_2_1_vm_icon == TRUE)
					{
						// one-2-one only functionality, do nothing as icon is already being displayed.
						//if (CphsPresent()) //if cphs is supported, check which line 
						//	GetCphsVoicemailStatus(0);
						break;
					}
					else
					{
						Delete_1_2_1_vm_icon  = FALSE;
						Display_1_2_1_vm_icon = FALSE;
						iconsDeleteState(iconIdVoice); 
					}
				}
				else
				{
					iconsSetState(iconIdVoice);		 /*  display voice mail icon.*/
					//if (CphsPresent()) //if cphs is supported, check which line 
					//		GetCphsVoicemailStatus(0);
				}
				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))
			{
				//hxl add for qq check 20021230----------------------------
#ifdef 	QQFUNC//hxl add for qq func switch,2003-3-24
				int ret;
				MmiTrace("new_sms_mt");
				if (!QQsend.QQCheck)
				{
					if (smsidle_get_ready_state())
					{
						nsmsold = sms_message_count (MFW_SMS_UNREAD);
						nsmsold-=1;
					}
					idle_display_QQ_status(&noldqq);
					ret=check_new_sms(0,0);
				}
#else
				//if(g_pcsyncstatus)//when pcsync run
				//	PcCmdStatus.nNewsms++;
#endif
				//end of hxl add------------------------------------------------

				/* set the status: The sms icon and  the string*/
				/* "message(s) received" will be displayed     */			
				iconsSetState(iconIdSMS);//2004/03/11 Sunny add     
#ifndef 	QQFUNC//hxl ,this shoud be moved ,after checked it is not qq
				if (smsidle_get_ready_state())
				{
					//sms_get_memset();
					idleEvent(IdleNewSmsMessage);
					//currentSMSTone = getcurrentSMSTone();
					//XSF CHANGED 2002.08.14 audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, 0 );
		            LedLightnessAdjust( 200 );		// 2004.4.2 WYJ  
        		    timStart(gtVibator);
					StartPlayByReason(SMSPLAY,0);
				}
				else
				{
					playdelaysmstone=1;
					//sms_get_memset();
				}
#endif
			}
			/*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  */
				//hxl add for pc or qq get the msg 20021030----------------------------
				T_MFW_SMS_MT *MtMessage = (T_MFW_SMS_MT *) w;
				char *tmpsms;
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
				static uint8    nqq=0;
				int nnew=0;
				int ret=0;
				static uint8    nleftqq=0;
				int txtinfo;
#endif

				MmiTrace("e_sms_mt");

				memset((char*)sms_text_ascii,'\0', sizeof(sms_text_ascii));
				if (MtMessage->dcs==0x08||MtMessage->dcs==0x18)
				{
					tmpsms=mmi_Sim_Sys(MtMessage->sms_msg,MtMessage->msg_len,MFW_DCS_UCS2,MAX_MSG_LEN);
					memcpy(sms_text_ascii,tmpsms,MAX_MSG_LEN);
				}
				else
				{
					tmpsms=mmi_Sim_Sys(MtMessage->sms_msg,MtMessage->msg_len, MFW_DCS_8bits,MAX_MSG_LEN);
					memcpy(sms_text_ascii,tmpsms,MAX_MSG_LEN);
				}
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
				if (QQReadNewSms)
				{
					QQReadNewSms=0;
					ret=IsQQSms((char *)MtMessage->orig_addr.number,sms_text_ascii,&(MtMessage->sctp),1);
					MmiTraceInt(ret);
					if (ret>0)
					{
						MmiTrace("qq");
						if ((ret==Is_Left_Info))
						{
							nleftqq++;
							ret=Is_Invalid_QQ;
						}
						if ((ret!=Is_Invalid_QQ)&&(ret!=QQ_ALLOC_FAIL))
						{
							if (ret!=Is_Spec_QQ)
								nqq++;
							if (nqq>noldqq)
								StartPlayByReason(QQPLAY,0);

						}
						nnew=check_new_sms(1,MtMessage->index);
					}
					else
					{
						MmiTrace("not qq");
						nsms++;
						if (nsms>nsmsold)
							StartPlayByReason(SMSPLAY,0);
						nnew=check_new_sms(0,0);
					}
					if ((nnew<0)&&(nleftqq>0))
					{
						View_left_info();
						nleftqq=0;
					}
					if ((nnew<0))
					{
						MmiTrace("remiand new");
						QQsend.QQCheck=0;
						if (nsms)
						{
							//if(g_pcsyncstatus)//when pcsync run
							//	PcCmdStatus.nNewsms=nsms;
							if (nsms>nsmsold)
							{
								if (smsidle_get_ready_state())
								{
									idleEvent(IdleNewSmsMessage);
								}
								else
									playdelaysmstone=1;
							}
						}
						else if (nqq>noldqq)
						{
							dspl_BitBlt(0,2,16,16,0,(void*)newQQ,DSPL_BMPXOR);					//place the game name bitmap
							dspl_BitBlt(0,2,16,16,0,(void*)newQQmask,DSPL_BMPAND);					//place the game name bitmap
							dspl_BitBlt(0,2,16,16,0,(void*)newQQ,DSPL_BMPXOR);					//place the game name bitmap
							idleEvent(IdleNewQQMessage);
							idle_display_QQ_status(&txtinfo);
							if ((In_QQ==1)&&(CanReadQQ)&&(!In_QQInfo))
							{//can show "read" button
								ReadbtnShow=1;
								display3SoftKeys(TxtRead);
							}
						}
						nqq=0;
						nsms=0;
					}

					break;
				}
				else
#endif	
					if (PcCmdStatus.isPcCmdRun)
				{
					PcCmdStatus.isPcCmdRun=0;
					MmiTrace("read_sms_mt");

					Get_sms_info(sms_text_ascii,&(MtMessage->orig_addr), &(MtMessage->sctp), MtMessage->sc_addr,0);
					break;
				}
				//end of hxl add---------------------------------------

				/* check for the class 0 message */
				alphabet = cmhSMS_getAlphabetPp ( MtMessage->dcs );

				if (alphabet EQ MFW_DCS_7bits)
				{
					static char temp_buffer [MAX_MSG_LEN_ARRAY];

					TRACE_EVENT ("E_SMS_MT");       

					if (MtMessage->dcs & TEXT_COMPRESSED)
					{
						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
						/* SH - commented out convert call below - message already decoded by ACI */
						/*SmsRead_convertSMSmsg(Message->sms_msg, MFW_DCS_8bits, Message->msg_len,
										  temp_buffer, MFW_ASCII, MAX_MSG_LEN, FALSE);*/

						addCBCH(MtMessage->sms_msg, IdleNewSmsMessage);                              

					}
					else
					{
						TRACE_EVENT ("text_uncompressed");

						/*
						 assume uncompressed message is ASCII
						*/

						addCBCH(MtMessage->sms_msg, IdleNewSmsMessage);
					}

					//display now on the idle screen
					statusCBCH(TRUE);

				}

				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;
			BOOL k=FALSE;
			SHORT geograhical_scope = (SHORT)0xC000;

			T_MFW_SMS_CB *Message = (T_MFW_SMS_CB *)w;
			char *tmpsms;

			TRACE_EVENT ("E_SMS_CB");

			memset(temp_buffer, 0,sizeof(temp_buffer));

			//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");

				MmiTrace("e_sms_mt");
				sprintf(buf, "windy: MeMessage->dcs=%d", Message->dcs);
				TRACE_EVENT(buf);
				//dcs'svalue is reference from EL600		
				memset (CBmid, '\0', 5);
				sprintf(CBmid, "%d", Message->msg_id);
				for (i = 0; i < MAXCB; i++)
					if (Message->msg_id==FFS_flashData.msg_id[i])
					{
						k=TRUE;
						break;
					}
				if (k)
				{
					if (Message->dcs==0x11||((Message->dcs&0xec)==0x48))
					{
						tmpsms=mmi_Sim_Sys(Message->cb_msg,Message->msg_len,MFW_DCS_UCS2,MAX_CBMSG_LEN);
						memcpy(temp_buffer, tmpsms,MAX_CBMSG_LEN+3);
					}
					else
					{
						tmpsms=mmi_Sim_Sys(Message->cb_msg,Message->msg_len, MFW_DCS_8bits,MAX_CBMSG_LEN);
						memcpy(temp_buffer, tmpsms,MAX_CBMSG_LEN+3);
					}       

					// 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
						if ( idleIsFocussed()&& (!call_data.win))
						{
							addCBCH(temp_buffer, IdleNewCBImmediateMessage);
							statusCBCH(TRUE);
						}
						k=FALSE;
					}
#ifdef MMI_HOMEZONE_ENABLED
				} /* SPR759 - SH */
#endif
			}
#if 0
			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);

			}
#endif
		}
		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 */
		/* Marcus: Issue 1170: 07/10/2002: Start */
		{
			T_MFW_SMS_STATUS *sms_status = (T_MFW_SMS_STATUS *)w;
			char text_8bit[50];	 //buffer for conversion from 7bit to 8bit
			USHORT* unicodeStr; 
			USHORT* txtStr;
			int uIndex;
			TRACE_EVENT("E_SMS_STATUS");

			currentSMSTone = getcurrentSMSTone();
			// audio_PlaySoundID( AUDIO_BUZZER, currentSMSTone, 200, 0 );

			if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
			{
				memset(status_report, '\0', sizeof(status_report));
				memset (text_8bit, 0, sizeof(text_8bit));
				sprintf(text_8bit,"%0u%0u/%0u%0u/%0u%0u %0u%0u:%0u%0u:%0u%0u \n",
						sms_status->rctp.year[0],
						sms_status->rctp.year[1],
						sms_status->rctp.month[0],
						sms_status->rctp.month[1],
						sms_status->rctp.day[0],
						sms_status->rctp.day[1],
						sms_status->rctp.hour[0],
						sms_status->rctp.hour[1],
						sms_status->rctp.minute[0],
						sms_status->rctp.minute[1],
						sms_status->rctp.second[0],
						sms_status->rctp.second[1]
					   );
				AscEx_To_Unicode((char* )text_8bit, (char*)status_report );
				memset (text_8bit, 0, sizeof(text_8bit));
				unicodeStr =charPtrToUSHORTPtr(text_8bit);
				uIndex = 0;
				txtStr = charPtrToUSHORTPtr(MmiRsrcGetText(smsidle_sr_status_to_text_id(sms_status->status)));
				while ((*txtStr!= 0) && (uIndex*2 <50))
				{
					unicodeStr[uIndex] = *txtStr;
					txtStr++;
					uIndex++;
				}
				wstrcat(USHORTPtrToCharPtr(unicodeStr),":");
				wstrcat(status_report, text_8bit);
				if (sms_status->addr.ton == MFW_TON_INTERNATIONAL)
					wstrcat(status_report, "+");
				wstrcat(status_report, sms_status->addr.number);
				if ((!call_data.win)) //idleIsFocussed()&& (!call_data.win))
				{
					StartPlayByReason(SMSPLAY,0);
					addCBCH(status_report, IdleNewSmsMessage);
					//display now on the idle screen
					statusCBCH(TRUE);
				}
				/*
					 * There is no support for Chinese in the addCBCH function,
					 * so will be problems with class 0 SMS messages and with cell
					 * broadcast messages that need to be addressed anyway.
					 * A new issue will be raised to handle this problem.
					 */
			}
			else
			{
				memset(status_report, '\0', sizeof(status_report));
				sprintf(status_report,"%0u%0u/%0u%0u/%0u%0u %0u%0u:%0u%0u:%0u%0u \n",
						sms_status->rctp.year[0],
						sms_status->rctp.year[1],
						sms_status->rctp.month[0],
						sms_status->rctp.month[1],
						sms_status->rctp.day[0],
						sms_status->rctp.day[1],
						sms_status->rctp.hour[0],
						sms_status->rctp.hour[1],
						sms_status->rctp.minute[0],
						sms_status->rctp.minute[1],
						sms_status->rctp.second[0],
						sms_status->rctp.second[1]
					   );
				//strcpy(status_report, MmiRsrcGetText(TxtSRR));
				//strcat(status_report, ": ");
				//strcpy(status_report, MmiRsrcGetText(TxtStatus));
				//strcat(status_report, ": ");
				strcat(status_report, MmiRsrcGetText(smsidle_sr_status_to_text_id(sms_status->status)));
				strcat(status_report, ": ");
				//sprintf(&status_report[strlen(status_report)], " (%u): ", sms_status->status);
#ifdef NO_ASCIIZ
				//if (sms_status->addr.len)
				//{
				// memcpy(&status_report[strlen(status_report)], sms_status->addr.tag, sms_status->addr.len);
				//   strcat(status_report, "\n");
				//}
#else
				if (strlen(sms_status->addr.tag))
				{
					strcat(status_report, sms_status->addr.tag);
					strcat(status_report, " ");
				}
#endif
				if (sms_status->addr.ton == MFW_TON_INTERNATIONAL)
					strcat(status_report, "+");
				strcat(status_report, sms_status->addr.number);
				if ((!call_data.win))// idleIsFocussed()&& (!call_data.win))
				{
					StartPlayByReason(SMSPLAY,0);
					addCBCH(status_report, IdleNewSmsMessage);
					//display now on the idle screen
					statusCBCH(TRUE);
				}
			}
		}
		/* Marcus: Issue 1170: 07/10/2002: End */
		break;
	case E_SMS_MEM:	/* indicates status of memory */
		{   
#if 0
			int TxtToShow;
			memcpy(&l_sms_mem, (T_MFW_SMS_MEM_INFO*)w, sizeof(T_MFW_SMS_MEM_INFO));
			//sprintf(tempString, "used:%d\ntotal:%d",(int)l_sms_mem.used,(int)l_sms_mem.total);

			/* retrieve he status of the book, and create a string for output
			based on the status
			*/
			buf == '\0';
			TxtToShow = TxtUsed;
			sprintf( buf, "%d/%d", (int)l_sms_mem.used,(int)l_sms_mem.total );

			{
				T_DISPLAY_DATA display_info;
				dialog_info_init(&display_info);//gdy add
				display_info.KeyEvents    =  KEY_RIGHT|KEY_CLEAR;

⌨️ 快捷键说明

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