--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(hal-backend-device-haptic C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+INCLUDE_DIRECTORIES(../common)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(haptic_pkgs REQUIRED
+ dlog
+ glib-2.0
+ libsyscommon
+ capi-system-info)
+
+FOREACH(flag ${haptic_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} MODULE emulator.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${haptic_pkgs_LDFLAGS})
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /hal/lib COMPONENT RuntimeLibraries)
--- /dev/null
+/*
+ * Copyright (c) Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <system_info.h>
+#include <libsyscommon/list.h>
+#include <hal/device/hal-haptic-interface.h>
+#include "common.h"
+
+static GList *handle_list;
+static int unique_number = 0;
+
+static int get_device_count(int *count)
+{
+ if (count)
+ *count = 1;
+
+ return 0;
+}
+
+static int open_device(int *device_handle)
+{
+ GList *elem;
+ int handle;
+ bool found = false;
+
+ if (unique_number == INT_MAX)
+ unique_number = 0;
+
+ while (found != true) {
+ ++unique_number;
+ elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)unique_number);
+ if (!elem)
+ found = true;
+ }
+ handle = unique_number;
+ SYS_G_LIST_APPEND(handle_list, (gpointer)(long)handle);
+
+ if (device_handle)
+ *device_handle = handle;
+
+ return 0;
+}
+
+static int close_device(int device_handle)
+{
+ SYS_G_LIST_REMOVE(handle_list, (gpointer)(long)device_handle);
+
+ return 0;
+}
+
+static int vibrate_monotone(int device_handle, int duration, int frequency, int overdrive, int level, int intensity, int priority)
+{
+ GList *elem;
+
+ elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)device_handle);
+ if (!elem)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int stop_device(int device_handle)
+{
+ GList *elem;
+
+ elem = SYS_G_LIST_FIND(handle_list, (gpointer)(long)device_handle);
+ if (!elem)
+ return -EINVAL;
+
+ return 0;
+}
+
+#define MODEL_NAME "http://tizen.org/system/model_name"
+#define MODEL_EMULATOR "Emulator"
+
+bool is_emulator(void)
+{
+ int ret;
+ char *model_name = NULL;
+ static bool emul = false;
+ static int set = 0;
+
+ if (set)
+ return emul;
+
+ ret = system_info_get_platform_string(MODEL_NAME, &model_name);
+ if (ret < 0) {
+ _E("Cannot get model name: %d", ret);
+ return emul;
+ }
+
+ if (!strncmp(MODEL_EMULATOR, model_name, strlen(model_name) + 1))
+ emul = true;
+
+ set = 1;
+ free(model_name);
+
+ return emul;
+}
+
+static bool is_valid(void)
+{
+ if (is_emulator()) {
+ _I("Support emulator haptic device.");
+ return true;
+ }
+
+ _E("Do not support emulator haptic device.");
+ return false;
+}
+
+static int haptic_init(void **data)
+{
+ hal_backend_haptic_funcs *haptic_funcs;
+
+ haptic_funcs = calloc(1, sizeof(hal_backend_haptic_funcs));
+ if (!haptic_funcs)
+ return -ENOMEM;
+
+ haptic_funcs->get_device_count = get_device_count;
+ haptic_funcs->open_device = open_device;
+ haptic_funcs->close_device = close_device;
+ haptic_funcs->vibrate_monotone = vibrate_monotone;
+ haptic_funcs->stop_device = stop_device;
+ haptic_funcs->is_valid = is_valid;
+
+ *data = (void *)haptic_funcs;
+
+ return 0;
+}
+
+static int haptic_exit(void *data)
+{
+ if (!data)
+ return -EINVAL;
+
+ free(data);
+ return 0;
+}
+
+hal_backend EXPORT hal_backend_device_haptic_data = {
+ .name = "haptic",
+ .vendor = "EMUL",
+ .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+ .init = haptic_init,
+ .exit = haptic_exit,
+};