Call Waiting Settings Tutorial

This tutorial describes how to get and set the call waiting settings in a Symbian platform device.

Call waiting settings example

The following code gets the list of call waiting entries, and prints each service group for which call waiting is active. The code assumes iMobilePhone is an RMobilePhone object.

void CClientApp::CallWaitingL()
    {

    // Create and start CW retriever
    CRetrieveMobilePhoneCWList* retrieveCWList = CRetrieveMobilePhoneCWList::NewL(iMobilePhone);
    CleanupStack::PushL(retrieveCWList);

    TRequestStatus status;
    retrieveCWList->Start(status);
    User::WaitForRequest(status);
    User::LeaveIfError(status.Int());

    // Get the list of call waiting entries
    CMobilePhoneCWList* cwList = retrieveCWList->RetrieveListL();
    CleanupStack::PushL(cwList);

    // Print each service group for which CW is active
    TInt nEntries = cwList->Enumerate();
    RMobilePhone::TMobilePhoneCWInfoEntryV1 cwEntry;

    // Names of service groups 
    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++)
        {
         cwEntry = cwList->GetEntryL(i);
         if (cwEntry.iStatus == RMobilePhone::ECallWaitingStatusActive)
            {
             aServiceGroupName = aServiceGroupNameStings[cwEntry.iServiceGroup];
             console->Printf(_L("Call waiting active for service group %d\n"),aServiceGroupName); 
            }
        }

    // Clean up
    CleanupStack::PopAndDestroy(2); // cwList, retrieveCWList    

    }