×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    Getting content of an SMS - user11 panic

    Hello All,
    I am trying to get the content of an SMS.
    I am using the CSmsClientMtm::Body() method to get the content in the form of a richtext. I am then copying it to a TBuf. On the emulator the code is working fine, but on the device I am getting User11 panic.
    I have taken the length of the descriptor as 160.
    I read that the user11 panic is caused if the length of the descriptor exceeds its maximum length. But in this case the length cant go beyond 160.
    Can anyone please tell me what is causing the problem?
    Please help me.

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    Re: Getting content of an SMS - user11 panic

    Following is the code...

    void CSmsHandler::ReadMessage()
    {
    HBufC* SMSContent = HBufC::NewLC(400);
    //HBufC8* SMSContent8 = HBufC8::NewLC(400);

    TMsvSelectionOrdering sort;
    sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries

    CMsvEntry* inboxContext=CMsvEntry::NewL(*iSession,KMsvGlobalInBoxIndexEntryId,sort); // Reading Messages from Inbox Folder
    CleanupStack::PushL(inboxContext);

    CMsvEntrySelection* entries = inboxContext->ChildrenL();
    CleanupStack::PushL( entries );

    TInt msgCount= entries->Count();
    for (TInt i=0; i<entries->Count(); i++)
    {
    TMsvId entryID = entries->At(i);
    iSmsMtm->SwitchCurrentEntryL(entryID);

    CMsvEntry* entry= iSession->GetEntryL((*entries)[i]);
    CleanupStack::PushL(entry);

    CMsvStore* inboxStore= entry->ReadStoreL();
    CleanupStack::PushL(inboxStore);
    if (inboxStore->HasBodyTextL())
    {
    TMsvEntry entry1 = entry->Entry();
    if(entry1.Unread()) //check if the message is unread
    {

    CRichText& richText= iSmsMtm->Body();
    inboxStore->RestoreBodyTextL(richText);
    const TInt length = richText.DocumentLength();

    SMSContent->Des().Copy(richText.Read(0,length)); // Gives you actual content(Body) of SMS
    TBuf<400> aBuf;
    aBuf.Copy(SMSContent->Des());
    richText.Reset();

    }
    }
    CleanupStack::PopAndDestroy(2,entry);
    }
    CleanupStack::PopAndDestroy(3);
    }

    Can anyone help me please?

  3. #3
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    91

    Re: Getting content of an SMS - user11 panic

    Hello all, I have changed the buf length from 160 to 400. now I am not getting the panic.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Getting content of an SMS - user11 panic

    Why do not you use that HBufC instead?[CODE]CRichText& richText= iSmsMtm->Body();
    inboxStore->RestoreBodyTextL(richText);
    const TInt length = richText.DocumentLength();
    SMSContent=HBufC::NewL(length); // because this is the place where you know the length...
    SMSContent->Des().Copy(richText.Read(0,length));[/QUOTE]

Similar Threads

  1. Read SMS/ SMS Alert.
    By nirenj in forum General Messaging
    Replies: 3
    Last Post: 2009-01-14, 12:39
  2. Using Bluetooth serial port in MIDlets (nokia 9500 issue)
    By orsteglasy in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2007-10-07, 21:49
  3. Need a PHP/HTML script which integrates with SDK and send sms
    By ramanladhani in forum Tools and SDK Feedback (Closed)
    Replies: 2
    Last Post: 2007-01-14, 10:56
  4. How to abstract SMS content and convert it to txt file
    By joshua_meng in forum General Messaging
    Replies: 0
    Last Post: 2006-01-17, 13:01
  5. Replies: 1
    Last Post: 2001-11-08, 15:39

Posting Permissions

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