Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 20:44, 14 December 2007.

Retrieve General phone information using Shared Data API

From Forum Nokia Wiki


The PSVariables.h provides Publish & Subscribe keys related to general phone information like availabity of SIM, GPRS, IRDA, Network etc.

Note: The PSVariables.h can be found in Shared Data API which is a part of the SDK API Plugin for S60 3rd SDK MR.

Example code

GPRS Availability:The following code displays GPRS Availability status:

void CPSVariablesAppUi::GetGPRSAvailabilityStatus()
   {
   TInt value;
   TInt ret=RProperty::Get(KUidSystemCategory, KPSUidGprsAvailabilityValue, value);
   if(KErrNone==ret)
     {
     CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
     TBuf<30> msg;
     switch(value)
    	{
    	case EPSGprsAvailable:
    	     {
             msg.Copy(_L("Gprs Available"));
             informationNote->ExecuteLD(msg);
   	     break;	
   	     }   	
   	case EPSGprsNotAvailable:
   	     {
   	     msg.Copy(_L("Gprs Not Available"));
   	     informationNote->ExecuteLD(msg);
   	     break;	
   	     }
   	case EPSGprsAvailabilityUnknown:
             {
             msg.Copy(_L("Gprs Availability Unknown"));
   	     informationNote->ExecuteLD(msg);
   	     break;	
   	     }
       }
     }
   }

Status of Auto Lock:The following code displays the Auto Lock status (On/Off):

void CPSVariablesAppUi::GetAutoLockStatus()
   {
   TInt value;
   TInt ret=RProperty::Get(KUidSystemCategory, KPSUidAutolockStatusValue, value);
   if(KErrNone==ret)
     {
     CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
     TBuf<30> msg;	
     switch(value)
    	{
    	case EPSAutolockOff:
    	    {
   	    msg.Copy(_L("Auto Lock Off"));
   	    informationNote->ExecuteLD(msg);
   	    break;	
   	    }   	
   	case EPSAutolockOn:
   	    {
   	    msg.Copy(_L("Auto Lock On"));
   	    informationNote->ExecuteLD(msg);
   	    break;	
   	    }   	
    	}
     }
   }

SIM change information: Indicates if the current SIM card is the same as the previous one. It detects the SIM change every time the phone is switched ON.

Case1: Say SIM1 is present in phone - phone switched OFF - removed SIM1 - inserted SIM2 - phone switched ON - Running the application notifies "SIM Changed".

Case2: Say SIM1 is present in phone - phone switched OFF - Again phone switched ON - Running the application notifies "SIM not Changed".

Case3: Say SIM1 is present in phone - phone switched OFF - removed SIM1 - inserted SIM2 - phone switched ON - Again phone switched OFF - phone switched ON - Now running the application notifies "SIM not Changed".

The following code displays SIM change information:

void CPSVariablesAppUi::IsSIMchanged()
   {
   TInt value;
   TInt ret=RProperty::Get(KUidSystemCategory, KPSUidSimChangedValue, value);
   if(KErrNone==ret)
     {
     CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
     TBuf<30> msg;
     switch(value)
    	{
    	case EPSSimNotChanged:
    	    {
            msg.Copy(_L("Sim Not Changed"));
            informationNote->ExecuteLD(msg);
            break;	
   	    }   	
   	case EPSSimChanged:
   	    {
   	    msg.Copy(_L("Sim Changed"));
            informationNote->ExecuteLD(msg);
   	    break;	
            }   	
        }
     }
   }

Network Strength:The following code displays Network strength in bars (1 to 8):

void CPSVariablesAppUi::GetNetworkStrength()
   {
   TInt value;
   TInt ret=RProperty::Get(KUidSystemCategory,KPSUidNetworkBarsValue,value);
   if(KErrNone==ret)
	{
	TBuf<50> msg;
	msg.AppendNum(value);
	CEikonEnv::Static()->InfoWinL(_L("Network Strength in bars: "),msg);
	}
   }

It also provides the keys for getting following information:

1) Status of SIM: present, removed, rejected, etc.

2) Status of GPRS connection: Gprs suspended, context active etc.

3) Status of IRDA connection: IRDA Irlap layer loaded, connected, blocked, etc.

4) Silent Mode: profile silent Activated or not.

5) Network Status: Availability YES/NO.

6) Network Strength: Low, Medium, High, etc.

7) SIM Inbox/Outbox: Empty or Documents inside.

8) Calls forwarding status: All calls, No calls, Only on Line1, etc.

9) Sim Sms Memory Status: Sim Sms Memory Full or Not Full.

10) Sim Ready Status: Indicates if the SIM card is ready to send SIM card contacts information or not.

11) SIM lock status: Sim Lock Active, Restriction ON, etc.

......

Example project

The following sample application is tested in Nokia N71.

Example application

Related Discussions
Thread Thread Starter Forum Replies Last Post
Why session of RTimer can't be shared among thread? rensijie General Symbian C++ 4 2007-08-27 19:00
Phone Book API yjchia Mobile Java General 6 2003-08-11 08:25
MMS message on webserver Romme General Messaging 2 2003-05-28 20:52
Image caching pillar Mobile Java Media (Graphics & Sounds) 2 2006-07-28 00:06
how to retrieve information from cdbv3.dat file symashi General Symbian C++ 1 2005-02-23 09:19
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX