How to know Flight mode status
Article Metadata
This is done using GetFlightMode() function from CTelephony class.
- Asynchronous call; so to cancel it use CTelephony::EGetFlightModeCancel
- Sometimes the phone’s software may not support this feature then the method returns KErrNotSupported.
Libraries needed:
LIBRARY Etel3rdParty.lib and euser.lib
Source:
class CClientApp : public CActive
{
private:
CTelephony* iTelephony;
CTelephony::TFlightModeV1 iFlightModeV1;
CTelephony::TFlightModeV1Pckg iFlightModeV1Pckg;
public:
CClientApp(CTelephony* aTelephony);
void FlightModeStatus();
private:
void RunL();
void DoCancel();
};
CClientApp:: CClientApp(CTelephony* aTelephony)
: CActive(EPriorityStandard),
iTelephony(aTelephony),
iFlightModeV1Pckg(iFlightModeV1)
{
//Constructor
}
void CClientApp::FlightModeStatus()
{
iTelephony->GetFlightMode(iStatus, iFlightModeV1Pckg);
SetActive();
}
void CClientApp::RunL()
{
if(iStatus==KErrNone)
{
CTelephony::TFlightModeStatus flightMode = iFlightModeV1.iFlightModeStatus;
if(flightMode == CTelephony::EFlightModeOff)
{} //If Flight mode status is off, all operations will be allowed
}
}
void CClientApp::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetFlightModeCancel);
}


(no comments yet)