Routing a voice call between the earpiece and the loudspeaker on Symbian
Article Metadata
Code Example
Tested with
Compatibility
Article
Contents |
Overview
The CR Keys To Control Phone Volume API included in the SDK API Plug-in package also includes keys for routing the voice call between the earpiece and the loudspeaker.
This snippet requires the following capabilities:
- ReadUserData
- WriteUserData
- ReadDeviceData
- WriteDeviceData
Because of the capability requirements, self-signing is not possible. A Developer Certificate is needed.
MMP file
The following capabilities and libraries are required:
CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData
LIBRARY centralrepository.lib
Source file
The required headers files are:
- include <telephonyinternalcrkeys_partner.h> //from SDK API Plug-in
- include <centralrepository.h> //CRepository
A simple way to switch the voice call routing between the earpiece and the loudspeaker is shown in the code snippet below. The routing mode is changed by reading the value of the Central Repository key and rewriting the opposite value.
TInt mode(-1);
TInt errNo =
RProperty::Get(KTelephonyAudioOutput,
KTelephonyAudioOutputPreference,
mode);
switch(mode)
{
case EPSPrivate:
RProperty::Set(KTelephonyAudioOutput,
KTelephonyAudioOutputPreference,
EPSPublic);
break;
case EPSPublic:
RProperty::Set(KTelephonyAudioOutput,
KTelephonyAudioOutputPreference,
EPSPrivate);
break;
default:
break;
}

