×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Is the SIM card ready?

    How to get a notification, that the SIM card is ready?
    While the SIM isn't ready, IMSI and home network information can't be read. And the SIM won't return this information, while the PIN code isn't entered.
    Any solutions are applicable, even based on the published partner API.
    Or suggest how to wait for the SIM card activation, and to read information after that.
    Thanks in advance.

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

    Re: Is the SIM card ready?

    can't remember seeing any public API available for this function, so you'd propably need to do with workarounds, like checking the SIM with timer..

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Re: Is the SIM card ready?

    Quote Originally Posted by symbianyucca View Post
    can't remember seeing any public API available for this function, so you'd propably need to do with workarounds, like checking the SIM with timer..
    Thanks. I thought about this, and asked to find a better solution.
    Other workaround is to subscribe current network register status notification. The phone won't be registered, while the SIM isn't ready.

  4. #4
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Banglore,India
    Posts
    64

    Re: Is the SIM card ready?

    you can do it by using CTelephony class.
    it has GetSubscriberId() function which gives the subscriber id.
    do like this

    CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg;
    CTelephony::TSubscriberIdV1 iSubscriberIdV1;
    CTelephony* iTelephony;
    iTelephony->GetSubscriberId(iStatus,static_cast<TDes8&>(iSubscriberIdV1Pckg));

    In RunL()

    RunL()
    {
    if(KErrNone == iStatus.Int())
    {
    buf.Copy(iSubscriberIdV1.iSubscriberId);
    //is SIM is ready,it will give subscriber id
    }
    else
    {
    buf.Copy(something);
    //copy somthing here,like string of zeroes. if SIM is not ready
    }
    }

    write some function to return buf.
    the function where you would like to know SIM status,just compare buf value,as subscriber ID would not be something like all zeroes,you can easily find out if SIM is ready or not.

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: Is the SIM card ready?

    the network registration change waiting is probably better one, since you can actually wait in AO, and not do the polling with timer.

  6. #6
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Re: Is the SIM card ready?

    Quote Originally Posted by Dattanand View Post
    you can do it by using CTelephony class.
    it has GetSubscriberId() function which gives the subscriber id.
    ...
    Unfortunately, it is unsuitable solution, because GetSubscriberId() returns a error (something like KErrNotSupported or other, I don't remember at the moment), if the SIM isn't ready.
    So it may be using only for periodically querying if the SIM is ready.

  7. #7
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Banglore,India
    Posts
    64

    Re: Is the SIM card ready?

    look at the code,it doesnt return anything,subscriber id is stored in second parameter.

  8. #8
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Re: Is the SIM card ready?

    Quote Originally Posted by Dattanand View Post
    look at the code,it doesnt return anything,subscriber id is stored in second parameter.
    Usually asynchronously methods return errors via iStatus. If a method is OK, iStatus == KErrNone. If the method fails, iStatus.Int() contains a error code.
    This case is no exception, I've tested it before posting the first thread message.

  9. #9
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Re: Is the SIM card ready?

    I've found an another solution.
    So I have access to the published partner API, I describe the solution using it.
    There is the RMobilePhone::NotifySecurityEvent() method. When PIN1 is entered, it sends the EPin1Verified event.
    So the solution:
    1. Receive the current lock status, using RMobilePhone::GetLockInfo().
    2. If the phone is locked, subscribe to security event notification, and wait for EPin1Verified.

    But there are opened questions:
    1. Is the SIM ready right away the notification is received?
    2. Is the event sent if PIN1 request is disabled?
    3. Are there other SIM lock reasons?

    While answers isn't given, I'll find other solutions.

    All of these may be done using the public CTelephony class. See CTelephony::GetLockInfo() and CTelephony::NotifyChange(TNotificationEvent::EPin1LockInfoChange).

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

    Re: Is the SIM card ready?

    If you look in the psvariables.h file in the partnering SDK in the shareddata API there is are various publish and subscribe variables for this.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

  11. #11
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Banglore,India
    Posts
    64

    Re: Is the SIM card ready?

    I think this subscriber ID approach is itself wrong for your need,what u need is to check whether SIM is connected to network,even if idle SIM is present,it will retrive subscriber ID

  12. #12
    Registered User
    Join Date
    Jan 2006
    Location
    St. Petersburg
    Posts
    6

    Re: Is the SIM card ready?

    Quote Originally Posted by Paul.Todd View Post
    If you look in the psvariables.h file in the partnering SDK in the shareddata API there is are various publish and subscribe variables for this.
    Which the partnering SDK are you using? I use SDK based on UIQ 3.1 SDK, and it doesn't contains this header.

    Quote Originally Posted by Dattanand View Post
    I think this subscriber ID approach is itself wrong for your need,what u need is to check whether SIM is connected to network,even if idle SIM is present,it will retrive subscriber ID
    No, if the SIM is present, its data isn't accessible, while PIN isn't entered.


    But, it does not matter at all. I've found the best solutions!!!
    Look at sacls.h (this file is present in UIQ 3.1 SDK).

    There is RProperty with category KUidSystemCategory and key KUidSIMStatusValue (other keys see at sacls.h, this file is present in UIQ 3.1 SDK, I think, it is in others ones).
    Thise property can have the following values:
    Code:
    enum TSASIMStatus
    	{
    	ESASimOk,
    	ESASimNotPresent,
    	ESASimRejected
    	};
    What I do. When the application starts, it gets the property value and subscribes to the value changes. It remained only to wait for the ESASimOk value.

    I did the following test:
    Switched on the phone, and refused to enter PIN. The SIM wasn't activated.
    Started the application. The current property value was -19 and the RProperty::Get returned KErrNone. -19 wasn't a TSASIMStatus value, but it wasn't ESASimOk too .
    Then I tried to call, PIN was requested, I entered it, and the SIM was unlocked. A few seconds later (not right away! See my question # 1 some messages above) the SIM was initialized and I received notification, that the SIM status was changed to ESASimOk.
    Later I pulled out the SIM, and received ESASimNotPresent notification.

    Great! All works as I need.

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

    Re: Is the SIM card ready?

    Which the partnering SDK are you using? I use SDK based on UIQ 3.1 SDK, and it doesn't contains this header.
    I was rather hoping you were using S60 AS THIS IS AN S60 FORUM.
    Download Symbian OS now! [url]http://developer.symbian.org[/url]

Similar Threads

  1. Send SMS Problem. Cannot Get SMSC Address. Due to Strange SIM Card?
    By cksong in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-07-02, 16:13
  2. no sim card?
    By davidmaxwaterman in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-06-08, 12:35
  3. Error 4870 when send SMS using Prepaid SIM Card
    By yitming in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2004-09-26, 10:44
  4. Replies: 3
    Last Post: 2003-12-04, 07:56
  5. SIM card Security Code
    By kappacoco in forum Symbian
    Replies: 1
    Last Post: 2003-03-31, 09:18

Posting Permissions

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