This tutorial describes how to get and set the call barring settings in a Symbian platform device.
The Call Barring supplementary service of the GSM prevents the subscriber from making or receiving certain types of call. CDMA does not have this service, though phone manufacturers can prevent certain call types by using internal settings.
The following code gets the list of call barring entries for outgoing international calls, and prints each service group for which call barring is active.
The code assumes iMobilePhone is an RMobilePhone object.
void CClientApp::CallBarringL() { // Create and start CB retriever for outgoing international calls CRetrieveMobilePhoneCBList* retrieveCBList = CRetrieveMobilePhoneCBList::NewL(iMobilePhone); CleanupStack::PushL(retrieveCBList); TRequestStatus status; retrieveCBList->Start(status, RMobilePhone::EBarOutgoingInternational); User::WaitForRequest(status); User::LeaveIfError(status.Int()); // Get the list of call barring entries CMobilePhoneCBList* cbList = retrieveCBList->RetrieveListL(); CleanupStack::PushL(cbList); // Print each service group for which CB active TInt nEntries = cbList->Enumerate(); RMobilePhone::TMobilePhoneCBInfoEntryV1 cbEntry; TText* aServiceGroupNameStings[]={_S("Unspecified"), _S("Voice"), _S("Auxiliary Voice"), _S("CSD"),_S("Packet"),_S("Fax"),_S("SMS"),_S("All")}; TPtr aServiceGroupName(NULL,20); for (TInt i=0; i<=nEntries; i++) { cbEntry = cbList->GetEntryL(i); if (cbEntry.iStatus == RMobilePhone::ECallBarringStatusActive) { aServiceGroupName = aServiceGroupNameStings[cbEntry.iServiceGroup]; console->Printf(_L("Outgoing international barring set for %S\n"), aServiceGroupName); } } // Clean up CleanupStack::PopAndDestroy(2); // cbList, retrieveCBList }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.