How to change mobile device's Network Mode programmatically in Symbian^3
Article Metadata
Tested with
Devices(s): Nokia N8
Compatibility
Platform(s): Symbian^3
Platform Security
Signing Required: DevCert
Capabilities: NetworkControl
Article
Keywords: RMobilePhone, RMmCustomAPI
Created: User:Kbwiki
(01 Nov 2010)
Last edited: hamishwillee
(03 Jul 2012)
Description
This article describes how to change the global network mode (UMTS/GSM/DualMode) programmatically.
Note: RMmCustomAPI is not part of the Symbian^3 public SDK. See the RMmCustomAPI Class Reference at symlab.org (a small archive/mirror site of symbian.org).
Solution
The following Capabilities and libraries are required:
CAPABILITY NetworkControl LIBRARY etel.lib etelmm.lib customapi.lib
#include <etelmm.h>
#include <e32property.h>
#include <RMmCustomAPI.h>
// Class member variables
RMobilePhone iMobilePhone;
RTelServer iTelServer;
TFileName iTsyName;
RMmCustomAPI iCustomAPI;
Initialisation
// In ConstructL()
User::LeaveIfError(iTelServer.Connect());
User::LeaveIfError(iTelServer.RTelServer::GetTsyName(0,iTsyName));
User::LeaveIfError(iTelServer.LoadPhoneModule(iTsyName));
TInt numPhones;
User::LeaveIfError(iTelServer.EnumeratePhones(numPhones));
if (numPhones < 1)
User::Leave(KErrNotFound);
// Get info about the first available phone
RTelServer::TPhoneInfo info;
User::LeaveIfError(iTelServer.GetPhoneInfo(0, info));
//Use this info to open a connection to the phone
iMobilePhone.Open(iTelServer, info.iName);
User::LeaveIfError(iCustomAPI.Open(iMobilePhone));
Changing the network mode
TInt error = KErrNone;
// To get the current network mode
TUint32 currentNetworkModes;
error = iCustomAPI.GetCurrentSystemNetworkModes(currentNetworkModes);
// To set the Network Mode as GSM
error = iCustomAPI.SetSystemNetworkMode(RMmCustomAPI::KCapsNetworkModeGsm);
// To set the Network Mode as UMTS/3G
error = iCustomAPI.SetSystemNetworkMode(RMmCustomAPI::KCapsNetworkModeUmts);
Releasing resources
iMobilePhone.Close();
iTelServer.Close();


Jlnblade62 - How test this code ?
Hello,
Sorry for my english, i am french. I would try this code but i don't understand how do that.
I work on Qt SDK 1.1.4. I created a new Qt application for mobile and edited the .pro in order to add this : CAPABILITY NetworkControl LIBRARY etel.lib etelmm.lib customapi.lib
The first problem is the configuration... How and where add the different libs ? Moreover, how found this files :
I must define the EPOC path in the project in order to use this file ? If possible, can you give me a zip file that contains a project in order to study how work this code ?
Thanks.Jlnblade62 11:49, 1 February 2012 (EET)