This tutorial describes how to get the current and home network information using the RMobilePhone functions.
Use the RMobilePhone functions to get information about the current, home, and detected networks.
To query what network information is available, use RMobilePhone::GetNetworkCaps(). The RMobilePhone functions are used to get the network information.
CRetrieveMobilePhoneDetectedNetworks is provided to get a list of all the detected networks.
The following code checks if the information about the current network can be obtained, and if so, gets that information, and reads from it the full network name.
The code assumes iMobilePhone is an RMobilePhone object.
TUint32 networkCaps; User::LeaveIfError(iMobilePhone.GetNetworkCaps(networkCaps)); RMobilePhone::TMobilePhoneNetworkLongName networkName; if (networkCaps & RMobilePhone::KCapsGetCurrentNetwork) { RMobilePhone::TMobilePhoneNetworkInfoV1 mobilePhoneNetworkInfo; RMobilePhone::TMobilePhoneNetworkInfoV1Pckg mobilePhoneNetworkInfoPckg(mobilePhoneNetworkInfo); RMobilePhone::TMobilePhoneLocationAreaV1 mobilePhoneLocationArea; TRequestStatus status; iMobilePhone.GetCurrentNetwork(status, mobilePhoneNetworkInfoPckg, mobilePhoneLocationArea); User::WaitForRequest(status); User::LeaveIfError(status.Int()); networkName = mobilePhoneNetworkInfo.iLongName; }
After retrieving the network information, the device has to selects a network to use. See Mobile Network Selection Tutorial for more information on how to get and set the parameters to select a network.
Once a network is selected the user decides to automatically update the date and time from the network. See Network Date and Time Tutorial for more information on how to receive date and time from the network.
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.