Checking flip cover and camera positions using Symbian C++
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);
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);