×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    17

    Problem inbox: already in use (-14)

    Hi to all,
    i have written this code (whit the help of this forum) for save all image .gif who incoming from bluetooth:
    Code:
    void CEventKeeperContainerView::HandleSessionEventL(TMsvSessionEvent aEvent,TAny* aArg1, TAny* aArg2, TAny* aArg3)
    	{
    //-----------------------------------------------------------
    //      Various case
    //------------------------------------------------------------
    
    TBuf<24> aAddress;
    			_LIT8(KMimeBufgif, "image/gif");
    			TBuf8<9>mimeBufgif(KMimeBufgif);
    			
    
    			
    			//CMsvSession* session = CMsvSession::OpenSyncL(*this);
    		
    				TMsvSelectionOrdering sort;
    				sort.SetShowInvisibleEntries(ETrue);
    				sort.SetSorting(EMsvSortByDate);
    				// Take a handle to the folder entry
    				CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession,KMsvGlobalInBoxIndexEntryId, sort);
    				//CleanupStack::PushL(parentEntry);
    				// A selection of all BT entries
    				CMsvEntrySelection* entries = parentEntry->ChildrenWithMtmL(KUidMsgTypeBt);
    				TInt index=entries->Find(iNewMessageId);
    				TMsvId id=entries->At(index);
    				//const TMsvId id = entries->At(0);
    				//CleanupStack::PushL(entries);
    				//Get entry
    				CMsvEntry* btEntry = iSession->GetEntryL(id);
    				//CleanupStack::PushL(btEntry);
    				//Then get entrys child
    				CMsvEntrySelection* btChildren = btEntry->ChildrenL();
    				//CleanupStack::PushL(btChildren);
    				TInt childc = btChildren->Count();
    				if (childc>0)
    					{
    					for(TInt i=0; i<childc; i++)
    						{
    						TMsvId btAtt = (*btChildren)[i];
    						btEntry->SetEntryL(btAtt);
    						if (btEntry->HasStoreL())
    							{
    							CMsvStore* store = btEntry->ReadStoreL();
    							//CleanupStack::PushL(store);
    	
    							MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
    							TInt attcount = attMngr.AttachmentCount();
    							for(TInt j=0; j<attcount; j++)
    								{
    								CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(j);
    																TInt lunghezzanome;
    								lunghezzanome=attachment->AttachmentName().Length();	//Mi ricavo la lunghezza del nome del file 
    								HBufC* veroNome=HBufC::NewLC(lunghezzanome);			
    								*veroNome=attachment->AttachmentName();	
    								if(mimeBufgif.CompareF(attachment->MimeType())== 0) 				
    						            	{ 
    						            	Token = 1;
    						            	}		
    										
    										
    								
    								if(Token == 1)
    									{
    										
    									RFile file = attMngr.GetAttachmentFileL(j);
    									TInt size;
    									file.Size(size);
    									TFileName copyfileName;
    									copyfileName.Copy( _L("C:\\Prova\\"));
    									copyfileName.Append(*veroNome);
    									RFile toFile;
    									RFs iSession;
    									iSession.Connect();
    									//TInt delerr = iSession.Delete(copyfileName);
    									//if(delerr == KErrNotFound || delerr == KErrNone)
    										
    									toFile.Create(iSession,copyfileName,EFileWrite);
    									//HBufC8* bufferDes = NULL;
    									//bufferDes = HBufC8::NewLC(size);
    									//TPtr8 BDPointer(bufferDes->Des());
    									//User::LeaveIfError(file.Read(BDPointer, size));
    									//User::LeaveIfError(toFile.Write(BDPointer,size));
    									toFile.Flush();
    									toFile.Close();
    												
    									//iFilePaths->AppendL(copyfileName);
    											
    										
    									//else
    										//{
    	
    										//}
    									file.Close();
    									iSession.Close();
    									//CleanupStack::Pop();//bufferDes
    	
    									}
    								Token = 0;
    								}
    							//CleanupStack::PopAndDestroy(store);
    							}
    							}
    					}
    				//CleanupStack::PopAndDestroy(2);
    									
    				//CleanupStack::PopAndDestroy(2);
    				
    
    			break;
    			}


    When I run this code in the Emulator all is ok: the image attached in bluetooth message is saved in the folder specified.
    After this operation if the user wants delete the message recived from the Inbox folder, Symbian doesn't allow this and display this message: "GENERAL: ALREADY IN USE(-14).
    Does anybody can help me?
    Thank's

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

    Re: Problem inbox: already in use (-14)

    As I see your code closes only some files, everything else is leaked away from coding point of view, and remains open+locked from the Message Server's point of view.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    17

    Re: Problem inbox: already in use (-14)

    Have you got any idea about which kind of file still remain opened?
    Thank you.

  4. #4
    Regular Contributor
    Join Date
    Feb 2008
    Location
    Pune, India
    Posts
    340

    Re: Problem inbox: already in use (-14)

    Please compare your code with the one I posted on this link. It should solve your problem.
    Regards,
    Sainagakishore Srikantham (Kishore)

    Don't Hope, KNOW!!! ---------- Visit me at http://ssnkishore.blogspot.com ----------

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    17

    Re: Problem inbox: already in use (-14)

    Hi to All,
    with your suggestion I have find this solution

    Code:
    //Listening when new message is arrived in inbox
    if (aArg2 &&  *(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    				{  
    					CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    					if( iNewMessageId == entries->At(0) )
    						{ 
    						const TMsvId id = entries->At(0);
    						CMsvEntry* btEntry = iSession->GetEntryL(id);
    						CleanupStack::PushL(btEntry);
    						CMsvEntrySelection* btChildren = btEntry->ChildrenL();
    						CleanupStack::PushL(btChildren);
    						TInt childCount = btChildren->Count();
    						if (childCount>0)
    							{
    							for(TInt i=0; i<childCount; i++)
    								{
    								TMsvId btAtt = (*btChildren)[i];
    								btEntry->SetEntryL(btAtt);
    								if (btEntry->HasStoreL())
    									{
    									CMsvStore* store = btEntry->ReadStoreL();
    									CleanupStack::PushL(store);
    									MMsvAttachmentManager& attMngr = store->AttachmentManagerL();
    									TInt attcount = attMngr.AttachmentCount();
    									for(TInt j=0; j<attcount; j++)
    										{
    										CMsvAttachment* attachment = attMngr.GetAttachmentInfoL(j);
    										TPtrC ptr = attachment->AttachmentName();
    										TPtrC8 mime = attachment->MimeType();
    										
    	
    										if(mimeBufgif.CompareF(attachment->MimeType())== 0) 	
    											{
    											
    																				
    										
    										TFileName copyfileName;
    										copyfileName.Copy( _L("C:\\Prova\\"));
    										copyfileName.Append(ptr);
    										RFile toFile;
    										RFs iSession;
    										iSession.Connect();
    																				
    										toFile.Create(iSession,copyfileName,EFileWrite);
    										toFile.Flush();
    										toFile.Close();
    										
    										iSession.Close();
    										
    										
    											}
    										
    										}
    									CleanupStack::PopAndDestroy(store);
    									} //if (btEntry)
    								
    								}  //for
    							CleanupStack::PopAndDestroy(btChildren);
    							CleanupStack::PopAndDestroy(btEntry);
    							}	// if (childCount)
    						    				
    						    				
    						}
    				}

    Thank you very much.
    Vituperio

Similar Threads

  1. Creating MMS to Inbox problem
    By mikkoiv in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-12-10, 13:58
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  4. Problem with chang SMS in Inbox
    By SL57J in forum Symbian
    Replies: 0
    Last Post: 2003-05-19, 09:17
  5. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36

Posting Permissions

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