×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    4

    Question AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    Hello,

    I'm trying to extract all BlueTooth messages with their attachments.

    I'm running this in S60 v3 FP1 Emulator.

    However the code crashes in trying to access the AttachmentManager.

    Here's a snippet of relevant code (additional irrelevant lines removed):


    Code:
    #include <btcmtm.h>
    
    
    CClientMtmRegistry   *clientMtmReg = CClientMtmRegistry::NewL(*iMessagingSession);  
    CBtClientMtm* btMtm = STATIC_CAST(CBtClientMtm*, clientMtmReg->NewMtmL(KUidMsgTypeBt));
    	
    	
    TMsvId entId = aBtMsgArray[i];	// having collected TMsvIDs of all BT messages in this array
    	
    CMsvEntry *cmsvEntry = iMessagingSession->GetEntryL(entId);
    const TMsvEntry &tmsvEntry = cmsvEntry->Entry();
    	
    btMtm->SwitchCurrentEntryL(tmsvEntry.Id());
    btMtm->LoadMessageL();
    	
    CMsvEntry*  btEntry = iMessagingSession->GetEntryL(tmsvEntry.Id());
    CMsvEntrySelection* btChildren = btEntry->ChildrenL();
    	
    	
    if (btChildren->Count() >= 1)
    {
    	TMsvId btAtt = (*btChildren)[0];
    	btEntry->SetEntryL(btAtt); // switch context to CHILD entry
    		  
    	if (btEntry->HasStoreL())
    	{
    		CMsvStore* msgStore = btEntry->ReadStoreL();
    		if(msgStore!= NULL) 	
    		{ 		
    			MMsvAttachmentManager& attManager = msgStore->AttachmentManagerL();   ---> Program crashes here, with System Error -25
    				
    			//MMsvAttachmentManager* attManagerPtr = NULL;
    			//TRAP(rc, attManagerPtr = &(msgStore->AttachmentManagerL())) ; 	// ---->This crashes too
    			}
    		}
    	}
    Examining the contents of msgStore just before executing the problem code, - I see that the AttachmentManager is NULL (0x00000000).

    I've searched on these forums and came across this thread reporting a similar problem but there seems to be no resolution:
    http://discussion.forum.nokia.com/fo...chmentManagerL


    Is there a reason why the AttachmentManager is NULL? Is something wrong with the code segment above? Or is there another way to access the BT messages?


    Another related question - the above code fails to compile in S60 v3 (MR) SDK. It cannot find the header file <btcmtm.h> Is this functionality not available on S60V3 ??


    Thanks in advance for any help, leads and suggestions.
    Raman

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    Are you experimenting with completed messages? If you check http://wiki.forum.nokia.com/index.php/Error_codes, that result code may indicate that the message is not stored completely.
    The Attachment Manager is not NULL, if a method (AttachmentManagerL in this case) leaves, it has no other result.
    A thing you could try is checking what msgStore->IsNullL() says.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4

    Re: AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    Thanks a bunch Wizard_hu.

    Indeed it seems that some messages are "not complete" - whatever that means. When I try to open the same message using the Messaging application on the Emulator - I get the same error "system Error -25"

    However, I need to be able to deal with such a case - even if that means I only log an error and skip that message and continue, without crashing on it.

    Unfortunately msgStore->IsNull() still returns False in this case. Is there some other way to figure out first whether a message is complete or not?

    Thanks
    Raman

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    You can check TMsvEntry::Complete, that should help.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    4

    Re: AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    Thanks again wizard_hu - that helps a lot.

    May I ask a related question - though pertaining to Email messages this time.

    It seems to me that a email message is not "complete" until is fully retrieved from the server. In such a case, again the
    CMsvStore is null and not usable - and hence I cannot access either CImHeader (to extract header fields like To, From, Subject)
    nor the AttachmentManager.

    Is there another method to get some basic information (such as To, From, Subject, etc.) without going through the CMsvStore -> CImHeader chain?

    Since the native Messaging application can display these in the Emulator/Phone - for "unretrieved" and not "complete" messages, I imagine there has
    to be another way to get some basic information.

    Thanks for all your help.

    Raman

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: AttachmentManager is NULL? - problem accessing BlueTooth message attachments

    What you see in the built-in Messages application (without opening the message itself), that is usually the TMsvEntry. Check its text fields (iDetails and iDescription).

Similar Threads

  1. Problem read bluetooth message (3rd edition)
    By santu.paul@gmail.com in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2009-05-20, 07:15
  2. OBEX/Bluetooth: getReceivedHeaders() returns null
    By schoenke in forum Mobile Java General
    Replies: 5
    Last Post: 2009-01-30, 16:18
  3. two attachments in BT message ???
    By ag24master in forum Symbian
    Replies: 0
    Last Post: 2007-02-28, 14:34
  4. Problem with MIME in attachments
    By birAdam in forum General Messaging
    Replies: 1
    Last Post: 2006-10-17, 07:39
  5. Message attachments
    By vodkaloon in forum Symbian
    Replies: 0
    Last Post: 2004-11-01, 09:02

Posting Permissions

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