Get MCC MNC in Qt for Symbian
This article shows how to reliably get the phone MCC and MNC from Symbian device using a Qt Mobile Extension. Note that at time of writing (Qt Mobility 1.0) this article has not been superseded by the Qt Mobility API because even though the MCC and MNC can be derived from the IMSI (QSystemDeviceInfo:imsi) this process is not reliable.
S60 5th Edition
The IMSI is a 15 digit number. The first 3 digits of IMSI are the MCC, and is followed by the MNC, either 2 digits (European standard) or 3 digits (North American standard). Because the MNC length may differ, getting the MCC and MNC from IMSI is not always safe. The code given gets the MCC and MNC from the Symbian CTelephony::GetCurrentNetworkInfo() API.
- Install Qt with a standalone SDK: Archived:Using Qt with Standalone SDKs
- Download File:ExtXQSysInfo.zip and extract to your project directory.
- Edit your .pro file as below.
Note: These files are extended from source file of XQSysInfo API. I have edited some file of XQSysInfo API to get MCC and MNC. XQSysInfo::mcc() return MCC and XQSysInfo::mnc() returns MNC.
All source files are automatically added to .pro file by carbide, so need to add the libraries and capability only.
symbian:LIBS += -letel3rdparty \
symbian:TARGET.CAPABILITY = ReadDeviceData
XQSysInfo *sysInfo = new XQSysInfo(this);
/* show MCC on label */
ui.label->setText("MCC: " + sysInfo->mcc());
/* show MNC on label */
ui.label_2->setText("MNC: " + sysInfo->mnc());
The code snippet is expected to show MCC MNC on screen as showm bellow.
Download Code Example
- The Code Example will show MCC and MNC on screen and is tested on Nokia 5800 XpressMusic.