×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    252

    Bluetooth Attachment problem

    Hi,
    i need to read title of message bluetooth.
    I send a text file, I try to read with command "idescription" but field is empty.
    Write my code:
    Code:
    void CSmsHandler::SetMtmEntryL(TMsvId aEntryId)
    	{
    	   //Get the server entry from our session
    
    	   CMsvEntry* entry = iSession->GetEntryL(aEntryId);
    
    	   CleanupStack::PushL(entry);
    
    	   //Check if our mtm is different from the mtm set to our entry
    	   if ((iMtm == NULL) || (entry->Entry().iMtm != (iMtm->Entry()).Entry().iMtm))
    	    {
    	       //If so, we delete the old...
    	       delete iMtm;
    	       iMtm = NULL;
    
    	       // ...and get a new one from the MtmRegistry
    	       iMtm = iMtmRegistry->NewMtmL(entry->Entry().iMtm);
    	    }
    	    iMtm->SetCurrentEntryL(entry);
    
    	   CleanupStack::Pop(entry);
    	}
    
    	TBool CSmsHandler::GetBluetoohAttachment( TMsvId aMessageId)
    	{
    
    	   _LIT(KBluetoothMessage, "Bluetooth");
    	   //CEikonEnv::Static()->AlertWin(_L("start"),KBluetoothMessage);
    	   SetMtmEntryL(aMessageId);
    
    	   iMtm->LoadMessageL();
    
    	   TMsvEntry MsvEntry = iMtm->Entry().Entry();
    
    	   TBufC<20> itext(MsvEntry.iDetails);
    
    	   if( itext == KBluetoothMessage)
    	   {
    	   	 // CEikonEnv::Static()->AlertWin(_L("dentro if"),KBluetoothMessage);
    	      CMsvEntry& btEntry = iMtm->Entry();
    
    	      CMsvEntrySelection* btChildren = btEntry.ChildrenL();
    	      
    	      
    	      if (btChildren->Count() >= 1)
    	      {
    
    	         TMsvId btAtt = (*btChildren)[0];
    	         btEntry.SetEntryL(btAtt); // switch context to CHILD entry
    
    	         TBufC<20> itext3(MsvEntry.iDetails);
    		 	 TBufC<20> itext2(MsvEntry.iDescription);
    		 	 CEikonEnv::Static()->AlertWin(itext3,itext2);
    		 	 
    		 	 if (btEntry.HasStoreL())
    	         {
    	         
    	         	CEikonEnv::Static()->AlertWin(_L("if 1"),_L("1"));
    	            CMsvStore* store = btEntry.ReadStoreL();
    
    	            CleanupStack::PushL(store);
    
    	            CRichText* richText = CRichText::NewL(
    	                              CEikonEnv::Static()->SystemParaFormatLayerL(),
    	                              CEikonEnv::Static()->SystemCharFormatLayerL());
    	            richText->Reset();
    	            CleanupStack::PushL(richText);
    
    	            if (store->HasBodyTextL())
    	            {
    	            	CEikonEnv::Static()->AlertWin(_L("if 2"),_L("2"));
    	               // Get the SMS body text.
    	               store->RestoreBodyTextL(*richText);
    
    
    	               TPtrC ptr;
    	               TCharFormat aFormat;
    	               richText->GetChars(ptr,aFormat,0);
    
    	              
    	               CEikonEnv::Static()->AlertWin(_L("rich"), _L("store->HasBodyTextL()" ));
    	            
    	            }
    	            else
    	            {
    	            CEikonEnv::Static()->AlertWin(_L("else 1"),_L("1"));
    	               MMsvAttachmentManager& iAttMangr=store->AttachmentManagerL();
    
    	               RFile attFile=iAttMangr.GetAttachmentFileL(0);
    
    	               TBuf8<256> attFileBuf;
    
    	               attFile.Read(attFileBuf);
    
    	               attFile.Close();
    
    	               TBuf<223>a;
    	               a.Copy(attFileBuf);
    	            }
    
    	            CleanupStack::PopAndDestroy(richText);
    	            CleanupStack::PopAndDestroy(store);
    	         }
    	         else
    	         {
    	            return EFalse;
    	         }
    	      }
    	  	
    	   }
    	   return ETrue;
    	}

    My application return false, why??
    Another question: How to know the device bluetooth that send this message?

    Many thanks
    Silvia

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

    Re: Bluetooth Attachment problem

    As files sent via bluetooth aren't shown as "messages" in the sent items folder, you can't get the name of the file sent. The message is sent so fast that our application doesn't get enough time to catch it and read its
    "attachment store". In fact, most of the times my application returned "no store present". I had similar requirement but couldn't get it. However you can get the name of the file received via bluetooth. Check this thread to find the code.
    Regards,
    Sainagakishore Srikantham (Kishore)

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

  3. #3
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    252

    Re: Bluetooth Attachment problem

    Quote Originally Posted by ssn.kishore View Post
    As files sent via bluetooth aren't shown as "messages" in the sent items folder, you can't get the name of the file sent. The message is sent so fast that our application doesn't get enough time to catch it and read its
    "attachment store". In fact, most of the times my application returned "no store present". I had similar requirement but couldn't get it. However you can get the name of the file received via bluetooth. Check this thread to find the code.
    Many thanks
    Silvia

Similar Threads

  1. Bluetooth Service Discovery Problem
    By rwan067 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-03-18, 14:32
  2. Q: Problem with Nokia PC Suite and Bluetooth
    By Juha_74 in forum General Development Questions
    Replies: 0
    Last Post: 2007-03-13, 13:32
  3. Strange Problem with Bluetooth Connection
    By bigbadwolf in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2006-12-06, 09:51
  4. Bluetooth serviceDiscover problem Device Not Reachable
    By kashifqazi in forum Bluetooth Technology
    Replies: 1
    Last Post: 2006-10-13, 12:31
  5. Nokia SDK Bluetooth service re-discovery problem, Help Me!:(
    By tomsonxu in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-11-08, 07:51

Posting Permissions

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