Checking flip cover and camera positions using Symbian C++
Article Metadata
Tested with
Devices(s): Nokia N90
Compatibility
Platform(s): S60 2nd Edition, FP3
Article
Created: User:Technical writer 2
(25 Aug 2005)
Last edited: hamishwillee
(14 Jun 2012)
Overview
The code snippet shows how to check the flip cover and camera position in S60 2nd Edition, FP3.
Description
It is possible to detect flip cover opening/closing events in CEikAppUi::HandleKeyEventL(). The corresponding events (TEventCode) are EEventScreenDeviceChanged, EEventCaseOpened, and EEventCaseClosed. When the camera is rotated, there will be key events of type EEventKeyUp and EEventKeyDown with TKeyEvent::iScanCode values ranging from 234 to 238 depending on its orientation.
Example code for checking the current orientation of camera:
#include <ECam.h> // link against ecam.lib
CCamera* cam = CCamera::NewL(*this, 0);
TCameraInfo info;
cam->CameraInfo(info);
TCameraOrientation orientation = info.iOrientation;
Possible values for the orientation (TCameraOrientation):
- EOrientationOutwards: Outward pointing camera (pictures)
- EOrientationInwards: Inward pointing camera (conferencing)
- EOrientationMobile: Orientation can be changed by the user
- EOrientationUnknown: Orientation is not known
Checking the current position of flip cover:
#include <hal.h> // link against hal.lib
TInt dState; HAL::Get(HALData::EDisplayState, dState);


Hi!
Does this tutorial work on Symbian 2nd edition phones only?
I tried - TInt dState; HAL::Get(HALData::EDisplayState, dState);
but dState is always 1!
Any idea what is causing the problem?