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 15:15, 7 December 2007.

How to detect profile

From Forum Nokia Wiki

This sample shows how to detect if the user has selected silent profile (in S60 3rd edition and in older models)

TBool CheckIfSilentMode()
{
#ifdef __SERIES60_3X__
	TBool inSilentMode=EFalse;
 
	CRepository* cr = CRepository::NewLC( KCRUidProfileEngine );
	TInt value;
   // Get the ID of the currently active profile:
/*
* 0 = General profile (default value)<br>
* 1 = Silent profile<br>
* 2 = Meeting profile<br>
* 3 = Outdoor profile<br>
* 4 = Pager profile<br>
* 5 = Off-line profile<br>
* 6 = Drive profile<br>
*/	
      cr->Get( KProEngActiveProfile, value ) ;
      if(value==1||value==2)
		inSilentMode=ETrue;
	cr->Get( KProEngActiveRingingType, value );
	if(value==4) //silent
		inSilentMode=ETrue;
	CleanupStack::PopAndDestroy( cr );
 
#else
_LIT(KProfileDatabase,"c:\\system\\Apps\\profileApp\\dbProfile.db"); 
_LIT(KProfileLookup,"ProfileLookup"); 
_LIT(KProfileStore,"ProfileStore"); 
 
      CPermanentFileStore* fstore =
        CPermanentFileStore::OpenLC(CEikonEnv::Static()->FsSession(),
        KProfileDatabase,EFileRead);    
	RDbStoreDatabase database;    
	database.OpenL(fstore,fstore->Root()); 
	RDbTable table;  
 
	table.Open(database, KProfileLookup); 
	TBool foundactive = EFalse;
	TInt  prfindex=0;
	while (table.NextL() && !foundactive)
	{
		table.GetL();      
		if (!table.IsColNull(6) && (table.ColInt16(6) != 0) )
		{
			foundactive = ETrue;
			prfindex	= table.ColInt16(1);
		}
	}
	table.Close(); 
 
	TBuf<20> tablestr;
	tablestr.Format(_L("PRF%d"),prfindex);
	table.Open(database,tablestr);
 
// first record, field 3 holds call alert
// a value of 4 means silent mode
	table.FirstL();
	table.GetL();      
	TInt value;
	value =  table.ColInt16(3);
	inSilentMode = (value == 4);
	table.Close(); 
 
	database.Close(); 
	CleanupStack::PopAndDestroy(fstore);
#endif
      return inSilentMode;
}

Related Links

Related Discussions
Thread Thread Starter Forum Replies Last Post
6310i and HBH20 philipwilson Bluetooth Technology 1 2003-02-27 05:32
DTL-4 HCRP Profile roderfeld Bluetooth Technology 1 2002-05-23 09:23
Profile for AT Commands rajuk_2004 Bluetooth Technology 1 2007-05-23 12:13
6310i problems with headsets not supporting the handsfree profile jgervais Bluetooth Technology 2 2002-12-04 01:08
CDC profile for Nokia ataulhaque Mobile Java General 2 2007-04-30 04:35
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZaudioQ
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX