sending out sms error

Login to reply to this topic.
Wed, 2004-07-21 05:24
Joined: 2004-05-28
Forum posts: 6
can somebody please help me i have an error sending sms and there is very little refernce of building an sms application.

at the end of the CActiveScheduler::start() nothing happens and when the application is exited it gives an kern-exec 3 error

hope somebody can help thanks



void CSMSRouterAppUi::RouteMessageL(TMsvId aEntryId)
{
   iEikonEnv->InfoWinL(_L("RouteMessageL"),_L("1"));

   
   // Accesses the entry to be routed
   CMsvEntry* entry = iSession->GetEntryL(aEntryId);
   CleanupStack::PushL(entry);      // push1

   iEikonEnv->InfoWinL(_L("Message"),_L("2"));

   // Gets the index entry for the context
   TMsvEntry msvEntry = entry->Entry();

   _LIT(iRecipientsTelNum, "6596187087");

   // set iRecipient into the Details of the entry
   msvEntry.iMtm = KUidMsgTypeSMS;
   msvEntry.iServiceId = KMsvLocalServiceIndexEntryId;
   msvEntry.iDetails.Set(iRecipientsTelNum);         // set recipient info in details
   msvEntry.SetInPreparation(EFalse);               // set inPreparation to false
   msvEntry.SetSendingState(KMsvSendStateWaiting);      // set the sending state (immediately)
   msvEntry.iDate.HomeTime();                     // set time to Home Time

   iEikonEnv->InfoWinL(_L("Message"),_L("3"));

   
   CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*> (iMtmReg->NewMtmL(KUidMsgTypeSMS));
   CleanupStack::PushL(smsMtm);   // push2

   iEikonEnv->InfoWinL(_L("Message"),_L("4"));

   // create entry from this index entry
   smsMtm->SwitchCurrentEntryL(KMsvDraftEntryId);
   smsMtm->Entry().CreateL(msvEntry);
   smsMtm->AddAddresseeL(iRecipientsTelNum);

   iEikonEnv->InfoWinL(_L("Message"),_L("5"));

   /*--------------------------------------------------------------------------
   *   CSmsHeader
   *   SMS MTM encapsulation of an SMS message.
   *   This class allows a messaging client to access the lower-level message
   *   encapsulation used by the SMS stack.
   ---------------------------------------------------------------------------*/

   CSmsHeader& header = smsMtm->SmsHeader();
   CSmsSettings* sendOptions = CSmsSettings::NewL();
   CleanupStack::PushL(sendOptions);      // push3
   sendOptions->CopyL(smsMtm->ServiceSettings()); // restore existing settings

   iEikonEnv->InfoWinL(_L("Message"),_L("6"));

   // set send options
   sendOptions->SetDelivery(ESmsDeliveryImmediately);      // set to be delivered immediately
   header.SetSmsSettingsL(*sendOptions);

   iEikonEnv->InfoWinL(_L("Message"),_L("7"));

   // let's check if there's sc address
   if (header.Message().ServiceCenterAddress().Length() == 0)
   {
      // no, there isn't. We assume there is at least one sc number set and use
      // the default SC number.
      CSmsSettings* serviceSettings = &(smsMtm->ServiceSettings());

      iEikonEnv->InfoWinL(_L("Message"),_L("8"));
       
      // if number of scaddresses in the list is null
       if (!serviceSettings->NumSCAddresses())
       {
         // here there should be a dialog in which user can add sc number
         iEikonEnv->InfoWinL(_L("No service center number"),_L("cannot send this one."));

         iEikonEnv->InfoWinL(_L("Message"),_L("8a"));
      }
      else
      {
           // set sc address to default.
           CSmsNumber* sc = 0;
         sc = &(serviceSettings->SCAddress(serviceSettings->DefaultSC()));
         header.Message().SetServiceCenterAddressL(sc->Address());

         iEikonEnv->InfoWinL(_L("Message"),_L("8b"));
      }
   }

   smsMtm->AddAddresseeL(iRecipientsTelNum,msvEntry.iDetails);

   iEikonEnv->InfoWinL(_L("Message"),_L("9"));

   /*// This moves the message entry to outbox, we'll schedule it for sending after this.
   TMsvId movedId = MoveMessageEntryL( KMsvGlobalOutBoxIndexEntryId );  // move message to outbox*/

    // We must create an entry selection for message copies (although now we only have one message in selection)
   CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
   CleanupStack::PushL(selection);      // push4

   selection->AppendL(aEntryId);

   iEikonEnv->InfoWinL(_L("Message"),_L("10"));  

   //Add entry to task scheduler
   TBuf8<1> dummyParams;



   CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
   waiter->Start();
   CleanupStack::PushL(waiter);   //push5

   iEikonEnv->InfoWinL(_L("Message"),_L("11"));

   /*--------------------------------------------------------------------------
   *   CMsvOperation
   *
   *   Defines an interface for use by objects which control asynchronous
   *   commands in the messaging system. Such objects are returned by CMsvEntry
   *   and User Interface MTM functions that complete asynchronously.
   *
   *   The interface allows clients to:
   *      1.get progress information about the operation
   *      2.cancel the operation
   *      3.be signalled asynchronously when the operation completes;
   *        a client passes in a TRequestStatus of a suitable active object
   *        for this purpose
   *-------------------------------------------------------------------------*/
   
   // invoking async schedule copy command on our mtm
   CMsvOperation* op= smsMtm->InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy,*selection,dummyParams,waiter->iStatus);
   CleanupStack::PushL(op);      //push6

   iEikonEnv->InfoWinL(_L("Message"),_L("12"));

   /*--------------------------------------------------------------------------
   *   CActiveScheduler
   *
   *   Controls the handling of asynchronous requests as represented by active
   *   objects. An active scheduler is used to schedule the sequence in which
   *   active object request completion events are handled by a single
   *   event-handling thread.
   *-------------------------------------------------------------------------*/

   CActiveScheduler::Start();

   iEikonEnv->InfoWinL(_L("Message"),_L("13"));

   CleanupStack::PopAndDestroy(6);
}
  • Login to reply to this topic.