×
Namespaces

Variants
Actions

How to know Flight mode status

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: polaka_sr (20 Dec 2007)
Last edited: hamishwillee (26 Jul 2012)

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);
}



Wiki Internal Links

This page was last modified on 26 July 2012, at 05:41.
51 page views in the last 30 days.
×