1 //#ifndef __TEST_APPCORE_H__
2 //#define __TEST_APPCORE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 * Dali-env provides a stub for appcore used by dali-core on desktop.
23 * This file is used for over-riding appcore functions with test functions
24 * which allow us to do things like simulate orientation change
34 size_t event_data_size;
36 } sensor_event_data_t;
39 void *registered_data = NULL;
42 UNKNOWN_SENSOR = 0x0000,
43 ACCELEROMETER_SENSOR = 0x0001,
44 GEOMAGNETIC_SENSOR = 0x0002,
45 LIGHT_SENSOR = 0x0004,
46 PROXIMITY_SENSOR = 0x0008,
47 THERMOMETER_SENSOR = 0x0010,
48 GYROSCOPE_SENSOR = 0x0020,
49 PRESSURE_SENSOR = 0x0040,
50 MOTION_SENSOR = 0x0080,
53 enum accelerometer_evet_type {
54 ACCELEROMETER_EVENT_ROTATION_CHECK = (ACCELEROMETER_SENSOR<<16) |0x0001,
55 ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME = (ACCELEROMETER_SENSOR<<16) |0x0002,
56 ACCELEROMETER_EVENT_CALIBRATION_NEEDED = (ACCELEROMETER_SENSOR<<16) |0x0004,
60 enum accelerometer_rotate_state {
62 ROTATION_LANDSCAPE_LEFT = 1,
63 ROTATION_PORTRAIT_TOP = 2,
64 ROTATION_PORTRAIT_BTM = 3,
65 ROTATION_LANDSCAPE_RIGHT = 4,
66 ROTATION_EVENT_0 = 2, /*CCW base*/
67 ROTATION_EVENT_90 = 1, /*CCW base*/
68 ROTATION_EVENT_180 = 3, /*CCW base*/
69 ROTATION_EVENT_270 = 4, /*CCW base*/
74 * @see appcore_set_rotation_cb(), appcore_get_rotation_state()
79 APPCORE_RM_PORTRAIT_NORMAL,
81 APPCORE_RM_PORTRAIT_REVERSE,
82 /**< Portrait upside down mode */
83 APPCORE_RM_LANDSCAPE_NORMAL,
84 /**< Left handed landscape mode */
85 APPCORE_RM_LANDSCAPE_REVERSE,
86 /**< Right handed landscape mode */
87 APPCORE_RM_INVALID = 0x99 // undefined
90 int (*rotate_function) (enum appcore_rm, void *) = NULL;
91 bool CallbackInstalled = false;
93 int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *), void *data)
96 registered_data = data;
98 tet_printf("installed rotation call back\n");
99 CallbackInstalled = true;
103 int appcore_unset_rotation_cb(void)
105 rotate_function = NULL;
106 registered_data = NULL;
108 tet_printf("removed rotation call back\n");
110 CallbackInstalled = false;
115 // new function to simulate a change in orientation
116 void appcore_force_orientation(appcore_rm rm)
118 if (CallbackInstalled)
120 rotate_function(rm,registered_data);
131 //#endif // __TEST_APPCORE_H__