×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    80

    save SMS, Problem

    hi,

    i am using the following code to save the sms


    TBuf<60> aAddress(_L("57657657"));
    TBuf<60> aDescription(_L("a smple sms"));
    TBuf<60> aMessage(_L("a smple sms"));

    iMtmRegistry = CClientMtmRegistry::NewL( *iSession );

    // Create an SMS Client MTM object.
    iSmsMtm = STATIC_CAST( CSmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeSMS ) );

    iSmsMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId); //inbox
    TMsvId serviceId( KUidMsgTypeSMS.iUid );
    iSmsMtm->CreateMessageL(KUidMsgTypeSMS.iUid);

    // iSmsMtm->CreateMessageL(serviceId);
    // iSmsMtm->AddAddresseeL(aAddress); //to address if need

    CSmsHeader& iHeader = iSmsMtm->SmsHeader();
    iHeader.SetFromAddressL(aAddress);

    CRichText& body = iSmsMtm->Body();
    body.Reset();
    body.InsertL(0, aMessage);

    TMsvEntry entry = iSmsMtm->Entry().Entry();
    entry.SetInPreparation(EFalse);
    entry.SetVisible(ETrue);
    entry.iDate.HomeTime();
    entry.iDescription.Set(aDescription);
    entry.iDetails.Set(aAddress);
    entry.SetUnread(ETrue);

    iSmsMtm->Entry().ChangeL(entry);
    iSmsMtm->SaveMessageL();




    the iSmsMtm is of CSmsClientMtm type and iMtmRegistry is of CClientMtmRegistry type.

    but when i am debuging this code it is giving the panic at following line

    iSmsMtm->CreateMessageL(KUidMsgTypeSMS.iUid);


    the panic is KERN EXEC 44,
    i know the meaning of KERN EXEC 44 but i dont know how to resolve the problem.


    if any body have any idea please replay

    Thanks
    Vickey

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

    Re: save SMS, Problem

    I have never used this CreateMessageL-method (I know the CreateL-way), but the SDK Help says:
    Quote Originally Posted by SDK Help
    void CreateMessageL(TMsvId aServiceId);
    So I would probably try CSmsClientMtm::ServiceId (in the "traditional" TMsvEntry+CreateL way you also do that) if it helps.

  3. #3
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    80

    Re: save SMS, Problem

    thanks for the response


    i tried it by the CMsvEntry, but it is also giving the same panic

    the code id following....

    TMsvEntry newEntry;
    newEntry.iType = KUidMsvMessageEntry;
    newEntry.iServiceId = KMsvLocalServiceIndexEntryId;
    newEntry.iMtm = KUidMsgTypeSMS;
    newEntry.SetVisible(EFalse);
    newEntry.SetInPreparation(ETrue);
    TMsvId aID = newEntry.Id();

    // create empty message in outbox
    CMsvEntry* entry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
    CleanupStack::PushL(entry);


    entry->CreateL(newEntry);


    iSession->CleanupEntryPushL(newEntry.Id());
    // switch to created entry
    entry->SetEntryL(newEntry.Id());

    // create a rich text body
    CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
    CleanupStack::PushL(paraFormatLayer);
    CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
    CleanupStack::PushL(charFormatLayer);
    CRichText* richText = CRichText::NewL(paraFormatLayer,charFormatLayer);
    CleanupStack::PushL(richText);
    richText->InsertL(0, aMessage);
    // ... can set message text in richText now

    // create the header object
    //CSmsHeader* smsHeader = CSmsHeader::NewL(KSmsTypeSubmit, *richText, tia637::KTeleserviceWEMT);
    // CSmsHeader* smsHeader;


    CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *richText);
    CleanupStack::PushL(smsHeader);
    // smsHeader->SetDefaultMessageSettingsL(aServiceSettings);
    // .. configure further as required

    // set the message header in the entry's store
    CMsvStore* store = entry->EditStoreL();
    CleanupStack::PushL(store);
    smsHeader->StoreL(*store);
    store->StoreBodyTextL(*richText);
    store->CommitL();
    CleanupStack::PopAndDestroy(5);



    the abhove code giving the panic KERN EXEC 44 at


    entry->CreateL(newEntry);

    i dont know where i am doing wrong,
    if u have any idea please replay

    Thanks
    Vickey

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

    Re: save SMS, Problem

    How do you open the CMsvSession object?

  5. #5
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    80

    Re: save SMS, Problem

    iSession = CMsvSession::OpenAsyncL( *this );
    in ConstructL()
    Last edited by vickey; 2008-02-12 at 06:04.

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

    Re: save SMS, Problem

    Read about the difference between OpenSyncL and OpenAsyncL in the SDK Help.

  7. #7
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    80

    Re: save SMS, Problem

    i checked on the sdk but the difference is that the one is open the session asynchronously and other one with synchronously.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,570

    Re: save SMS, Problem

    Could you check what happens if you use OpenSyncL?

  9. #9
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    80

    Re: save SMS, Problem

    hi, thanks for yr response,

    i used the OpenSync() insted of OpenAsync(), noe its working fine,

    thanks

Similar Threads

  1. Write a program that save sms in individual inbox
    By asdfghjkl_asdfghjkl in forum Symbian
    Replies: 5
    Last Post: 2008-05-28, 08:39
  2. Replies: 2
    Last Post: 2007-11-10, 13:19
  3. HELP! problem w/ sending and reading sms..
    By mauve928 in forum General Messaging
    Replies: 0
    Last Post: 2003-12-14, 19:10
  4. Problem sending SMS using Nokia 6210 and SDK 2.1
    By standi in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2002-07-25, 03:14

Posting Permissions

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