How to Use the API to control the volume of mobile phones

Source: Internet
Author: User

Tint lvol = 6; <br/> tint lerr = irepository-> set (ktelephonyincallearvolume, lvol); <br/> tbuf <10> lbuferr; <br/> lbuferr. appendnum (lerr); <br/> If (lerr = kerrnone) <br/> {<br/> ceikonenv: infowinl (_ L ("phone ear volume set: "), _ L (" successful "); <br/>}< br/> else <br/>{< br/> ceikonenv :: infowinl (_ L ("phone ear volume set err:"), lbuferr); <br/>}</P> <p> lbuferr. zero (); <br/> lerr = irepository-> set (ktelephonyincallloudspeakervolume, lvol); <br/> lbuferr. appendnum (lerr); </P> <p> If (lerr = kerrnone) <br/>{< br/> ceikonenv :: infowinl (_ L ("phone speaker volume set:"), _ L ("successful ")); <br/>}< br/> else <br/> {<br/> ceikonenv: infowinl (_ L ("phone speaker vol set err :"), lbuferr); <br/>}

Cr keys to control phone volume API provides buttons to control the volume of mobile phones during calls.

 

-Ktelephonyincallearvolume and ktelephonyincallloudspeakervolume Cr keys can be used to increase or decrease the phone volume during a call.

 

 

Sample Code

 

Header file:

 

# Include <telephonyinternalcrkeys_partner.h> // Cr keys to control phone volume <br/> # include <centralrepository. h> // crepository 

 

From and ex

Link Library:

Centralrepository. Lib // crepository 

Required capabilities

CAPABILITY    WriteUserData  //required for Setting the Volume:
//Telephony Call Handling Persistent Info API. //This API provides information related to call handling.const TUid KCRUidCallHandling = {0x101F8784}; //Used by phone application, which contains the integer value //of Incall in ear piece betweeen 1-10.const TUint32 KTelephonyIncallEarVolume = 0x00000001; //Used by phone application, which contains the integer value //of Incall in Loud speaker betweeen 1-10.const TUint32 KTelephonyIncallLoudspeakerVolume = 0x00000002;
The call volume of mobile phone headphones and speakers can be controlled by passing the "ktelephonyincallearvolume" and "telephonyincallloudspeakervolume" parameters through the get () method and set () method of crepository.
//To create a CRepository object for accessing Phone Volume repository:iRepository = CRepository::NewL(KCRUidCallHandling);
Run the following code to obtain the headset volume during a call:
TBuf<3> lBufVol;TInt lVol;User::LeaveIfError(iRepository->Get(KTelephonyIncallEarVolume,lVol));lBufVol.AppendNum(lVol);CEikonEnv::InfoWinL(_L("Phone Incall Ear Volume:"),lBufVol);
Run the following code to obtain the speaker volume during a call:
TBuf<3> lBufVol;TInt lVol;User::LeaveIfError(iRepository->Get(KTelephonyIncallLoudspeakerVolume, lVol));lBufVol.AppendNum(lVol);CEikonEnv::InfoWinL(_L("Phone Incall Loud Speaker Volume:"),lBufVol);
The following code sets the volume of the headset or speaker:

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.