Checking flip cover and camera positions using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N90
Platform(s): S60 2nd Edition, FP3
S60 2nd Edition (initial release)
Created: User:Technical writer 2 (25 Aug 2005)
Last edited: hamishwillee (14 Jun 2012)


The code snippet shows how to check the flip cover and camera position in S60 2nd Edition, FP3.


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;
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);
This page was last modified on 14 June 2012, at 06:28.
45 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.