summaryrefslogtreecommitdiff
path: root/test/feedback.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/feedback.c')
-rw-r--r--test/feedback.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/test/feedback.c b/test/feedback.c
new file mode 100644
index 0000000..b7ad333
--- /dev/null
+++ b/test/feedback.c
@@ -0,0 +1,120 @@
+/*
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * PROPRIETARY/CONFIDENTIAL
+ *
+ * This software is the confidential and proprietary information of SAMSUNG
+ * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
+ * this software is owned by Samsung and you shall not disclose such
+ * Confidential Information and shall use it only in accordance with the terms
+ * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
+ * make no representations or warranties about the suitability of the software,
+ * either express or implied, including but not limited to the implied
+ * warranties of merchantability, fitness for a particular purpose, or
+ * non-infringement. SAMSUNG shall not be liable for any damages suffered by
+ * licensee arising out of or related to this software.
+ *
+ */
+#include <string.h>
+#include <signal.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef WIDTH
+# define WIDTH 480
+#endif
+
+#ifndef HEIGHT
+# define HEIGHT 640
+#endif
+
+#include <Ecore_Evas.h>
+#include <Ecore.h>
+#include <Edje.h>
+#include <feedback.h>
+
+struct three_axis_s{
+ float x,y,z;
+};
+const float Alpha = 0.8;
+
+struct three_axis_s gravitys = {0,0,0};
+struct three_axis_s linear_accelation = {0,0,0};
+
+
+static void
+efl_resize_window(Ecore_Evas *ee) {
+ Evas_Coord w, h;
+ /* check how big the window is currently */
+ ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
+ /* set the evas-object (edje) to the window size */
+ evas_object_resize(evas_object_top_get(ecore_evas_get(ee)), w, h);
+}
+
+void cb_debug_signal(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ printf("------------ [%s / %s]\n", emission, source);
+}
+void cb_click_btn(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+ printf("------------ [%s / %s]\n", emission, source);
+
+ if (strncmp(source, "key_tap", 7) == 0){
+ feedback_react(FEEDBACK_PATTERN_TOUCH_TAP);
+ }else if (strncmp(source, "key_multi", 9) == 0){
+ feedback_react(FEEDBACK_PATTERN_TOUCH_MULTI_TAP);
+ }else if (strncmp(source, "key_hold", 8) == 0){
+ feedback_react(FEEDBACK_PATTERN_TOUCH_KEY);
+ }else if (strncmp(source, "key_txt", 7) == 0){
+ feedback_react(FEEDBACK_PATTERN_TOUCH_HOLD);
+ }else if (strncmp(source, "key_hw_hold", 11) == 0){
+ feedback_react(FEEDBACK_PATTERN_TOUCH_TAP);
+ }
+}
+
+int
+main(int argc, char **argv){
+ ecore_evas_init();
+
+ Ecore_Evas* ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);
+// ecore_evas_rotation_with_resize_set(ee, 90);
+ ecore_evas_callback_resize_set(ee, efl_resize_window);
+ ecore_evas_title_set(ee, "feedback");
+ ecore_evas_borderless_set(ee, 0);
+ ecore_evas_shaped_set(ee, 0);
+
+ ecore_evas_show(ee);
+ Evas* evas = ecore_evas_get(ee);
+
+ edje_init();
+ feedback_initialize();
+ Evas_Object* edje = edje_object_add(evas);
+
+ if(!edje_object_file_set(edje, "./feedback.edj", "main")){
+ printf("Couldn't load the edje theme. It should be ./feedback.edj\n");
+ return 1;
+ }
+
+ {
+ Evas_Coord w, h;
+
+ evas_object_move(edje, 0, 0);
+ edje_object_signal_callback_add(edje, "DEBUG", "*", cb_debug_signal, edje);
+ edje_object_signal_callback_add(edje, "mouse,down,1", "key_*", cb_click_btn, edje);
+ edje_object_size_min_get(edje, &w, &h);
+ evas_object_resize(edje, w, h);
+ evas_object_show(edje);
+ ecore_evas_resize(ee, (int)w, (int)h);
+ ecore_evas_show(ee);
+ }
+
+ ecore_main_loop_begin();
+
+ edje_shutdown();
+ evas_shutdown();
+ feedback_deinitialize();
+
+ return 0;
+}
+