API Documentation

Documentation for developing SailfishOS applications

SimInfo Class


The SimInfo class provides access to SIM card information. More...

Header: #include <mdm-siminfo.h>

Public Types

class SimState
class SlotInfo
enum NetworkRegistrationStatus { UnknownRegistrationStatus, NotRegistered, Registered, SearchingForRegistration, RegistrationDenied, Roaming }
enum PinRequired { SimPinUnknown, SimPinNotRequired, SimPinRequired, SimPukRequired }


Public Functions

SimInfo(QObject *parent = 0)
bool available() const
QList<SlotInfo> cardIdentifier() const
bool hotSwappingSupported() const
QList<SlotInfo> imeiCodes() const
QList<SimState> simSlotStates() const
QList<SlotInfo> subscriberIdentities() const
QList<SlotInfo> subscriberNumbers() const


void availableChanged(bool available)
void simStateChanged(const Sailfish::Mdm::SimInfo::SimState &state)

Detailed Description

The SimInfo class provides access to SIM card information.

The available SIM card information includes IMEI, IMSI, ICCID, and phone number. The information is not valid until available is true.

To use this class, clients must add the following to their qmake project:

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

and then #include <mdm-siminfo.h>.

Example of usage:

 #include <mdm-siminfo.h>
 void printSimInfo(QObject *parent)
     Sailfish::Mdm::SimInfo *info = new Sailfish::Mdm::SimInfo(parent);
     QObject::connect(info, &Sailfish::Mdm::SimInfo::availableChanged, [info] {
         qInfo() << "IMEI(s) :" << info->imeiCodes();
         qInfo() << "IMSI(s) :" << info->subscriberIdentities();
         qInfo() << "ICCID(s):" << info->cardIdentifier();
         qInfo() << "SSN(s)  :" << info->subscriberNumbers();

Member Type Documentation

enum SimInfo::NetworkRegistrationStatus

This enum type specifies the network registration status for a SIM.

Sailfish::Mdm::SimInfo::UnknownRegistrationStatus-1The registration status is unknown
Sailfish::Mdm::SimInfo::NotRegistered0The SIM is not registered to any network
Sailfish::Mdm::SimInfo::Registered1The SIM is registered to the home network
Sailfish::Mdm::SimInfo::SearchingForRegistration2Currently searching for the network for SIM registration
Sailfish::Mdm::SimInfo::RegistrationDenied3Network registration has been denied
Sailfish::Mdm::SimInfo::Roaming4The SIM is registered, but is roaming

enum SimInfo::PinRequired

This enum type specifies a requirement constraint for a SIM PIN.

Sailfish::Mdm::SimInfo::SimPinUnknown-1It is not known if the SIM requires a PIN
Sailfish::Mdm::SimInfo::SimPinNotRequired0No PIN is required to use the SIM
Sailfish::Mdm::SimInfo::SimPinRequired1A PIN code is required to use the SIM
Sailfish::Mdm::SimInfo::SimPukRequired2The SIM has been locked due to incorrect PIN and requires the PUK to be entered to unlock it

Property Documentation

available : const bool

This property holds true if the system service which provides information about SIM cards is available to be queried.

It may be unavailable if the process doesn't have the appropriate permissions to access the service.

Access functions:

bool available() const

Notifier signal:

void availableChanged(bool available)

Member Function Documentation

SimInfo::SimInfo(QObject *parent = 0)

Default constructs an instance of SimInfo.


Destroys the instance of SimInfo.

QList<SlotInfo> SimInfo::cardIdentifier() const

Returns the ICCID code for each SIM card located in the SIM card slots.

Note that this is a synchronous, blocking call.

bool SimInfo::hotSwappingSupported() const

Returns true if SIM can be changed and used without rebooting the system.

QList<SlotInfo> SimInfo::imeiCodes() const

Returns the IMEI code for each SIM card located in the SIM card slots.

Note that this is a synchronous, blocking call.

QList<SimState> SimInfo::simSlotStates() const

Returns detailed information about each SIM card.

Note that this method returns currently cached values, and that the cache is populated asynchronously, triggered when the SimInfo instance is constructed.

You may connect to the simStateChanged() signal to listen for changes to SIM state information.

[signal] void SimInfo::simStateChanged(const Sailfish::Mdm::SimInfo::SimState &state)

This signal is emitted when detailed information about a SIM card inserted into a particular SIM slot changes. The state provides the newly updated information.

QList<SlotInfo> SimInfo::subscriberIdentities() const

Returns the IMSI number for each SIM card located in the SIM card slots.

Note that this is a synchronous, blocking call.

QList<SlotInfo> SimInfo::subscriberNumbers() const

Returns the phone number of each SIM card located in the SIM card slots.

Note that this is a synchronous, blocking call.

We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.