4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11 * Anastasia Lyupa <a.lyupa@samsung.com>
13 * This library is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU Lesser General Public License as published by the
15 * Free Software Foundation; either version 2.1 of the License, or (at your option)
18 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21 * License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library; if not, write to the Free Software Foundation, Inc., 51
25 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * - Samsung RnD Institute Russia
33 #include <appfw/app.h>
34 #include <runtime_info.h>
45 #include "real_functions.h"
47 static int external_angle = 0;
48 static int internal_angle = 0;
50 // ===================================================================
51 // orientation related functions
52 // ===================================================================
54 static int convert_angle(int angle)
64 os = _OS_LANDSCAPE_REVERSE;
67 os = _OS_PORTRAIT_REVERSE;
79 void on_orientation_changed(int angle, bool capi)
81 probeInfo_t probeInfo;
85 internal_angle = angle;
86 external_angle = internal_angle;
88 if(isOptionEnabled(OPT_EVENT))
90 setProbePoint(&probeInfo);
93 PACK_COMMON_BEGIN(MSG_PROBE_UIEVENT,
94 API_ID_on_orientation_changed,
95 "dd", angle, (uint32_t)capi);
96 PACK_COMMON_END('v', 0, 0, 0);
97 PACK_UIEVENT(_EVENT_ORIENTATION, 0, 0, 0, "", convert_angle(external_angle));
104 // SCREENSHOT_DONE();
112 return external_angle;
115 // ====================================================================
116 // initialize and finalize event
117 // ====================================================================
119 int initialize_event()
121 external_angle = internal_angle = app_get_device_orientation();