×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    19

    Sending SMS immediately from Series60 device

    I am trying to send an sms immediately after construction from a 7650 device, but it won't work.

    I am using the CSendAs class to create a message in the outbox. This sort of works, at least it is visible in the 7650's messaging application, with seemingly correct details.

    Then, inspired by the GDSMS example, I try to issue an asynchronous call to schedule the message and pass the request status member of a CMsvOperationWait as argument.

    What happens is that I get a panic/error message popup saying something like "Message could not be sent" as well as a "System error" message.

    So, is it a correct approach to use the above scheme for immediate sending ?
    I have not found documentation on the CMsvOperationWait, is it a beta-glitch or is it deprecated and unsupported ?
    Am I missing something in the creation of the message which makes it unsendable ?
    Is there any documentation other than the API reference that I should read to understand this better ?

    Regards

    /Niklas


    Code snippet follows:


    CSendAs *sendAs;

    // Create SendAs
    sendAs = CSendAs::NewL(*this);
    CleanupStack::PushL(sendAs);


    // Set SMS MTM

    TUid smsUid;
    smsUid.iUid = KUidMsgTypeSMS;
    sendAs->SetMtmL( smsUid );

    // Check services
    if( sendAs->AvailableServices().Count() < 1 )
    User::Leave(KErrNotFound);

    // ------ Issuing a SetService(1) results in out of range panic
    sendAs->SetService(0);


    // Check Capabilities of the SMS MTM
    User::LeaveIfError( sendAs->QueryMessageCapability (KUidMtmQueryCanSendMsg, EFalse));
    User::LeaveIfError( sendAs->QueryMessageCapability(KUidMtmQueryMaxBodySize, ETrue));


    // Create the Message in the outbox
    sendAs->CreateMessageL( KMsvGlobalOutBoxIndexEntryId );


    // Set recipient
    sendAs->AddRecipientL(iTelephoneNumber); // A literal with a telephonenumber

    iMessageBody->Reset();
    iMessageBody->InsertL(0, aMessage );

    // Set body of message
    sendAs->SetBodyL(*iMessageBody);

    TInt r;
    User::LeaveIfError( r = sendAs->ValidateMessage());

    // Save message to message server, and make it visible in outbox
    sendAs->SaveMessageL( ETrue );


    // Schedule to send now.
    // Use MTM from sendAs
    CBaseMtm* SmsMtm = &(sendAs->ClientMtm());

    TMsvEntry entry(SmsMtm->Entry().Entry());
    entry.iDate.HomeTime();
    entry.iDetails.Set(_L("MyDetails"));
    entry.SetOffPeak(EFalse); // What does this do ?
    entry.SetSendingState(KMsvSendStateWaiting); // Is this necessary ?
    SmsMtm->Entry().ChangeL(entry);

    CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
    CleanupStack::PushL(sel);
    sel->AppendL(entry.Id());

    CMsvOperation* operation = NULL;
    CleanupStack::PushL(operation);

    CMsvOperationWait* waiter = CMsvOperationWait::NewLC();

    TBuf8<1> dummy;

    waiter->Start();
    operation = SmsMtm->InvokeAsyncFunctionL( ESmsMtmCommandScheduleCopy, *sel, dummy, waiter->iStatus );

    CActiveScheduler::Start();


    CleanupStack::PopAndDestroy(4); // sendAs, sel, operation, waiter
    sendAs = NULL;

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    19

    RE: Sending SMS immediately from Series60 device

    Hi,

    here is a summary of how I solved my problem of SENDING an sms immediately from a 7650 w/ firmware 3.12 using v 0.9 of the SDK.

    I ported the vital functionality of the GDSMS example to work on Series60, as I did not succeed in using CSendAs. Scheduling did not work with CSendAs, so I use the CSmsClientMtm directly as in the example. Problem is though that some include files are missing. This is remedied by doing the following:

    1. Get the header "etelbgsm.h" from the Nokia 9200 SDK

    2. Next problem is a file "etelgprs.h", I have not found this one and do not need GPRS so I edit the headers "smutset.h" and "smutset.inl" to exclude all references to GPRS (just a few). This may be inspired by doing a diff with the same files of the Nokia 9200 SDK.

    Tip: Not caring much for GUI stuff at the moment, I simplified the work by adapting the recently published MMS Example to SMS as above instead of porting the whole GDSMS including GUI functionality. Which I suspect includes a lot of missing headers as well.


    Regards

    Niklas

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    19

    RE: Sending SMS immediately from Series60 device

    Well, now I have put the code and a SIS file here:

    www.csd.uu.se/~nian2981/smsexample

    Nokia Staff: The code above is an adaptation of Nokia software, please tell me if you think it is inappropriate to publish the code on the web, and then I'll remove it. However, I think maybe some developers may find it useful.

    regards

    Niklas

Posting Permissions

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