×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    create sms in inbox have problem

    hi ,experts
    I have some problem in create sms message in inbox in console app ,I use socket block all messages and create those wanted in inbox ,
    but in iMtm->Entry().CreateL(newIndexEntry) leaves, this code I test in UI application ok. I guess some variable in function used not initialized yet,but
    I can't find which .


    Code:
    	
    const TInt LEN = 12;
    	if(!iMtmRegistry)
    		iMtmRegistry = CClientMtmRegistry::NewL(*iSession);
    	if(!iMtm)
    		iMtm = static_cast<CSmsClientMtm*>(iMtmRegistry->NewMtmL(KUidMsgTypeSMS));
    
    	//================================================================
    	//	新的代码
    	//================================================================	
    	iMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId); //test!
    	TMsvEntry newIndexEntry;
    	newIndexEntry.iDate.HomeTime();
    	// 短信还未创建完成
    	newIndexEntry.SetInPreparation(ETrue);
    	// This is an SMS message
    	newIndexEntry.iMtm = KUidMsgTypeSMS;
    	newIndexEntry.iType = KUidMsvMessageEntry;
    
    	newIndexEntry.iDetails.Set(aAddr);
    	newIndexEntry.iDescription.Set(aContent.Left(LEN));
    
    	newIndexEntry.SetSendingState(KMsvSendStateNotApplicable);
    	newIndexEntry.SetUnread(ETrue);
    	newIndexEntry.SetNew(ETrue);
    
    	//in 3rd edition crashes here if capabilities are wrong
    	newIndexEntry.iServiceId = ((CSmsClientMtm*)iMtm)->ServiceId();
    
    	//pID = (TInt*)&newIndexEntry;
    	//*(pID+2) = 0x120021;
    	iMtm->Entry().CreateL(newIndexEntry); //leave here   
    	TMsvId smsId = newIndexEntry.Id();
    	iMtm->SwitchCurrentEntryL(smsId);
    	iMtm->Entry().ChangeL(newIndexEntry);
    	iMtm->SaveMessageL();
    
    	/*--------------------------------------------
    	// 重写 header
    	//------------------------------------------*/
    	//CRichText* richText = CRichText::NewL(CEikonEnv::Static()->SystemParaFormatLayerL(), CEikonEnv::Static()->SystemCharFormatLayerL());
    	CRichText* richText = CRichText::NewL(iParaFormatLayer, iCharFormatLayer);
    	CleanupStack::PushL(richText);
    	richText->InsertL(0, aContent);
    	CSmsHeader* mySmsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver,*richText);
    	CleanupStack::PushL(mySmsHeader);
    	CMsvEntry* tmpEntry = iSession->GetEntryL(newIndexEntry.Id());
    	CleanupStack::PushL(tmpEntry);
    	if ( tmpEntry->HasStoreL() )
    	{
    		mySmsHeader->SetFromAddressL(aAddr);
    
    		CMsvStore* store = tmpEntry->EditStoreL();
    		CleanupStack::PushL(store);
    
    		// 设置短信的创建时间,在msventry里面设置的无效
    		CSmsDeliver& deliver = mySmsHeader->Deliver();
    		TTime nowTime;
    		nowTime.HomeTime();
    		deliver.SetServiceCenterTimeStamp(nowTime);
    
    		mySmsHeader->StoreL(*store);
    		store->StoreBodyTextL(*richText);
    
    		store->CommitL();
    		CleanupStack::PopAndDestroy(store);
    	}
    
    	// 不能save,否则不是缺主题,就是缺正文
    	// iSmsMtm->SaveMessageL();
    
    	TMsvEntry tttEntry =  iMtm->Entry().Entry();
    	// 创建完成
    	tttEntry.SetInPreparation(EFalse);
    	// 不设置只读,在收件箱列表处浏览没有回复选项
    	tttEntry.SetReadOnly(ETrue);
    	iMtm->Entry().ChangeL(tttEntry);
    	CleanupStack::PopAndDestroy(3, richText); // tmpEntry, mySmsHeader, richText
    	return;

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,748

    Re: create sms in inbox have problem

    It would be beneficial to know the actual leave code (TRAP and check it, or enable the panic codes - http://wiki.forum.nokia.com/index.ph...ded_panic_code, it will also display panics stemming in un-TRAP-ed leaves -, or check the emulator log - http://wiki.forum.nokia.com/index.php/Epocwind.out - in case of you are using the emulator).
    The blind guess would be CMsvSession::OpenAsyncL, in "serial" code it is better to use OpenSyncL, and simply move the actions from HandleSessionEventL/EMsvServerReady after this line.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    Re: create sms in inbox have problem

    Quote Originally Posted by wizard_hu_ View Post
    It would be beneficial to know the actual leave code (TRAP and check it, or enable the panic codes - http://wiki.forum.nokia.com/index.ph...ded_panic_code, it will also display panics stemming in un-TRAP-ed leaves -, or check the emulator log - http://wiki.forum.nokia.com/index.php/Epocwind.out - in case of you are using the emulator).
    The blind guess would be CMsvSession::OpenAsyncL, in "serial" code it is better to use OpenSyncL, and simply move the actions from HandleSessionEventL/EMsvServerReady after this line.

    I use OpenSyncL and run ok,thanks very much .

Similar Threads

  1. How to receive a SMS on port 0 using a MIDlet before letting the inbox.
    By ravidiwakar.25@gmail.com in forum Mobile Java General
    Replies: 16
    Last Post: 2009-03-24, 07:18
  2. Weird sms inbox problem
    By nuker85 in forum Symbian
    Replies: 0
    Last Post: 2007-05-12, 11:03
  3. How to create new sms in inbox
    By nasir_perwez in forum Symbian
    Replies: 4
    Last Post: 2007-04-23, 11:38
  4. New message in SMS Inbox
    By isseyp in forum Mobile Java General
    Replies: 4
    Last Post: 2004-05-07, 14:45
  5. Problem with chang SMS in Inbox
    By SL57J in forum Symbian
    Replies: 0
    Last Post: 2003-05-19, 09:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×