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

📄 mminwsimulatordlg.cpp

📁 mtk simulator v2 new source code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
				}
				else
				{
					return RSP_AUTO;
				
				}

			}
		}
	}

}

void CMMINWSimulatorDlg::OnClickListIncomingMessages(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	//message to recieve when left click is done on the list 
	//get the selected index from the list and call the XML and get the values from it and display in the 
	//popup dialog box	
	
	int nIndex = 0;
	CPopSelectMsgDlg popDlg;//set the string map with mesage id message response map
	popDlg.SetLibraryIdentifier(library_identifier);
	CString strMsgId;
	COutgoingMessage *pOutGoingMessage = NULL;
	CPtrList *plstRespMsgs = NULL;
	
	AMLOGINFO(_T("Incoming Message List Clicked"));

	POSITION pos = m_lstIncomingMessages.GetFirstSelectedItemPosition();
	if(pos!=NULL)
	{
		m_nIncomingListIndex = m_lstIncomingMessages.GetNextSelectedItem(pos);
		m_inComingMsgSelIndex = m_nIncomingListIndex;//contains the selected item
		strMsgId = m_lstIncomingMessages.GetItemText(m_nIncomingListIndex,0);
		AMLOGINFO(_T("Msg Id selected is -> %s"),strMsgId);
		CMessage *pMessage = m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstIncomingMsg,_ttoi(strMsgId));

		if((pMessage)) 
		{
			
			CPtrList *ptRespList = GetAllResponseMsgs(pMessage->GetMessageId());
			ClickedMsgId=pMessage->GetMessageId();
			RsponseMode = GetRspMode(pMessage->GetMessageId());
			CMessage *pOutGoingMsg,*pMessageOut;

			if(ptRespList->GetCount() > 1)
			{
				popDlg.m_strMessageId = strMsgId;
				plstRespMsgs = GetAllResponseMsgs(_ttoi(strMsgId.GetBuffer(0)));
				popDlg.m_lstRespMessages = plstRespMsgs;//stuff the CptrList		
				popDlg.DoModal();
			}

			if(ptRespList->GetCount() == 1) // if there is only one response message
			{
				POSITION pos = ptRespList->GetHeadPosition();				
					pOutGoingMsg = (COutgoingMessage*)(ptRespList->GetNext( pos )) ;
					pMessageOut = m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,pOutGoingMsg->GetMessageId());					
					
				if((pMessageOut->GetPluginName().CompareNoCase(_T("")))&&pMessageOut->GetPluginName().CompareNoCase(_T("Null")))
				{
					popDlg.m_strMessageId = strMsgId;
					plstRespMsgs = GetAllResponseMsgs(_ttoi(strMsgId.GetBuffer(0)));
					popDlg.m_lstRespMessages = plstRespMsgs;//stuff the CptrList		
					popDlg.DoModal();
				}
				else
				{
				
					CFormat *pFormatOut = m_pMessageManager->GetFormatForMessage(pMessageOut);
					//Input mode is Dialog 
					if((RsponseMode==RSP_MANUAL)&&(!pFormatOut->GetInputMode().CompareNoCase(_T("Dialog"))))
					{
						IsClickOnIncomingMsgList=1;
						SendMsg(pMessageOut->GetMessageId());				
					}
     				        else //Input mode is dataset 
					{
		if(pMessage!=NULL)
		{
					popDlg.m_strMessageId = strMsgId;
					plstRespMsgs = GetAllResponseMsgs(_ttoi(strMsgId.GetBuffer(0)));
					popDlg.m_lstRespMessages = plstRespMsgs;//stuff the CptrList		
					popDlg.DoModal();
		}
				}
			}

		}
	}
	}
}


void CMMINWSimulatorDlg::OnOK() 
{
	// TODO: Add extra validation here
	//AfxMessageBox(_T("Inside On Ok"));
	//CDialog::OnOK();
}

void CMMINWSimulatorDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CGCMLGenerator generate_xml;
	generate_xml.MakeGCML();
         ShowWindow(SW_HIDE);
}

