Namespaces
Variants
Actions
Revision as of 17:05, 30 March 2009 by savaj (Talk | contribs)

How to know Flight mode status

Jump to: navigation, search

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

54 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved