×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    416

    Code from SilentSms freezes in premature call of RunL()

    Hello developers,

    please leave here a clue where I could make a mistake:

    The waiting for incoming sms is triggered by method Idle() in CActive class with EPriorityStandard:

    Code:
    void CSmsService::Idle()
    {
        if ( !IsActive() )
        {
            iRead=ETrue;
            iFs.Connect();
            iSocketServer.Connect(); 
            //User::After(1000000); //I tried both versions
            SocketListen();         
        }
    }
    The SocketListen() looks like this:

    Code:
    void CSmsService::SocketListen()
        {
        _LIT(KTag, "");
        TBuf8<2> matchTag;
        matchTag.Copy(KTag);
    
        //Opens a socket by creating a new subsession to the socket server.
        TInt err = iSocket.Open(iSocketServer, KSMSAddrFamily, KSockDatagram, KSMSDatagramProtocol);
        if(err==KErrNone)
            { 
            TRequestStatus iStatus;
            TSmsAddr smsaddr; 
            // App. listens for sms msgs with some special tag in it.
            smsaddr.SetSmsAddrFamily(ESmsAddrMatchText); 
            smsaddr.SetTextMatch(matchTag);
            TInt BindErr = iSocket.Bind(smsaddr);
            if(BindErr == KErrNone)
                {
                iPckgBuf() = KSockSelectRead;
                //Applies an asynchronous I/O control operation on a socket.
                iSocket.Ioctl( KIOctlSelect,iStatus, &iPckgBuf, KSOLSocket);
                iRead=ETrue;
                SetActive();
                }
            }
    }
    And the problem is that the execution stops - freezes on the line iSmsMessage->InternalizeL(readStream). That is understandable as there was no incoming sms yet. The RunL() is triggered and I do not know why.

    Code:
    void CSmsService::RunL()
    {
        if(iStatus == KErrNone)
        {    
        
            if(iRead && iGlobalProperties.GetSecurePhone() )
            {
                CSmsBuffer *smsBuffer = CSmsBuffer::NewL();
                CleanupStack::PushL(smsBuffer);
                //Stream that reads a CSmsMessage object across a socket.
                RSmsSocketReadStream readStream(iSocket);
                //Allocates and creates a CSmsMessage
                //ESmsDeliver-SMS-DELIVER, sent from service center to Mobile Station. 
                iSmsMessage = CSmsMessage::NewL(iFs,CSmsPDU::ESmsDeliver,smsBuffer);
                //Internalises data from stream to CSmsMessage
                iSmsMessage->InternalizeL(readStream);
                readStream.Close(); 
                //Extracting the received message to a buffer   
                iSmsMessage->Buffer().Extract(iBuf,0,iSmsMessage->Buffer().Length());
                iSocket.Ioctl( KIoctlReadMessageSucceeded,iStatus, &iPckgBuf, KSolSmsProv);
                //Printing the received Message.
                //CAknInformationNote* note122=new(ELeave) CAknInformationNote;
                //note122->ExecuteLD(iBuf);
                
                iRead=EFalse;       
                SetActive();
                CleanupStack::PopAndDestroy(smsBuffer);
            }
        }
    }

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Location
    Wiltshire, UK
    Posts
    3,644

    Re: Code from SilentSms freezes in premature call of RunL()

    Somehwere you have a local variable called iStatus - I fixed a collegues problem with exactly this on Friday.

    This bug was fixed in the wiki example last month
    Last edited by Paul.Todd; 2009-02-23 at 11:42.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  3. #3
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    416

    Re: Code from SilentSms freezes in premature call of RunL()

    Quote Originally Posted by Paul.Todd View Post
    Somehwere you have a local variable called iStatus - I fixed a collegues problem with exactly this on Friday.

    This bug was fixed in the wiki example last month
    I was thinking for a few times that is a sort of hack - because in a simple application it seems to be working. But later I found istatus -46 in the log file. I should be more suspicious and self confident about wiki samples.

    There is still local instance of iStatus in the SilentSms example on the wiki.

    Paul thank you very much.

  4. #4
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    416

    Re: Code from SilentSms freezes in premature call of RunL()

    Hi Paul, I do not want to post the same problem described here. Can you leave a comment there?

    Thank you.

Similar Threads

  1. Rcall::Dial (Asynchronous call)
    By aldrin_rave in forum Symbian
    Replies: 5
    Last Post: 2010-05-21, 13:51
  2. (Bluetooth) RSocket Write function does not call RunL function
    By ronald29 in forum Symbian Networking & Messaging (Closed)
    Replies: 13
    Last Post: 2008-10-14, 10:58
  3. Replies: 2
    Last Post: 2007-10-05, 20:40
  4. Replies: 3
    Last Post: 2007-08-23, 09:33
  5. Replies: 5
    Last Post: 2003-10-30, 14:44

Posting Permissions

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