LRESULT CMMINWSimulatorDlg::OnPopUpSendMessage(WPARAM wParam, LPARAM lParam)
{
	//type cast the wparam for the message id and lparam for value
	PopUpMsgStruct *stPopMsg = new PopUpMsgStruct;
	stPopMsg = (PopUpMsgStruct*)lParam;
	m_MessageId = _ttoi((stPopMsg->strMsgId));
	AMLOGINFO(_T("Sending Message via Pop Up for Msg id %d"),stPopMsg->nMsgId);	
	SendMessageToMMI(m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,stPopMsg->nMsgId),stPopMsg->strMsgValue);
	//*******delete the stuff from the m_IncomingMsgDataList list now URGENT********		
	//RmBuffEntryIncomingBufferList(m_nIncomingListIndex);
	//also disable the entry in the clist here ****************URGENT///
	delete stPopMsg;
	return(TRUE);
}

LRESULT CMMINWSimulatorDlg::OnSendAsyncMessage(WPARAM wParam, LPARAM lParam)
{
	//message recvd when async message event is to be send
	PopUpMsgStruct *stPopMsg = new PopUpMsgStruct;
	stPopMsg = (PopUpMsgStruct*)lParam;
	if(stPopMsg->nMsgId ==1)
	{
		SendAsyncMessageToMMI(stPopMsg->strMsgResponse);
	}
	else if(stPopMsg->nMsgId == 2)
	{
		AMLOGINFO(_T("Sending Async Message for Msg id %d"),stPopMsg->strMsgValue);	
		SendMessageToMMI(m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,m_pMessageManager->LocateMessageIdForName(m_pMessageManager->m_plstOutGoingMsg,stPopMsg->strMsgResponse)),_T(""));
	}
	else		 
	{
		AMLOGINFO(_T("Sending Message for Msg id %d"),stPopMsg->strMsgValue);	
		SendMessageToMMI(m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,m_pMessageManager->LocateMessageIdForName(m_pMessageManager->m_plstOutGoingMsg,stPopMsg->strMsgResponse)),stPopMsg->strMsgValue);
	}
	return(TRUE);
}

CPtrList* CMMINWSimulatorDlg::GetAllResponseMsgs(UINT16 iMsgId)
{
	CIncomingMsg *pIncMessage;	
	CPtrList *lstRespMsg = new CPtrList();
	if(m_pMessageManager->m_plstIncomingMsg->GetCount())//check if emtpy message list 
	{	
		for( POSITION pos = m_pMessageManager->m_plstIncomingMsg->GetHeadPosition(); pos != NULL; )
		{			
			pIncMessage = (CIncomingMsg*)(m_pMessageManager->m_plstIncomingMsg->GetNext( pos )) ;
			if(pIncMessage->GetMessageId() == iMsgId)
			{
				CList<UINT32, UINT32>& lstRespId = pIncMessage->GetResponseMessageList();
				//iResponse = pIncMessage->m_RespMsgList.GetCount(); 
				if(lstRespId.GetCount() > 0)
				{	
					for( POSITION posResp = lstRespId.GetHeadPosition(); posResp != NULL; )
					lstRespMsg->AddTail(m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,lstRespId.GetNext(posResp)));
				}				
				break;
			}
		}
		AMLOGINFO(_T("Response Messages for --%d-- are--> %d"),iMsgId,lstRespMsg->GetCount());
	}
//	else
//		theApp.m_LogTrace.WriteLine(_T("Inside GetAllResponseMsgs no entry found error"));				
	return lstRespMsg;	
}

LRESULT  CMMINWSimulatorDlg::SendMsgWithPlugInFromAddEditDlg(WPARAM wparam,LPARAM lparam)
{
	if(lparam == 0)
	{
	CMessage * clMessage = (CMessage*) wparam;
		if(clMessage->GetPluginName().CompareNoCase(_T("")))
		{
	CString strPlugin = clMessage->GetPluginName();
	MYQUEUE stMsgQueue;
	void *pData = PluginFunctionForOutGoingMessage(strPlugin);		
	stMsgQueue.oslSrcId = MOD_L4C;
	stMsgQueue.oslDestId = PRT_EVENT;
	stMsgQueue.oslMsgId = clMessage->GetMessageId();
	stMsgQueue.oslDataPtr = pData;
	stMsgQueue.oslPeerBuffPtr = NULL;		
	myNSRThread->WriteToSocket(&stMsgQueue);	
	
	return 0;
}
	}
	else if(wparam == 0)
	{
		SendMessageDetails * ptr_to_msg_detail_struct = (SendMessageDetails *)lparam;
		SendMessageFreq(ptr_to_msg_detail_struct->clMessage,ptr_to_msg_detail_struct->dataset);
	}
	else
	{
		CMessage * mesg_to_be_sent = (CMessage*)wparam;
		CString * dataset_to_be_sent = (CString*)lparam;
		SendMessageToMMI(mesg_to_be_sent,*dataset_to_be_sent);
	}
}

