×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    32

    Wink NOKIA Experts pay attention! Why Sms is in the draft box ,it should be send out.

    I want to send a sms out.It's a text message.
    When I send it out ,it still in the draft box?
    Can you help me?
    Thank you!

    Here is my code.

    void CMtmsExampleEngine::SendSMSL()
    {
    // Set context to the SMS message
    iSmsMtm->SwitchCurrentEntryL(iSmsId);

    // Load the message
    iSmsMtm->LoadMessageL();

    // Set the SMS service centre address
    CSmsSettings& settings = iSmsMtm->ServiceSettings();


    #ifndef EKA2
    const TInt numSCAddresses = settings.NumSCAddresses();
    if (numSCAddresses > 0)
    {
    CSmsNumber* serviceCentreNumber = NULL;

    // Get the default SC address, if valid, Otherwise just get the first from the list.
    if ((settings.DefaultSC() >= 0) && (settings.DefaultSC() < numSCAddresses))
    serviceCentreNumber = &(settings.SCAddress(settings.DefaultSC()));
    else
    serviceCentreNumber = &(settings.SCAddress(0));

    iSmsMtm->SmsHeader().SetServiceCenterAddressL(serviceCentreNumber->Address());
    }
    #else
    const TInt numSCAddresses = settings.ServiceCenterCount();
    if (numSCAddresses > 0)
    {
    CSmsServiceCenter* serviceCentreNumber = NULL;
    // Get the default SC address, if valid, Otherwise just get the first from the list.
    if ((settings.DefaultServiceCenter() >= 0) && (settings.DefaultServiceCenter() < numSCAddresses))
    serviceCentreNumber = &(settings.GetServiceCenter(settings.DefaultServiceCenter()));
    else
    serviceCentreNumber = &(settings.GetServiceCenter(0));

    iSmsMtm->SmsHeader().SetServiceCenterAddressL(serviceCentreNumber->Address());
    }
    #endif

    else
    {
    // report panic, programming error - there should never be a missing service number,
    }

    // Save the message
    iSmsMtm->SaveMessageL();

    // Update the index entry
    TMsvEntry indexEntry = iSmsMtm->Entry().Entry();
    indexEntry.SetInPreparation(EFalse);
    indexEntry.SetSendingState(KMsvSendStateWaiting);
    iSmsMtm->Entry().ChangeL(indexEntry);

    // Now send
    Cancel(); // prepare iOp for use
    iEntrySelection->Reset();
    iEntrySelection->AppendL(iSmsId);

    TBuf8<1> dummyParams;
    iOp = iSmsMtm->InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy, *iEntrySelection, dummyParams, iStatus);
    SetActive();
    }

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: NOKIA Experts pay attention! Why Sms is in the draft box ,it should be send out.

    could you chekc the SMS example that is available on forum Nokia, it works, so maybe you could switch to that implementation, or find out the difference it has between your code.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    32

    Re: NOKIA Experts pay attention! Why Sms is in the draft box ,it should be send out.

    Quote Originally Posted by symbianyucca View Post
    could you chekc the SMS example that is available on forum Nokia, it works, so maybe you could switch to that implementation, or find out the difference it has between your code.
    I checked it carefully, then I find out the difference.
    I post it here ,maybe it can help others.

    #ifndef EKA2 //for S60 2nd
    indexEntry.iDate.HomeTime ( );
    #else //for S60 3rd
    indexEntry.iDate.UniversalTime();
    #endif




    void CMtmsExampleEngine::CreateDraftSMSL(const TDesC& aAddress )
    {
    // Set attributes on index entry
    TMsvEntry indexEntry;
    indexEntry.SetInPreparation (ETrue );
    indexEntry.iMtm = KUidMsgTypeSMS;
    indexEntry.iType = KUidMsvMessageEntry;
    indexEntry.iServiceId = iSmsMtm->ServiceId ( );
    #ifndef EKA2
    indexEntry.iDate.HomeTime ( );
    #else
    indexEntry.iDate.UniversalTime();
    #endif
    // Create entry from this index entry
    iSmsMtm->SwitchCurrentEntryL (KMsvDraftEntryId );
    iSmsMtm->Entry().CreateL (indexEntry );

    // Set the MTM's active context to the new message
    iSmsId = indexEntry.Id ( );
    iSmsMtm->SwitchCurrentEntryL (iSmsId );

    // Add body
    CRichText& body = iSmsMtm->Body ( );
    body.Reset ( );
    body.InsertL (0, KSMSBody );
    indexEntry.iDescription.Set (KSMSBody );

    // Add addressee
    iSmsMtm->AddAddresseeL (aAddress );
    indexEntry.iDetails.Set (aAddress );

    // Update index entry
    iSmsMtm->Entry().ChangeL (indexEntry );

    // Update store entry
    iSmsMtm->SaveMessageL ( );
    }


    The setting of entry is wrong. It let's the message delay.

    I am also sorry for my language skill.

Similar Threads

  1. Replies: 0
    Last Post: 2004-10-11, 10:09

Posting Permissions

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