×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Getting information at startup that GSM is registred

    Hello,
    i meet the following problem,
    i want to sent SMS at the startup.
    I use RSendAsMessage class to send SMS.

    The problem is that when i send sms at startup it stucks in outbox.
    Propably the reason of that is that GSM network is not registred when i try to send that SMS.
    I have tried to use iNetworkInfoV1.iMode to get info if device has registred and event if it is SMS still stucks in outbox.
    If i set some timeout and then try to send it is easily sent.

    Is it possible to detect that GSM network is ready to send my SMS ?

    thanks in advance

    Nuker85

  2. #2
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Getting information at startup that GSM is registred

    after some time of research and testing i realised that that sms which is stuck after short time returns system error info: Unable to send sms and in details it shows -4550 error number.
    What is more it is impossible to force sending this sms from outbox using "messages" view. It returns all the time error.

    What may be the reason that i can t send sms at startup?

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Getting information at startup that GSM is registred

    Hi,

    Did you try using :-

    iTelephony->GetNetworkRegistrationStatus(iStatus, iNetworkRegistrationV1Pckg);
    SetActive();

    And then in the RunL()

    if(iNetworkRegistrationV1.iRegStatus == CTelephony::ERegisteredOnHomeNetwork)
    {
    // you are registered on GSM network, do your thing from here..
    }

    Where,

    CTelephony::TNetworkRegistrationV1 iNetworkRegistrationV1;
    CTelephony::TNetworkRegistrationV1Pckg iNetworkRegistrationV1Pckg;
    CTelephony* iTelephony;

    goes in the .h file

    Cheers,
    Mayank

  4. #4
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Getting information at startup that GSM is registred

    hello,
    thanks for being interested in my thread.
    Yes i have also tried it and i send sms when this functions status is in ERegisteredOnHomeNetwork state.

    Maybe there is something wrong with my sending function:
    Code:
    void CSMSSender::SendSms(const TDesC& aNumber, const TDesC& aBody)
    	{
    	Cancel();
    	TInt error(0);
    	error = iSendAs.Connect();
    
    	if (error == KErrNone)
    		{
    		iBody.Copy(aBody);
    		iNumber.Copy(iNumber);
    		CleanupClosePushL(iSendAs);
    		iSendAsMessage.CreateL(iSendAs, KUidMsgTypeSMS);
    		iSendAsMessage.AddRecipientL(aNumber,
    				RSendAsMessage::ESendAsRecipientTo);
    
    		// Set the body text
    		iSendAsMessage.SetBodyTextL(aBody);
    		iSendAsMessage.SendMessage(iStatus);
    		SetActive();
    		}
    	}
    In RunL my AO returns KErrNone and SMS is in outbox and is stuck...

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Getting information at startup that GSM is registred

    Hi,

    I have an application that is an auto-start one, and I am using the below code to send SMS out right at app start and it works fine :-

    Code:
    RSendAs sendas;
    TInt res = sendas.Connect();
    CleanupClosePushL(sendas);
    
    RSendAsMessage message;
    CleanupClosePushL(message);
        
    // Buffer to hold emailId/mobileNumber
    TBuf<20> mobileNumber(_L("9900123456"));
    	
    TBuf<256> myMsg(_L("test message"));
     
    TRAP(res, message.CreateL(sendas, KSenduiMtmSmsUid ));
    message.AddRecipientL(mobileNumber, RSendAsMessage::ESendAsRecipientTo);
     
    // Set the body of the message
    message.SetBodyTextL(myMsg);
    
    // Send SMS out	
    TRAP(res, message.SendMessageAndCloseL());
     	
    CleanupStack::Pop(1); // RMessage
    CleanupStack::PopAndDestroy(1); // RSendAs
    Cheers,
    Mayank

  6. #6
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Getting information at startup that GSM is registred

    Hello,
    does your application autostart after device reboot?

    I have got this problem just after device is switched on.

    I have found some type of solution and i use timer which is launched after gsm registration and after 10 sec sends sms and it works fine.

    This solution works but launching timer is not what i have been searching for.

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Getting information at startup that GSM is registred

    Quote Originally Posted by nuker85 View Post
    Hello,
    does your application autostart after device reboot?
    Yes my application auto-starts on device reboot/switch on.

    I have got this problem just after device is switched on.
    I am not sure why it doesnt work, but I am using the code in my app init function which gets called on device reboot/restart.

    Cheers,
    Mayank

  8. #8
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: Getting information at startup that GSM is registred

    thanks for response,
    I have realised that i have got different Uid:
    Code:
    KUidMsgTypeSMS
    where you had:
    Code:
    KSenduiMtmSmsUid
    I have changed it and it has helped a litte,
    now if SMS gets into outbox it does not stuck there forever but is resend after few minutes by system.

    But still message is not send immediately after sim registration in some cases.

    This situation takes place only with some SIM cards. On SIMs which provider registers it immediately this functions works properly, on other one
    it does not.

Similar Threads

  1. WLAN and GSM Strenght value
    By omarfr in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-05-29, 10:01
  2. ATcommands for 6210 & GSM modem, r they similar?
    By mauve928 in forum General Messaging
    Replies: 2
    Last Post: 2003-12-04, 09:01

Posting Permissions

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