void CMMINWSimulatorDlg::SendAsyncMessageToMMI(CString strRecvd)
{
	//function to send the async event to the socket 
	//it reads the async event name from the async list events and then send the message
	CPtrList *ptrAyncEventsList = GetAllAsyncEventsForApp(strRecvd);
	for( POSITION pos = ptrAyncEventsList->GetHeadPosition(); pos != NULL;)
	{
		SendMessageToMMI((CMessage*)(ptrAyncEventsList->GetNext( pos )),_T(""));
	}
	//take a for loop and keep on calling sendMesage(CMessage ) to send the message	
}

CPtrList* CMMINWSimulatorDlg::GetAllAsyncEventsForApp(CString strRecvd)
{
	CPtrList *ptrList = new CPtrList();
	CAsyncMessageSeq *pAsyncMessage;	
	CString strXMLEvent;
	
	if(m_pMessageManager->m_plstAsyncMsg->GetCount() > 0)//check if emtpy message list 
	{	
		for( POSITION pos = m_pMessageManager->m_plstAsyncMsg->GetHeadPosition(); pos != NULL;)
		{
			pAsyncMessage = (CAsyncMessageSeq*)(m_pMessageManager->m_plstAsyncMsg->GetNext( pos )) ;
			strXMLEvent = pAsyncMessage->GetMessageName();
			if(!strXMLEvent.CompareNoCase(strRecvd))
				//add it into the Map
			{
				//now peek into the outgoing message list for this messagid 
				//and get the CMessage object to be done
				//keep on adding into the Ptr List and return it 
				CList<UINT32, UINT32&>& messageList = pAsyncMessage->GetMessageList();								
				if(messageList.GetCount() > 0)
				{	
					for( POSITION posResp = messageList.GetHeadPosition(); posResp != NULL; )					
					{
						ptrList->AddTail(m_pMessageManager->LocateMessageInList(m_pMessageManager->m_plstOutGoingMsg,messageList.GetNext(posResp)));	

					}					
				}
				if(ptrList->GetCount() <= 0)
				AMLOGERROR(_T("Inside GetAllAsync Messages for App no found error"));
			}				
		}
	}	
	return  ptrList;
}

extern void *HandleWriteEntryRequest();
extern void *HandleGetAllEntriesRequest();
extern void *HandleDeleteEntryRequest();
extern void *HandleSearchEntryRequest();
extern void *HandleGetStorageRequest();
extern void *HandleSetStorageRequest();
extern void SetBufferForPbook(void *Pdata);
extern void *SendSMSResponse();
extern void *SendSMSContectByIndex();
extern void *SendGetVoicemailAddressRsp(); //abhi
extern void *SendSetVoicemailAddressRsp(); //abhi
extern void *SendSMSToMMI();
extern void *SendMessageList();
extern void *SendMessageNumber();
extern void *SaveSMSMessage();
extern void *GetMemoryStorage();
extern void *SetMemoryStorage();
extern void *DeleteSMSRequest();
extern void SetBufferForMessage(void *Pdata);
extern void  AudioPlayReq(void* Req);
extern void AudioStopReq(void);
extern void *CheckSecurityBootup();
extern void *SettingGPRSGetConnectType(void);
extern void *SettingGPRSSetConnectType(void);
extern void *GetCallPriceUnit(void);
extern void *SetCallPriceUnit(void);
extern void *SettingGetNetworkBand(void);
extern void *SettingSetNetworkBand(void);
extern void *ValidatePinBootup();
extern void SetBufferForSettings(void * dataBuf);
void *CheckPinBS(void);
extern void AudioPlayIMelodyStringReq(void*);
extern void AudioPlayIMelodyFileReq(void*);
/*JP : for New SMS Implementation */
extern void* SMSBootUpBeginInd();
extern void* SMSSendBootupReadInd();
extern void *SendSmsMemStatus();
extern void *GetProfileParamsRsp(void);
extern void *SetProfileSettingParamsRsp(void);
/*End : For New SMS Implementatio */

