|
|
Classification: |
C++ |
Category: |
Telephony (ETel) |
Created: |
11/13/2001 |
Modified: |
12/03/2001 |
Number: |
FAQ-0750 |
Platform: |
Not Applicable |
|
Question: How do I find out whether the phone is on or off from within an application?
Answer: You can use the GetState(KUidPhonePwr) method of RSystemAgent. The RSystemAgent class is included in sysagt.lib. A value of
TInt status equal to 1 indicates the phone is on, whilst a return value of 0 indicates the phone is off. Other values indicate
an error. The code fragment shown below shows how this method may be used.
#include #include .....
RSystemAgent iSysAgent; TInt error = iSysAgent.Connect(); TInt status = iSysAgent.GetState(KUidPhonePwr); iSysAgent.Close();
The GetState(...) method returns a KErrUnknown (-19) value when used under emulation. This API is supported from Symbian OS v6.0.
|
|
|