void CMMINWSimulatorDlg::PluginFunctionForMessage(CString pLugin)
{
	//this function has the case switch for the id passed
	if(!pLugin.CompareNoCase(_T("CreateMsgNetWrkAttach")))
	{
		//call the plugin name for the network attach function 
//		CreateMsgNetWrkAttach();
	}
	else if(!pLugin.CompareNoCase(_T("AudioPlayReq")))
	{
		AudioPlayReq(RetDataPointerForInMessage(1320));
	}
	else if(!pLugin.CompareNoCase(_T("AudioStopReq")))
	{
		AudioStopReq();
	}
        else if(!pLugin.CompareNoCase(_T("SendSMSResponse")))
	{
		SetBufferForMessage(RetDataPointerForInMessage(1522));
		SendSMSResponse();
	}
	else if(!pLugin.CompareNoCase(_T("CheckPinBS")))
	{
		SetBufferForSettings(RetDataPointerForInMessage(1448));
		CheckPinBS();
	}
	else if(!pLugin.CompareNoCase(_T("AudioPlayIMelodyStringReq")))
	{
		AudioPlayIMelodyStringReq(RetDataPointerForInMessage(1324));
	}
	else if(!pLugin.CompareNoCase(_T("AudioPlayIMelodyFileReq")))
	{
		AudioPlayIMelodyFileReq(RetDataPointerForInMessage(1329));
	}
}

extern void SetBufferForCallHistory(void* dataBuf);
extern void *SetLastNoRsp();
extern void *GetLastNoRsp();
extern void * DeleteAllCallsRsp();
extern void *IncomingCallInd();
extern void *CheckSimLock();
extern void *BootupFunctions();

void* CMMINWSimulatorDlg::PluginFunctionForOutGoingMessage(CString pLugin)
{
	void *pData = NULL;
	if(!pLugin.CompareNoCase(_T("CreateMsgNetWrkAttach")))
	{
		//call the plugin name for the network attach function 
//		CreateMsgNetWrkAttach();
	}
	else if(!pLugin.CompareNoCase(_T("HandleGetAllEntriesRequest")))
	{
		pData = RetDataPointerForInMessage(1484);
		if(pData)
		{
			SetBufferForPbook(pData);
		pData = HandleGetAllEntriesRequest();
	}
	}
	else if(!pLugin.CompareNoCase(_T("HandleWriteEntryRequest")))
	{
		pData = RetDataPointerForInMessage(1490);
		if(pData)
		{
			SetBufferForPbook(pData);
		pData = HandleWriteEntryRequest();
	}
	}
	else if(!pLugin.CompareNoCase(_T("HandleDeleteEntryRequest")))
	{
		pData = RetDataPointerForInMessage(1492);
		if(pData)
		{
			SetBufferForPbook(pData);
		pData = HandleDeleteEntryRequest();
	}
	}
	else if(!pLugin.CompareNoCase(_T("HandleSearchEntryRequest")))
	{
		pData = RetDataPointerForInMessage(1482);
		if(pData)
		{
			SetBufferForPbook(pData);
		pData = HandleSearchEntryRequest();
	}
	}
	else if(!pLugin.CompareNoCase(_T("HandleGetStorageRequest")))
	{
		//SetBufferForPbook(RetDataPointerForInMessage(109));
		pData = HandleGetStorageRequest();
	}
	else if(!pLugin.CompareNoCase(_T("HandleSetStorageRequest")))
	{
		pData = RetDataPointerForInMessage(1486);
		if(pData)
		{
			SetBufferForPbook(pData);
		pData = HandleSetStorageRequest();
	}
	}
        
	else if(!pLugin.CompareNoCase(_T("satsetupmenuplg")))

⌨️ 快捷键说明

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