Merge branch 'features/brillcodec_2i' into 'tizen_next' 82/31082/1
authorKitae Kim <kt920.kim@samsung.com>
Mon, 1 Dec 2014 08:10:20 +0000 (17:10 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Mon, 1 Dec 2014 09:43:24 +0000 (18:43 +0900)
Conflicts:
configure
package/changelog
package/pkginfo.manifest
target-i386/hax-all.c
tizen/src/Makefile
tizen/src/display/maru_display.c
tizen/src/display/maru_sdl.c
tizen/src/display/maru_shm.c
tizen/src/display/maru_shm.h
tizen/src/eventcast/encode_fb.c
tizen/src/eventcast/encode_fb.h
tizen/src/eventcast/touch.c
tizen/src/eventcast/touch.h
tizen/src/hw/pci/Makefile.objs
tizen/src/hw/pci/maru_brillcodec.c
tizen/src/hw/pci/maru_brillcodec.h
tizen/src/hw/pci/maru_brillcodec_device.c
tizen/src/tethering/Makefile.objs
tizen/src/tethering/common.c
tizen/src/util/new_debug_ch.c
tizen/src/util/osutil.h
vl.c

Change-Id: Iab1486003ec796882e52647d08518624db664cdc

147 files changed:
.gitignore
Makefile.target
block/vhdx.c
configure
coroutine-win32.c
cpu-exec.c
cpus.c
exec.c
fsdev/qemu-fsdev.c
fsdev/qemu-fsdev.h
hax-stub.c
hw/9pfs/virtio-9p-device.c
hw/9pfs/virtio-9p-local-maru.c
hw/9pfs/virtio-9p-maru.c
hw/acpi/ich9.c
hw/acpi/piix4.c
hw/i386/pc.c
hw/net/eepro100.c
hw/net/ne2000-isa.c
hw/vigs/vigs_device.c
hw/yagl/yagl_device.c
hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c
include/sysemu/hax.h
include/sysemu/kvm.h
include/sysemu/sysemu.h
main-loop.c
package/changelog
package/emulator-qemu-x86.install.ubuntu-32
package/emulator-qemu-x86.install.ubuntu-64
package/pkginfo.manifest
qga/channel-win32.c
slirp/slirp.c
target-i386/hax-all.c
target-i386/hax-darwin.c
target-i386/hax-darwin.h
target-i386/hax-i386.h
target-i386/hax-interface.h
target-i386/hax-windows.c
target-i386/hax-windows.h
target-i386/translate.c
tizen/emulator_configure.sh
tizen/src/Makefile
tizen/src/Makefile.objs
tizen/src/display/Makefile.objs
tizen/src/display/maru_display.c
tizen/src/display/maru_display.h
tizen/src/display/maru_finger.c
tizen/src/display/maru_sdl.c
tizen/src/display/maru_sdl.h
tizen/src/display/maru_sdl_processing.c
tizen/src/display/maru_shm.c
tizen/src/display/maru_shm.h
tizen/src/ecs/Makefile.objs
tizen/src/ecs/ecs.c
tizen/src/ecs/ecs.h
tizen/src/ecs/ecs_eventcast.c [new file with mode: 0644]
tizen/src/ecs/ecs_eventcast.h [moved from tizen/src/ecs/ecs_tethering.h with 51% similarity]
tizen/src/ecs/ecs_mon.c
tizen/src/ecs/ecs_msg.c
tizen/src/ecs/ecs_msg_device.c [new file with mode: 0644]
tizen/src/ecs/ecs_msg_injector.c [new file with mode: 0644]
tizen/src/ecs/ecs_nfc.c [new file with mode: 0644]
tizen/src/ecs/ecs_tethering.c [deleted file]
tizen/src/ecs/genmsg/ecs.pb-c.c
tizen/src/ecs/genmsg/ecs.pb-c.h
tizen/src/ecs/genmsg/ecs_ids.pb-c.c
tizen/src/ecs/genmsg/ecs_ids.pb-c.h
tizen/src/ecs/msg/ecs.proto
tizen/src/ecs/msg/ecs_ids.proto
tizen/src/emul_state.c
tizen/src/emul_state.h
tizen/src/emulator.c
tizen/src/emulator_options.c
tizen/src/eventcast/Makefile.objs [moved from tizen/src/tethering/Makefile.objs with 70% similarity]
tizen/src/eventcast/common.c [moved from tizen/src/tethering/common.c with 55% similarity]
tizen/src/eventcast/common.h [moved from tizen/src/tethering/common.h with 75% similarity]
tizen/src/eventcast/encode_fb.c [moved from tizen/src/tethering/encode_fb.c with 91% similarity]
tizen/src/eventcast/encode_fb.h [moved from tizen/src/tethering/encode_fb.h with 83% similarity]
tizen/src/eventcast/genmsg/eventcast.pb-c.c [new file with mode: 0644]
tizen/src/eventcast/genmsg/eventcast.pb-c.h [new file with mode: 0644]
tizen/src/eventcast/msg/eventcast.proto [moved from tizen/src/tethering/msg/tethering.proto with 90% similarity]
tizen/src/eventcast/sensor.c [moved from tizen/src/tethering/sensor.c with 57% similarity]
tizen/src/eventcast/sensor.h [moved from tizen/src/tethering/sensor.h with 81% similarity]
tizen/src/eventcast/touch.c [moved from tizen/src/tethering/touch.c with 57% similarity]
tizen/src/eventcast/touch.h [moved from tizen/src/tethering/touch.h with 82% similarity]
tizen/src/hw/maru_board.c
tizen/src/hw/maru_pm.c
tizen/src/hw/pci/Makefile.objs
tizen/src/hw/pci/maru_brightness.c
tizen/src/hw/pci/maru_camera_common_pci.c
tizen/src/hw/pci/maru_camera_darwin_converter.c
tizen/src/hw/pci/maru_camera_darwin_pci.m
tizen/src/hw/pci/maru_camera_linux_pci.c
tizen/src/hw/pci/maru_camera_win32_interface.h
tizen/src/hw/pci/maru_camera_win32_pci.c
tizen/src/hw/pci/maru_codec.c [deleted file]
tizen/src/hw/pci/maru_codec.h [deleted file]
tizen/src/hw/usb/maru_usb_touchscreen.c
tizen/src/hw/virtio/maru_virtio_esm.c
tizen/src/hw/virtio/maru_virtio_evdi.c
tizen/src/hw/virtio/maru_virtio_jack.c
tizen/src/hw/virtio/maru_virtio_jack.h
tizen/src/hw/virtio/maru_virtio_keyboard.c
tizen/src/hw/virtio/maru_virtio_nfc.c
tizen/src/hw/virtio/maru_virtio_nfc.h
tizen/src/hw/virtio/maru_virtio_power.c
tizen/src/hw/virtio/maru_virtio_sensor.c
tizen/src/hw/virtio/maru_virtio_touchscreen.c
tizen/src/hw/virtio/maru_virtio_vmodem.c
tizen/src/skin/client/build.xml
tizen/src/skin/client/native_src/make_so_mac.sh
tizen/src/skin/client/native_src/share.c
tizen/src/skin/client/skins/wearable-360x480-1btn/default.dbi [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_0.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_0_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_180.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_180_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/wearable-360x480-1btn/info.ini [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/PopupMenu.java
tizen/src/skin/maruskin_client.c
tizen/src/skin/maruskin_keymap.c
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_server.c
tizen/src/tethering/genmsg/tethering.pb-c.c [deleted file]
tizen/src/tethering/genmsg/tethering.pb-c.h [deleted file]
tizen/src/util/check_gl_core.c
tizen/src/util/maru_device_hotplug.c
tizen/src/util/maru_device_hotplug.h
tizen/src/util/maru_err_table.c
tizen/src/util/new_debug_ch.c
tizen/src/util/new_debug_ch.h
tizen/src/util/osutil-darwin.c
tizen/src/util/osutil-linux.c
tizen/src/util/osutil-win32.c
tizen/src/util/osutil.c
tizen/src/util/osutil.h
tizen/src/util/sdb.c
ui/spice-core.c
ui/spice-display.c
util/qemu-sockets.c
version.rc
vl.c

index b256258..ac62109 100644 (file)
@@ -69,6 +69,8 @@ libuser
 *.exe
 *.dll
 *.so
+*.dylib
+/.DS_Store
 *.mo
 *.fn
 *.ky
index ce58578..742d2d0 100644 (file)
@@ -126,12 +126,11 @@ obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
 # HAX support
 ifdef CONFIG_WIN32
 obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-windows.o
-obj-$(CONFIG_NO_HAX) += hax-stub.o
 endif
 ifdef CONFIG_DARWIN
 obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-darwin.o
-obj-$(CONFIG_NO_HAX) += hax-stub.o
 endif
+obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
index 509baaf..14ba8b2 100644 (file)
@@ -99,7 +99,8 @@ static const MSGUID logical_sector_guid = { .data1 = 0x8141bf1d,
 /* Each parent type must have a valid GUID; this is for parent images
  * of type 'VHDX'.  If we were to allow e.g. a QCOW2 parent, we would
  * need to make up our own QCOW2 GUID type */
-static const MSGUID parent_vhdx_guid = { .data1 = 0xb04aefb7,
+static const MSGUID parent_vhdx_guid __attribute__((unused))
+                                     = { .data1 = 0xb04aefb7,
                                          .data2 = 0xd19e,
                                          .data3 = 0x4a81,
                                          .data4 = { 0xb7, 0x89, 0x25, 0xb8,
index b4feed2..a88fa73 100755 (executable)
--- a/configure
+++ b/configure
@@ -4958,15 +4958,6 @@ echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
 if test "$trace_default" = "yes"; then
   echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
 fi
-if test "$hax" = "yes" ; then
-  if test "$mingw32" = "yes" ; then
-    echo "CONFIG_HAX_BACKEND=y" >> $config_host_mak
-  elif test "$darwin" = "yes" ; then
-    echo "CONFIG_HAX_BACKEND=y" >> $config_host_mak
-  else
-    hax="no"
-  fi
-fi
 
 if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
index edc1f72..17ace37 100644 (file)
@@ -36,8 +36,17 @@ typedef struct
 static __thread CoroutineWin32 leader;
 static __thread Coroutine *current;
 
-CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
-                                      CoroutineAction action)
+/* This function is marked noinline to prevent GCC from inlining it
+ * into coroutine_trampoline(). If we allow it to do that then it
+ * hoists the code to get the address of the TLS variable "current"
+ * out of the while() loop. This is an invalid transformation because
+ * the SwitchToFiber() call may be called when running thread A but
+ * return in thread B, and so we might be in a different thread
+ * context each time round the loop.
+ */
+CoroutineAction __attribute__((noinline))
+qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
+                      CoroutineAction action)
 {
     CoroutineWin32 *from = DO_UPCAST(CoroutineWin32, base, from_);
     CoroutineWin32 *to = DO_UPCAST(CoroutineWin32, base, to_);
index c07c8af..64a6150 100644 (file)
@@ -223,8 +223,7 @@ volatile sig_atomic_t exit_request;
 static int need_handle_intr_request(CPUState *cpu)
 {
 #ifdef CONFIG_HAX
-    CPUArchState *env = cpu->env_ptr;
-    if (!hax_enabled() || hax_vcpu_emulation_mode(env))
+    if (!hax_enabled() || hax_vcpu_emulation_mode(cpu))
         return cpu->interrupt_request;
     return 0;
 #else
@@ -333,7 +332,7 @@ int cpu_exec(CPUArchState *env)
             }
 
 #ifdef CONFIG_HAX
-            if (hax_enabled() && !hax_vcpu_exec(env))
+            if (hax_enabled() && !hax_vcpu_exec(cpu))
                 longjmp(cpu->jmp_env, 1);
 #endif
 
@@ -711,7 +710,7 @@ int cpu_exec(CPUArchState *env)
                 }
                 cpu->current_tb = NULL;
 #ifdef CONFIG_HAX
-                if (hax_enabled() && hax_stop_emulation(env))
+                if (hax_enabled() && hax_stop_emulation(cpu))
                     cpu_loop_exit(cpu);
 #endif
                 /* reset soft MMU for next block (it can currently
diff --git a/cpus.c b/cpus.c
index 7d86bdd..0b3a7c5 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -511,6 +511,10 @@ void cpu_synchronize_all_post_reset(void)
 
     CPU_FOREACH(cpu) {
         cpu_synchronize_post_reset(cpu);
+#ifdef CONFIG_HAX
+        if (hax_enabled() && hax_ug_platform())
+            hax_cpu_synchronize_post_reset(cpu);
+#endif
     }
 }
 
@@ -520,6 +524,10 @@ void cpu_synchronize_all_post_init(void)
 
     CPU_FOREACH(cpu) {
         cpu_synchronize_post_init(cpu);
+#ifdef CONFIG_HAX
+        if (hax_enabled() && hax_ug_platform())
+            hax_cpu_synchronize_post_init(cpu);
+#endif
     }
 }
 
@@ -837,6 +845,17 @@ static void qemu_tcg_wait_io_event(void)
     }
 }
 
+#ifdef CONFIG_HAX
+static void qemu_hax_wait_io_event(CPUState *cpu)
+{
+    while (cpu_thread_is_idle(cpu)) {
+        qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
+    }
+
+    qemu_wait_io_event_common(cpu);
+}
+#endif
+
 static void qemu_kvm_wait_io_event(CPUState *cpu)
 {
     while (cpu_thread_is_idle(cpu)) {
@@ -966,6 +985,35 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
     return NULL;
 }
 
+#ifdef CONFIG_HAX
+static void *qemu_hax_cpu_thread_fn(void *arg)
+{
+    CPUState *cpu = arg;
+    int r;
+    qemu_thread_get_self(cpu->thread);
+    qemu_mutex_lock(&qemu_global_mutex);
+
+    cpu->thread_id = qemu_get_thread_id();
+    cpu->created = true;
+    cpu->halted = 0;
+    current_cpu = cpu;
+
+    hax_init_vcpu(cpu);
+    qemu_cond_signal(&qemu_cpu_cond);
+
+    while (1) {
+        if (cpu_can_run(cpu)) {
+            r = hax_smp_cpu_exec(cpu);
+            if (r == EXCP_DEBUG) {
+                cpu_handle_guest_debug(cpu);
+            }
+        }
+        qemu_hax_wait_io_event(cpu);
+    }
+    return NULL;
+}
+#endif
+
 static void qemu_cpu_kick_thread(CPUState *cpu)
 {
 #ifndef _WIN32
@@ -979,9 +1027,13 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
 /* The cpu thread cannot catch it reliably when shutdown the guest on Mac.
  * We can double check it and resend it
  */
+
 #ifdef CONFIG_DARWIN
     if (!exit_request)
         cpu_signal(0);
+
+        if (hax_enabled() && hax_ug_platform())
+            cpu->exit_request = 1;
 #endif
 #else /* _WIN32 */
     if (!qemu_cpu_is_self(cpu)) {
@@ -1002,6 +1054,8 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
         }
 
         cpu_signal(0);
+        if(hax_enabled()  && hax_ug_platform())
+            cpu->exit_request = 1;
 
         if (ResumeThread(cpu->hThread) == (DWORD)-1) {
             fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__,
@@ -1015,7 +1069,11 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
 void qemu_cpu_kick(CPUState *cpu)
 {
     qemu_cond_broadcast(cpu->halt_cond);
+#ifdef CONFIG_HAX
+    if (((hax_enabled()  && hax_ug_platform()) || !tcg_enabled()) && !cpu->thread_kicked) {
+#else
     if (!tcg_enabled() && !cpu->thread_kicked) {
+#endif
         qemu_cpu_kick_thread(cpu);
         cpu->thread_kicked = true;
     }
@@ -1047,7 +1105,11 @@ static bool qemu_in_vcpu_thread(void)
 
 void qemu_mutex_lock_iothread(void)
 {
+#ifdef CONFIG_HAX
+    if ((hax_enabled() && hax_ug_platform()) || !tcg_enabled()) {
+#else
     if (!tcg_enabled()) {
+#endif
         qemu_mutex_lock(&qemu_global_mutex);
     } else {
         iothread_requesting_mutex = true;
@@ -1130,8 +1192,8 @@ void resume_all_vcpus(void)
 static void qemu_tcg_init_vcpu(CPUState *cpu)
 {
 #ifdef CONFIG_HAX
-       if (hax_enabled())
-               hax_init_vcpu(cpu->env_ptr);
+    if (hax_enabled())
+        hax_init_vcpu(cpu);
 #endif
     char thread_name[VCPU_THREAD_NAME_SIZE];
 
@@ -1160,6 +1222,29 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
     }
 }
 
+#ifdef CONFIG_HAX
+static void qemu_hax_start_vcpu(CPUState *cpu)
+{
+    char thread_name[VCPU_THREAD_NAME_SIZE];
+
+    cpu->thread = g_malloc0(sizeof(QemuThread));
+    cpu->halt_cond = g_malloc0(sizeof(QemuCond));
+    qemu_cond_init(cpu->halt_cond);
+
+    snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/HAX",
+             cpu->cpu_index);
+
+    qemu_thread_create(cpu->thread, thread_name, qemu_hax_cpu_thread_fn,
+                       cpu, QEMU_THREAD_JOINABLE);
+#ifdef _WIN32
+        cpu->hThread = qemu_thread_get_handle(cpu->thread);
+#endif
+    while (!cpu->created) {
+        qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
+    }
+}
+#endif
+
 static void qemu_kvm_start_vcpu(CPUState *cpu)
 {
     char thread_name[VCPU_THREAD_NAME_SIZE];
@@ -1197,8 +1282,13 @@ void qemu_init_vcpu(CPUState *cpu)
     cpu->nr_cores = smp_cores;
     cpu->nr_threads = smp_threads;
     cpu->stopped = true;
+
     if (kvm_enabled()) {
         qemu_kvm_start_vcpu(cpu);
+#ifdef CONFIG_HAX
+    } else if (hax_enabled() && hax_ug_platform()) {
+        qemu_hax_start_vcpu(cpu);
+#endif
     } else if (tcg_enabled()) {
         qemu_tcg_init_vcpu(cpu);
     } else {
diff --git a/exec.c b/exec.c
index b6035d5..2c26903 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1297,7 +1297,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
              */
             if (hax_enabled()) {
                 int ret;
-                ret = hax_populate_ram((uint64_t)(intptr_t)new_block->host, size);
+                ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, size);
                 if (ret < 0) {
                     fprintf(stderr, "Hax failed to populate ram\n");
                     exit(-1);
index b54adce..42cff15 100644 (file)
@@ -101,3 +101,20 @@ FsDriverEntry *get_fsdev_fsentry(char *id)
     }
     return NULL;
 }
+
+void qemu_fsdev_remove(const char * const id)
+{
+    if (id) {
+        struct FsDriverListEntry *fsle;
+
+        QTAILQ_FOREACH(fsle, &fsdriver_entries, next) {
+            if (strcmp(fsle->fse.fsdev_id, id) == 0) {
+                QTAILQ_REMOVE(&fsdriver_entries, fsle, next);
+                g_free(fsle->fse.fsdev_id);
+                g_free(fsle);
+                break;
+            }
+        }
+    }
+}
+
index 9fa45bf..df69094 100644 (file)
@@ -40,6 +40,7 @@ typedef struct FsDriverListEntry {
 } FsDriverListEntry;
 
 int qemu_fsdev_add(QemuOpts *opts);
+void qemu_fsdev_remove(const char * const id);
 FsDriverEntry *get_fsdev_fsentry(char *id);
 extern FileOperations local_ops;
 extern FileOperations handle_ops;
index 456caa8..8620f5b 100644 (file)
 
 #include "sysemu/hax.h"
 
+bool hax_allowed;
+
 int hax_sync_vcpus(void)
 {
     return 0;
 }
 
-int hax_accel_init(void)
-{
-   return 0;
-}
-
-void hax_disable(int disable)
+int hax_accel_init(uint64_t ram_size)
 {
-   return;
+   return -ENOSYS;
 }
 
-int hax_pre_init(uint64_t ram_size)
+int hax_ug_platform(void)
 {
-   return 0;
-}
-
-int hax_enabled(void)
-{
-   return 0;
+    return 0;
 }
index 519b6e3..05dd759 100644 (file)
@@ -107,11 +107,11 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp)
         error_setg(errp, "Virtio-9p Failed to initialize fs-driver with id:%s"
                    " and export path:%s", s->fsconf.fsdev_id, s->ctx.fs_root);
 #ifdef CONFIG_MARU
-        char *path = get_canonical_path(s->ctx.fs_root);
-        maru_register_exit_msg(MARU_EXIT_UNKNOWN, "Failed to find the file sharing path."
-                    " Check if the path is correct or not.\n\n%s", path);
-
-        g_free(path);
+        gchar *canonical_path = get_canonical_path(s->ctx.fs_root);
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN,
+            "Virtio-9p Failed to initialize fs-driver with id: %s"
+            " and export path: %s", s->fsconf.fsdev_id, canonical_path);
+        g_free(canonical_path);
 #endif
         goto out;
     }
@@ -130,19 +130,31 @@ static void virtio_9p_device_realize(DeviceState *dev, Error **errp)
     if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
 #else
     if (s->ops->name_to_path(&s->ctx, NULL, "\\", &path) < 0) {
-#endif
+#endif /* CONFIG_WIN32 */
 #else
     if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
-#endif
+#endif /* CONFIG_MARU */
         error_setg(errp,
                    "error in converting name to path %s", strerror(errno));
         goto out;
     }
     if (s->ops->lstat(&s->ctx, &path, &stat)) {
         error_setg(errp, "share path %s does not exist", fse->path);
+#ifdef CONFIG_MARU
+        gchar *canonical_path = get_canonical_path(fse->path);
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN,
+            "share path %s does not exist", canonical_path);
+        g_free(canonical_path);
+#endif
         goto out;
     } else if (!S_ISDIR(stat.st_mode)) {
         error_setg(errp, "share path %s is not a directory", fse->path);
+#ifdef CONFIG_MARU
+        gchar *canonical_path = get_canonical_path(fse->path);
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN,
+            "share path %s is not a directory", canonical_path);
+        g_free(canonical_path);
+#endif
         goto out;
     }
     v9fs_path_free(&path);
index 5ca2d15..2147fd2 100644 (file)
@@ -50,7 +50,7 @@
 #endif
 
 #include "tizen/src/util/new_debug_ch.h"
-DECLARE_DEBUG_CHANNEL(9p_local);
+DECLARE_DEBUG_CHANNEL(9pfs_local);
 
 #ifndef XFS_SUPER_MAGIC
 #define XFS_SUPER_MAGIC  0x58465342
@@ -250,7 +250,7 @@ err_out:
         GetDiskFreeSpace(RootPathName, NULL, &BytesPerSector, NULL, NULL);
         hostBytesPerSector = BytesPerSector;
     }
-    err = _stat(pathname, stbuf);
+    err = stat(pathname, stbuf);
 
     /* Modify the permission to 777 except the directories. */
     stbuf->st_mode = stbuf->st_mode | 0777;
@@ -334,9 +334,8 @@ update_map_file:
     if (credp->fc_gid != -1) {
         gid = credp->fc_gid;
     }
-// FIXME
 #ifndef CONFIG_WIN32
-    if (credp->fc_mode != -1) {
+    if (credp->fc_mode != (mode_t)-1) {
         mode = credp->fc_mode;
     }
 #else
@@ -420,7 +419,7 @@ static int local_set_xattr(const char *path, FsCred *credp)
              return err;
          }
      }
-     if (credp->fc_mode != -1) {
+     if (credp->fc_mode != (mode_t)-1) {
          err = setxattr(path, "user.virtfs.mode", &credp->fc_mode,
                  sizeof(mode_t), 0, 0);
          if (err) {
@@ -1313,7 +1312,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path,
         gettimeofday(&tv_now, NULL);
     }
     if (buf[0].tv_nsec == UTIME_OMIT || buf[1].tv_nsec == UTIME_OMIT) {
-        _stat(r_path, &st);
+        stat(r_path, &st);
     }
 
     for (i = 0; i < 2; i++) {
@@ -1345,7 +1344,7 @@ static int local_remove(FsContext *ctx, const char *path)
 #ifndef CONFIG_WIN32
         err =  lstat(buffer, &stbuf);
 #else
-        err = _stat(buffer, &stbuf);
+        err = stat(buffer, &stbuf);
 #endif
         g_free(buffer);
         if (err) {
index 9556dbd..0811794 100644 (file)
@@ -57,7 +57,7 @@ extern uint64_t hostBytesPerSector;
 #endif
 
 #include "../../tizen/src/debug_ch.h"
-MULTI_DEBUG_CHANNEL(tizen, qemu_9p_test);
+MULTI_DEBUG_CHANNEL(tizen, 9pfs);
 
 int open_fd_hw;
 int total_open_fd;
index 0afac42..8e4e972 100644 (file)
@@ -31,6 +31,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/acpi/acpi.h"
 #include "sysemu/kvm.h"
+#include "sysemu/hax.h"
 #include "exec/address-spaces.h"
 
 #include "hw/i386/ich9.h"
@@ -169,7 +170,7 @@ static void pm_reset(void *opaque)
     acpi_pm_tmr_reset(&pm->acpi_regs);
     acpi_gpe_reset(&pm->acpi_regs);
 
-    if (kvm_enabled()) {
+    if (kvm_enabled()||hax_enabled()) {
         /* Mark SMM as already inited to prevent SMM from running. KVM does not
          * support SMM mode. */
         pm->smi_en |= ICH9_PMIO_SMI_EN_APMC_EN;
index 4188e09..9bfea6c 100644 (file)
@@ -25,6 +25,7 @@
 #include "hw/pci/pci.h"
 #include "hw/acpi/acpi.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/hax.h"
 #include "qemu/range.h"
 #include "exec/ioport.h"
 #include "hw/nvram/fw_cfg.h"
@@ -298,7 +299,7 @@ static void piix4_reset(void *opaque)
     pci_conf[0x40] = 0x01; /* PM io base read only bit */
     pci_conf[0x80] = 0;
 
-    if (s->kvm_enabled) {
+    if (s->kvm_enabled ||hax_enabled()) {
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
     }
@@ -393,7 +394,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
     /* APM */
     apm_init(dev, &s->apm, apm_ctrl_changed, s);
 
-    if (s->kvm_enabled) {
+    if (s->kvm_enabled || hax_enabled()) {
         /* Mark SMM as already inited to prevent SMM from running.  KVM does not
          * support SMM mode. */
         pci_conf[0x5B] = 0x02;
index 612bde2..d6628d7 100644 (file)
@@ -905,9 +905,6 @@ static const int ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, 0x360,
                                               0x280, 0x380 };
 static const int ne2000_irq[NE2000_NB_MAX] = { 9, 10, 11, 3, 4, 5 };
 
-static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
-static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
-
 void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)
 {
     static int nb_ne2k = 0;
index 3b891ca..9c70cce 100644 (file)
@@ -1217,7 +1217,6 @@ static void eepro100_write_mdi(EEPRO100State *s)
                 break;
             case 1:            /* Status Register */
                 missing("not writable");
-                data = s->mdimem[reg];
                 break;
             case 2:            /* PHY Identification Register (Word 1) */
             case 3:            /* PHY Identification Register (Word 2) */
@@ -1230,7 +1229,8 @@ static void eepro100_write_mdi(EEPRO100State *s)
             default:
                 missing("not implemented");
             }
-            s->mdimem[reg] = data;
+            s->mdimem[reg] &= eepro100_mdi_mask[reg];
+            s->mdimem[reg] |= data & ~eepro100_mdi_mask[reg];
         } else if (opcode == 2) {
             /* MDI read */
             switch (reg) {
index c660e58..0a14f6d 100644 (file)
@@ -98,6 +98,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
 
     dc->realize = isa_ne2000_realizefn;
     dc->props = ne2000_isa_properties;
+    dc->vmsd = &vmstate_isa_ne2000;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
 
index 464bd10..c3185da 100644 (file)
@@ -336,7 +336,7 @@ static int vigs_device_init(PCIDevice *dev)
             return -1;
         }
 
-        if (!dobj) {
+        if (!wqobj) {
             error_report("unable to create work queue");
             return -1;
         }
index 8a8b07f..de24498 100644 (file)
@@ -267,7 +267,7 @@ static int yagl_device_init(PCIDevice *dev)
             return -1;
         }
 
-        if (!dobj) {
+        if (!wqobj) {
             error_report("unable to create work queue");
             return -1;
         }
index ba178d2..c900234 100644 (file)
@@ -1227,6 +1227,7 @@ static void *yagl_egl_wgl_extaddr_get(struct yagl_dyn_lib *dyn_lib,
 
     if (!wgl_get_procaddr_fn || !wgl_create_context_fn ||
         !wgl_make_current_fn || !wgl_delete_context_fn) {
+        YAGL_LOG_ERROR_WIN();
         goto out;
     }
 
@@ -1235,25 +1236,30 @@ static void *yagl_egl_wgl_extaddr_get(struct yagl_dyn_lib *dyn_lib,
 
     win = yagl_egl_wgl_dummy_win_create();
     if (!win) {
+        YAGL_LOG_ERROR_WIN();
         goto out;
     }
 
     dc = GetDC(win);
     if (!dc) {
+        YAGL_LOG_ERROR_WIN();
         goto out;
     }
 
     /* We need to set pixel format of dc before we can create GL context */
     if (!yagl_egl_wgl_dc_set_def_pixfmt(dc)) {
+        YAGL_LOG_ERROR_WIN();
         goto out;
     }
 
     glc = wgl_create_context_fn(dc);
     if (!glc) {
+        YAGL_LOG_ERROR_WIN();
         goto out;
     }
 
     if (wgl_make_current_fn(dc, glc) == FALSE) {
+        YAGL_LOG_ERROR_WIN();
         wgl_make_current_fn(NULL, NULL);
         wgl_delete_context_fn(glc);
         goto out;
@@ -1270,10 +1276,6 @@ static void *yagl_egl_wgl_extaddr_get(struct yagl_dyn_lib *dyn_lib,
     }
 
 out:
-   if (!proc) {
-       YAGL_LOG_ERROR_WIN();
-   }
-
     if (win) {
         if (dc) {
             ReleaseDC(win, dc);
@@ -1295,14 +1297,18 @@ void *yagl_dyn_lib_get_ogl_procaddr(struct yagl_dyn_lib *dyn_lib,
     void *proc = NULL;
 
     YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_get_procaddr,
-               "Retrieving %s address", sym);
+                        "Retrieving %s address", sym);
 
     proc = yagl_egl_wgl_extaddr_get(dyn_lib, sym);
 
     if (!proc) {
-       YAGL_LOG_TRACE("wglGetProcAddress failed for %s, trying GetProcAddress",
-           sym);
+        YAGL_LOG_TRACE("wglGetProcAddress failed for %s, "
+                       "trying GetProcAddress", sym);
         proc = yagl_dyn_lib_get_sym(dyn_lib, sym);
+        if (!proc) {
+            YAGL_LOG_ERROR("wglGetProcAddress & GetProcAddress failed for %s",
+                           sym);
+        }
     }
 
     YAGL_LOG_FUNC_EXIT("%s address: %p", sym, proc);
index 2def89a..edece10 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Authors:
  *  Anthony Liguori   <aliguori@us.ibm.com>
- * 
+ *
  * Copyright (c) 2011 Intel Corporation
  *  Written by:
  *  Jiang Yunhong<yunhong.jiang@intel.com>
 #include "config-host.h"
 #include "qemu-common.h"
 
-#define dprint printf
-#ifdef CONFIG_HAX_BACKEND
-int hax_enabled(void);
-void hax_disable(int disable);
-int hax_pre_init(uint64_t ram_size);
-int hax_accel_init(void);
+extern bool hax_allowed;
+
+int hax_ug_platform(void);
+int hax_accel_init(uint64_t ram_size);
 int hax_sync_vcpus(void);
 
+// called after hax_init
+#define hax_enabled()           hax_allowed
+
 #ifdef CONFIG_HAX
-//#include "cpu.h"
-//#include "kvm.h"
+
+#define dprint printf
+
 #include "hw/hw.h"
 #include "qemu/bitops.h"
 #include "exec/memory.h"
-
-int hax_init_vcpu(CPUArchState *env);
-int hax_vcpu_exec(CPUArchState *env);
-void hax_vcpu_sync_state(CPUArchState *env, int modified);
-//extern void hax_cpu_synchronize_state(CPUArchState *env);
-//extern void hax_cpu_synchronize_post_reset(CPUArchState *env);
-//extern void hax_cpu_synchronize_post_init(CPUArchState *env);
+int hax_init_vcpu(CPUState *cpu);
+int hax_vcpu_exec(CPUState *cpu);
+int hax_smp_cpu_exec(CPUState *cpu);
+void hax_cpu_synchronize_post_reset(CPUState *cpu);
+void hax_cpu_synchronize_post_init(CPUState *cpu);
 int hax_populate_ram(uint64_t va, uint32_t size);
 int hax_set_phys_mem(MemoryRegionSection *section);
-int hax_vcpu_emulation_mode(CPUArchState *env);
-int hax_stop_emulation(CPUArchState *env);
-int hax_stop_translate(CPUArchState *env);
-int hax_arch_get_registers(CPUArchState *env);
-int hax_vcpu_destroy(CPUArchState *env);
-void hax_raise_event(CPUArchState *env);
-//int need_handle_intr_request(CPUState *env);
-int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction,
-                int size, int count, void *buffer);
+int hax_vcpu_emulation_mode(CPUState *cpu);
+int hax_stop_emulation(CPUState *cpu);
+int hax_stop_translate(CPUState *cpu);
+int hax_vcpu_destroy(CPUState *cpu);
+void hax_raise_event(CPUState *cpu);
 void hax_reset_vcpu_state(void *opaque);
 #include "target-i386/hax-interface.h"
 #include "target-i386/hax-i386.h"
-#endif
-
-#else
-
-#define hax_enabled()            (0)
-#define hax_sync_vcpus()
-#define hax_accel_init()         (0)
-#define hax_pre_init(x)
 
 #endif
 
-#endif
+#endif // _HAX_H
index cdfa911..0bee1e8 100644 (file)
@@ -307,10 +307,6 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
 void kvm_cpu_synchronize_state(CPUState *cpu);
 void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 void kvm_cpu_synchronize_post_init(CPUState *cpu);
-#ifdef CONFIG_HAX
-void hax_cpu_synchronize_post_reset(CPUArchState *env);
-void hax_cpu_synchronize_post_init(CPUArchState *env);
-#endif
 
 /* generic hooks - to be moved/refactored once there are more users */
 
@@ -326,10 +322,6 @@ static inline void cpu_synchronize_post_reset(CPUState *cpu)
     if (kvm_enabled()) {
         kvm_cpu_synchronize_post_reset(cpu);
     }
-#ifdef CONFIG_HAX
-    CPUArchState *env = cpu->env_ptr;
-    hax_cpu_synchronize_post_reset(env);
-#endif
 }
 
 static inline void cpu_synchronize_post_init(CPUState *cpu)
@@ -337,10 +329,6 @@ static inline void cpu_synchronize_post_init(CPUState *cpu)
     if (kvm_enabled()) {
         kvm_cpu_synchronize_post_init(cpu);
     }
-#ifdef CONFIG_HAX
-    CPUArchState *env = cpu->env_ptr;
-    hax_cpu_synchronize_post_init(env);
-#endif
 }
 
 int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg);
index 0a44fce..dd7f174 100644 (file)
@@ -98,7 +98,8 @@ typedef enum DisplayType
     DT_GTK,
     DT_NOGRAPHIC,
 #ifdef CONFIG_MARU
-    DT_MARU,
+    DT_MARU_SDL,
+    DT_MARU_SHM,
 #endif
     DT_NONE,
 } DisplayType;
index 13e52a0..054a559 100644 (file)
@@ -118,27 +118,11 @@ AioContext *qemu_get_aio_context(void)
     return qemu_aio_context;
 }
 
-#ifdef CONFIG_HAX
-static void qemu_notify_hax_event(void)
-{
-   CPUArchState *env = NULL;
-
-   if (hax_enabled()) {
-       for (env = first_cpu; env != NULL; env = env->next_cpu) {
-           hax_raise_event(env);
-       }
-   }
-}
-#endif
-
 void qemu_notify_event(void)
 {
     if (!qemu_aio_context) {
         return;
     }
-#ifdef CONFIG_HAX
-    qemu_notify_hax_event();
-#endif
     aio_notify(qemu_aio_context);
 }
 
index a99456e..30a133b 100644 (file)
@@ -1,3 +1,62 @@
+* 2.0.13
+- hax: support smp feature on Windows and Mac OS X.
+== Kitae Kim <kt920.kim@samsung.com> 2014-11-24
+* 2.0.12
+- package: added install dependency for spice-protocol and spice-vdagent
+== SungMin Ha <sungmin82.ha@samsung.com> 2014-11-05
+* 2.0.11
+- web-viewer: added init and shutdown logic of nodejs and websocket
+== SungMin Ha <sungmin82.ha@samsung.com> 2014-10-01
+* 2.0.10
+- spice: modified default scale 1/2
+== SungMin Ha <sungmin82.ha@samsung.com> 2014-09-15
+* 2.0.9
+- maru-camera: Insert the prevent code for when queries default value of controls
+- maru-camera: Fix bug that missing the close function to call when error occurs
+== Jinhyung Jo <jinhyung.jo@samsung.com> 2014-09-05
+* 2.0.8
+- spice-server: added auto port setting for tizen
+== SungMin Ha <sungmin82.ha@samsung.com> 2014-09-03
+* 2.0.7
+- nfc: Add getting status
+- emulator: add get_emul_serial_port func for logging
+- VIGS: Implement plane flip/rotate
+- VIGS: Fix texture fetch for GL3
+- VIGS: Disable blending by default
+- skin: fixed message format for emuld to shutdown
+- debugch: fix logging problem when using DEBUGCH
+- VIGS: Support YUV420 planar format
+- VIGS: Support planar pixel formats
+- VIGS: Support underlays and alpha blending
+- yagl: modified enable_yagl flag
+- tethering: add functions to get connected ip address and port
+- tethering: change log function into new style
+- brillcodec: clean-up source
+- codec: remove unused module
+- tethering: improve error cases
+- tethering: convert sensor values before sending ecs
+- brillcodec: remove redundant memory copy when decoding video
+- tethering: remove redundant source when copying ip address
+- sdb: fix sdbd port to a dynamic number
+- tethering: handle hwkey event and source clean-up
+- virtio-9p: fix compilation errors on Windows
+- emulator: enhance Makefile for standalone executables
+- maru_shm: fix compilation error on Mac OS X
+- log: fix runtime error and MacOS build fail
+- emulator: fix issue that skin is not started on MacOS
+- HAX: fix performance degradation on HAX
+- log: modify some emulator.log formats
+- brillcodec: remove useless memory copy
+- tethering: fix connection failure case
+- tethering: provide a function to get framebuffer on Mac OS X
+- debugch: Fix DEBUGCH and open flag
+- tethering: add a function to get framebuffer in maru_sdl
+- tethering: fix connection routine
+- build: add pkgconfig path of libpng to build qemu on DIBS of Mac OS X
+- skin: detect a system settings change
+- build: add libpng and change loader path of it on Mac OS X
+- ecs: Add location data set/get
+== Jinhyung Jo <jinhyung.jo@samsung.com> 2014-09-01
 * 2.0.6
 - fix compilation errors on Windows.
 - add "-Wno-error=redundant-decls" option on Windows.
index f952b2c..15eb412 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/bin/bash -x
 
 TIZEN_KVM_SCRIPT="/etc/init.d/tizen-kvm-multi"
 if [ -f ${TIZEN_KVM_SCRIPT} ]
@@ -57,3 +57,33 @@ else
 fi
 
 rm ${TMP_FILE}
+
+# run check-gl and show pop-up if using gallium driver.
+CHECK_GL_CMD=${TIZEN_SDK_INSTALL_PATH}/tools/emulator/bin/check-gl
+
+GL_WARNING_MSG="You are using invalid graphic card driver for the emulator.
+You have to use the lastest vendor-provided graphic card driver.
+
+For more information, see under ubuntu driver help page.
+https://help.ubuntu.com/community/BinaryDriverHowto/ "
+
+showGraphicDriverWarning()
+{
+       zenity --error --no-wrap --text="
+$GL_WARNING_MSG"
+}
+
+$CHECK_GL_CMD
+RET=$?
+echo "check_gl return : $RET"
+if [ "$RET" = "0" ] ; then
+       echo "check-gl ... OK."
+elif [ "$RET" = "2" ] ; then
+       # show warning dialog
+       echo "check-gl ... fail."
+       if [ "$INSTALLMANAGER_UI" = "GUI" ] ; then
+               showGraphicDriverWarning
+       else
+               echo "Warning : $GL_WARNING_MSG"
+       fi
+fi
index f952b2c..15eb412 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -ex
+#!/bin/bash -x
 
 TIZEN_KVM_SCRIPT="/etc/init.d/tizen-kvm-multi"
 if [ -f ${TIZEN_KVM_SCRIPT} ]
@@ -57,3 +57,33 @@ else
 fi
 
 rm ${TMP_FILE}
+
+# run check-gl and show pop-up if using gallium driver.
+CHECK_GL_CMD=${TIZEN_SDK_INSTALL_PATH}/tools/emulator/bin/check-gl
+
+GL_WARNING_MSG="You are using invalid graphic card driver for the emulator.
+You have to use the lastest vendor-provided graphic card driver.
+
+For more information, see under ubuntu driver help page.
+https://help.ubuntu.com/community/BinaryDriverHowto/ "
+
+showGraphicDriverWarning()
+{
+       zenity --error --no-wrap --text="
+$GL_WARNING_MSG"
+}
+
+$CHECK_GL_CMD
+RET=$?
+echo "check_gl return : $RET"
+if [ "$RET" = "0" ] ; then
+       echo "check-gl ... OK."
+elif [ "$RET" = "2" ] ; then
+       # show warning dialog
+       echo "check-gl ... fail."
+       if [ "$INSTALLMANAGER_UI" = "GUI" ] ; then
+               showGraphicDriverWarning
+       else
+               echo "Warning : $GL_WARNING_MSG"
+       fi
+fi
index 500029c..408f22b 100644 (file)
@@ -1,4 +1,4 @@
-Version: 2.0.6
+Version: 2.0.13
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 Source: emulator
 
@@ -32,7 +32,7 @@ Package: emulator-qemu-x86
 OS: ubuntu-32
 Build-host-os: ubuntu-32
 Build-dependency: emulator-lib [ ubuntu-32 ], emulator-spice-server-dev [ ubuntu-32 ], libav-dev [ ubuntu-32 ]
-Install-dependency: emulator-kernel-x86 [ ubuntu-32 ], emulator-spice-server [ ubuntu-32 ], libav [ ubuntu-32 ]
+Install-dependency: emulator-kernel-x86 [ ubuntu-32 ], emulator-spice-server [ ubuntu-32 ], libav [ ubuntu-32 ], spice-protocol [ ubuntu-32 ], spice-vdagent [ ubuntu-32 ]
 Description: Tizen x86 Emulator
 
 #Package: emulator-qemu-arm
@@ -46,7 +46,7 @@ Package: emulator-qemu-x86
 OS: ubuntu-64
 Build-host-os: ubuntu-64
 Build-dependency: emulator-lib [ ubuntu-64 ], emulator-spice-server-dev [ ubuntu-64 ], libav-dev [ ubuntu-64]
-Install-dependency: emulator-kernel-x86 [ ubuntu-64 ], emulator-spice-server [ ubuntu-64 ], libav [ ubuntu-64 ]
+Install-dependency: emulator-kernel-x86 [ ubuntu-64 ], emulator-spice-server [ ubuntu-64 ], libav [ ubuntu-64 ], spice-protocol [ ubuntu-64 ], spice-vdagent [ ubuntu-64 ]
 Description: Tizen x86 Emulator
 
 #Package: emulator-qemu-arm
index 0d5e5f5..da95e12 100644 (file)
@@ -270,6 +270,9 @@ GIOStatus ga_channel_write_all(GAChannel *c, const char *buf, size_t size)
 {
     GIOStatus status = G_IO_STATUS_NORMAL;
     size_t count;
+#ifdef CONFIG_MARU
+    count = 0;
+#endif
 
     while (size) {
         status = ga_channel_write(c, buf, size, &count);
index bad8dad..4f50c2b 100644 (file)
@@ -37,8 +37,6 @@ static const uint8_t special_ethaddr[ETH_ALEN] = {
     0x52, 0x55, 0x00, 0x00, 0x00, 0x00
 };
 
-static const uint8_t zero_ethaddr[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
-
 u_int curtime;
 
 static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances =
index a41f4c3..7069be9 100644 (file)
@@ -28,6 +28,7 @@
 #include "hax-i386.h"
 #include "sysemu/kvm.h"
 #include "exec/address-spaces.h"
+#include "qemu/main-loop.h"
 
 #define HAX_EMUL_ONE    0x1
 #define HAX_EMUL_REAL   0x2
 #define HAX_EMULATE_STATE_NONE  0x3
 #define HAX_EMULATE_STATE_INITIAL       0x4
 
+#define HAX_NON_UG_PLATFORM 0x0
+#define HAX_UG_PLATFORM     0x1
+
+static void hax_vcpu_sync_state(CPUArchState *env, int modified);
+static int hax_arch_get_registers(CPUArchState *env);
+static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int dir, int size, int cnt, void *buf);
+static int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft);
+
 struct hax_state hax_global;
-int ret_hax_init = 0;
-static int hax_disabled = 1;
 
-int hax_support = -1;
+int ug_support = 0;
 
-/* Called after hax_init */
-int hax_enabled(void)
-{
-    return (!hax_disabled && hax_support);
-}
+bool hax_allowed;
 
-void hax_disable(int disable)
+/* Called after hax_init_internal */
+int hax_ug_platform(void)
 {
-    hax_disabled = disable;
+    return (ug_support);
 }
 
 /* Currently non-PG modes are emulated by QEMU */
-int hax_vcpu_emulation_mode(CPUArchState *env)
+int hax_vcpu_emulation_mode(CPUState *cpu)
 {
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
     return !(env->cr[0] & CR0_PG_MASK);
 }
 
@@ -91,7 +96,7 @@ static int hax_stop_tbloop(CPUArchState *env)
         break;
     case HAX_EMULATE_STATE_INITIAL:
     case HAX_EMULATE_STATE_REAL:
-        if (!hax_vcpu_emulation_mode(env))
+        if (!hax_vcpu_emulation_mode(cpu))
             return 1;
         break;
     default:
@@ -103,9 +108,10 @@ static int hax_stop_tbloop(CPUArchState *env)
     return 0;
 }
 
-int hax_stop_emulation(CPUArchState *env)
+int hax_stop_emulation(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
+
     if (hax_stop_tbloop(env))
     {
         cpu->hax_vcpu->emulation_state =  HAX_EMULATE_STATE_NONE;
@@ -120,11 +126,10 @@ int hax_stop_emulation(CPUArchState *env)
     return 0;
 }
 
-int hax_stop_translate(CPUArchState *env)
+int hax_stop_translate(CPUState *cpu)
 {
-    struct hax_vcpu_state *vstate;
+    struct hax_vcpu_state *vstate = cpu->hax_vcpu;
 
-    vstate = ENV_GET_CPU(env)->hax_vcpu;
     assert(vstate->emulation_state);
     if (vstate->emulation_state == HAX_EMULATE_STATE_MMIO )
         return 1;
@@ -146,9 +151,9 @@ hax_fd hax_vcpu_get_fd(CPUArchState *env)
 }
 
 /* Current version */
-uint32_t hax_cur_version = 0x1;
+uint32_t hax_cur_version = 0x3; // ver 2.0: support fast mmio
 /* Least HAX kernel version */
-uint32_t hax_lest_version = 0x1;
+uint32_t hax_lest_version = 0x3;
 
 static int hax_get_capability(struct hax_state *hax)
 {
@@ -169,6 +174,9 @@ static int hax_get_capability(struct hax_state *hax)
         return -ENXIO;
     }
 
+    if ((cap->winfo & HAX_CAP_UG))
+        ug_support = 1;
+
     if (cap->wstatus & HAX_CAP_MEMQUOTA)
     {
         if (cap->mem_quota < hax->mem_quota)
@@ -229,6 +237,7 @@ int hax_vcpu_create(int id)
         goto error;
     }
 
+    vcpu->vcpu_id = id;
     vcpu->fd = hax_host_open_vcpu(hax_global.vm->id, id);
     if (hax_invalid_fd(vcpu->fd))
     {
@@ -258,9 +267,9 @@ error:
     return -1;
 }
 
-int hax_vcpu_destroy(CPUArchState *env)
+int hax_vcpu_destroy(CPUState *cpu)
 {
-    struct hax_vcpu_state *vcpu = ENV_GET_CPU(env)->hax_vcpu;
+    struct hax_vcpu_state *vcpu = cpu->hax_vcpu;
 
     if (!hax_global.vm)
     {
@@ -281,10 +290,9 @@ int hax_vcpu_destroy(CPUArchState *env)
     return 0;
 }
 
-int hax_init_vcpu(CPUArchState *env)
+int hax_init_vcpu(CPUState *cpu)
 {
     int ret;
-    CPUState *cpu = ENV_GET_CPU(env);
 
     ret = hax_vcpu_create(cpu->cpu_index);
     if (ret < 0)
@@ -296,7 +304,7 @@ int hax_init_vcpu(CPUArchState *env)
     cpu->hax_vcpu = hax_global.vm->vcpus[cpu->cpu_index];
     cpu->hax_vcpu->emulation_state = HAX_EMULATE_STATE_INITIAL;
     cpu->hax_vcpu_dirty = 1;
-    qemu_register_reset(hax_reset_vcpu_state, env);
+    qemu_register_reset(hax_reset_vcpu_state, (CPUArchState *)(cpu->env_ptr));
 
     return ret;
 }
@@ -437,40 +445,21 @@ static MemoryListener hax_memory_listener = {
     .log_global_stop = hax_log_global_stop,
 };
 
-#if 0
-static void hax_handle_interrupt(CPUArchState *env, int mask)
+static void hax_handle_interrupt(CPUState *cpu, int mask)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
     cpu->interrupt_request |= mask;
 
     if (!qemu_cpu_is_self(cpu)) {
         qemu_cpu_kick(cpu);
     }
 }
-#endif
 
-int hax_pre_init(uint64_t ram_size)
-{
-    struct hax_state *hax = NULL;
-
-    dprint("hax_disabled %d\n", hax_disabled);
-    if (hax_disabled)
-        return 0;
-    hax = &hax_global;
-    memset(hax, 0, sizeof(struct hax_state));
-    hax->mem_quota = ram_size;
-    dprint("ram_size %llx\n", ram_size);
-
-    return 0;
-}
-
-static int hax_init(void)
+static int hax_init_internal(void)
 {
     struct hax_state *hax = NULL;
+    struct hax_qemu_version qversion;
     int ret;
 
-    hax_support = 0;
-
     hax = &hax_global;
 
 
@@ -509,7 +498,10 @@ static int hax_init(void)
 
     memory_listener_register(&hax_memory_listener, &address_space_memory);
 
-    hax_support = 1;
+    qversion.cur_version = hax_cur_version;
+    qversion.least_version = hax_lest_version;
+    hax_notify_qemu_version(hax->vm->fd, &qversion);
+    cpu_interrupt_handler = hax_handle_interrupt;
 
     return ret;
 error:
@@ -521,26 +513,57 @@ error:
     return ret;
 }
 
-int hax_accel_init(void)
+int hax_accel_init(uint64_t ram_size)
 {
-    if (hax_disabled) {
-        dprint("HAX is disabled and emulator runs in emulation mode.\n");
-        return 0;
-    }
+    struct hax_state *hax = NULL;
+    int ret = 0;
+
+    hax = &hax_global;
+    memset(hax, 0, sizeof(struct hax_state));
+    hax->mem_quota = ram_size;
+    dprint("ram_size %llx\n", ram_size);
 
-    ret_hax_init = hax_init();
-    if (ret_hax_init && (ret_hax_init != -ENOSPC)) {
+    ret = hax_init_internal();
+    // It is better to fail than to transit implicitly.
+    /*
+    if (ret && (ret != -ENOSPC)) {
         dprint("No accelerator found.\n");
-        return ret_hax_init;
     } else {
         dprint("HAX is %s and emulator runs in %s mode.\n",
-        !ret_hax_init ? "working" : "not working",
-        !ret_hax_init ? "fast virt" : "emulation");
-        return 0;
+        !ret ? "working" : "not working",
+        !ret ? "fast virt" : "emulation");
     }
+    */
+
+    return ret;
 }
 
-int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction,
+static int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft)
+{
+    uint64_t buf = 0;
+    /*
+     * With fast MMIO, QEMU need not sync vCPU state with HAXM
+     * driver because it will only invoke MMIO handler
+     * However, some MMIO operations utilize virtual address like qemu_pipe
+     * Thus we need to sync the CR0, CR3 and CR4 so that QEMU
+     * can translate the guest virtual address to guest physical
+     * address
+     */
+    env->cr[0] = hft->_cr0;
+    env->cr[2] = hft->_cr2;
+    env->cr[3] = hft->_cr3;
+    env->cr[4] = hft->_cr4;
+
+    buf = hft->value;
+
+    cpu_physical_memory_rw(hft->gpa, (uint8_t *)&buf, hft->size, hft->direction);
+    if (hft->direction == 0)
+        hft->value = buf;
+
+    return 0;
+}
+
+static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction,
   int size, int count, void *buffer)
 {
     uint8_t *ptr;
@@ -601,11 +624,11 @@ static int hax_vcpu_interrupt(CPUArchState *env)
     {
         int irq;
 
-        cpu->interrupt_request &= ~CPU_INTERRUPT_HARD;
-        irq = cpu_get_pic_interrupt(env);
+         irq = cpu_get_pic_interrupt(env);
         if (irq >= 0) {
             hax_inject_interrupt(env, irq);
-        }
+            cpu->interrupt_request &= ~CPU_INTERRUPT_HARD;
+         }
     }
 
     /* If we have an interrupt but the guest is not ready to receive an
@@ -619,9 +642,9 @@ static int hax_vcpu_interrupt(CPUArchState *env)
     return 0;
 }
 
-void hax_raise_event(CPUArchState *env)
+void hax_raise_event(CPUState *cpu)
 {
-    struct hax_vcpu_state *vcpu = ENV_GET_CPU(env)->hax_vcpu;
+    struct hax_vcpu_state *vcpu = cpu->hax_vcpu;
 
     if (!vcpu)
         return;
@@ -638,20 +661,59 @@ void hax_raise_event(CPUArchState *env)
  * 5. An unknown VMX exit happens
  */
 extern void qemu_system_reset_request(void);
-static int hax_vcpu_hax_exec(CPUArchState *env)
+static int hax_vcpu_hax_exec(CPUArchState *env, int ug_platform)
 {
     int ret = 0;
     CPUState *cpu = ENV_GET_CPU(env);
+    X86CPU *x86_cpu = X86_CPU(cpu);
     struct hax_vcpu_state *vcpu = cpu->hax_vcpu;
     struct hax_tunnel *ht = vcpu->tunnel;
 
-    if (hax_vcpu_emulation_mode(env))
+    if(!ug_platform)
+    {
+        if (hax_vcpu_emulation_mode(cpu))
+        {
+            dprint("Trying to vcpu execute at eip:" TARGET_FMT_lx "\n", env->eip);
+            return  HAX_EMUL_EXITLOOP;
+        }
+
+        cpu->halted = 0;
+
+        if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
+            cpu->interrupt_request &= ~CPU_INTERRUPT_POLL;
+            apic_poll_irq(x86_cpu->apic_state);
+        }
+    }
+    else  /* UG platform */
     {
-        dprint("Trying to vcpu execute at eip:%x\n", env->eip);
-        return  HAX_EMUL_EXITLOOP;
+        if (!hax_enabled())
+        {
+            dprint("Trying to vcpu execute at eip:" TARGET_FMT_lx "\n", env->eip);
+            return  HAX_EMUL_EXITLOOP;
+        }
+
+        cpu->halted = 0;
+
+        if (cpu->interrupt_request & CPU_INTERRUPT_POLL) {
+            cpu->interrupt_request &= ~CPU_INTERRUPT_POLL;
+            apic_poll_irq(x86_cpu->apic_state);
+        }
+
+        if (cpu->interrupt_request & CPU_INTERRUPT_INIT) {
+            fprintf(stderr, "\nUG hax_vcpu_hax_exec: handling INIT for %d \n", cpu->cpu_index);
+            do_cpu_init(x86_cpu);
+            hax_vcpu_sync_state(env, 1);
+        }
+
+        if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) {
+            fprintf(stderr, "UG hax_vcpu_hax_exec: handling SIPI for %d \n", cpu->cpu_index);
+            hax_vcpu_sync_state(env, 0);
+            do_cpu_sipi(x86_cpu);
+            hax_vcpu_sync_state(env, 1);
+        }
     }
 
-    //hax_cpu_synchronize_state(env);
+    //hax_cpu_synchronize_state(cpu);
 
     do {
         int hax_ret;
@@ -662,15 +724,24 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
         }
 
 #if 0
-        if (env->hax_vcpu_dirty) {
+        if (cpu->hax_vcpu_dirty) {
                 hax_vcpu_sync_state(env, 1);
-                env->hax_vcpu_dirty = 0;
+                cpu->hax_vcpu_dirty = 0;
         }
 #endif
 
         hax_vcpu_interrupt(env);
-
-        hax_ret = hax_vcpu_run(vcpu);
+        if (!ug_platform)
+        {
+            hax_ret = hax_vcpu_run(vcpu);
+        }
+        else /* UG platform */
+        {
+            qemu_mutex_unlock_iothread();
+            hax_ret = hax_vcpu_run(vcpu);
+            qemu_mutex_lock_iothread();
+            current_cpu = cpu;
+        }
 
         /* Simply continue the vcpu_run if system call interrupted */
         if (hax_ret == -EINTR || hax_ret == -EAGAIN) {
@@ -695,6 +766,10 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
             case HAX_EXIT_MMIO:
                 ret = HAX_EMUL_ONE;
                 break;
+            case HAX_EXIT_FAST_MMIO:
+                ret = hax_handle_fastmmio(env,
+                        (struct hax_fastmmio *)vcpu->iobuf);
+                break;
             case HAX_EXIT_REAL:
                 ret = HAX_EMUL_REAL;
                 break;
@@ -755,7 +830,7 @@ static void do_hax_cpu_synchronize_state(void *_env)
     }
 }
 
-void hax_cpu_synchronize_state(CPUState *cpu)
+static void hax_cpu_synchronize_state(CPUState *cpu)
 {
     if (!cpu->hax_vcpu_dirty) {
         run_on_cpu(cpu, do_hax_cpu_synchronize_state, cpu);
@@ -763,32 +838,34 @@ void hax_cpu_synchronize_state(CPUState *cpu)
 }
 #endif
 
-void hax_cpu_synchronize_post_reset(CPUArchState *env)
+void hax_cpu_synchronize_post_reset(CPUState *cpu)
 {
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
     hax_vcpu_sync_state(env, 1);
-    ENV_GET_CPU(env)->hax_vcpu_dirty = 0;
+    cpu->hax_vcpu_dirty = 0;
 }
 
-void hax_cpu_synchronize_post_init(CPUArchState *env)
+void hax_cpu_synchronize_post_init(CPUState *cpu)
 {
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
     hax_vcpu_sync_state(env, 1);
-    ENV_GET_CPU(env)->hax_vcpu_dirty = 0;
+    cpu->hax_vcpu_dirty = 0;
 }
 
 /*
  * return 1 when need emulate, 0 when need exit loop
  */
-int hax_vcpu_exec(CPUArchState *env)
+int hax_vcpu_exec(CPUState *cpu)
 {
     int next = 0, ret = 0;
     struct hax_vcpu_state *vcpu;
-    CPUState *cpu = ENV_GET_CPU(env);
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
 
     if (cpu->hax_vcpu->emulation_state != HAX_EMULATE_STATE_NONE)
         return 1;
 
     vcpu = cpu->hax_vcpu;
-    next = hax_vcpu_hax_exec(env);
+    next = hax_vcpu_hax_exec(env, HAX_NON_UG_PLATFORM);
     switch (next)
     {
         case HAX_EMUL_ONE:
@@ -813,6 +890,31 @@ int hax_vcpu_exec(CPUArchState *env)
     return ret;
 }
 
+int hax_smp_cpu_exec(CPUState *cpu)
+{
+    CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
+    int why;
+    int ret;
+
+    while (1) {
+        if (cpu->exception_index >= EXCP_INTERRUPT) {
+            ret = cpu->exception_index;
+            cpu->exception_index = -1;
+            break;
+        }
+
+        why = hax_vcpu_hax_exec(env, HAX_UG_PLATFORM);
+
+        if ((why != HAX_EMUL_HLT) && (why != HAX_EMUL_EXITLOOP))
+        {
+            dprint("Unknown hax vcpu return %x\n", why);
+            abort();
+        }
+    }
+
+    return ret;
+}
+
 #define HAX_RAM_INFO_ROM 0x1
 
 static void set_v8086_seg(struct segment_desc_t *lhs, const SegmentCache *rhs)
@@ -1139,7 +1241,7 @@ static int hax_set_fpu(CPUArchState *env)
     return hax_sync_fpu(env, &fpu, 1);
 }
 
-int hax_arch_get_registers(CPUArchState *env)
+static int hax_arch_get_registers(CPUArchState *env)
 {
     int ret;
 
@@ -1184,7 +1286,7 @@ static int hax_arch_set_registers(CPUArchState *env)
     return 0;
 }
 
-void hax_vcpu_sync_state(CPUArchState *env, int modified)
+static void hax_vcpu_sync_state(CPUArchState *env, int modified)
 {
     if (hax_enabled()) {
         if (modified)
index 5339ce0..b8dcbd4 100644 (file)
@@ -84,7 +84,7 @@ int hax_set_phys_mem(MemoryRegionSection *section)
 
     info.pa_start = start_addr;
     info.size = size;
-    info.va = (int64_t)(intptr_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region);
+    info.va = (uint64_t)(intptr_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region);
     info.flags = memory_region_is_rom(mr) ? 1 : 0;
 
     ret = ioctl(hax_global.vm->fd, HAX_VM_IOCTL_SET_RAM, pinfo);
@@ -196,6 +196,22 @@ hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id)
     return fd;
 }
 
+int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion)
+{
+    int ret;
+
+    if (hax_invalid_fd(vm_fd))
+        return -EINVAL;
+
+    ret = ioctl(vm_fd, HAX_VM_IOCTL_NOTIFY_QEMU_VERSION, qversion);
+
+    if (ret < 0)
+    {
+        dprint("Failed to notify qemu API version\n");
+        return ret;
+    }
+    return 0;
+}
 /* Simply assume the size should be bigger than the hax_tunnel,
  * since the hax_tunnel can be extended later with compatibility considered
  */
index 1a20cc9..203b01e 100644 (file)
@@ -38,14 +38,15 @@ static inline void hax_close_fd(hax_fd fd)
 
 /* HAX model level ioctl */
 #define HAX_IOCTL_VERSION _IOWR(0, 0x20, struct hax_module_version)
-#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, int)
-#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, int)
+#define HAX_IOCTL_CREATE_VM _IOWR(0, 0x21, uint32_t)
+#define HAX_IOCTL_DESTROY_VM _IOW(0, 0x22, uint32_t)
 #define HAX_IOCTL_CAPABILITY _IOR(0, 0x23, struct hax_capabilityinfo)
 
-#define HAX_VM_IOCTL_VCPU_CREATE    _IOR(0, 0x80, int)
+#define HAX_VM_IOCTL_VCPU_CREATE _IOWR(0, 0x80, uint32_t)
 #define HAX_VM_IOCTL_ALLOC_RAM _IOWR(0, 0x81, struct hax_alloc_ram_info)
 #define HAX_VM_IOCTL_SET_RAM _IOWR(0, 0x82, struct hax_set_ram_info)
-#define HAX_VM_IOCTL_VCPU_DESTROY    _IOR(0, 0x83, int)
+#define HAX_VM_IOCTL_VCPU_DESTROY _IOW(0, 0x83, uint32_t)
+#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION _IOW(0, 0x84, struct hax_qemu_version)
 
 #define HAX_VCPU_IOCTL_RUN  _IO(0, 0xc0)
 #define HAX_VCPU_IOCTL_SET_MSRS _IOWR(0, 0xc1, struct hax_msr_data)
index 655e8bd..e00c5b2 100644 (file)
@@ -71,6 +71,7 @@ int hax_sync_fpu(CPUArchState *env, struct fx_layout *fl, int set);
 
 int hax_vm_destroy(struct hax_vm *vm);
 int hax_capability(struct hax_state *hax, struct hax_capabilityinfo *cap);
+int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion);
 
 /* Common host function */
 int hax_host_create_vm(struct hax_state *hax, int *vm_id);
index ca0f958..4523ce1 100644 (file)
@@ -45,12 +45,12 @@ struct fx_layout {
     uint8       mmx_1[8][16];
     uint8       mmx_2[8][16];
     uint8       pad[96];
-};
+}  __attribute__ ((aligned (8)));
 
 struct vmx_msr {
     uint64 entry;
     uint64 value;
-};
+} __attribute__ ((__packed__));
 
 /*
  * Fixed array is not good, but it makes Mac support a bit easier by avoiding
@@ -63,7 +63,7 @@ struct hax_msr_data
     uint16_t done;
     uint16_t pad[2];
     struct vmx_msr entries[HAX_MAX_MSR_ARRAY];
-};
+} __attribute__ ((__packed__));
 
 union interruptibility_state_t {
     uint32 raw;
@@ -249,6 +249,7 @@ enum exit_status {
     HAX_EXIT_STATECHANGE,
     /* the vcpu is now only paused when destroy, so simply return to hax */
     HAX_EXIT_PAUSED,
+    HAX_EXIT_FAST_MMIO,
 };
 
 /* The interface definition:
@@ -287,13 +288,22 @@ struct hax_tunnel
         struct {
         } state;
     };
-};
+} __attribute__ ((__packed__));
 
 struct hax_module_version
 {
     uint32_t compat_version;
     uint32_t cur_version;
-};
+} __attribute__ ((__packed__));
+
+/* This interface is support only after API version 2 */
+struct hax_qemu_version
+{
+    /* Current API version in QEMU*/
+    uint32_t cur_version;
+    /* The least API version supported by QEMU */
+    uint32_t least_version;
+}__attribute__ ((__packed__));
 
 /* The mac specfic interface to qemu, mostly is ioctl related */
 struct hax_tunnel_info
@@ -302,14 +312,14 @@ struct hax_tunnel_info
     uint64_t io_va;
     uint16_t size;
     uint16_t pad[3];
-};
+} __attribute__ ((__packed__));
 
 struct hax_alloc_ram_info
 {
     uint32_t size;
     uint32_t pad;
     uint64_t va;
-};
+}__attribute__ ((__packed__));
 #define HAX_RAM_INFO_ROM 0x1
 struct hax_set_ram_info
 {
@@ -318,7 +328,7 @@ struct hax_set_ram_info
     uint8_t flags;
     uint8_t pad[3];
     uint64_t va;
-};
+}__attribute__ ((__packed__));
 
 #define HAX_CAP_STATUS_WORKING  0x1
 #define HAX_CAP_STATUS_NOTWORKING  0x0
@@ -328,6 +338,7 @@ struct hax_set_ram_info
 #define HAX_CAP_FAILREASON_NX   0x2
 
 #define HAX_CAP_MEMQUOTA       0x2
+#define HAX_CAP_UG          0x4
 
 struct hax_capabilityinfo
 {
@@ -343,6 +354,19 @@ struct hax_capabilityinfo
     uint16_t winfo;
     uint32_t pad;
     uint64_t mem_quota;
-};
+}__attribute__ ((__packed__));
 
+struct hax_fastmmio
+{
+    uint64_t gpa;
+    uint64_t value;
+    uint8_t size;
+    uint8_t direction;
+    uint16_t reg_index;
+    uint32_t pad0;
+    uint64_t _cr0;
+    uint64_t _cr2;
+    uint64_t _cr3;
+    uint64_t _cr4;
+} __attribute__ ((__packed__));
 #endif
index d6f402a..eee7684 100644 (file)
@@ -121,8 +121,7 @@ int hax_set_phys_mem(MemoryRegionSection *section)
 
     info.pa_start = start_addr;
     info.size = size;
-    info.va = (uint64_t)(intptr_t)(memory_region_get_ram_ptr(mr) +
-            section->offset_within_region);
+    info.va = (uint64_t)(intptr_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region);
     info.flags = memory_region_is_rom(mr) ? 1 : 0;
 
     hDeviceVM = hax_global.vm->fd;
@@ -286,6 +285,26 @@ hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id)
     return hDeviceVM;
 }
 
+int hax_notify_qemu_version(hax_fd vm_fd, struct hax_qemu_version *qversion)
+{
+    int ret;
+    DWORD dSize = 0;
+    if (hax_invalid_fd(vm_fd))
+        return -EINVAL;
+    ret = DeviceIoControl(vm_fd,
+      HAX_VM_IOCTL_NOTIFY_QEMU_VERSION,
+      qversion, sizeof(struct hax_qemu_version),
+      NULL, 0,
+      &dSize,
+      (LPOVERLAPPED) NULL);
+    if (!ret)
+    {
+        dprint("Failed to notify qemu API version\n");
+        return -1;
+    }
+    return 0;
+}
+
 int hax_host_create_vcpu(hax_fd vm_fd, int vcpuid)
 {
     int ret;
index eb561fe..e017a6e 100644 (file)
@@ -67,5 +67,5 @@ static inline int hax_invalid_fd(hax_fd fd)
 #define HAX_VCPU_IOCTL_INTERRUPT        CTL_CODE(HAX_DEVICE_TYPE, 0x90c, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define HAX_VCPU_SET_REGS               CTL_CODE(HAX_DEVICE_TYPE, 0x90d, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #define HAX_VCPU_GET_REGS               CTL_CODE(HAX_DEVICE_TYPE, 0x90e, METHOD_BUFFERED, FILE_ANY_ACCESS)
-
+#define HAX_VM_IOCTL_NOTIFY_QEMU_VERSION CTL_CODE(HAX_DEVICE_TYPE, 0x910, METHOD_BUFFERED, FILE_ANY_ACCESS)
 #endif
index 9cc8922..79964db 100644 (file)
@@ -1507,14 +1507,6 @@ static void gen_shift_rm_im(DisasContext *s, TCGMemOp ot, int op1, int op2,
     }
 }
 
-static inline void tcg_gen_lshift(TCGv ret, TCGv arg1, target_long arg2)
-{
-    if (arg2 >= 0)
-        tcg_gen_shli_tl(ret, arg1, arg2);
-    else
-        tcg_gen_shri_tl(ret, arg1, -arg2);
-}
-
 static void gen_rot_rm_T1(DisasContext *s, TCGMemOp ot, int op1, int is_right)
 {
     target_ulong mask = (ot == MO_64 ? 0x3f : 0x1f);
@@ -7993,7 +7985,7 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu,
         pc_ptr = disas_insn(env, dc, pc_ptr);
         num_insns++;
 #ifdef CONFIG_HAX
-        if (hax_enabled() && hax_stop_translate(env))
+        if (hax_enabled() && hax_stop_translate(cs))
         {
             gen_jmp_im(pc_ptr - dc->cs_base);
             gen_eob(dc);
index b56cff0..e562fa8 100755 (executable)
@@ -218,7 +218,6 @@ exec ./configure \
  --extra-cflags=-Wno-error=redundant-decls \
  --extra-ldflags=-Wl,--large-address-aware \
  --cc=gcc \
- --disable-coroutine-pool \
  --audio-drv-list=winwave \
  --enable-hax \
  --disable-vnc \
index 9a66868..b62b05b 100644 (file)
@@ -4,6 +4,11 @@ DIBS_ARM_DIR=../arm
 DIBS_COMMON_DIR=../common
 DIBS_SWT_DIR=-Dclasspath.dibs=$(ROOTDIR)/tools/emulator/bin
 
+ifeq ($(CC),"")
+       @echo "cc does not exist"
+       @exit 1
+endif
+
 ifndef TIZEN_SDK_DEV_PATH
 TIZEN_SDK_DEV_PATH=${HOME}/tizen-sdk-dev
 endif
@@ -48,9 +53,9 @@ CHECK_GL_LDFLAGS += -mmacosx-version-min=10.4 `pkg-config --cflags --libs glib-2
 endif
 
 util/check-gl$(EXESUF): $(CHECK_GL_OBJS)
-       gcc $(CHECK_GL_OBJS) $(CHECK_GL_LDFLAGS) -o $@
+       $(CC) $(CHECK_GL_OBJS) $(CHECK_GL_LDFLAGS) -o $@
 $(CHECK_GL_OBJS): %.o: %.c
-       gcc $< $(CHECK_GL_CFLAGS) -o $@
+       $(CC) $< $(CHECK_GL_CFLAGS) -o $@
 
 # Building check-cam
 CHECK_CAM_CFLAGS = -c
index 508e120..c3127b7 100644 (file)
@@ -15,7 +15,7 @@ obj-y += display/
 obj-y += ecs/
 
 # tethering
-obj-y += tethering/
+obj-y += eventcast/
 
 # maru skin
 obj-y += skin/
index 3660db9..b546ca2 100644 (file)
@@ -1,10 +1,7 @@
 obj-y += maru_display.o
-ifdef CONFIG_USE_SHM
-obj-y += maru_shm.o
-else
-ifdef CONFIG_SDL
-obj-y += maru_sdl.o maru_sdl_processing.o maru_finger.o
-endif
-endif
+
+obj-$(CONFIG_USE_SHM) += maru_shm.o
+
+obj-$(CONFIG_SDL) += maru_sdl.o maru_sdl_processing.o maru_finger.o
 
 $(obj)/maru_display.o $(obj)/maru_sdl.o $(obj)/maru_sdl_processing.o $(obj)/maru_finger.o: QEMU_CFLAGS += $(SDL_CFLAGS)
index 7616657..fcf229e 100644 (file)
 
 
 #include "emulator.h"
-#include "emulator_common.h"
 #include "maru_display.h"
 #include "debug_ch.h"
 
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-#include "maru_sdl.h"
-#endif
-#else
-#include "maru_shm.h"
-#endif
-
 MULTI_DEBUG_CHANNEL(tizen, display);
 
 MaruScreenShot* screenshot = NULL;
 
+static MaruDisplayChangeListener *mdcl;
+
 static void maru_display_fini(void)
 {
     INFO("fini qemu display\n");
 
     g_free(screenshot);
 
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_quit();
-#endif
-#else
-    maru_shm_quit();
-#endif
+    if (mdcl->fini) {
+        mdcl->fini();
+    }
+
+    g_free(mdcl);
 }
 
 static void maru_display_notify_exit(Notifier *notifier, void *data) {
@@ -65,28 +56,28 @@ static void maru_display_notify_exit(Notifier *notifier, void *data) {
 }
 static Notifier maru_display_exit = { .notify = maru_display_notify_exit };
 
-//TODO: interface
-void maru_display_init(DisplayState *ds)
+void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen)
 {
     INFO("init qemu display\n");
 
-#ifndef CONFIG_USE_SHM
+    mdcl = g_malloc0(sizeof(MaruDisplayChangeListener));
+
+    switch (display_type) {
 #ifdef CONFIG_SDL
-    maru_sdl_pre_init();
+    case DT_MARU_SDL:
+        maru_sdl_pre_init(mdcl);
+        break;
 #endif
-#else
-    maru_shm_pre_init();
+#ifdef CONFIG_USE_SHM
+    case DT_MARU_SHM:
+        maru_shm_pre_init(mdcl);
+        break;
 #endif
-
-    /*  graphics context information */
-    DisplayChangeListener *dcl;
-
-    dcl = g_malloc0(sizeof(DisplayChangeListener));
-#if defined(CONFIG_USE_SHM) || defined(CONFIG_SDL)
-    //FIXME
-    dcl->ops = &maru_dcl_ops;
-#endif
-    register_displaychangelistener(dcl);
+    default:
+        ERR("can not enter here.\n");
+        // can not enter here...
+        break;
+    }
 
     screenshot = g_malloc0(sizeof(MaruScreenShot));
     screenshot->pixels = NULL;
@@ -98,61 +89,40 @@ void maru_display_init(DisplayState *ds)
 
 void maru_display_resize(void)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_resize();
-#endif
-#else
-    maru_shm_resize();
-#endif
+    if (mdcl->resize) {
+        mdcl->resize();
+    }
 }
 
 void maru_display_update(void)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_update();
-#endif
-#else
-    maru_shm_update();
-#endif
+    if (mdcl->update) {
+        mdcl->update();
+    }
 }
 
-void maru_display_invalidate(bool on)
+void maru_display_set_invalidate(bool on)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_invalidate(on);
-#endif
-#else
-    /* do nothing */
-#endif
+    if (mdcl->set_invalidate) {
+        mdcl->set_invalidate(on);
+    }
 }
 
-void maru_display_interpolation(bool on)
+void maru_display_set_interpolation(bool on)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_interpolation(on);
-#endif
-#else
-    /* do nothing */
-#endif
+    if (mdcl->set_interpolation) {
+        mdcl->set_interpolation(on);
+    }
 }
 
 void maru_ds_surface_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide)
 {
-#ifndef CONFIG_USE_SHM
-#ifdef CONFIG_SDL
-    maru_sdl_init(swt_handle,
-        display_width, display_height, blank_guide);
-#endif
-#else
-    maru_shm_init(swt_handle,
-        display_width, display_height, blank_guide);
-#endif
+    if (mdcl->surface_init) {
+        mdcl->surface_init(swt_handle, display_width,
+                display_height, blank_guide);
+    }
 }
 
 MaruScreenShot *get_screenshot(void)
index c9c4552..8c746f2 100644 (file)
 #ifndef __MARU_DISPLAY_H__
 #define __MARU_DISPLAY_H__
 
+#include "sysemu/sysemu.h"
 #include "ui/console.h"
 
+typedef struct {
+    void (*surface_init)(uint64 swt_handle,
+            unsigned int display_width, unsigned int display_height,
+            bool blank_guide);
+    void (*fini)(void);
+
+    void (*resize)(void);
+    void (*update)(void);
+    void (*set_invalidate)(bool);
+    void (*set_interpolation)(bool);
+} MaruDisplayChangeListener;
+
 typedef struct MaruScreenShot {
     unsigned char *pixels;
     bool request;
     bool ready;
 } MaruScreenShot;
 
-void maru_display_init(DisplayState *ds);
+void maru_display_init(DisplayState *ds, DisplayType display_type, int full_screen);
 void maru_display_resize(void);
 void maru_display_update(void);
-void maru_display_invalidate(bool on);
-void maru_display_interpolation(bool on);
+void maru_display_set_invalidate(bool on);
+void maru_display_set_interpolation(bool on);
+
 void maru_ds_surface_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide);
@@ -51,4 +65,10 @@ void maru_ds_surface_init(uint64 swt_handle,
 MaruScreenShot *get_screenshot(void);
 void save_screenshot(DisplaySurface *surface);
 
+// maru_sdl
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl);
+
+// maru_shm
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
+
 #endif /* __MARU_DISPLAY_H__ */
index de365e8..e628b5d 100644 (file)
@@ -36,7 +36,7 @@
 #include "hw/virtio/maru_virtio_touchscreen.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, maru_finger);
+MULTI_DEBUG_CHANNEL(qemu, finger);
 
 
 /* ===== Reference: http://content.gpwiki.org/index.php/SDL:Tutorials:Drawing_and_Filling_Circles ===== */
index 04bf1a7..adad35e 100644 (file)
 #include "emulator.h"
 #include "emul_state.h"
 #include "maru_display.h"
-#include "maru_sdl.h"
 #include "maru_sdl_processing.h"
 #include "hw/pci/maru_brightness.h"
 #include "debug_ch.h"
 
-#include "tethering/touch.h"
+#include "eventcast/encode_fb.h"
 
 #include <SDL.h>
 #ifndef CONFIG_WIN32
 #include <SDL_syswm.h>
 #endif
 
-MULTI_DEBUG_CHANNEL(tizen, maru_sdl);
+MULTI_DEBUG_CHANNEL(tizen, sdl);
+
+static DisplayChangeListener *dcl;
 
 static QEMUBH *sdl_init_bh;
 static QEMUBH *sdl_resize_bh;
@@ -280,28 +281,13 @@ static void qemu_ds_sdl_refresh(DisplayChangeListener *dcl)
 #endif
 }
 
-DisplayChangeListenerOps maru_dcl_ops = {
+static DisplayChangeListenerOps dcl_ops = {
     .dpy_name          = "maru_sdl",
     .dpy_gfx_update    = qemu_ds_sdl_update,
     .dpy_gfx_switch    = qemu_ds_sdl_switch,
     .dpy_refresh       = qemu_ds_sdl_refresh,
 };
 
-void maru_sdl_interpolation(bool on)
-{
-    if (on == true) {
-        INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
-
-        /* PIXMAN_FILTER_BILINEAR */
-        sdl_pixman_filter = PIXMAN_FILTER_BEST;
-    } else {
-        INFO("set PIXMAN_FILTER_FAST filter for image processing\n");
-
-        /* PIXMAN_FILTER_NEAREST */
-        sdl_pixman_filter = PIXMAN_FILTER_FAST;
-    }
-}
-
 static void qemu_update(void)
 {
     if (sdl_alteration < 0) {
@@ -502,6 +488,8 @@ static void maru_sdl_init_bh(void *opaque)
     SDL_GetWMInfo(&info);
 #endif
 
+    sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL);
+    sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL);
     qemu_bh_schedule(sdl_resize_bh);
 
 #ifdef SDL_THREAD
@@ -517,46 +505,7 @@ static void maru_sdl_init_bh(void *opaque)
 #endif
 }
 
-void maru_sdl_pre_init(void) {
-    sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL);
-    sdl_resize_bh = qemu_bh_new(maru_sdl_resize_bh, NULL);
-    sdl_update_bh = qemu_bh_new(maru_sdl_update_bh, NULL);
-
-#ifdef SDL_THREAD
-    qemu_mutex_init(&sdl_mutex);
-    qemu_cond_init(&sdl_cond);
-#endif
-}
-
-void maru_sdl_init(uint64 swt_handle,
-    unsigned int display_width, unsigned int display_height,
-    bool blank_guide)
-{
-    gchar SDL_windowhack[32] = { 0, };
-    long window_id = swt_handle;
-    blank_guide_enable = blank_guide;
-
-    INFO("maru sdl init\n");
-
-    sprintf(SDL_windowhack, "%ld", window_id);
-    g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
-
-    INFO("register SDL environment variable. "
-        "(SDL_WINDOWID = %s)\n", SDL_windowhack);
-
-    set_emul_resolution(display_width, display_height);
-    set_emul_sdl_bpp(SDL_BPP);
-    maru_sdl_interpolation(false);
-    init_multi_touch_state();
-
-    if (blank_guide_enable == true) {
-        INFO("blank guide is on\n");
-    }
-
-    qemu_bh_schedule(sdl_init_bh);
-}
-
-void maru_sdl_quit(void)
+static void maru_sdl_quit(void)
 {
     INFO("maru sdl quit\n");
 
@@ -595,27 +544,98 @@ void maru_sdl_quit(void)
     qemu_cond_destroy(&sdl_cond);
     qemu_mutex_destroy(&sdl_mutex);
 #endif
+
+    unregister_displaychangelistener(dcl);
+    g_free(dcl);
 }
 
-void maru_sdl_resize(void)
+static void maru_sdl_resize(void)
 {
     INFO("maru sdl resize\n");
 
-    qemu_bh_schedule(sdl_resize_bh);
+    if (sdl_resize_bh != NULL) {
+        qemu_bh_schedule(sdl_resize_bh);
+    }
 }
 
-void maru_sdl_update(void)
+static void maru_sdl_update(void)
 {
     if (sdl_update_bh != NULL) {
         qemu_bh_schedule(sdl_update_bh);
     }
 }
 
-void maru_sdl_invalidate(bool on)
+static void maru_sdl_set_invalidate(bool on)
 {
     sdl_invalidate = on;
 }
 
+static void maru_sdl_set_interpolation(bool on)
+{
+    if (on == true) {
+        INFO("set PIXMAN_FILTER_BEST filter for image processing\n");
+
+        /* PIXMAN_FILTER_BILINEAR */
+        sdl_pixman_filter = PIXMAN_FILTER_BEST;
+    } else {
+        INFO("set PIXMAN_FILTER_FAST filter for image processing\n");
+
+        /* PIXMAN_FILTER_NEAREST */
+        sdl_pixman_filter = PIXMAN_FILTER_FAST;
+    }
+}
+
+static void maru_sdl_init(uint64 swt_handle,
+    unsigned int display_width, unsigned int display_height,
+    bool blank_guide)
+{
+    gchar SDL_windowhack[32] = { 0, };
+    long window_id = swt_handle;
+    blank_guide_enable = blank_guide;
+
+    INFO("maru sdl init\n");
+
+    sprintf(SDL_windowhack, "%ld", window_id);
+    g_setenv("SDL_WINDOWID", SDL_windowhack, 1);
+
+    INFO("register SDL environment variable. "
+        "(SDL_WINDOWID = %s)\n", SDL_windowhack);
+
+    set_emul_resolution(display_width, display_height);
+    set_emul_sdl_bpp(SDL_BPP);
+    maru_sdl_set_interpolation(false);
+    init_multi_touch_state();
+
+    if (blank_guide_enable == true) {
+        INFO("blank guide is on\n");
+    }
+
+    qemu_bh_schedule(sdl_init_bh);
+}
+
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl)
+{
+    dcl = g_malloc0(sizeof(DisplayChangeListener));
+    dcl->ops = &dcl_ops;
+
+    mdcl->surface_init = maru_sdl_init;
+    mdcl->fini = maru_sdl_quit;
+
+    mdcl->resize = maru_sdl_resize;
+    mdcl->update = maru_sdl_update;
+    mdcl->set_invalidate = maru_sdl_set_invalidate;
+    mdcl->set_interpolation = maru_sdl_set_interpolation;
+
+    sdl_init_bh = qemu_bh_new(maru_sdl_init_bh, NULL);
+
+#ifdef SDL_THREAD
+    qemu_mutex_init(&sdl_mutex);
+    qemu_cond_init(&sdl_cond);
+#endif
+
+    register_displaychangelistener(dcl);
+}
+
 bool maru_extract_framebuffer(void *buffer)
 {
     uint32_t buffer_size = 0;
@@ -633,7 +653,7 @@ bool maru_extract_framebuffer(void *buffer)
     maru_do_pixman_dpy_surface(dpy_surface->image);
 
     buffer_size = surface_stride(dpy_surface) * surface_height(dpy_surface);
-    INFO("extract framebuffer %d\n", buffer_size);
+    TRACE("extract framebuffer %d\n", buffer_size);
 
     memcpy(buffer, surface_data(dpy_surface), buffer_size);
     return true;
index 5345c78..9fa2f64 100644 (file)
 #define MARU_SDL_H_
 
 #include "ui/console.h"
+#include "maru_display.h"
 
-extern DisplayChangeListenerOps maru_dcl_ops;
-
-void maru_sdl_pre_init(void);
-void maru_sdl_init(uint64 swt_handle,
-    unsigned int display_width, unsigned int display_height,
-    bool blank_guide);
-void maru_sdl_resize(void);
-void maru_sdl_update(void);
-void maru_sdl_invalidate(bool on);
-void maru_sdl_interpolation(bool on);
-void maru_sdl_quit(void);
-
-bool maru_extract_framebuffer(void *buffer);
+void maru_sdl_pre_init(MaruDisplayChangeListener *mdcl);
 
 #endif /* MARU_SDL_H_ */
index 174198e..dbe2a15 100644 (file)
@@ -33,7 +33,7 @@
 #include "hw/pci/maru_brightness.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(tizen, sdl_processing);
+MULTI_DEBUG_CHANNEL(tizen, sdl_op);
 
 
 /* Image processing functions using the pixman library */
index 9d14fcc..226e888 100644 (file)
 #include <sys/shm.h>
 
 #include "qemu/main-loop.h"
-#include "emul_state.h"
 #include "maru_display.h"
-#include "maru_shm.h"
+#include "emul_state.h"
 #include "hw/pci/maru_brightness.h"
 #include "skin/maruskin_server.h"
 #include "util/maru_err_table.h"
 #include "debug_ch.h"
 
-#include "tethering/touch.h"
+#include "eventcast/encode_fb.h"
 
-MULTI_DEBUG_CHANNEL(tizen, maru_shm);
+MULTI_DEBUG_CHANNEL(tizen, shm);
 
-static QEMUBH *shm_update_bh;
+static DisplayChangeListener *dcl;
 
 static DisplaySurface *dpy_surface;
 static void *shared_memory = (void *) 0;
@@ -201,24 +200,54 @@ static void qemu_ds_shm_refresh(DisplayChangeListener *dcl)
     }
 }
 
-static void maru_shm_update_bh(void *opaque)
-{
-    graphic_hw_invalidate(NULL);
-}
-
-DisplayChangeListenerOps maru_dcl_ops = {
+static DisplayChangeListenerOps dcl_ops = {
     .dpy_name          = "maru_shm",
     .dpy_refresh       = qemu_ds_shm_refresh,
     .dpy_gfx_update    = qemu_ds_shm_update,
     .dpy_gfx_switch    = qemu_ds_shm_switch,
 };
 
-void maru_shm_pre_init(void)
+static void maru_shm_quit(void)
 {
-    shm_update_bh = qemu_bh_new(maru_shm_update_bh, NULL);
+    struct shmid_ds shm_info;
+
+    INFO("maru shm quit\n");
+
+    if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) {
+        ERR("shmctl failed\n");
+        shm_info.shm_nattch = 0;
+    }
+
+    if (shmdt(shared_memory) == -1) {
+        ERR("shmdt failed\n");
+        perror("maru_vga: ");
+        return;
+    }
+    shared_memory = NULL;
+
+    if (shm_info.shm_nattch == 1) {
+        /* remove */
+        if (shmctl(skin_shmid, IPC_RMID, 0) == -1) {
+            INFO("segment was already removed\n");
+            perror("maru_vga: ");
+        } else {
+            INFO("shared memory was removed\n");
+        }
+    } else {
+        INFO("number of current attaches = %d\n",
+            (int)shm_info.shm_nattch);
+    }
+
+    unregister_displaychangelistener(dcl);
+    g_free(dcl);
 }
 
-void maru_shm_init(uint64 swt_handle,
+static void maru_shm_resize(void)
+{
+    shm_skip_update = 0;
+}
+
+static void maru_shm_init(uint64 swt_handle,
     unsigned int display_width, unsigned int display_height,
     bool blank_guide)
 {
@@ -271,48 +300,18 @@ void maru_shm_init(uint64 swt_handle,
     INFO("Memory attached at 0x%X\n", (int)shared_memory);
 }
 
-void maru_shm_quit(void)
-{
-    struct shmid_ds shm_info;
 
-    INFO("maru shm quit\n");
-
-    if (shmctl(skin_shmid, IPC_STAT, &shm_info) == -1) {
-        ERR("shmctl failed\n");
-        shm_info.shm_nattch = -1;
-    }
-
-    if (shmdt(shared_memory) == -1) {
-        ERR("shmdt failed\n");
-        perror("maru_vga: ");
-        return;
-    }
-    shared_memory = NULL;
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl)
+{
+    dcl = g_malloc0(sizeof(DisplayChangeListener));
+    dcl->ops = &dcl_ops;
 
-    if (shm_info.shm_nattch == 1) {
-        /* remove */
-        if (shmctl(skin_shmid, IPC_RMID, 0) == -1) {
-            INFO("segment was already removed\n");
-            perror("maru_vga: ");
-        } else {
-            INFO("shared memory was removed\n");
-        }
-    } else if (shm_info.shm_nattch != -1) {
-        INFO("number of current attaches = %d\n",
-            (int)shm_info.shm_nattch);
-    }
-}
+    mdcl->surface_init = maru_shm_init;
+    mdcl->fini = maru_shm_quit;
 
-void maru_shm_resize(void)
-{
-    shm_skip_update = 0;
-}
+    mdcl->resize = maru_shm_resize;
 
-void maru_shm_update(void)
-{
-    if (shm_update_bh != NULL) {
-        qemu_bh_schedule(shm_update_bh);
-    }
+    register_displaychangelistener(dcl);
 }
 
 bool maru_extract_framebuffer(void *buffer)
index efa50e2..14eb281 100644 (file)
 #define MARU_SHM_H_
 
 #include "ui/console.h"
+#include "maru_display.h"
 
-extern DisplayChangeListenerOps maru_dcl_ops;
-
-void maru_shm_pre_init(void);
-void maru_shm_init(uint64 swt_handle,
-    unsigned int display_width, unsigned int display_height,
-    bool blank_guide);
-void maru_shm_resize(void);
-void maru_shm_quit(void);
-void maru_shm_update(void);
-bool maru_extract_framebuffer(void *buffer);
+void maru_shm_pre_init(MaruDisplayChangeListener *mdcl);
 
 #endif /* MARU_SHM_H_ */
index 6f68dfb..5f58026 100644 (file)
@@ -1,4 +1,6 @@
 obj-y += genmsg/ecs.pb-c.o genmsg/ecs_ids.pb-c.o ../../distrib/protobuf/protobuf-c.o
-obj-y += ecs_msg.o ecs.o ecs_sensor.o
+obj-y += ecs.o ecs_msg.o ecs_msg_injector.o ecs_msg_device.o
 obj-y += ecs_mon.o ecs-json-streamer.o
-obj-y += ecs_tethering.o
+obj-y += ecs_eventcast.o
+obj-y += ecs_sensor.o
+obj-y += ecs_nfc.o
index c9af676..85cf5b4 100644 (file)
@@ -73,6 +73,7 @@ static int g_client_id = 1;
 
 static QemuMutex mutex_clilist;
 QemuMutex mutex_guest_connection;
+QemuMutex mutex_location_data;
 
 static QemuThread ecs_thread_id;
 
@@ -236,6 +237,7 @@ static void ecs_close(ECS_State *cs) {
 
     qemu_mutex_destroy(&mutex_clilist);
     qemu_mutex_destroy(&mutex_guest_connection);
+    qemu_mutex_destroy(&mutex_location_data);
 }
 
 #ifndef _WIN32
@@ -716,6 +718,7 @@ static void* ecs_initialize(void* args) {
 
     qemu_mutex_init(&mutex_clilist);
     qemu_mutex_init(&mutex_guest_connection);
+    qemu_mutex_init(&mutex_location_data);
 
     TRACE("ecs_loop entered.\n");
     while (cs->ecs_running) {
@@ -842,12 +845,12 @@ bool handle_protobuf_msg(ECS_Client* cli, char* data, int len)
             goto fail;
         msgproc_keepalive_ans(cli, msg);
     }
-    else if (master->type == ECS__MASTER__TYPE__TETHERING_REQ)
+    else if (master->type == ECS__MASTER__TYPE__EVENTCAST_REQ)
     {
-        ECS__TetheringReq* msg = master->tethering_req;
+        ECS__EventCastReq* msg = master->eventcast_req;
         if (!msg)
             goto fail;
-        msgproc_tethering_req(cli, msg);
+        msgproc_eventcast_req(cli, msg);
     }
 
     ecs__master__free_unpacked(master, NULL);
index 2f70c46..2f6b20a 100644 (file)
 #define COMMAND_TYPE_MONITOR    "monitor"
 #define COMMAND_TYPE_DEVICE     "device"
 
-#define COMMAND_TYPE_TETHERING  "tethering"
+#define COMMAND_TYPE_TETHERING  "eventcast"
 
 #define MSG_TYPE_SENSOR         "sensor"
+#define MSG_TYPE_LOCATION       "location"
 #define MSG_TYPE_NFC            "nfc"
 #define MSG_TYPE_SIMUL_NFC      "simul_nfc"
 #define MSG_TYPE_SDCARD         "sdcard"
@@ -78,7 +79,8 @@ enum message_action {
     MSG_ACT_MAG = 112,
     MSG_ACT_LIGHT = 113,
     MSG_ACT_PROXI = 114,
-    MSG_ACT_MOTION = 115
+    MSG_ACT_MOTION = 115,
+    MSG_ACT_LOCATION = 120
 };
 
 #define TIMER_ALIVE_S           60
@@ -103,6 +105,7 @@ typedef unsigned char   type_action;
 #define OUT_BUF_SIZE    4096
 #define READ_BUF_LEN    4096
 #define MAX_ID_SIZE     255
+#define MAX_INJECTOR_REQ_DATA 128
 typedef struct sbuf
 {
     int _netlen;
@@ -173,7 +176,12 @@ bool ntf_to_injector(const char* data, const int len);
 bool ntf_to_control(const char* data, const int len);
 bool ntf_to_monitor(const char* data, const int len);
 
-bool send_to_ecp(ECS__Master* master);
+bool send_msg_to_guest(ECS_Client* ccli, char* cmd, int group, int action,
+                       char* data, int data_len);
+void make_send_device_ntf (char* cmd, int group, int action, char* data);
+
+bool pb_to_all_clients(ECS__Master* master);
+bool pb_to_single_client(ECS__Master* master, ECS_Client *clii);
 
 bool send_injector_ntf(const char* data, const int len);
 bool send_monitor_ntf(const char* data, const int len);
@@ -199,7 +207,7 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg);
 bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg);
 void msgproc_checkversion_req(ECS_Client* ccli, ECS__CheckVersionReq* msg);
 void msgproc_keepalive_ans(ECS_Client* ccli, ECS__KeepAliveAns* msg);
-bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg);
+bool msgproc_eventcast_req(ECS_Client* ccli, ECS__EventCastReq* msg);
 
 char *get_tizen_sdk_data_path(void);
 
diff --git a/tizen/src/ecs/ecs_eventcast.c b/tizen/src/ecs/ecs_eventcast.c
new file mode 100644 (file)
index 0000000..45261b9
--- /dev/null
@@ -0,0 +1,348 @@
+/*
+ * Emulator Control Server - Device Tethering Handler
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ *  KiTae Kim       <kt920.kim@samsung.com>
+ *  JiHye Kim       <jihye1128.kim@samsung.com>
+ *  YeongKyoon Lee  <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "ui/console.h"
+
+#include "ecs.h"
+#include "ecs_eventcast.h"
+#include "eventcast/common.h"
+#include "eventcast/sensor.h"
+#include "eventcast/touch.h"
+#include "hw/virtio/maru_virtio_touchscreen.h"
+#include "hw/virtio/maru_virtio_hwkey.h"
+
+#include "util/new_debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(ecs);
+
+#define MSG_BUF_SIZE  255
+#define MSG_LEN_SIZE    4
+
+#define PRESSED     1
+#define RELEASED    2
+
+static bool send_eventcast_ntf(const char *data);
+static void send_eventcast_status_ntf(type_group group, type_action action);
+
+static int eventcast_port = 0;
+
+void send_eventcast_sensor_status_ecp(void)
+{
+    LOG_TRACE("send event_status to ecp\n");
+    send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP,
+            ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS);
+}
+
+void send_eventcast_touch_status_ecp(void)
+{
+    send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP,
+            ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS);
+}
+
+void send_eventcast_connection_status_ecp(void)
+{
+    LOG_TRACE("send connection_status to ecp\n");
+    send_eventcast_status_ntf(ECS_EVENTCAST_MSG_GROUP_ECP,
+            ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS);
+}
+
+#if 0
+static void send_eventcast_port_ecp(void)
+{
+    type_length length;
+    type_group group = ECS_EVENTCAST_MSG_GROUP_ECP;
+    type_action action = ECS_EVENTCAST_MSG_ACTION_CONNECT;
+    uint8_t *msg = NULL;
+    gchar data[12];
+
+    msg = g_malloc(MSG_BUF_SIZE);
+    if (!msg) {
+        return;
+    }
+
+    LOG_TRACE("send port_num: %d\n", eventcast_port);
+    g_snprintf(data, sizeof(data) - 1, "%d", eventcast_port);
+    length = strlen(data);
+
+    memcpy(msg, ECS_EVENTCAST_MSG_CATEGORY, 10);
+    memcpy(msg + 10, &length, sizeof(unsigned short));
+    memcpy(msg + 12, &group, sizeof(unsigned char));
+    memcpy(msg + 13, &action, sizeof(unsigned char));
+    memcpy(msg + 14, data, length);
+
+    LOG_TRACE("send eventcast_ntf to ecp. action=%d, group=%d, data=%s\n",
+        action, group, data);
+
+    send_eventcast_ntf((const char *)msg);
+
+    if (msg) {
+        g_free(msg);
+    }
+}
+#endif
+
+static void send_eventcast_connection_info(void)
+{
+    type_length length;
+    type_group group = ECS_EVENTCAST_MSG_GROUP_ECP;
+    type_action action = ECS_EVENTCAST_MSG_ACTION_CONNECT;
+    uint8_t *msg = NULL;
+    gchar data[64];
+
+    msg = g_malloc(MSG_BUF_SIZE);
+    if (!msg) {
+        LOG_SEVERE("failed to allocate memory\n");
+        return;
+    }
+
+    LOG_INFO("send eventcast port: %d\n", eventcast_port);
+    {
+        const char *ip = get_eventcast_connected_ipaddr();
+        int port = get_eventcast_connected_port();
+
+        if (!ip) {
+            LOG_SEVERE("invalid connected ip\n");
+            return;
+        }
+
+        if (!port) {
+            LOG_SEVERE("invalid connected port\n");
+            return;
+        }
+        g_snprintf(data, sizeof(data) - 1, "%s:%d", ip, port);
+        length = strlen(data);
+        data[length] = '\0';
+    }
+
+    memcpy(msg, ECS_EVENTCAST_MSG_CATEGORY, 10);
+    memcpy(msg + 10, &length, sizeof(unsigned short));
+    memcpy(msg + 12, &group, sizeof(unsigned char));
+    memcpy(msg + 13, &action, sizeof(unsigned char));
+    memcpy(msg + 14, data, length);
+
+    LOG_INFO("send connection msg to ecp. "
+        "action=%d, group=%d, data=%s length=%d\n",
+        action, group, data, length);
+
+    send_eventcast_ntf((const char *)msg);
+
+    g_free(msg);
+}
+
+static void send_eventcast_status_ntf(type_group group, type_action action)
+{
+    type_length length = 1;
+    int status = 0;
+    uint8_t *msg = NULL;
+    gchar data[2];
+
+    switch (action) {
+        case ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS:
+            status = get_eventcast_connection_status();
+            if (status == CONNECTED) {
+                send_eventcast_connection_info();
+            }
+            break;
+        case ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS:
+            status = get_eventcast_sensor_status();
+            break;
+        case ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS:
+            status = get_eventcast_touch_status();
+            break;
+        default:
+            break;
+    }
+
+    msg = g_malloc(MSG_BUF_SIZE);
+    if (!msg) {
+        return;
+    }
+
+    g_snprintf(data, sizeof(data), "%d", status);
+
+    memcpy(msg, ECS_EVENTCAST_MSG_CATEGORY, 10);
+    memcpy(msg + 10, &length, sizeof(unsigned short));
+    memcpy(msg + 12, &group, sizeof(unsigned char));
+    memcpy(msg + 13, &action, sizeof(unsigned char));
+    memcpy(msg + 14, data, 1);
+
+    LOG_TRACE("send eventcast_ntf to ecp. action=%d, group=%d, data=%s\n",
+        action, group, data);
+
+    send_eventcast_ntf((const char *)msg);
+
+    if (msg) {
+        g_free(msg);
+    }
+}
+
+static bool send_eventcast_ntf(const char *data)
+{
+    type_length length = 0;
+    type_group group = 0;
+    type_action action = 0;
+
+    const int catsize = 10;
+    char cat[catsize + 1];
+    memset(cat, 0, catsize + 1);
+
+    read_val_str(data, cat, catsize);
+    read_val_short(data + catsize, &length);
+    read_val_char(data + catsize + 2, &group);
+    read_val_char(data + catsize + 2 + 1, &action);
+
+    const char* ijdata = (data + catsize + 2 + 1 + 1);
+
+    LOG_TRACE("header cat = %s, length = %d, action=%d, group=%d\n", cat, length,action, group);
+
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__EventCastNtf ntf = ECS__EVENT_CAST_NTF__INIT;
+
+    ntf.category = (char*) g_malloc(catsize + 1);
+    strncpy(ntf.category, cat, 10);
+
+    ntf.length = length;
+    ntf.group = group;
+    ntf.action = action;
+
+    if (length > 0) {
+        ntf.has_data = 1;
+
+        ntf.data.data = g_malloc(length);
+        ntf.data.len = length;
+        memcpy(ntf.data.data, ijdata, length);
+
+        LOG_TRACE("data = %s, length = %hu\n", ijdata, length);
+    }
+
+    master.type = ECS__MASTER__TYPE__EVENTCAST_NTF;
+    master.eventcast_ntf = &ntf;
+
+    pb_to_all_clients(&master);
+
+    if (ntf.data.data && ntf.data.len > 0) {
+        g_free(ntf.data.data);
+    }
+
+    if (ntf.category) {
+        g_free(ntf.category);
+    }
+
+    return true;
+}
+
+void send_eventcast_sensor_data(const char *data, int len)
+{
+    set_injector_data(data);
+}
+
+void send_eventcast_touch_data(int x, int y, int index, int status)
+{
+    virtio_touchscreen_event(x, y, index, status);
+}
+
+void send_eventcast_hwkey_data(int keycode)
+{
+    maru_hwkey_event(PRESSED, keycode);
+    maru_hwkey_event(RELEASED, keycode);
+}
+
+// handle eventcast_req message
+bool msgproc_eventcast_req(ECS_Client* ccli, ECS__EventCastReq* msg)
+{
+    gchar cmd[10] = {0};
+    gchar **server_addr = NULL;
+
+    LOG_TRACE("enter %s\n", __func__);
+
+    g_strlcpy(cmd, msg->category, sizeof(cmd));
+    type_length length = (type_length) msg->length;
+    type_group group = (type_group) (msg->group & 0xff);
+    type_action action = (type_action) (msg->action & 0xff);
+
+    LOG_TRACE("<< header = cmd = %s, length = %d, action=%d, group=%d\n",
+            cmd, length, action, group);
+
+    switch(action) {
+        case ECS_EVENTCAST_MSG_ACTION_CONNECT:
+            LOG_TRACE("MSG_ACTION_CONNECT\n");
+
+            if (msg->data.data && msg->data.len > 0) {
+                const gchar *data = (const gchar *)msg->data.data;
+                gchar *ip_address = NULL;
+                guint64 port = 0;
+
+                server_addr = g_strsplit(data, ":", 0);
+                if (server_addr && server_addr[0]) {
+                    int len = strlen(server_addr[0]);
+
+                    if (len) {
+                        ip_address = g_malloc(len + 1);
+                        g_strlcpy(ip_address, server_addr[0], len + 1);
+                    }
+                    LOG_INFO("IP address: %s, length: %d\n", ip_address, len);
+                }
+
+                if (server_addr && server_addr[1]) {
+                    port = g_ascii_strtoull(server_addr[1], NULL, 10);
+                    LOG_INFO("port number: %d\n", port);
+                } else {
+                    LOG_SEVERE("failed to parse port number\n");
+                }
+                LOG_TRACE("len = %zd, data\" %s\"", strlen(data), data);
+
+                connect_eventcast_app(ip_address, port);
+                eventcast_port = port;
+
+                LOG_TRACE("port_num: %d, %d\n", port, eventcast_port);
+                g_free(ip_address);
+                g_strfreev(server_addr);
+            } else {
+                LOG_SEVERE("ip address and port value are null\n");
+            }
+            break;
+        case ECS_EVENTCAST_MSG_ACTION_DISCONNECT:
+            LOG_TRACE("MSG_ACTION_DISCONNECT\n");
+            disconnect_eventcast_app();
+            eventcast_port = 0;
+            break;
+        case ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS:
+        case ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS:
+        case ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS:
+            LOG_TRACE("get_status_action\n");
+            send_eventcast_status_ntf(group, action);
+            break;
+        default:
+            break;
+    }
+
+    LOG_TRACE("leave %s\n", __func__);
+
+    return true;
+}
similarity index 51%
rename from tizen/src/ecs/ecs_tethering.h
rename to tizen/src/ecs/ecs_eventcast.h
index 1acf078..ac8c4a0 100644 (file)
  *
  */
 
+#ifndef __ECS_EVENTCAST_H__
+#define __ECS_EVENTCAST_H__
+
 /*
- * define tethering messages between ecs and ecp
+ * define eventcast messages between ecs and ecp
  */
-#define ECS_TETHERING_MSG_CATEGORY                      "tethering"
-
-#define ECS_TETHERING_MSG_GROUP_ECP                     1
-// #define TETHERING_MSG_GROUP_USB
-// #define TETHERING_MSG_GROUP_WIFI
+#define ECS_EVENTCAST_MSG_CATEGORY                      "eventcast"
+#define ECS_EVENTCAST_MSG_GROUP_ECP                     1
+
+enum ECS_EVENTCAST_MSG_ACTION {
+    ECS_EVENTCAST_MSG_ACTION_CONNECT = 1,
+    ECS_EVENTCAST_MSG_ACTION_DISCONNECT,
+    ECS_EVENTCAST_MSG_ACTION_CONNECTION_STATUS,
+    ECS_EVENTCAST_MSG_ACTION_SENSOR_STATUS,
+    ECS_EVENTCAST_MSG_ACTION_TOUCH_STATUS,
+};
 
-#if 0
-#define ECS_TETHERING_MSG_ACTION_CONNECT                1
-#define ECS_TETHERING_MSG_ACTION_DISCONNECT             2
-#define ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS      3
-#define ECS_TETHERING_MSG_ACTION_SENSOR_STATUS          4
-#define ECS_TETHERING_MSG_ACTION_TOUCH_STATUS           5
-#endif
+void send_eventcast_sensor_status_ecp(void);
 
-enum ECS_TETHERING_MSG_ACTION {
-    ECS_TETHERING_MSG_ACTION_CONNECT = 1,
-    ECS_TETHERING_MSG_ACTION_DISCONNECT,
-    ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS,
-    ECS_TETHERING_MSG_ACTION_SENSOR_STATUS,
-    ECS_TETHERING_MSG_ACTION_TOUCH_STATUS,
-};
+void send_eventcast_touch_status_ecp(void);
 
-void send_tethering_sensor_status_ecp(void);
+void send_eventcast_connection_status_ecp(void);
 
-void send_tethering_touch_status_ecp(void);
+void send_eventcast_sensor_data(const char *data, int len);
 
-void send_tethering_connection_status_ecp(void);
+void send_eventcast_touch_data(int x, int y, int index, int status);
 
-void send_tethering_sensor_data(const char *data, int len);
+void send_eventcast_hwkey_data(int keycode);
 
-void send_tethering_touch_data(int x, int y, int index, int status);
+#endif /* __ECS_EVENTCAST_H__ */
index 9957144..ae4be4e 100644 (file)
@@ -112,7 +112,7 @@ bool send_monitor_ntf(const char* data, int size)
     master.type = ECS__MASTER__TYPE__MONITOR_NTF;
     master.monitor_ntf = &ntf;
 
-    send_to_ecp(&master);
+    pb_to_all_clients(&master);
 
     if (ntf.command)
         g_free(ntf.command);
index 0ac6538..cb1567b 100644 (file)
  */
 
 #include <stdbool.h>
+#include <pthread.h>
 #include <glib.h>
 
-#ifdef CONFIG_LINUX
-#include <sys/epoll.h>
-#endif
-
 #include "hw/qdev.h"
 #include "net/net.h"
 #include "net/slirp.h"
 #include "qapi/qmp/json-parser.h"
 #include "ui/qemu-spice.h"
 #include "qemu/queue.h"
-#include "qemu/option.h"
 #include "sysemu/char.h"
 #include "qemu/main-loop.h"
+
+#ifdef CONFIG_LINUX
+#include <sys/epoll.h>
+#endif
+
+#ifndef CONFIG_WIN32
+#include <arpa/inet.h>
+#endif
+
 #include "qemu-common.h"
-#include "util/sdb.h"
 #include "ecs-json-streamer.h"
 #include "qmp-commands.h"
 
-#include "ecs.h"
-#ifndef CONFIG_USE_SHM
-#include "display/maru_finger.h"
-#endif
-
-#include "hw/virtio/maru_virtio_evdi.h"
-#include "hw/virtio/maru_virtio_sensor.h"
-#include "hw/virtio/maru_virtio_jack.h"
-#include "hw/virtio/maru_virtio_power.h"
-#include "hw/virtio/maru_virtio_nfc.h"
 #include "hw/virtio/maru_virtio_vmodem.h"
-#include "skin/maruskin_operation.h"
-#include "skin/maruskin_server.h"
-#include "util/maru_device_hotplug.h"
-#include "emul_state.h"
+#include "hw/virtio/maru_virtio_evdi.h"
 
-#include "debug_ch.h"
-MULTI_DEBUG_CHANNEL(qemu, ecs-msg);
+#include "ecs.h"
 
-// utility functions
-static int guest_connection = 0;
-extern QemuMutex mutex_guest_connection;
+#include "debug_ch.h"
 
-/*static function define*/
-static void handle_sdcard(char* dataBuf, size_t dataLen);
-static char* get_emulator_sdcard_path(void);
-static char *get_old_tizen_sdk_data_path(void);
+MULTI_DEBUG_CHANNEL(qemu, ecs);
 
 static void* build_master(ECS__Master* master, int* payloadsize)
 {
@@ -98,26 +83,7 @@ static void* build_master(ECS__Master* master, int* payloadsize)
     return buf;
 }
 
-static bool send_single_msg(ECS__Master* master, ECS_Client *clii)
-{
-    int payloadsize = 0;
-    void* buf = build_master(master, &payloadsize);
-    if (!buf)
-    {
-        ERR("invalid buf\n");
-        return false;
-    }
-
-    send_to_single_client(clii, buf, payloadsize);
-
-    if (buf)
-    {
-        g_free(buf);
-    }
-    return true;
-}
-
-bool send_to_ecp(ECS__Master* master)
+bool pb_to_all_clients(ECS__Master* master)
 {
     int payloadsize = 0;
     void* buf = build_master(master, &payloadsize);
@@ -136,8 +102,8 @@ bool send_to_ecp(ECS__Master* master)
     }
     return true;
 }
-#if 0
-static bool send_to_single_client(ECS__Master* master, ECS_Client *ccli)
+
+bool pb_to_single_client(ECS__Master* master, ECS_Client *clii)
 {
     int payloadsize = 0;
     void* buf = build_master(master, &payloadsize);
@@ -147,8 +113,7 @@ static bool send_to_single_client(ECS__Master* master, ECS_Client *ccli)
         return false;
     }
 
-    if (!send_to_client(ccli->client_fd, buf, payloadsize))
-        return false;
+    send_to_single_client(clii, buf, payloadsize);
 
     if (buf)
     {
@@ -156,213 +121,66 @@ static bool send_to_single_client(ECS__Master* master, ECS_Client *ccli)
     }
     return true;
 }
-#endif
 
-static void send_status_injector_ntf(const char* cmd, int cmdlen, int act, char* on)
+void msgproc_keepalive_ans (ECS_Client* ccli, ECS__KeepAliveAns* msg)
 {
-    int msglen = 0, datalen = 0;
-    type_length length  = 0;
-    type_group group = GROUP_STATUS;
-    type_action action = act;
-
-    if (cmd == NULL || cmdlen > 10)
-        return;
-
-    if (on == NULL) {
-        msglen = 14;
-    } else {
-        datalen = strlen(on);
-        length  = (unsigned short)datalen;
-
-        msglen = datalen + 15;
-    }
-
-    char* status_msg = (char*) malloc(msglen);
-    if(!status_msg)
-        return;
-
-    memset(status_msg, 0, msglen);
-
-    memcpy(status_msg, cmd, cmdlen);
-    memcpy(status_msg + 10, &length, sizeof(unsigned short));
-    memcpy(status_msg + 12, &group, sizeof(unsigned char));
-    memcpy(status_msg + 13, &action, sizeof(unsigned char));
-
-    if (on != NULL) {
-        memcpy(status_msg + 14, on, datalen);
-    }
-
-    send_injector_ntf(status_msg, msglen);
-
-    if (status_msg)
-        free(status_msg);
+    ccli->keep_alive = 0;
 }
 
-static void msgproc_injector_ans(ECS_Client* ccli, const char* category, bool succeed)
+void make_send_device_ntf (char* cmd, int group, int action, char* data)
 {
-    if (ccli == NULL) {
-        return;
+    int msg_length = 15;
+    type_length length = 0;
+    if (data != NULL) {
+        length = strlen(data);
     }
-    int catlen = 0;
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__InjectorAns ans = ECS__INJECTOR_ANS__INIT;
-
-    TRACE("injector ans - category : %s, succed : %d\n", category, succeed);
-
-    catlen = strlen(category);
-    ans.category = (char*) g_malloc0(catlen + 1);
-    memcpy(ans.category, category, catlen);
-
-    ans.errcode = !succeed;
-    master.type = ECS__MASTER__TYPE__INJECTOR_ANS;
-    master.injector_ans = &ans;
-
-    send_single_msg(&master, ccli);
-
-    if (ans.category)
-        g_free(ans.category);
-}
-
-static void msgproc_device_ans(ECS_Client* ccli, const char* category, bool succeed, char* data)
-{
-    if (ccli == NULL) {
+    msg_length += length;
+    char* send_msg = (char*) malloc(msg_length);
+    if(!send_msg)
         return;
-    }
-    int catlen = 0;
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
-
-    TRACE("device ans - category : %s, succed : %d\n", category, succeed);
-
-    catlen = strlen(category);
-    ans.category = (char*) g_malloc0(catlen + 1);
-    memcpy(ans.category, category, catlen);
-
-    ans.errcode = !succeed;
-
+    memcpy(send_msg, cmd, 10);
+    memcpy(send_msg + 10, &length, sizeof(unsigned short));
+    memcpy(send_msg + 12, &group, sizeof(unsigned char));
+    memcpy(send_msg + 13, &action, sizeof(unsigned char));
     if (data != NULL) {
-        ans.length = strlen(data);
-
-        if (ans.length > 0) {
-            ans.has_data = 1;
-            ans.data.data = g_malloc(ans.length);
-            ans.data.len = ans.length;
-            memcpy(ans.data.data, data, ans.length);
-            TRACE("data = %s, length = %hu\n", data, ans.length);
-        }
+        memcpy(send_msg + 14, data, strlen(data));
     }
-
-    master.type = ECS__MASTER__TYPE__DEVICE_ANS;
-    master.device_ans = &ans;
-
-    send_single_msg(&master, ccli);
-
-    if (ans.category)
-        g_free(ans.category);
+    send_device_ntf(send_msg, msg_length);
+    free(send_msg);
 }
 
-bool msgproc_injector_req(ECS_Client* ccli, ECS__InjectorReq* msg)
-{
-    char cmd[10];
-    char data[10];
-    bool ret = false;
-    int sndlen = 0;
-    int value = 0;
+bool send_msg_to_guest(ECS_Client* ccli, char* cmd, int group, int action, char* data, int data_len)
+ {
+    int sndlen = 15; // HEADER(CMD + LENGTH + GROUP + ACTION) + 1
     char* sndbuf;
-    memset(cmd, 0, 10);
-    strncpy(cmd, msg->category, sizeof(cmd) -1);
-    type_length length = (type_length) msg->length;
-    type_group group = (type_group) (msg->group & 0xff);
-    type_action action = (type_action) (msg->action & 0xff);
-
-
-    int datalen = 0;
-    if (msg->has_data)
-    {
-        datalen = msg->data.len;
-    }
-    //TRACE(">> count= %d", ++ijcount);
-
-    TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d\n", cmd, length,
-            action, group);
-
-    /*SD CARD msg process*/
-    if (!strncmp(cmd, MSG_TYPE_SDCARD, strlen(MSG_TYPE_SDCARD))) {
-        if (msg->has_data) {
-            TRACE("msg(%zu) : %s\n", msg->data.len, msg->data.data);
-            handle_sdcard((char*) msg->data.data, msg->data.len);
-
-        } else {
-            ERR("has no msg\n");
-        }
+    bool ret = false;
 
-    } else if (!strncmp(cmd, MSG_TYPE_SENSOR, sizeof(MSG_TYPE_SENSOR))) {
-        if (group == MSG_GROUP_STATUS) {
-            memset(data, 0, 10);
-            if (action == MSG_ACT_BATTERY_LEVEL) {
-                sprintf(data, "%d", get_power_capacity());
-            } else if (action == MSG_ACT_BATTERY_CHARGER) {
-                sprintf(data, "%d", get_jack_charger());
-            } else {
-                goto injector_send;
-            }
-            TRACE("status : %s", data);
-            send_status_injector_ntf(MSG_TYPE_SENSOR, 6, action, data);
-            msgproc_injector_ans(ccli, cmd, true);
-            return true;
-        } else {
-            if (msg->data.data && datalen > 0) {
-                set_injector_data((char*) msg->data.data);
-            }
-        }
-    } else if (!strncmp(cmd, MSG_TYPE_GUEST, 5)) {
-        qemu_mutex_lock(&mutex_guest_connection);
-        value = guest_connection;
-        qemu_mutex_unlock(&mutex_guest_connection);
-        send_status_injector_ntf(MSG_TYPE_GUEST, 5, value, NULL);
-        return true;
-    }
+    if (data != NULL)
+        sndlen += data_len;
 
-injector_send:
-    sndlen = datalen + 14;
-    sndbuf = (char*) g_malloc(sndlen + 1);
+    sndbuf = (char*) g_malloc0(sndlen);
     if (!sndbuf) {
-        msgproc_injector_ans(ccli, cmd, ret);
         return false;
     }
-
-    memset(sndbuf, 0, sndlen + 1);
-
-    // set data
     memcpy(sndbuf, cmd, 10);
-    memcpy(sndbuf + 10, &length, 2);
+    memcpy(sndbuf + 10, &data_len, 2);
     memcpy(sndbuf + 12, &group, 1);
     memcpy(sndbuf + 13, &action, 1);
 
-
-    if (msg->has_data)
-    {
-        if (msg->data.data && msg->data.len > 0)
-        {
-            const char* data = (const char*)msg->data.data;
-            memcpy(sndbuf + 14, data, datalen);
-            TRACE(">> print len = %zd, data\" %s\"\n", strlen(data), data);
-        }
+    if (data != NULL) {
+        memcpy(sndbuf + 14, data, data_len);
     }
 
     if(strcmp(cmd, "telephony") == 0) {
-       TRACE("telephony msg >>");
-       ret = send_to_vmodem(route_ij, sndbuf, sndlen);
+        TRACE("telephony msg >>");
+        ret = send_to_vmodem(route_ij, sndbuf, sndlen);
     } else {
-       TRACE("evdi msg >> %s", cmd);
-       ret = send_to_evdi(route_ij, sndbuf, sndlen);
+        INFO("evdi msg >> %s", cmd);
+        ret = send_to_evdi(route_ij, sndbuf, sndlen);
     }
 
-
     g_free(sndbuf);
 
-    msgproc_injector_ans(ccli, cmd, ret);
-
     if (!ret) {
         return false;
     }
@@ -370,282 +188,6 @@ injector_send:
     return true;
 }
 
-void ecs_suspend_lock_state(int state)
-{
-    int catlen;
-
-    ECS__InjectorReq msg = ECS__INJECTOR_REQ__INIT;
-    const char* category = "suspend";
-
-    catlen = strlen(category);
-    msg.category = (char*) g_malloc0(catlen + 1);
-    memcpy(msg.category, category, catlen);
-
-    msg.group = 5;
-    msg.action = state;
-
-    msgproc_injector_req(NULL, &msg);
-}
-
-
-void msgproc_keepalive_ans (ECS_Client* ccli, ECS__KeepAliveAns* msg)
-{
-    ccli->keep_alive = 0;
-}
-
-void send_host_keyboard_ntf (int on)
-{
-    type_length length = (unsigned short)1;
-    type_group group = GROUP_STATUS;
-    type_action action = 122;
-
-    char* keyboard_msg = (char*) malloc(15);
-    if(!keyboard_msg)
-        return;
-
-    memcpy(keyboard_msg, "HKeyboard", 10);
-    memcpy(keyboard_msg + 10, &length, sizeof(unsigned short));
-    memcpy(keyboard_msg + 12, &group, sizeof(unsigned char));
-    memcpy(keyboard_msg + 13, &action, sizeof(unsigned char));
-    memcpy(keyboard_msg + 14, ((on == 1) ? "1":"0"), 1);
-
-    send_device_ntf(keyboard_msg, 15);
-
-    if (keyboard_msg)
-        free(keyboard_msg);
-}
-
-extern char tizen_target_img_path[];
-void send_target_image_information(ECS_Client* ccli) {
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
-    int length = strlen(tizen_target_img_path); // ??
-
-    ans.category = (char*) g_malloc(10 + 1);
-    strncpy(ans.category, "info", 10);
-
-    ans.errcode = 0;
-    ans.length = length;
-    ans.group = 1;
-    ans.action = 1;
-
-    if (length > 0)
-    {
-        ans.has_data = 1;
-
-        ans.data.data = g_malloc(length);
-        ans.data.len = length;
-        memcpy(ans.data.data, tizen_target_img_path, length);
-
-        TRACE("data = %s, length = %hu\n", tizen_target_img_path, length);
-    }
-
-    master.type = ECS__MASTER__TYPE__DEVICE_ANS;
-    master.device_ans = &ans;
-
-    send_single_msg(&master, ccli);
-
-    if (ans.data.len > 0)
-    {
-        g_free(ans.data.data);
-    }
-
-    g_free(ans.category);
-
-}
-
-bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
-{
-    int is_on = 0;
-    char cmd[10];
-    char* data = NULL;
-    memset(cmd, 0, 10);
-    strcpy(cmd, msg->category);
-    type_length length = (type_length) msg->length;
-    type_group group = (type_group) (msg->group & 0xff);
-    type_action action = (type_action) (msg->action & 0xff);
-
-    if (msg->has_data && msg->data.len > 0)
-    {
-        data = (char*) g_malloc0(msg->data.len + 1);
-        memcpy(data, msg->data.data, msg->data.len);
-    }
-
-    TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d\n", cmd, length,
-            action, group);
-
-    if (!strncmp(cmd, MSG_TYPE_SENSOR, 6)) {
-        if (group == MSG_GROUP_STATUS) {
-            if (action == MSG_ACT_ACCEL) {
-                get_sensor_accel();
-            } else if (action == MSG_ACT_GYRO) {
-                get_sensor_gyro();
-            } else if (action == MSG_ACT_MAG) {
-                get_sensor_mag();
-            } else if (action == MSG_ACT_LIGHT) {
-                get_sensor_light();
-            } else if (action == MSG_ACT_PROXI) {
-                get_sensor_proxi();
-            }
-        } else {
-            if (data != NULL) {
-                set_injector_data(data);
-            } else {
-                ERR("sensor set data is null\n");
-            }
-        }
-        msgproc_device_ans(ccli, cmd, true, NULL);
-    } else if (!strncmp(cmd, "Network", 7)) {
-        if (data != NULL) {
-            TRACE(">>> Network msg: '%s'\n", data);
-            if(net_slirp_redir(data) < 0) {
-                ERR( "redirect [%s] fail\n", data);
-            } else {
-                TRACE("redirect [%s] success\n", data);
-            }
-        } else {
-            ERR("Network redirection data is null.\n");
-        }
-    } else if (!strncmp(cmd, "HKeyboard", 8)) {
-        if (group == MSG_GROUP_STATUS) {
-            send_host_keyboard_ntf(is_host_keyboard_attached());
-        } else {
-            if (data == NULL) {
-                ERR("HKeyboard data is NULL\n");
-                return false;
-            }
-
-            if (!strncmp(data, "1", 1)) {
-                is_on = 1;
-            }
-            do_host_kbd_enable(is_on);
-            notify_host_kbd_state(is_on);
-        }
-    } else if (!strncmp(cmd, "TGesture", strlen("TGesture"))) {
-        /* release multi-touch */
-#if !defined(CONFIG_USE_SHM) && defined(CONFIG_SDL)
-        if (get_multi_touch_enable() != 0) {
-            clear_finger_slot(false);
-        }
-#else
-        // TODO:
-#endif
-
-        if (data == NULL) {
-            ERR("touch gesture data is NULL\n");
-            return false;
-        }
-
-        TRACE("%s\n", data);
-
-        char token[] = "#";
-
-        if (group == 1) { /* HW key event */
-            char *section = strtok(data, token);
-            int event_type = atoi(section);
-
-            section = strtok(NULL, token);
-            int keycode = atoi(section);
-
-            do_hw_key_event(event_type, keycode);
-        } else { /* touch event */
-            char *section = strtok(data, token);
-            int event_type = atoi(section);
-
-            section = strtok(NULL, token);
-            int xx = atoi(section);
-
-            section = strtok(NULL, token);
-            int yy = atoi(section);
-
-            section = strtok(NULL, token);
-            int zz = atoi(section);
-
-            do_mouse_event(1/* LEFT */, event_type, 0, 0, xx, yy, zz);
-        }
-    } else if (!strncmp(cmd, "info", 4)) {
-        // check to emulator target image path
-        TRACE("receive info message %s\n", tizen_target_img_path);
-        send_target_image_information(ccli);
-
-    } else if (!strncmp(cmd, "input", strlen("input"))) {
-        // cli input
-        TRACE("receive input message [%s]\n", data);
-
-        if (group == 0) {
-
-            TRACE("input keycode data : [%s]\n", data);
-
-            char token[] = " ";
-            char *section = strtok(data, token);
-            int keycode = atoi(section);
-            if (action == 1) {
-                //action 1 press
-                do_hw_key_event(KEY_PRESSED, keycode);
-
-            } else if (action == 2) {
-                //action 2 released
-                do_hw_key_event(KEY_RELEASED, keycode);
-
-            } else {
-                ERR("unknown action : [%d]\n", (int)action);
-            }
-        } else if (group == 1) {
-            //spec out
-            TRACE("input category's group 1 is spec out\n");
-        } else {
-            ERR("unknown group [%d]\n", (int)group);
-        }
-        msgproc_device_ans(ccli, cmd, true, NULL);
-
-    } else if (!strncmp(cmd, "vmname", strlen("vmname"))) {
-        char* vmname = get_emul_vm_name();
-        msgproc_device_ans(ccli, cmd, true, vmname);
-    } else if (!strncmp(cmd, "nfc", strlen("nfc"))) {
-        if (group == MSG_GROUP_STATUS) {
-            //TODO:
-            INFO("get nfc data: do nothing\n");
-        } else {
-            if (data != NULL) {
-                send_to_nfc(ccli->client_id, ccli->client_type, data, msg->data.len);
-            } else {
-                ERR("nfc data is null\n");
-            }
-        }
-    } else {
-        ERR("unknown cmd [%s]\n", cmd);
-    }
-
-    if (data) {
-        g_free(data);
-    }
-
-    return true;
-}
-
-bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg)
-{
-    int datalen = msg->data.len;
-    void* data = (void*)g_malloc(datalen);
-    if(!data) {
-        ERR("g_malloc failed!\n");
-        return false;
-    }
-
-    memset(data, 0, datalen);
-    memcpy(data, msg->data.data, msg->data.len);
-
-    if (msg->has_data && msg->data.len > 0)
-    {
-        TRACE("recv from nfc injector: %s, %z", msg->has_data, msg->data.len);
-        print_binary(data, datalen);
-    }
-
-    send_to_nfc(ccli->client_id, ccli->client_type, data, msg->data.len);
-    g_free(data);
-    return true;
-}
-
 bool ntf_to_injector(const char* data, const int len) {
     type_length length = 0;
     type_group group = 0;
@@ -664,7 +206,7 @@ bool ntf_to_injector(const char* data, const int len) {
     const char* ijdata = (data + catsize + 2 + 1 + 1);
 
     const char *encoded_ijdata = "";
-    TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,
+    TRACE("<< header cat = %s, length = %d, action=%d, group=%d\n", cat, length,
             action, group);
 
     QDict* obj_header = qdict_new();
@@ -709,415 +251,3 @@ bool ntf_to_injector(const char* data, const int len) {
     return true;
 }
 
-static bool injector_req_handle(const char* cat, type_action action)
-{
-    /*SD CARD msg process*/
-    if (!strncmp(cat, MSG_TYPE_SDCARD, strlen(MSG_TYPE_SDCARD))) {
-       return false;
-
-    } else if (!strncmp(cat, "suspend", 7)) {
-        ecs_suspend_lock_state(ecs_get_suspend_state());
-        return true;
-    } else if (!strncmp(cat, MSG_TYPE_GUEST, 5)) {
-        INFO("emuld connection is %d\n", action);
-        qemu_mutex_lock(&mutex_guest_connection);
-        guest_connection = action;
-        qemu_mutex_unlock(&mutex_guest_connection);
-        return false;
-    }
-
-    return false;
-}
-
-bool send_injector_ntf(const char* data, const int len)
-{
-    type_length length = 0;
-    type_group group = 0;
-    type_action action = 0;
-
-    const int catsize = 10;
-    char cat[catsize + 1];
-    memset(cat, 0, catsize + 1);
-
-    read_val_str(data, cat, catsize);
-    read_val_short(data + catsize, &length);
-    read_val_char(data + catsize + 2, &group);
-    read_val_char(data + catsize + 2 + 1, &action);
-
-    if (injector_req_handle(cat, action)) {
-        return true;
-    }
-
-    const char* ijdata = (data + catsize + 2 + 1 + 1);
-
-    TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
-
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__InjectorNtf ntf = ECS__INJECTOR_NTF__INIT;
-
-    ntf.category = (char*) g_malloc(catsize + 1);
-    strncpy(ntf.category, cat, 10);
-
-    ntf.length = length;
-    ntf.group = group;
-    ntf.action = action;
-
-    if (length > 0)
-    {
-        ntf.has_data = 1;
-
-        ntf.data.data = g_malloc(length);
-        ntf.data.len = length;
-        memcpy(ntf.data.data, ijdata, length);
-    }
-
-    master.type = ECS__MASTER__TYPE__INJECTOR_NTF;
-    master.injector_ntf = &ntf;
-
-    send_to_ecp(&master);
-
-    if (ntf.data.len > 0)
-    {
-        g_free(ntf.data.data);
-    }
-
-    g_free(ntf.category);
-
-    return true;
-}
-
-bool send_device_ntf(const char* data, const int len)
-{
-    type_length length = 0;
-    type_group group = 0;
-    type_action action = 0;
-
-    const int catsize = 10;
-    char cat[catsize + 1];
-    memset(cat, 0, catsize + 1);
-
-    read_val_str(data, cat, catsize);
-    read_val_short(data + catsize, &length);
-    read_val_char(data + catsize + 2, &group);
-    read_val_char(data + catsize + 2 + 1, &action);
-
-    const char* ijdata = (data + catsize + 2 + 1 + 1);
-
-    TRACE("<< header cat = %s, length = %d, action=%d, group=%d", cat, length,action, group);
-
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__DeviceNtf ntf = ECS__DEVICE_NTF__INIT;
-
-    ntf.category = (char*) g_malloc(catsize + 1);
-    strncpy(ntf.category, cat, 10);
-
-
-    ntf.length = length;
-    ntf.group = group;
-    ntf.action = action;
-
-    if (length > 0)
-    {
-        ntf.has_data = 1;
-
-        ntf.data.data = g_malloc(length);
-        ntf.data.len = length;
-        memcpy(ntf.data.data, ijdata, length);
-
-        TRACE("data = %s, length = %hu", ijdata, length);
-    }
-
-    master.type = ECS__MASTER__TYPE__DEVICE_NTF;
-    master.device_ntf = &ntf;
-
-    send_to_ecp(&master);
-
-    if (ntf.data.data && ntf.data.len > 0)
-    {
-        g_free(ntf.data.data);
-    }
-
-    if (ntf.category)
-        g_free(ntf.category);
-
-    return true;
-}
-
-bool send_nfc_ntf(struct nfc_msg_info* msg)
-{
-    const int catsize = 10;
-    char cat[catsize + 1];
-    ECS_Client *clii;
-    memset(cat, 0, catsize + 1);
-
-    print_binary((char*)msg->buf, msg->use);
-    TRACE("id: %02x, type: %02x, use: %d", msg->client_id, msg->client_type, msg->use);
-    clii =  find_client(msg->client_id, msg->client_type);
-    if (clii) {
-        if(clii->client_type == TYPE_SIMUL_NFC) {
-            strncpy(cat, MSG_TYPE_NFC, 3);
-        } else if (clii->client_type == TYPE_ECP) {
-            strncpy(cat, MSG_TYPE_SIMUL_NFC, 9);
-        }else {
-            ERR("cannot find type! : %d", clii->client_type);
-        }
-        TRACE("header category = %s", cat);
-    }
-    else {
-        ERR("cannot find client!\n");
-    }
-
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__NfcNtf ntf = ECS__NFC_NTF__INIT;
-
-    ntf.category = (char*) g_malloc(catsize + 1);
-    strncpy(ntf.category, cat, 10);
-
-    ntf.has_data = 1;
-
-    ntf.data.data = g_malloc(NFC_MAX_BUF_SIZE);
-    ntf.data.len = NFC_MAX_BUF_SIZE;
-    memcpy(ntf.data.data, msg->buf, NFC_MAX_BUF_SIZE);
-
-    printf("send to nfc injector: ");
-    master.type = ECS__MASTER__TYPE__NFC_NTF;
-    master.nfc_ntf = &ntf;
-
-    send_single_msg(&master, clii);
-
-    if (ntf.data.data && ntf.data.len > 0)
-    {
-        g_free(ntf.data.data);
-    }
-
-    if (ntf.category)
-        g_free(ntf.category);
-
-    return true;
-}
-
-
-static void handle_sdcard(char* dataBuf, size_t dataLen)
-{
-
-    char ret = 0;
-
-    if (dataBuf != NULL){
-        ret = dataBuf[0];
-
-        if (ret == '0' ) {
-            /* umount sdcard */
-            do_hotplug(DETACH_SDCARD, NULL, 0);
-        } else if (ret == '1') {
-            /* mount sdcard */
-            char sdcard_img_path[256];
-            char* sdcard_path = NULL;
-
-            sdcard_path = get_emulator_sdcard_path();
-            if (sdcard_path) {
-                g_strlcpy(sdcard_img_path, sdcard_path,
-                        sizeof(sdcard_img_path));
-
-                /* emulator_sdcard_img_path + sdcard img name */
-                char* sdcard_img_name = dataBuf+2;
-                if(dataLen > 3 && sdcard_img_name != NULL){
-                    char* pLinechange = strchr(sdcard_img_name, '\n');
-                    if(pLinechange != NULL){
-                        sdcard_img_name = g_strndup(sdcard_img_name, pLinechange - sdcard_img_name);
-                    }
-
-                    g_strlcat(sdcard_img_path, sdcard_img_name, sizeof(sdcard_img_path));
-                    TRACE("sdcard path: [%s]\n", sdcard_img_path);
-
-                    do_hotplug(ATTACH_SDCARD, sdcard_img_path, strlen(sdcard_img_path) + 1);
-
-                    /*if using strndup than free string*/
-                    if(pLinechange != NULL && sdcard_img_name!= NULL){
-                        free(sdcard_img_name);
-                    }
-
-                }
-
-                g_free(sdcard_path);
-            } else {
-                ERR("failed to get sdcard path!!\n");
-            }
-        } else if(ret == '2'){
-            TRACE("sdcard status 2 bypass" );
-        }else {
-            ERR("!!! unknown command : %c\n", ret);
-        }
-
-    }else{
-        ERR("!!! unknown data : %c\n", ret);
-    }
-}
-
-static char* get_emulator_sdcard_path(void)
-{
-    char *emulator_sdcard_path = NULL;
-    char *tizen_sdk_data = NULL;
-
-#ifndef CONFIG_WIN32
-    char emulator_sdcard[] = "/emulator/sdcard/";
-#else
-    char emulator_sdcard[] = "\\emulator\\sdcard\\";
-#endif
-
-    TRACE("emulator_sdcard: %s, %zu\n", emulator_sdcard, sizeof(emulator_sdcard));
-
-    tizen_sdk_data = get_tizen_sdk_data_path();
-    if (!tizen_sdk_data) {
-        ERR("failed to get tizen-sdk-data path.\n");
-        return NULL;
-    }
-
-    emulator_sdcard_path =
-        g_malloc(strlen(tizen_sdk_data) + sizeof(emulator_sdcard) + 1);
-    if (!emulator_sdcard_path) {
-        ERR("failed to allocate memory.\n");
-        return NULL;
-    }
-
-    g_snprintf(emulator_sdcard_path, strlen(tizen_sdk_data) + sizeof(emulator_sdcard),
-             "%s%s", tizen_sdk_data, emulator_sdcard);
-
-    g_free(tizen_sdk_data);
-
-    TRACE("sdcard path: %s\n", emulator_sdcard_path);
-    return emulator_sdcard_path;
-}
-
-/*
- *  get tizen-sdk-data path from sdk.info.
- */
-char *get_tizen_sdk_data_path(void)
-{
-    char const *emul_bin_path = NULL;
-    char *sdk_info_file_path = NULL;
-    char *tizen_sdk_data_path = NULL;
-#ifndef CONFIG_WIN32
-    const char *sdk_info = "../../../sdk.info";
-#else
-    const char *sdk_info = "..\\..\\..\\sdk.info";
-#endif
-    const char sdk_data_var[] = "TIZEN_SDK_DATA_PATH";
-
-    FILE *sdk_info_fp = NULL;
-    int sdk_info_path_len = 0;
-
-    TRACE("%s\n", __func__);
-
-    emul_bin_path = get_bin_path();
-    if (!emul_bin_path) {
-        ERR("failed to get emulator path.\n");
-        return NULL;
-    }
-
-    sdk_info_path_len = strlen(emul_bin_path) + strlen(sdk_info) + 1;
-    sdk_info_file_path = g_malloc(sdk_info_path_len);
-    if (!sdk_info_file_path) {
-        ERR("failed to allocate sdk-data buffer.\n");
-        return NULL;
-    }
-
-    g_snprintf(sdk_info_file_path, sdk_info_path_len, "%s%s",
-                emul_bin_path, sdk_info);
-    INFO("sdk.info path: %s\n", sdk_info_file_path);
-
-    sdk_info_fp = fopen(sdk_info_file_path, "r");
-    g_free(sdk_info_file_path);
-
-    if (sdk_info_fp) {
-        TRACE("Succeeded to open [sdk.info].\n");
-
-        char tmp[256] = { '\0', };
-        char *tmpline = NULL;
-        while (fgets(tmp, sizeof(tmp), sdk_info_fp) != NULL) {
-            if ((tmpline = g_strstr_len(tmp, sizeof(tmp), sdk_data_var))) {
-                tmpline += strlen(sdk_data_var) + 1; // 1 for '='
-                break;
-            }
-        }
-
-        if (tmpline) {
-            if (tmpline[strlen(tmpline) - 1] == '\n') {
-                tmpline[strlen(tmpline) - 1] = '\0';
-            }
-            if (tmpline[strlen(tmpline) - 1] == '\r') {
-                tmpline[strlen(tmpline) - 1] = '\0';
-            }
-
-            tizen_sdk_data_path = g_malloc(strlen(tmpline) + 1);
-            g_strlcpy(tizen_sdk_data_path, tmpline, strlen(tmpline) + 1);
-
-            INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
-
-            fclose(sdk_info_fp);
-            return tizen_sdk_data_path;
-        }
-
-        fclose(sdk_info_fp);
-    }
-
-    // legacy mode
-    ERR("Failed to open [sdk.info].\n");
-
-    return get_old_tizen_sdk_data_path();
-}
-
-static char *get_old_tizen_sdk_data_path(void)
-{
-    char *tizen_sdk_data_path = NULL;
-
-    INFO("try to search tizen-sdk-data path in another way.\n");
-
-#ifndef CONFIG_WIN32
-    char tizen_sdk_data[] = "/tizen-sdk-data";
-    int tizen_sdk_data_len = 0;
-    char *home_dir;
-
-    home_dir = (char *)g_getenv("HOME");
-    if (!home_dir) {
-        home_dir = (char *)g_get_home_dir();
-    }
-
-    tizen_sdk_data_len = strlen(home_dir) + sizeof(tizen_sdk_data) + 1;
-    tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
-    if (!tizen_sdk_data_path) {
-        ERR("failed to allocate memory.\n");
-        return NULL;
-    }
-    g_strlcpy(tizen_sdk_data_path, home_dir, tizen_sdk_data_len);
-    g_strlcat(tizen_sdk_data_path, tizen_sdk_data, tizen_sdk_data_len);
-
-#else
-    char tizen_sdk_data[] = "\\tizen-sdk-data\\";
-    gint tizen_sdk_data_len = 0;
-    HKEY hKey;
-    char strLocalAppDataPath[1024] = { 0 };
-    DWORD dwBufLen = 1024;
-
-    RegOpenKeyEx(HKEY_CURRENT_USER,
-        "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
-        0, KEY_QUERY_VALUE, &hKey);
-
-    RegQueryValueEx(hKey, "Local AppData", NULL,
-                    NULL, (LPBYTE)strLocalAppDataPath, &dwBufLen);
-    RegCloseKey(hKey);
-
-    tizen_sdk_data_len = strlen(strLocalAppDataPath) + sizeof(tizen_sdk_data) + 1;
-    tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
-    if (!tizen_sdk_data_path) {
-        ERR("failed to allocate memory.\n");
-        return NULL;
-    }
-
-    g_strlcpy(tizen_sdk_data_path, strLocalAppDataPath, tizen_sdk_data_len);
-    g_strlcat(tizen_sdk_data_path, tizen_sdk_data, tizen_sdk_data_len);
-#endif
-
-    INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
-    return tizen_sdk_data_path;
-}
-
diff --git a/tizen/src/ecs/ecs_msg_device.c b/tizen/src/ecs/ecs_msg_device.c
new file mode 100644 (file)
index 0000000..5fda57a
--- /dev/null
@@ -0,0 +1,466 @@
+/* Emulator Control Server
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ *  Jinhyung choi   <jinhyung2.choi@samsung.com>
+ *  MunKyu Im       <munkyu.im@samsung.com>
+ *  Daiyoung Kim    <daiyoung777.kim@samsung.com>
+ *  YeongKyoon Lee  <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "qemu-common.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
+
+#include "qmp-commands.h"
+#include "net/slirp.h"
+#include "fsdev/qemu-fsdev.h"
+#include "monitor/qdev.h"
+#include "hw/virtio/maru_virtio_sensor.h"
+#include "hw/virtio/maru_virtio_nfc.h"
+#include "skin/maruskin_operation.h"
+#include "skin/maruskin_server.h"
+
+#include "util/maru_device_hotplug.h"
+#include "emul_state.h"
+#include "ecs.h"
+#include "debug_ch.h"
+
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
+static void msgproc_device_ans(ECS_Client* ccli, const char* category, bool succeed, char* data)
+{
+    if (ccli == NULL) {
+        return;
+    }
+    int catlen = 0;
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
+
+    TRACE("device ans - category : %s, succed : %d\n", category, succeed);
+
+    catlen = strlen(category);
+    ans.category = (char*) g_malloc0(catlen + 1);
+    memcpy(ans.category, category, catlen);
+
+    ans.errcode = !succeed;
+
+    if (data != NULL) {
+        ans.length = strlen(data);
+
+        if (ans.length > 0) {
+            ans.has_data = 1;
+            ans.data.data = g_malloc(ans.length);
+            ans.data.len = ans.length;
+            memcpy(ans.data.data, data, ans.length);
+            TRACE("data = %s, length = %hu\n", data, ans.length);
+        }
+    }
+
+    master.type = ECS__MASTER__TYPE__DEVICE_ANS;
+    master.device_ans = &ans;
+
+    pb_to_all_clients(&master);
+
+    if (ans.category)
+        g_free(ans.category);
+}
+
+extern char tizen_target_img_path[];
+void send_target_image_information(ECS_Client* ccli) {
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
+    int length = strlen(tizen_target_img_path); // ??
+
+    ans.category = (char*) g_malloc(10 + 1);
+    strncpy(ans.category, "info", 10);
+
+    ans.errcode = 0;
+    ans.length = length;
+    ans.group = 1;
+    ans.action = 1;
+
+    if (length > 0)
+    {
+        ans.has_data = 1;
+
+        ans.data.data = g_malloc(length);
+        ans.data.len = length;
+        memcpy(ans.data.data, tizen_target_img_path, length);
+
+        TRACE("data = %s, length = %hu\n", tizen_target_img_path, length);
+    }
+
+    master.type = ECS__MASTER__TYPE__DEVICE_ANS;
+    master.device_ans = &ans;
+
+    pb_to_single_client(&master, ccli);
+
+    if (ans.data.len > 0)
+    {
+        g_free(ans.data.data);
+    }
+
+    g_free(ans.category);
+}
+
+static void msgproc_device_req_sensor(ECS_Client* ccli, ECS__DeviceReq* msg, char* cmd)
+{
+    char* data = NULL;
+    type_group group = (type_group) (msg->group & 0xff);
+    type_action action = (type_action) (msg->action & 0xff);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    if (group == MSG_GROUP_STATUS) {
+        if (action == MSG_ACT_ACCEL) {
+            get_sensor_accel();
+        } else if (action == MSG_ACT_GYRO) {
+            get_sensor_gyro();
+        } else if (action == MSG_ACT_MAG) {
+            get_sensor_mag();
+        } else if (action == MSG_ACT_LIGHT) {
+            get_sensor_light();
+        } else if (action == MSG_ACT_PROXI) {
+            get_sensor_proxi();
+        }
+    } else {
+        if (data != NULL) {
+            set_injector_data(data);
+        } else {
+            ERR("sensor set data is null\n");
+        }
+    }
+    msgproc_device_ans(ccli, cmd, true, NULL);
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+static void msgproc_device_req_network(ECS_Client* ccli, ECS__DeviceReq* msg)
+{
+    char* data = NULL;
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    if (data != NULL) {
+        TRACE(">>> Network msg: '%s'\n", data);
+        if(net_slirp_redir(data) < 0) {
+            ERR( "redirect [%s] fail\n", data);
+        } else {
+            TRACE("redirect [%s] success\n", data);
+        }
+    } else {
+        ERR("Network redirection data is null.\n");
+    }
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+static void msgproc_device_req_tgesture(ECS_Client* ccli, ECS__DeviceReq* msg)
+{
+    char* data = NULL;
+    type_group group = (type_group) (msg->group & 0xff);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    /* release multi-touch */
+#ifdef CONFIG_SDL
+    if (get_multi_touch_enable() != 0) {
+        clear_finger_slot(false);
+    }
+#else
+    // TODO:
+#endif
+
+    if (data == NULL) {
+        ERR("touch gesture data is NULL\n");
+        return;
+    }
+
+    TRACE("%s\n", data);
+
+    char token[] = "#";
+
+    if (group == 1) { /* HW key event */
+        char *section = strtok(data, token);
+        int event_type = atoi(section);
+
+        section = strtok(NULL, token);
+        int keycode = atoi(section);
+
+        do_hw_key_event(event_type, keycode);
+    } else { /* touch event */
+        char *section = strtok(data, token);
+        int event_type = atoi(section);
+
+        section = strtok(NULL, token);
+        int xx = atoi(section);
+
+        section = strtok(NULL, token);
+        int yy = atoi(section);
+
+        section = strtok(NULL, token);
+        int zz = atoi(section);
+
+        do_mouse_event(1/* LEFT */, event_type, 0, 0, xx, yy, zz);
+    }
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+static void msgproc_device_req_input(ECS_Client* ccli, ECS__DeviceReq* msg, char* cmd)
+{
+    char* data = NULL;
+    type_group group = (type_group) (msg->group & 0xff);
+    type_action action = (type_action) (msg->action & 0xff);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    // cli input
+    TRACE("receive input message [%s]\n", data);
+
+    if (group == 0) {
+        TRACE("input keycode data : [%s]\n", data);
+
+        char token[] = " ";
+        char *section = strtok(data, token);
+        int keycode = atoi(section);
+        if (action == 1) {
+            //action 1 press
+            do_hw_key_event(KEY_PRESSED, keycode);
+
+        } else if (action == 2) {
+            //action 2 released
+            do_hw_key_event(KEY_RELEASED, keycode);
+
+        } else {
+            ERR("unknown action : [%d]\n", (int)action);
+        }
+    } else if (group == 1) {
+        //spec out
+        TRACE("input category's group 1 is spec out\n");
+    } else {
+        ERR("unknown group [%d]\n", (int)group);
+    }
+    msgproc_device_ans(ccli, cmd, true, NULL);
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+static void msgproc_device_req_nfc(ECS_Client* ccli, ECS__DeviceReq* msg)
+{
+    char* data = NULL;
+    type_group group = (type_group) (msg->group & 0xff);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    if (group == MSG_GROUP_STATUS) {
+        get_nfc_data();
+    } else {
+        if (data != NULL) {
+            send_to_nfc(ccli->client_id, ccli->client_type, data, msg->data.len);
+        } else {
+            ERR("nfc data is null\n");
+        }
+    }
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+static char hds_path[PATH_MAX];
+
+static void msgproc_device_req_hds(ECS_Client* ccli, ECS__DeviceReq* msg, char * cmd)
+{
+    char* data = NULL;
+    type_group group = (type_group) (msg->group & 0xff);
+    type_action action = (type_action) (msg->action & 0xff);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        data = (char*) g_malloc0(msg->data.len + 1);
+        memcpy(data, msg->data.data, msg->data.len);
+    }
+
+    INFO("hds group: %d, action : %d\n", group, action);
+    if (group == MSG_GROUP_STATUS) {
+        char hds_data_send[PATH_MAX + 3];
+        if (is_hds_attached()) {
+            sprintf(hds_data_send, "1, %s", hds_path);
+        } else {
+            sprintf(hds_data_send, "0, ");
+        }
+        make_send_device_ntf(cmd, group, 99, hds_data_send);
+    } else if (group == 100 && action == 1) {
+        INFO("try attach with is_hds_attached : %d\n", is_hds_attached());
+        if (data != NULL && !is_hds_attached()) {
+            do_hotplug(ATTACH_HDS, data, strlen(data) + 1);
+            if (!is_hds_attached()) {
+                ERR("failed to attach");
+                make_send_device_ntf(cmd, 100, 2, NULL);
+            } else {
+                memset(hds_path, 0, sizeof(hds_path));
+                memcpy(hds_path, data, sizeof(hds_path) - 1);
+                INFO("send emuld to mount.\n");
+                send_msg_to_guest(ccli, cmd, group, action, data, strlen(data));
+            }
+        } else {
+            make_send_device_ntf(cmd, 100, 2, NULL);
+        }
+    } else if (group == 100 && action == 2) {
+        INFO("try detach with is_hds_attached : %d\n", is_hds_attached());
+        if (is_hds_attached()) {
+            INFO("send emuld to umount.\n");
+            send_msg_to_guest(ccli, cmd, group, action, NULL, 0);
+        } else {
+            INFO("hds is not attached. do not try detach it.\n");
+        }
+    } else {
+        ERR("hds unknown command: group %d action %d\n", group, action);
+    }
+
+    if (data) {
+        g_free(data);
+    }
+}
+
+bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
+{
+    char cmd[10];
+    memset(cmd, 0, 10);
+    strcpy(cmd, msg->category);
+
+    TRACE(">> device_req: header = cmd = %s, length = %d, action=%d, group=%d\n",
+            cmd, msg->length, msg->action, msg->group);
+
+    if (!strcmp(cmd, MSG_TYPE_SENSOR)) {
+        msgproc_device_req_sensor(ccli, msg, cmd);
+    } else if (!strcmp(cmd, "Network")) {
+        msgproc_device_req_network(ccli, msg);
+    } else if (!strcmp(cmd, "TGesture")) {
+        msgproc_device_req_tgesture(ccli, msg);
+    } else if (!strcmp(cmd, "info")) {
+        // check to emulator target image path
+        TRACE("receive info message %s\n", tizen_target_img_path);
+        send_target_image_information(ccli);
+    } else if (!strcmp(cmd, "hds")) {
+        msgproc_device_req_hds(ccli, msg, cmd);
+    } else if (!strcmp(cmd, "input")) {
+        msgproc_device_req_input(ccli, msg, cmd);
+    } else if (!strcmp(cmd, "vmname")) {
+        char* vmname = get_emul_vm_name();
+        msgproc_device_ans(ccli, cmd, true, vmname);
+    } else if (!strcmp(cmd, "nfc")) {
+        msgproc_device_req_nfc(ccli, msg);
+    } else {
+        ERR("unknown cmd [%s]\n", cmd);
+    }
+
+    return true;
+}
+
+bool send_device_ntf(const char* data, const int len)
+{
+    type_length length = 0;
+    type_group group = 0;
+    type_action action = 0;
+
+    const int catsize = 10;
+    char cat[catsize + 1];
+    memset(cat, 0, catsize + 1);
+
+    read_val_str(data, cat, catsize);
+    read_val_short(data + catsize, &length);
+    read_val_char(data + catsize + 2, &group);
+    read_val_char(data + catsize + 2 + 1, &action);
+
+    const char* ijdata = (data + catsize + 2 + 1 + 1);
+
+    TRACE("<< header cat = %s, length = %d, action=%d, group=%d\n", cat, length,action, group);
+
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__DeviceNtf ntf = ECS__DEVICE_NTF__INIT;
+
+    ntf.category = (char*) g_malloc(catsize + 1);
+    strncpy(ntf.category, cat, 10);
+
+
+    ntf.length = length;
+    ntf.group = group;
+    ntf.action = action;
+
+    if (length > 0)
+    {
+        ntf.has_data = 1;
+
+        ntf.data.data = g_malloc(length);
+        ntf.data.len = length;
+        memcpy(ntf.data.data, ijdata, length);
+
+        TRACE("data = %s, length = %hu\n", ijdata, length);
+    }
+
+    master.type = ECS__MASTER__TYPE__DEVICE_NTF;
+    master.device_ntf = &ntf;
+
+    pb_to_all_clients(&master);
+
+    if (ntf.data.data && ntf.data.len > 0)
+    {
+        g_free(ntf.data.data);
+    }
+
+    if (ntf.category)
+        g_free(ntf.category);
+
+    return true;
+}
+
diff --git a/tizen/src/ecs/ecs_msg_injector.c b/tizen/src/ecs/ecs_msg_injector.c
new file mode 100644 (file)
index 0000000..1d20de1
--- /dev/null
@@ -0,0 +1,667 @@
+/* Emulator Control Server
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ *  Jinhyung choi   <jinhyung2.choi@samsung.com>
+ *  MunKyu Im       <munkyu.im@samsung.com>
+ *  Daiyoung Kim    <daiyoung777.kim@samsung.com>
+ *  YeongKyoon Lee  <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "qemu-common.h"
+
+#include "hw/virtio/maru_virtio_vmodem.h"
+#include "hw/virtio/maru_virtio_evdi.h"
+#include "hw/virtio/maru_virtio_jack.h"
+#include "hw/virtio/maru_virtio_power.h"
+
+#include "util/maru_device_hotplug.h"
+#include "emul_state.h"
+#include "ecs.h"
+#include "debug_ch.h"
+#include "util/osutil.h"
+
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
+extern QemuMutex mutex_guest_connection;
+static int guest_connection = 0;
+
+extern QemuMutex mutex_location_data;
+static char location_data[MAX_INJECTOR_REQ_DATA];
+static void send_gen_injector_ntf(const char* cmd, int cmdlen, int grp, int act, char* on)
+{
+    int msglen = 0, datalen = 0;
+    type_length length  = 0;
+    type_group group = grp;
+    type_action action = act;
+
+    if (cmd == NULL || cmdlen > 10)
+        return;
+
+    if (on == NULL) {
+        msglen = 14;
+    } else {
+        datalen = strlen(on);
+        length  = (unsigned short)datalen;
+
+        msglen = datalen + 15;
+    }
+
+    char* status_msg = (char*) malloc(msglen);
+    if(!status_msg)
+        return;
+
+    memset(status_msg, 0, msglen);
+
+    memcpy(status_msg, cmd, cmdlen);
+    memcpy(status_msg + 10, &length, sizeof(unsigned short));
+    memcpy(status_msg + 12, &group, sizeof(unsigned char));
+    memcpy(status_msg + 13, &action, sizeof(unsigned char));
+
+    if (on != NULL) {
+        memcpy(status_msg + 14, on, datalen);
+    }
+
+    send_injector_ntf(status_msg, msglen);
+
+    free(status_msg);
+}
+
+static void msgproc_injector_ans(ECS_Client* ccli, const char* category, bool succeed)
+{
+    if (ccli == NULL) {
+        return;
+    }
+    int catlen = 0;
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__InjectorAns ans = ECS__INJECTOR_ANS__INIT;
+
+    TRACE("injector ans - category : %s, succed : %d\n", category, succeed);
+
+    catlen = strlen(category);
+    ans.category = (char*) g_malloc0(catlen + 1);
+    memcpy(ans.category, category, catlen);
+
+    ans.errcode = !succeed;
+    master.type = ECS__MASTER__TYPE__INJECTOR_ANS;
+    master.injector_ans = &ans;
+
+    pb_to_all_clients(&master);
+
+    if (ans.category)
+        g_free(ans.category);
+}
+
+static bool injector_send(ECS_Client* ccli, ECS__InjectorReq* msg, char* cmd)
+{
+    int sndlen = 15; // HEADER(CMD + LENGTH + GROUP + ACTION) + 1
+    const char* msg_data;
+    char* sndbuf;
+    bool ret = false;
+    type_group group;
+
+    group = (type_group) (msg->group & 0xff);
+
+    if (msg->has_data && msg->data.data && msg->data.len > 0)
+        sndlen += msg->data.len;
+
+    sndbuf = (char*) g_malloc0(sndlen);
+    if (!sndbuf) {
+        msgproc_injector_ans(ccli, cmd, false);
+        return false;
+    }
+
+    memcpy(sndbuf, cmd, 10);
+    memcpy(sndbuf + 10, &msg->length, 2);
+    memcpy(sndbuf + 12, &msg->group, 1);
+    memcpy(sndbuf + 13, &msg->action, 1);
+
+    if (msg->has_data && msg->data.data && msg->data.len > 0) {
+        msg_data = (const char*)msg->data.data;
+        memcpy(sndbuf + 14, msg_data, msg->data.len);
+        TRACE(">> print len = %zd, data\" %s\"\n", msg->data.len, msg_data);
+    }
+
+    if(strcmp(cmd, "telephony") == 0) {
+        TRACE("telephony msg >>");
+        ret = send_to_vmodem(route_ij, sndbuf, sndlen);
+    } else {
+        TRACE("evdi msg >> %s", cmd);
+        ret = send_to_evdi(route_ij, sndbuf, sndlen);
+    }
+
+    g_free(sndbuf);
+
+    if (group != MSG_GROUP_STATUS) {
+        msgproc_injector_ans(ccli, cmd, ret);
+    }
+
+    if (!ret) {
+        return false;
+    }
+
+    return true;
+}
+
+static char* get_emulator_sdcard_path(void)
+{
+    char *emulator_sdcard_path = NULL;
+    char *tizen_sdk_data = NULL;
+
+#ifndef CONFIG_WIN32
+    char emulator_sdcard[] = "/emulator/sdcard/";
+#else
+    char emulator_sdcard[] = "\\emulator\\sdcard\\";
+#endif
+
+    TRACE("emulator_sdcard: %s, %zu\n", emulator_sdcard, sizeof(emulator_sdcard));
+
+    tizen_sdk_data = get_tizen_sdk_data_path();
+    if (!tizen_sdk_data) {
+        ERR("failed to get tizen-sdk-data path.\n");
+        return NULL;
+    }
+
+    emulator_sdcard_path =
+        g_malloc(strlen(tizen_sdk_data) + sizeof(emulator_sdcard) + 1);
+    if (!emulator_sdcard_path) {
+        ERR("failed to allocate memory.\n");
+        return NULL;
+    }
+
+    g_snprintf(emulator_sdcard_path, strlen(tizen_sdk_data) + sizeof(emulator_sdcard),
+             "%s%s", tizen_sdk_data, emulator_sdcard);
+
+    g_free(tizen_sdk_data);
+
+    TRACE("sdcard path: %s\n", emulator_sdcard_path);
+    return emulator_sdcard_path;
+}
+
+static char *get_old_tizen_sdk_data_path(void)
+{
+    char *tizen_sdk_data_path = NULL;
+
+    INFO("try to search tizen-sdk-data path in another way.\n");
+
+#ifndef CONFIG_WIN32
+    char tizen_sdk_data[] = "/tizen-sdk-data";
+    int tizen_sdk_data_len = 0;
+    char *home_dir;
+
+    home_dir = (char *)g_getenv("HOME");
+    if (!home_dir) {
+        home_dir = (char *)g_get_home_dir();
+    }
+
+    tizen_sdk_data_len = strlen(home_dir) + sizeof(tizen_sdk_data) + 1;
+    tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
+    if (!tizen_sdk_data_path) {
+        ERR("failed to allocate memory.\n");
+        return NULL;
+    }
+    g_strlcpy(tizen_sdk_data_path, home_dir, tizen_sdk_data_len);
+    g_strlcat(tizen_sdk_data_path, tizen_sdk_data, tizen_sdk_data_len);
+
+#else
+    char tizen_sdk_data[] = "\\tizen-sdk-data\\";
+    gint tizen_sdk_data_len = 0;
+    HKEY hKey;
+    char strLocalAppDataPath[1024] = { 0 };
+    DWORD dwBufLen = 1024;
+
+    RegOpenKeyEx(HKEY_CURRENT_USER,
+        "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
+        0, KEY_QUERY_VALUE, &hKey);
+
+    RegQueryValueEx(hKey, "Local AppData", NULL,
+                    NULL, (LPBYTE)strLocalAppDataPath, &dwBufLen);
+    RegCloseKey(hKey);
+
+    tizen_sdk_data_len = strlen(strLocalAppDataPath) + sizeof(tizen_sdk_data) + 1;
+    tizen_sdk_data_path = g_malloc(tizen_sdk_data_len);
+    if (!tizen_sdk_data_path) {
+        ERR("failed to allocate memory.\n");
+        return NULL;
+    }
+
+    g_strlcpy(tizen_sdk_data_path, strLocalAppDataPath, tizen_sdk_data_len);
+    g_strlcat(tizen_sdk_data_path, tizen_sdk_data, tizen_sdk_data_len);
+#endif
+
+    INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
+    return tizen_sdk_data_path;
+}
+
+/*
+ *  get tizen-sdk-data path from sdk.info.
+ */
+char *get_tizen_sdk_data_path(void)
+{
+    char const *emul_bin_path = NULL;
+    char *sdk_info_file_path = NULL;
+    char *tizen_sdk_data_path = NULL;
+#ifndef CONFIG_WIN32
+    const char *sdk_info = "../../../sdk.info";
+#else
+    const char *sdk_info = "..\\..\\..\\sdk.info";
+#endif
+    const char sdk_data_var[] = "TIZEN_SDK_DATA_PATH";
+
+    FILE *sdk_info_fp = NULL;
+    int sdk_info_path_len = 0;
+
+    TRACE("%s\n", __func__);
+
+    emul_bin_path = get_bin_path();
+    if (!emul_bin_path) {
+        ERR("failed to get emulator path.\n");
+        return NULL;
+    }
+
+    sdk_info_path_len = strlen(emul_bin_path) + strlen(sdk_info) + 1;
+    sdk_info_file_path = g_malloc(sdk_info_path_len);
+    if (!sdk_info_file_path) {
+        ERR("failed to allocate sdk-data buffer.\n");
+        return NULL;
+    }
+
+    g_snprintf(sdk_info_file_path, sdk_info_path_len, "%s%s",
+                emul_bin_path, sdk_info);
+    INFO("sdk.info path: %s\n", sdk_info_file_path);
+
+    sdk_info_fp = fopen(sdk_info_file_path, "r");
+    g_free(sdk_info_file_path);
+
+    if (sdk_info_fp) {
+        TRACE("Succeeded to open [sdk.info].\n");
+
+        char tmp[256] = { '\0', };
+        char *tmpline = NULL;
+        while (fgets(tmp, sizeof(tmp), sdk_info_fp) != NULL) {
+            if ((tmpline = g_strstr_len(tmp, sizeof(tmp), sdk_data_var))) {
+                tmpline += strlen(sdk_data_var) + 1; // 1 for '='
+                break;
+            }
+        }
+
+        if (tmpline) {
+            if (tmpline[strlen(tmpline) - 1] == '\n') {
+                tmpline[strlen(tmpline) - 1] = '\0';
+            }
+            if (tmpline[strlen(tmpline) - 1] == '\r') {
+                tmpline[strlen(tmpline) - 1] = '\0';
+            }
+
+            tizen_sdk_data_path = g_malloc(strlen(tmpline) + 1);
+            g_strlcpy(tizen_sdk_data_path, tmpline, strlen(tmpline) + 1);
+
+            INFO("tizen-sdk-data path: %s\n", tizen_sdk_data_path);
+
+            fclose(sdk_info_fp);
+            return tizen_sdk_data_path;
+        }
+
+        fclose(sdk_info_fp);
+    }
+
+    // legacy mode
+    ERR("Failed to open [sdk.info].\n");
+
+    return get_old_tizen_sdk_data_path();
+}
+
+static char* get_sdcard_img_path(char* sdcard_img_name, size_t dataLen) {
+    char* sdcard_img_path = NULL;
+    char* sdcard_path = NULL;
+    if (sdcard_img_name == NULL || dataLen < 3) {
+        return NULL;
+    }
+    dataLen = dataLen - 3;
+    if (sdcard_img_name[dataLen] == '\n') {
+        sdcard_img_name[dataLen] = '\0';
+        TRACE("sdcard_img_name: %s\n", sdcard_img_name);
+    } else {
+        ERR("wrong sdcard message!\n");
+        return NULL;
+    }
+
+    sdcard_path = get_emulator_sdcard_path();
+    if (sdcard_path != NULL) {
+        sdcard_img_path = g_malloc(DEFAULTBUFLEN);
+        g_strlcpy(sdcard_img_path, sdcard_path, DEFAULTBUFLEN);
+        g_strlcat(sdcard_img_path, sdcard_img_name, DEFAULTBUFLEN);
+        TRACE("sdcard img path: [%s] length: %d\n", sdcard_img_path, strlen(sdcard_img_path));
+        g_free(sdcard_path);
+        return sdcard_img_path;
+    }
+    return NULL;
+}
+
+static int handle_sdcard(char* dataBuf, size_t dataLen)
+{
+    int err_no = 0;
+    char ret = 0;
+
+    if (dataBuf != NULL){
+        ret = dataBuf[0];
+
+        if (ret == '0' ) {
+            /* umount sdcard */
+            char* sdcard_img_path = get_sdcard_img_path(dataBuf + 2, dataLen);
+            err_no = remove_sdcard_lock_os(sdcard_img_path);
+            if (errno == 0 && is_sdcard_attached()) {
+                do_hotplug(DETACH_SDCARD, NULL, 0);
+            } else {
+                ERR("failed to umount: %s\n", sdcard_img_path);
+                send_gen_injector_ntf(MSG_TYPE_SDCARD, 6, 11, err_no, NULL);
+                return err_no;
+            }
+            g_free(sdcard_img_path);
+        } else if (ret == '1') {
+            /* mount sdcard */
+            char* sdcard_img_path = get_sdcard_img_path(dataBuf + 2, dataLen);
+            if ( !is_sdcard_attached() && make_sdcard_lock_os(sdcard_img_path)) {
+                do_hotplug(ATTACH_SDCARD, sdcard_img_path, strlen(sdcard_img_path) + 1);
+                send_gen_injector_ntf(MSG_TYPE_SDCARD, 6, 11, 0, NULL);
+            } else {
+                send_gen_injector_ntf(MSG_TYPE_SDCARD, 6, 11, 5, NULL);
+                return ERR_LCK;
+            }
+            g_free(sdcard_img_path);
+
+        } else if (ret == '2') {
+            TRACE("sdcard status 2 bypass\n" );
+        } else {
+            ERR("!!! unknown command : %c\n", ret);
+            return ret;
+        }
+    } else {
+        ERR("!!! unknown data : %c\n", ret);
+        return ret;
+    }
+    return ERR_SUCCESS;
+}
+
+static bool injector_req_sdcard(ECS_Client* ccli, ECS__InjectorReq* msg, char *cmd)
+{
+    if (msg->has_data) {
+        TRACE("msg(%zu) : %s\n", msg->data.len, msg->data.data);
+        if (handle_sdcard((char*) msg->data.data, msg->data.len) > 0) {
+            return false;
+        }
+    } else {
+        ERR("has no msg\n");
+    }
+
+    injector_send(ccli, msg, cmd);
+
+    return true;
+}
+
+static void send_status_injector_ntf(const char* cmd, int cmdlen, int act, char* on)
+{
+    int msglen = 0, datalen = 0;
+    type_length length  = 0;
+    type_group group = MSG_GROUP_STATUS;
+    type_action action = act;
+
+    if (cmd == NULL || cmdlen > 10)
+        return;
+
+    if (on == NULL) {
+        msglen = 14;
+    } else {
+        datalen = strlen(on);
+        length  = (unsigned short)datalen;
+
+        msglen = datalen + 15;
+    }
+
+    char* status_msg = (char*) malloc(msglen);
+    if(!status_msg)
+        return;
+
+    memset(status_msg, 0, msglen);
+
+    memcpy(status_msg, cmd, cmdlen);
+    memcpy(status_msg + 10, &length, sizeof(unsigned short));
+    memcpy(status_msg + 12, &group, sizeof(unsigned char));
+    memcpy(status_msg + 13, &action, sizeof(unsigned char));
+
+    if (on != NULL) {
+        memcpy(status_msg + 14, on, datalen);
+    }
+
+    send_injector_ntf(status_msg, msglen);
+
+    free(status_msg);
+}
+
+static bool injector_req_sensor(ECS_Client* ccli, ECS__InjectorReq* msg, char *cmd)
+{
+    char data[MAX_INJECTOR_REQ_DATA];
+    type_group group;
+    type_action action;
+
+    memset(data, 0, MAX_INJECTOR_REQ_DATA);
+    group = (type_group) (msg->group & 0xff);
+    action = (type_action) (msg->action & 0xff);
+
+    if (group == MSG_GROUP_STATUS) {
+        switch (action) {
+        case MSG_ACT_BATTERY_LEVEL:
+            sprintf(data, "%d", get_power_capacity());
+            break;
+        case MSG_ACT_BATTERY_CHARGER:
+            sprintf(data, "%d", get_jack_charger());
+            break;
+        case MSG_ACT_USB:
+            sprintf(data, "%d", get_jack_usb());
+            break;
+        case MSG_ACT_EARJACK:
+            sprintf(data, "%d", get_jack_earjack());
+            break;
+        case MSG_ACT_LOCATION:
+            qemu_mutex_lock(&mutex_location_data);
+            sprintf(data, "%s", location_data);
+            qemu_mutex_unlock(&mutex_location_data);
+            break;
+        default:
+            return injector_send(ccli, msg, cmd);
+        }
+        TRACE("status : %s\n", data);
+        send_status_injector_ntf(MSG_TYPE_SENSOR, 6, action, data);
+        return true;
+    } else if (msg->data.data && msg->data.len > 0) {
+        set_injector_data((char*) msg->data.data);
+        return injector_send(ccli, msg, cmd);
+    }
+
+    return false;
+}
+
+static bool injector_req_guest(void)
+{
+    int value = 0;
+    qemu_mutex_lock(&mutex_guest_connection);
+    value = guest_connection;
+    qemu_mutex_unlock(&mutex_guest_connection);
+    send_status_injector_ntf(MSG_TYPE_GUEST, 5, value, NULL);
+    return true;
+}
+
+static bool injector_req_location(ECS_Client* ccli, ECS__InjectorReq* msg, char *cmd)
+{
+    if (msg->data.data != NULL && msg->data.len > 0) {
+        qemu_mutex_lock(&mutex_location_data);
+        snprintf(location_data, msg->data.len + 1, "%s", (char*)msg->data.data);
+        qemu_mutex_unlock(&mutex_location_data);
+        return injector_send(ccli, msg, cmd);
+    }
+
+    return false;
+}
+
+bool msgproc_injector_req(ECS_Client* ccli, ECS__InjectorReq* msg)
+{
+    char cmd[11];
+    bool ret = false;
+
+    strncpy(cmd, msg->category, sizeof(cmd) - 1);
+
+    if (!strcmp(cmd, MSG_TYPE_SDCARD)) {
+        ret = injector_req_sdcard(ccli, msg, cmd);
+    } else if (!strcmp(cmd, MSG_TYPE_SENSOR)) {
+        ret = injector_req_sensor(ccli, msg, cmd);
+    } else if (!strcmp(cmd, MSG_TYPE_GUEST)) {
+        ret = injector_req_guest();
+    } else if (!strcmp(cmd, MSG_TYPE_LOCATION)) {
+        ret = injector_req_location(ccli, msg, cmd);
+    } else {
+        ret = injector_send(ccli, msg, cmd);
+    }
+
+    return ret;
+}
+
+void ecs_suspend_lock_state(int state)
+{
+    int catlen;
+
+    ECS__InjectorReq msg = ECS__INJECTOR_REQ__INIT;
+    const char* category = "suspend";
+
+    catlen = strlen(category);
+    msg.category = (char*) g_malloc0(catlen + 1);
+    memcpy(msg.category, category, catlen);
+
+    msg.group = 5;
+    msg.action = state;
+
+    msgproc_injector_req(NULL, &msg);
+}
+
+#define MSG_GROUP_HDS   100
+static bool injector_req_handle(char* cat, type_action action)
+{
+    /*SD CARD msg process*/
+    if (!strcmp(cat, MSG_TYPE_SDCARD)) {
+        return false;
+    } else if (!strcmp(cat, "suspend")) {
+        ecs_suspend_lock_state(ecs_get_suspend_state());
+        return true;
+    } else if (!strcmp(cat, MSG_TYPE_GUEST)) {
+        INFO("emuld connection is %d\n", action);
+        qemu_mutex_lock(&mutex_guest_connection);
+        guest_connection = action;
+        qemu_mutex_unlock(&mutex_guest_connection);
+        return false;
+    } else if (!strcmp(cat, "hds")) {
+        INFO("hds status is %d\n", action);
+        switch (action) {
+            case 1:
+                make_send_device_ntf(cat, MSG_GROUP_HDS, action, NULL);
+                break;
+            case 2:
+                make_send_device_ntf(cat, MSG_GROUP_HDS, action, NULL);
+                break;
+            case 3:
+                do_hotplug(DETACH_HDS, NULL, 0);
+                if (!is_hds_attached()) {
+                    make_send_device_ntf(cat, MSG_GROUP_HDS, 5, NULL);
+                } else {
+                    make_send_device_ntf(cat, MSG_GROUP_HDS, action, NULL);
+                }
+                break;
+            case 4:
+                make_send_device_ntf(cat, MSG_GROUP_HDS, action, NULL);
+                break;
+            default:
+                ERR("unknown action: %s.\n", action);
+                break;
+        }
+        return true;
+    } else {
+        ERR("unknown command: %s.\n", cat);
+    }
+
+    return false;
+}
+
+bool send_injector_ntf(const char* data, const int len)
+{
+    type_length length = 0;
+    type_group group = 0;
+    type_action action = 0;
+
+    const int catsize = 10;
+    char cat[catsize + 1];
+    memset(cat, 0, catsize + 1);
+
+    read_val_str(data, cat, catsize);
+    read_val_short(data + catsize, &length);
+    read_val_char(data + catsize + 2, &group);
+    read_val_char(data + catsize + 2 + 1, &action);
+
+    if (injector_req_handle(cat, action)) {
+        return true;
+    }
+
+    const char* ijdata = (data + catsize + 2 + 1 + 1);
+
+    TRACE("<< header cat = %s, length = %d, action=%d, group=%d\n", cat, length,action, group);
+
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__InjectorNtf ntf = ECS__INJECTOR_NTF__INIT;
+
+    ntf.category = (char*) g_malloc(catsize + 1);
+    strncpy(ntf.category, cat, 10);
+
+    ntf.length = length;
+    ntf.group = group;
+    ntf.action = action;
+
+    if (length > 0)
+    {
+        ntf.has_data = 1;
+
+        ntf.data.data = g_malloc(length);
+        ntf.data.len = length;
+        memcpy(ntf.data.data, ijdata, length);
+    }
+
+    master.type = ECS__MASTER__TYPE__INJECTOR_NTF;
+    master.injector_ntf = &ntf;
+
+    pb_to_all_clients(&master);
+
+    if (ntf.data.len > 0)
+    {
+        g_free(ntf.data.data);
+    }
+
+    g_free(ntf.category);
+
+    return true;
+}
+
diff --git a/tizen/src/ecs/ecs_nfc.c b/tizen/src/ecs/ecs_nfc.c
new file mode 100644 (file)
index 0000000..dcc1e4c
--- /dev/null
@@ -0,0 +1,116 @@
+/* Emulator Control Server
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ *  Jinhyung choi   <jinhyung2.choi@samsung.com>
+ *  MunKyu Im       <munkyu.im@samsung.com>
+ *  Daiyoung Kim    <daiyoung777.kim@samsung.com>
+ *  YeongKyoon Lee  <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "qemu-common.h"
+
+#include "hw/virtio/maru_virtio_nfc.h"
+
+#include "ecs.h"
+
+#include "debug_ch.h"
+
+MULTI_DEBUG_CHANNEL(qemu, ecs);
+
+bool msgproc_nfc_req(ECS_Client* ccli, ECS__NfcReq* msg)
+{
+    int datalen = msg->data.len;
+    void* data = (void*)g_malloc(datalen);
+    if(!data) {
+        ERR("g_malloc failed!\n");
+        return false;
+    }
+
+    memset(data, 0, datalen);
+    memcpy(data, msg->data.data, msg->data.len);
+
+    if (msg->has_data && msg->data.len > 0)
+    {
+        TRACE("recv from nfc injector: %s, %z\n", msg->has_data, msg->data.len);
+        print_binary(data, datalen);
+    }
+
+    send_to_nfc(ccli->client_id, ccli->client_type, data, msg->data.len);
+    g_free(data);
+    return true;
+}
+
+bool send_nfc_ntf(struct nfc_msg_info* msg)
+{
+    const int catsize = 10;
+    char cat[catsize + 1];
+    ECS_Client *clii;
+    memset(cat, 0, catsize + 1);
+
+    print_binary((char*)msg->buf, msg->use);
+    TRACE("id: %02x, type: %02x, use: %d\n", msg->client_id, msg->client_type, msg->use);
+    clii =  find_client(msg->client_id, msg->client_type);
+    if (clii) {
+        if(clii->client_type == TYPE_SIMUL_NFC) {
+            strncpy(cat, MSG_TYPE_NFC, 3);
+        } else if (clii->client_type == TYPE_ECP) {
+            strncpy(cat, MSG_TYPE_SIMUL_NFC, 9);
+        }else {
+            ERR("cannot find type! : %d\n", clii->client_type);
+        }
+        TRACE("header category = %s\n", cat);
+    }
+    else {
+        ERR("cannot find client!\n");
+    }
+
+    ECS__Master master = ECS__MASTER__INIT;
+    ECS__NfcNtf ntf = ECS__NFC_NTF__INIT;
+
+    ntf.category = (char*) g_malloc(catsize + 1);
+    strncpy(ntf.category, cat, 10);
+
+    ntf.has_data = 1;
+
+    ntf.data.data = g_malloc(NFC_MAX_BUF_SIZE);
+    ntf.data.len = NFC_MAX_BUF_SIZE;
+    memcpy(ntf.data.data, msg->buf, NFC_MAX_BUF_SIZE);
+
+    TRACE("send to nfc injector: \n");
+    master.type = ECS__MASTER__TYPE__NFC_NTF;
+    master.nfc_ntf = &ntf;
+
+    pb_to_all_clients(&master);
+
+    if (ntf.data.data && ntf.data.len > 0)
+    {
+        g_free(ntf.data.data);
+    }
+
+    if (ntf.category)
+        g_free(ntf.category);
+
+    return true;
+}
+
+
diff --git a/tizen/src/ecs/ecs_tethering.c b/tizen/src/ecs/ecs_tethering.c
deleted file mode 100644 (file)
index 2960048..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Emulator Control Server - Device Tethering Handler
- *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Contact:
- *  KiTae Kim       <kt920.kim@samsung.com>
- *  JiHye Kim       <jihye1128.kim@samsung.com>
- *  YeongKyoon Lee  <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "ui/console.h"
-
-#include "ecs.h"
-#include "ecs_tethering.h"
-#include "tethering/common.h"
-#include "tethering/sensor.h"
-#include "tethering/touch.h"
-#include "hw/virtio/maru_virtio_touchscreen.h"
-#include "debug_ch.h"
-
-MULTI_DEBUG_CHANNEL(tizen, ecs_tethering);
-
-#define MSG_BUF_SIZE  255
-#define MSG_LEN_SIZE    4
-
-// static bool send_tethering_ntf(const char *data, const int len);
-static bool send_tethering_ntf(const char *data);
-static void send_tethering_status_ntf(type_group group, type_action action);
-
-static int tethering_port = 0;
-
-void send_tethering_sensor_status_ecp(void)
-{
-    INFO(">> send tethering_event_status to ecp\n");
-    send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
-            ECS_TETHERING_MSG_ACTION_SENSOR_STATUS);
-}
-
-void send_tethering_touch_status_ecp(void)
-{
-    send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
-            ECS_TETHERING_MSG_ACTION_TOUCH_STATUS);
-}
-
-void send_tethering_connection_status_ecp(void)
-{
-    INFO(">> send tethering_connection_status to ecp\n");
-    send_tethering_status_ntf(ECS_TETHERING_MSG_GROUP_ECP,
-            ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS);
-}
-
-static void send_tethering_port_ecp(void)
-{
-    type_length length;
-    type_group group = ECS_TETHERING_MSG_GROUP_ECP;
-    type_action action = ECS_TETHERING_MSG_ACTION_CONNECT;
-    uint8_t *msg = NULL;
-    gchar data[12];
-
-    msg = g_malloc(MSG_BUF_SIZE);
-    if (!msg) {
-        return;
-    }
-
-    TRACE(">> send port_num: %d\n", tethering_port);
-
-    g_snprintf(data, sizeof(data) - 1, "%d", tethering_port);
-    length = strlen(data);
-
-    memcpy(msg, ECS_TETHERING_MSG_CATEGORY, 10);
-    memcpy(msg + 10, &length, sizeof(unsigned short));
-    memcpy(msg + 12, &group, sizeof(unsigned char));
-    memcpy(msg + 13, &action, sizeof(unsigned char));
-    memcpy(msg + 14, data, length);
-
-    TRACE(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s\n",
-        action, group, data);
-
-//    send_tethering_ntf((const char *)msg, MSG_BUF_SIZE);
-    send_tethering_ntf((const char *)msg);
-
-    if (msg) {
-        g_free(msg);
-    }
-}
-
-static void send_tethering_status_ntf(type_group group, type_action action)
-{
-    type_length length = 1;
-    int status = 0;
-    uint8_t *msg = NULL;
-    gchar data[2];
-
-    switch (action) {
-    case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS:
-        status = get_tethering_connection_status();
-        if (status == CONNECTED) {
-            send_tethering_port_ecp();
-        }
-        break;
-    case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS:
-        status = get_tethering_sensor_status();
-        break;
-    case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS:
-        status = get_tethering_touch_status();
-        break;
-    default:
-        break;
-    }
-
-    msg = g_malloc(MSG_BUF_SIZE);
-    if (!msg) {
-        return;
-    }
-
-    g_snprintf(data, sizeof(data), "%d", status);
-
-    memcpy(msg, ECS_TETHERING_MSG_CATEGORY, 10);
-    memcpy(msg + 10, &length, sizeof(unsigned short));
-    memcpy(msg + 12, &group, sizeof(unsigned char));
-    memcpy(msg + 13, &action, sizeof(unsigned char));
-    memcpy(msg + 14, data, 1);
-
-    TRACE(">> send tethering_ntf to ecp. action=%d, group=%d, data=%s\n",
-        action, group, data);
-
-//    send_tethering_ntf((const char *)msg, MSG_BUF_SIZE);
-    send_tethering_ntf((const char *)msg);
-
-    if (msg) {
-        g_free(msg);
-    }
-}
-
-// static bool send_tethering_ntf(const char *data, const int len)
-static bool send_tethering_ntf(const char *data)
-{
-    type_length length = 0;
-    type_group group = 0;
-    type_action action = 0;
-
-    const int catsize = 10;
-    char cat[catsize + 1];
-    memset(cat, 0, catsize + 1);
-
-    read_val_str(data, cat, catsize);
-    read_val_short(data + catsize, &length);
-    read_val_char(data + catsize + 2, &group);
-    read_val_char(data + catsize + 2 + 1, &action);
-
-    const char* ijdata = (data + catsize + 2 + 1 + 1);
-
-    TRACE("<< header cat = %s, length = %d, action=%d, group=%d\n", cat, length,action, group);
-
-    ECS__Master master = ECS__MASTER__INIT;
-    ECS__TetheringNtf ntf = ECS__TETHERING_NTF__INIT;
-
-    ntf.category = (char*) g_malloc(catsize + 1);
-    strncpy(ntf.category, cat, 10);
-
-    ntf.length = length;
-    ntf.group = group;
-    ntf.action = action;
-
-    if (length > 0) {
-        ntf.has_data = 1;
-
-        ntf.data.data = g_malloc(length);
-        ntf.data.len = length;
-        memcpy(ntf.data.data, ijdata, length);
-
-        TRACE("data = %s, length = %hu\n", ijdata, length);
-    }
-
-    master.type = ECS__MASTER__TYPE__TETHERING_NTF;
-    master.tethering_ntf = &ntf;
-
-    send_to_ecp(&master);
-
-    if (ntf.data.data && ntf.data.len > 0) {
-        g_free(ntf.data.data);
-    }
-
-    if (ntf.category) {
-        g_free(ntf.category);
-    }
-
-    return true;
-}
-
-void send_tethering_sensor_data(const char *data, int len)
-{
-    set_injector_data(data);
-}
-
-void send_tethering_touch_data(int x, int y, int index, int status)
-{
-    virtio_touchscreen_event(x, y, index, status);
-}
-
-// handle tethering_req message
-bool msgproc_tethering_req(ECS_Client* ccli, ECS__TetheringReq* msg)
-{
-    gchar cmd[10] = {0};
-    gchar **server_addr = NULL;
-
-    g_strlcpy(cmd, msg->category, sizeof(cmd));
-    type_length length = (type_length) msg->length;
-    type_group group = (type_group) (msg->group & 0xff);
-    type_action action = (type_action) (msg->action & 0xff);
-
-    TRACE(">> header = cmd = %s, length = %d, action=%d, group=%d\n",
-            cmd, length, action, group);
-
-    if (group == ECS_TETHERING_MSG_GROUP_ECP) {
-        switch(action) {
-        case ECS_TETHERING_MSG_ACTION_CONNECT:
-        {
-            // get ip address and port
-            if (msg->data.data && msg->data.len > 0) {
-                const gchar *data = (const gchar *)msg->data.data;
-                // gchar **server_addr = NULL;
-                gchar *ip_address = NULL;
-                guint64 port = 0;
-
-                server_addr = g_strsplit(data, ":", 0);
-                if (server_addr && server_addr[0]) {
-                    int len = strlen(server_addr[0]);
-
-                    if (len) {
-                        ip_address = g_malloc(len + 1);
-                        g_strlcpy(ip_address, server_addr[0], len + 1);
-                    }
-                    INFO("IP address: %s, length: %d\n", ip_address, len);
-                }
-
-                if (server_addr && server_addr[1]) {
-                    port = g_ascii_strtoull(server_addr[1], NULL, 10);
-                    INFO("port number: %d\n", port);
-                } else {
-                    ERR("failed to parse port number\n");
-                }
-
-                TRACE("MSG_ACTION_CONNECT");
-                TRACE("len = %zd, data\" %s\"", strlen(data), data);
-
-                connect_tethering_app(ip_address, port);
-                tethering_port = port;
-
-                TRACE(">> port_num: %d, %d\n", port, tethering_port);
-                g_free(ip_address);
-
-                g_strfreev(server_addr);
-            }
-        }
-            break;
-        case ECS_TETHERING_MSG_ACTION_DISCONNECT:
-            INFO(">> MSG_ACTION_DISCONNECT\n");
-            disconnect_tethering_app();
-            tethering_port = 0;
-            break;
-        case ECS_TETHERING_MSG_ACTION_CONNECTION_STATUS:
-        case ECS_TETHERING_MSG_ACTION_SENSOR_STATUS:
-        case ECS_TETHERING_MSG_ACTION_TOUCH_STATUS:
-            TRACE(">> get_status_action\n");
-            send_tethering_status_ntf(group, action);
-            break;
-        default:
-            break;
-        }
-    }
-
-    return true;
-}
index 0871aec..a91167e 100644 (file)
@@ -651,133 +651,133 @@ void   ecs__nfc_ntf__free_unpacked
   PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__nfc_ntf__descriptor);
   protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
 }
-void   ecs__tethering_req__init
-                     (ECS__TetheringReq         *message)
+void   ecs__event_cast_req__init
+                     (ECS__EventCastReq         *message)
 {
-  static ECS__TetheringReq init_value = ECS__TETHERING_REQ__INIT;
+  static ECS__EventCastReq init_value = ECS__EVENT_CAST_REQ__INIT;
   *message = init_value;
 }
-size_t ecs__tethering_req__get_packed_size
-                     (const ECS__TetheringReq *message)
+size_t ecs__event_cast_req__get_packed_size
+                     (const ECS__EventCastReq *message)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor);
   return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
 }
-size_t ecs__tethering_req__pack
-                     (const ECS__TetheringReq *message,
+size_t ecs__event_cast_req__pack
+                     (const ECS__EventCastReq *message,
                       uint8_t       *out)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor);
   return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
 }
-size_t ecs__tethering_req__pack_to_buffer
-                     (const ECS__TetheringReq *message,
+size_t ecs__event_cast_req__pack_to_buffer
+                     (const ECS__EventCastReq *message,
                       ProtobufCBuffer *buffer)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor);
   return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
 }
-ECS__TetheringReq *
-       ecs__tethering_req__unpack
+ECS__EventCastReq *
+       ecs__event_cast_req__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data)
 {
-  return (ECS__TetheringReq *)
-     protobuf_c_message_unpack (&ecs__tethering_req__descriptor,
+  return (ECS__EventCastReq *)
+     protobuf_c_message_unpack (&ecs__event_cast_req__descriptor,
                                 allocator, len, data);
 }
-void   ecs__tethering_req__free_unpacked
-                     (ECS__TetheringReq *message,
+void   ecs__event_cast_req__free_unpacked
+                     (ECS__EventCastReq *message,
                       ProtobufCAllocator *allocator)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_req__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_req__descriptor);
   protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
 }
-void   ecs__tethering_ans__init
-                     (ECS__TetheringAns         *message)
+void   ecs__event_cast_ans__init
+                     (ECS__EventCastAns         *message)
 {
-  static ECS__TetheringAns init_value = ECS__TETHERING_ANS__INIT;
+  static ECS__EventCastAns init_value = ECS__EVENT_CAST_ANS__INIT;
   *message = init_value;
 }
-size_t ecs__tethering_ans__get_packed_size
-                     (const ECS__TetheringAns *message)
+size_t ecs__event_cast_ans__get_packed_size
+                     (const ECS__EventCastAns *message)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor);
   return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
 }
-size_t ecs__tethering_ans__pack
-                     (const ECS__TetheringAns *message,
+size_t ecs__event_cast_ans__pack
+                     (const ECS__EventCastAns *message,
                       uint8_t       *out)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor);
   return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
 }
-size_t ecs__tethering_ans__pack_to_buffer
-                     (const ECS__TetheringAns *message,
+size_t ecs__event_cast_ans__pack_to_buffer
+                     (const ECS__EventCastAns *message,
                       ProtobufCBuffer *buffer)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor);
   return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
 }
-ECS__TetheringAns *
-       ecs__tethering_ans__unpack
+ECS__EventCastAns *
+       ecs__event_cast_ans__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data)
 {
-  return (ECS__TetheringAns *)
-     protobuf_c_message_unpack (&ecs__tethering_ans__descriptor,
+  return (ECS__EventCastAns *)
+     protobuf_c_message_unpack (&ecs__event_cast_ans__descriptor,
                                 allocator, len, data);
 }
-void   ecs__tethering_ans__free_unpacked
-                     (ECS__TetheringAns *message,
+void   ecs__event_cast_ans__free_unpacked
+                     (ECS__EventCastAns *message,
                       ProtobufCAllocator *allocator)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ans__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ans__descriptor);
   protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
 }
-void   ecs__tethering_ntf__init
-                     (ECS__TetheringNtf         *message)
+void   ecs__event_cast_ntf__init
+                     (ECS__EventCastNtf         *message)
 {
-  static ECS__TetheringNtf init_value = ECS__TETHERING_NTF__INIT;
+  static ECS__EventCastNtf init_value = ECS__EVENT_CAST_NTF__INIT;
   *message = init_value;
 }
-size_t ecs__tethering_ntf__get_packed_size
-                     (const ECS__TetheringNtf *message)
+size_t ecs__event_cast_ntf__get_packed_size
+                     (const ECS__EventCastNtf *message)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor);
   return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
 }
-size_t ecs__tethering_ntf__pack
-                     (const ECS__TetheringNtf *message,
+size_t ecs__event_cast_ntf__pack
+                     (const ECS__EventCastNtf *message,
                       uint8_t       *out)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor);
   return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
 }
-size_t ecs__tethering_ntf__pack_to_buffer
-                     (const ECS__TetheringNtf *message,
+size_t ecs__event_cast_ntf__pack_to_buffer
+                     (const ECS__EventCastNtf *message,
                       ProtobufCBuffer *buffer)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor);
   return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
 }
-ECS__TetheringNtf *
-       ecs__tethering_ntf__unpack
+ECS__EventCastNtf *
+       ecs__event_cast_ntf__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data)
 {
-  return (ECS__TetheringNtf *)
-     protobuf_c_message_unpack (&ecs__tethering_ntf__descriptor,
+  return (ECS__EventCastNtf *)
+     protobuf_c_message_unpack (&ecs__event_cast_ntf__descriptor,
                                 allocator, len, data);
 }
-void   ecs__tethering_ntf__free_unpacked
-                     (ECS__TetheringNtf *message,
+void   ecs__event_cast_ntf__free_unpacked
+                     (ECS__EventCastNtf *message,
                       ProtobufCAllocator *allocator)
 {
-  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__tethering_ntf__descriptor);
+  PROTOBUF_C_ASSERT (message->base.descriptor == &ecs__event_cast_ntf__descriptor);
   protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
 }
 void   ecs__master__init
@@ -1796,7 +1796,7 @@ const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor =
   (ProtobufCMessageInit) ecs__nfc_ntf__init,
   NULL,NULL,NULL    /* reserved[123] */
 };
-static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
+static const ProtobufCFieldDescriptor ecs__event_cast_req__field_descriptors[5] =
 {
   {
     "category",
@@ -1804,7 +1804,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_STRING,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, category),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, category),
     NULL,
     NULL,
     0,            /* packed */
@@ -1816,7 +1816,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, length),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, length),
     NULL,
     NULL,
     0,            /* packed */
@@ -1828,7 +1828,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, group),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, group),
     NULL,
     NULL,
     0,            /* packed */
@@ -1840,7 +1840,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, action),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, action),
     NULL,
     NULL,
     0,            /* packed */
@@ -1851,42 +1851,42 @@ static const ProtobufCFieldDescriptor ecs__tethering_req__field_descriptors[5] =
     5,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_BYTES,
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, has_data),
-    PROTOBUF_C_OFFSETOF(ECS__TetheringReq, data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, has_data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastReq, data),
     NULL,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
 };
-static const unsigned ecs__tethering_req__field_indices_by_name[] = {
+static const unsigned ecs__event_cast_req__field_indices_by_name[] = {
   3,   /* field[3] = action */
   0,   /* field[0] = category */
   4,   /* field[4] = data */
   2,   /* field[2] = group */
   1,   /* field[1] = length */
 };
-static const ProtobufCIntRange ecs__tethering_req__number_ranges[1 + 1] =
+static const ProtobufCIntRange ecs__event_cast_req__number_ranges[1 + 1] =
 {
   { 1, 0 },
   { 0, 5 }
 };
-const ProtobufCMessageDescriptor ecs__tethering_req__descriptor =
+const ProtobufCMessageDescriptor ecs__event_cast_req__descriptor =
 {
   PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "ECS.TetheringReq",
-  "TetheringReq",
-  "ECS__TetheringReq",
+  "ECS.EventCastReq",
+  "EventCastReq",
+  "ECS__EventCastReq",
   "ECS",
-  sizeof(ECS__TetheringReq),
+  sizeof(ECS__EventCastReq),
   5,
-  ecs__tethering_req__field_descriptors,
-  ecs__tethering_req__field_indices_by_name,
-  1,  ecs__tethering_req__number_ranges,
-  (ProtobufCMessageInit) ecs__tethering_req__init,
+  ecs__event_cast_req__field_descriptors,
+  ecs__event_cast_req__field_indices_by_name,
+  1,  ecs__event_cast_req__number_ranges,
+  (ProtobufCMessageInit) ecs__event_cast_req__init,
   NULL,NULL,NULL    /* reserved[123] */
 };
-static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
+static const ProtobufCFieldDescriptor ecs__event_cast_ans__field_descriptors[7] =
 {
   {
     "errcode",
@@ -1894,7 +1894,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errcode),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, errcode),
     NULL,
     NULL,
     0,            /* packed */
@@ -1906,7 +1906,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_STRING,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, errstr),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, errstr),
     NULL,
     NULL,
     0,            /* packed */
@@ -1918,7 +1918,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_STRING,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, category),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, category),
     NULL,
     NULL,
     0,            /* packed */
@@ -1930,7 +1930,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, length),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, length),
     NULL,
     NULL,
     0,            /* packed */
@@ -1942,7 +1942,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, group),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, group),
     NULL,
     NULL,
     0,            /* packed */
@@ -1954,7 +1954,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, action),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, action),
     NULL,
     NULL,
     0,            /* packed */
@@ -1965,15 +1965,15 @@ static const ProtobufCFieldDescriptor ecs__tethering_ans__field_descriptors[7] =
     7,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_BYTES,
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, has_data),
-    PROTOBUF_C_OFFSETOF(ECS__TetheringAns, data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, has_data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastAns, data),
     NULL,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
 };
-static const unsigned ecs__tethering_ans__field_indices_by_name[] = {
+static const unsigned ecs__event_cast_ans__field_indices_by_name[] = {
   5,   /* field[5] = action */
   2,   /* field[2] = category */
   6,   /* field[6] = data */
@@ -1982,27 +1982,27 @@ static const unsigned ecs__tethering_ans__field_indices_by_name[] = {
   4,   /* field[4] = group */
   3,   /* field[3] = length */
 };
-static const ProtobufCIntRange ecs__tethering_ans__number_ranges[1 + 1] =
+static const ProtobufCIntRange ecs__event_cast_ans__number_ranges[1 + 1] =
 {
   { 1, 0 },
   { 0, 7 }
 };
-const ProtobufCMessageDescriptor ecs__tethering_ans__descriptor =
+const ProtobufCMessageDescriptor ecs__event_cast_ans__descriptor =
 {
   PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "ECS.TetheringAns",
-  "TetheringAns",
-  "ECS__TetheringAns",
+  "ECS.EventCastAns",
+  "EventCastAns",
+  "ECS__EventCastAns",
   "ECS",
-  sizeof(ECS__TetheringAns),
+  sizeof(ECS__EventCastAns),
   7,
-  ecs__tethering_ans__field_descriptors,
-  ecs__tethering_ans__field_indices_by_name,
-  1,  ecs__tethering_ans__number_ranges,
-  (ProtobufCMessageInit) ecs__tethering_ans__init,
+  ecs__event_cast_ans__field_descriptors,
+  ecs__event_cast_ans__field_indices_by_name,
+  1,  ecs__event_cast_ans__number_ranges,
+  (ProtobufCMessageInit) ecs__event_cast_ans__init,
   NULL,NULL,NULL    /* reserved[123] */
 };
-static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
+static const ProtobufCFieldDescriptor ecs__event_cast_ntf__field_descriptors[5] =
 {
   {
     "category",
@@ -2010,7 +2010,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_STRING,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, category),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, category),
     NULL,
     NULL,
     0,            /* packed */
@@ -2022,7 +2022,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, length),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, length),
     NULL,
     NULL,
     0,            /* packed */
@@ -2034,7 +2034,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, group),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, group),
     NULL,
     NULL,
     0,            /* packed */
@@ -2046,7 +2046,7 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
     PROTOBUF_C_LABEL_REQUIRED,
     PROTOBUF_C_TYPE_INT32,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, action),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, action),
     NULL,
     NULL,
     0,            /* packed */
@@ -2057,39 +2057,39 @@ static const ProtobufCFieldDescriptor ecs__tethering_ntf__field_descriptors[5] =
     5,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_BYTES,
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, has_data),
-    PROTOBUF_C_OFFSETOF(ECS__TetheringNtf, data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, has_data),
+    PROTOBUF_C_OFFSETOF(ECS__EventCastNtf, data),
     NULL,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
 };
-static const unsigned ecs__tethering_ntf__field_indices_by_name[] = {
+static const unsigned ecs__event_cast_ntf__field_indices_by_name[] = {
   3,   /* field[3] = action */
   0,   /* field[0] = category */
   4,   /* field[4] = data */
   2,   /* field[2] = group */
   1,   /* field[1] = length */
 };
-static const ProtobufCIntRange ecs__tethering_ntf__number_ranges[1 + 1] =
+static const ProtobufCIntRange ecs__event_cast_ntf__number_ranges[1 + 1] =
 {
   { 1, 0 },
   { 0, 5 }
 };
-const ProtobufCMessageDescriptor ecs__tethering_ntf__descriptor =
+const ProtobufCMessageDescriptor ecs__event_cast_ntf__descriptor =
 {
   PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "ECS.TetheringNtf",
-  "TetheringNtf",
-  "ECS__TetheringNtf",
+  "ECS.EventCastNtf",
+  "EventCastNtf",
+  "ECS__EventCastNtf",
   "ECS",
-  sizeof(ECS__TetheringNtf),
+  sizeof(ECS__EventCastNtf),
   5,
-  ecs__tethering_ntf__field_descriptors,
-  ecs__tethering_ntf__field_indices_by_name,
-  1,  ecs__tethering_ntf__number_ranges,
-  (ProtobufCMessageInit) ecs__tethering_ntf__init,
+  ecs__event_cast_ntf__field_descriptors,
+  ecs__event_cast_ntf__field_indices_by_name,
+  1,  ecs__event_cast_ntf__number_ranges,
+  (ProtobufCMessageInit) ecs__event_cast_ntf__init,
   NULL,NULL,NULL    /* reserved[123] */
 };
 static const ProtobufCFieldDescriptor ecs__master__field_descriptors[19] =
@@ -2287,37 +2287,37 @@ static const ProtobufCFieldDescriptor ecs__master__field_descriptors[19] =
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
   {
-    "tethering_req",
+    "eventcast_req",
     103,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_MESSAGE,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__Master, tethering_req),
-    &ecs__tethering_req__descriptor,
+    PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_req),
+    &ecs__event_cast_req__descriptor,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
   {
-    "tethering_ans",
+    "eventcast_ans",
     104,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_MESSAGE,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ans),
-    &ecs__tethering_ans__descriptor,
+    PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_ans),
+    &ecs__event_cast_ans__descriptor,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
   },
   {
-    "tethering_ntf",
+    "eventcast_ntf",
     105,
     PROTOBUF_C_LABEL_OPTIONAL,
     PROTOBUF_C_TYPE_MESSAGE,
     0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(ECS__Master, tethering_ntf),
-    &ecs__tethering_ntf__descriptor,
+    PROTOBUF_C_OFFSETOF(ECS__Master, eventcast_ntf),
+    &ecs__event_cast_ntf__descriptor,
     NULL,
     0,            /* packed */
     0,NULL,NULL    /* reserved1,reserved2, etc */
@@ -2329,6 +2329,9 @@ static const unsigned ecs__master__field_indices_by_name[] = {
   9,   /* field[9] = device_ans */
   10,   /* field[10] = device_ntf */
   8,   /* field[8] = device_req */
+  17,   /* field[17] = eventcast_ans */
+  18,   /* field[18] = eventcast_ntf */
+  16,   /* field[16] = eventcast_req */
   6,   /* field[6] = injector_ans */
   7,   /* field[7] = injector_ntf */
   5,   /* field[5] = injector_req */
@@ -2339,9 +2342,6 @@ static const unsigned ecs__master__field_indices_by_name[] = {
   11,   /* field[11] = monitor_req */
   15,   /* field[15] = nfc_ntf */
   14,   /* field[14] = nfc_req */
-  17,   /* field[17] = tethering_ans */
-  18,   /* field[18] = tethering_ntf */
-  16,   /* field[16] = tethering_req */
   0,   /* field[0] = type */
 };
 static const ProtobufCIntRange ecs__master__number_ranges[2 + 1] =
index c81f5d3..2b97f86 100644 (file)
@@ -24,9 +24,9 @@ typedef struct _ECS__MonitorAns ECS__MonitorAns;
 typedef struct _ECS__MonitorNtf ECS__MonitorNtf;
 typedef struct _ECS__NfcReq ECS__NfcReq;
 typedef struct _ECS__NfcNtf ECS__NfcNtf;
-typedef struct _ECS__TetheringReq ECS__TetheringReq;
-typedef struct _ECS__TetheringAns ECS__TetheringAns;
-typedef struct _ECS__TetheringNtf ECS__TetheringNtf;
+typedef struct _ECS__EventCastReq ECS__EventCastReq;
+typedef struct _ECS__EventCastAns ECS__EventCastAns;
+typedef struct _ECS__EventCastNtf ECS__EventCastNtf;
 typedef struct _ECS__Master ECS__Master;
 
 
@@ -225,7 +225,7 @@ struct  _ECS__NfcNtf
     , NULL, 0,{0,NULL} }
 
 
-struct  _ECS__TetheringReq
+struct  _ECS__EventCastReq
 {
   ProtobufCMessage base;
   char *category;
@@ -235,12 +235,12 @@ struct  _ECS__TetheringReq
   protobuf_c_boolean has_data;
   ProtobufCBinaryData data;
 };
-#define ECS__TETHERING_REQ__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_req__descriptor) \
+#define ECS__EVENT_CAST_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_req__descriptor) \
     , NULL, 0, 0, 0, 0,{0,NULL} }
 
 
-struct  _ECS__TetheringAns
+struct  _ECS__EventCastAns
 {
   ProtobufCMessage base;
   int32_t errcode;
@@ -252,12 +252,12 @@ struct  _ECS__TetheringAns
   protobuf_c_boolean has_data;
   ProtobufCBinaryData data;
 };
-#define ECS__TETHERING_ANS__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ans__descriptor) \
+#define ECS__EVENT_CAST_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_ans__descriptor) \
     , 0, NULL, NULL, 0, 0, 0, 0,{0,NULL} }
 
 
-struct  _ECS__TetheringNtf
+struct  _ECS__EventCastNtf
 {
   ProtobufCMessage base;
   char *category;
@@ -267,8 +267,8 @@ struct  _ECS__TetheringNtf
   protobuf_c_boolean has_data;
   ProtobufCBinaryData data;
 };
-#define ECS__TETHERING_NTF__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&ecs__tethering_ntf__descriptor) \
+#define ECS__EVENT_CAST_NTF__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&ecs__event_cast_ntf__descriptor) \
     , NULL, 0, 0, 0, 0,{0,NULL} }
 
 
@@ -291,9 +291,9 @@ struct  _ECS__Master
   ECS__MonitorNtf *monitor_ntf;
   ECS__NfcReq *nfc_req;
   ECS__NfcNtf *nfc_ntf;
-  ECS__TetheringReq *tethering_req;
-  ECS__TetheringAns *tethering_ans;
-  ECS__TetheringNtf *tethering_ntf;
+  ECS__EventCastReq *eventcast_req;
+  ECS__EventCastAns *eventcast_ans;
+  ECS__EventCastNtf *eventcast_ntf;
 };
 #define ECS__MASTER__INIT \
  { PROTOBUF_C_MESSAGE_INIT (&ecs__master__descriptor) \
@@ -585,62 +585,62 @@ ECS__NfcNtf *
 void   ecs__nfc_ntf__free_unpacked
                      (ECS__NfcNtf *message,
                       ProtobufCAllocator *allocator);
-/* ECS__TetheringReq methods */
-void   ecs__tethering_req__init
-                     (ECS__TetheringReq         *message);
-size_t ecs__tethering_req__get_packed_size
-                     (const ECS__TetheringReq   *message);
-size_t ecs__tethering_req__pack
-                     (const ECS__TetheringReq   *message,
+/* ECS__EventCastReq methods */
+void   ecs__event_cast_req__init
+                     (ECS__EventCastReq         *message);
+size_t ecs__event_cast_req__get_packed_size
+                     (const ECS__EventCastReq   *message);
+size_t ecs__event_cast_req__pack
+                     (const ECS__EventCastReq   *message,
                       uint8_t             *out);
-size_t ecs__tethering_req__pack_to_buffer
-                     (const ECS__TetheringReq   *message,
+size_t ecs__event_cast_req__pack_to_buffer
+                     (const ECS__EventCastReq   *message,
                       ProtobufCBuffer     *buffer);
-ECS__TetheringReq *
-       ecs__tethering_req__unpack
+ECS__EventCastReq *
+       ecs__event_cast_req__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data);
-void   ecs__tethering_req__free_unpacked
-                     (ECS__TetheringReq *message,
+void   ecs__event_cast_req__free_unpacked
+                     (ECS__EventCastReq *message,
                       ProtobufCAllocator *allocator);
-/* ECS__TetheringAns methods */
-void   ecs__tethering_ans__init
-                     (ECS__TetheringAns         *message);
-size_t ecs__tethering_ans__get_packed_size
-                     (const ECS__TetheringAns   *message);
-size_t ecs__tethering_ans__pack
-                     (const ECS__TetheringAns   *message,
+/* ECS__EventCastAns methods */
+void   ecs__event_cast_ans__init
+                     (ECS__EventCastAns         *message);
+size_t ecs__event_cast_ans__get_packed_size
+                     (const ECS__EventCastAns   *message);
+size_t ecs__event_cast_ans__pack
+                     (const ECS__EventCastAns   *message,
                       uint8_t             *out);
-size_t ecs__tethering_ans__pack_to_buffer
-                     (const ECS__TetheringAns   *message,
+size_t ecs__event_cast_ans__pack_to_buffer
+                     (const ECS__EventCastAns   *message,
                       ProtobufCBuffer     *buffer);
-ECS__TetheringAns *
-       ecs__tethering_ans__unpack
+ECS__EventCastAns *
+       ecs__event_cast_ans__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data);
-void   ecs__tethering_ans__free_unpacked
-                     (ECS__TetheringAns *message,
+void   ecs__event_cast_ans__free_unpacked
+                     (ECS__EventCastAns *message,
                       ProtobufCAllocator *allocator);
-/* ECS__TetheringNtf methods */
-void   ecs__tethering_ntf__init
-                     (ECS__TetheringNtf         *message);
-size_t ecs__tethering_ntf__get_packed_size
-                     (const ECS__TetheringNtf   *message);
-size_t ecs__tethering_ntf__pack
-                     (const ECS__TetheringNtf   *message,
+/* ECS__EventCastNtf methods */
+void   ecs__event_cast_ntf__init
+                     (ECS__EventCastNtf         *message);
+size_t ecs__event_cast_ntf__get_packed_size
+                     (const ECS__EventCastNtf   *message);
+size_t ecs__event_cast_ntf__pack
+                     (const ECS__EventCastNtf   *message,
                       uint8_t             *out);
-size_t ecs__tethering_ntf__pack_to_buffer
-                     (const ECS__TetheringNtf   *message,
+size_t ecs__event_cast_ntf__pack_to_buffer
+                     (const ECS__EventCastNtf   *message,
                       ProtobufCBuffer     *buffer);
-ECS__TetheringNtf *
-       ecs__tethering_ntf__unpack
+ECS__EventCastNtf *
+       ecs__event_cast_ntf__unpack
                      (ProtobufCAllocator  *allocator,
                       size_t               len,
                       const uint8_t       *data);
-void   ecs__tethering_ntf__free_unpacked
-                     (ECS__TetheringNtf *message,
+void   ecs__event_cast_ntf__free_unpacked
+                     (ECS__EventCastNtf *message,
                       ProtobufCAllocator *allocator);
 /* ECS__Master methods */
 void   ecs__master__init
@@ -708,14 +708,14 @@ typedef void (*ECS__NfcReq_Closure)
 typedef void (*ECS__NfcNtf_Closure)
                  (const ECS__NfcNtf *message,
                   void *closure_data);
-typedef void (*ECS__TetheringReq_Closure)
-                 (const ECS__TetheringReq *message,
+typedef void (*ECS__EventCastReq_Closure)
+                 (const ECS__EventCastReq *message,
                   void *closure_data);
-typedef void (*ECS__TetheringAns_Closure)
-                 (const ECS__TetheringAns *message,
+typedef void (*ECS__EventCastAns_Closure)
+                 (const ECS__EventCastAns *message,
                   void *closure_data);
-typedef void (*ECS__TetheringNtf_Closure)
-                 (const ECS__TetheringNtf *message,
+typedef void (*ECS__EventCastNtf_Closure)
+                 (const ECS__EventCastNtf *message,
                   void *closure_data);
 typedef void (*ECS__Master_Closure)
                  (const ECS__Master *message,
@@ -741,9 +741,9 @@ extern const ProtobufCMessageDescriptor ecs__monitor_ans__descriptor;
 extern const ProtobufCMessageDescriptor ecs__monitor_ntf__descriptor;
 extern const ProtobufCMessageDescriptor ecs__nfc_req__descriptor;
 extern const ProtobufCMessageDescriptor ecs__nfc_ntf__descriptor;
-extern const ProtobufCMessageDescriptor ecs__tethering_req__descriptor;
-extern const ProtobufCMessageDescriptor ecs__tethering_ans__descriptor;
-extern const ProtobufCMessageDescriptor ecs__tethering_ntf__descriptor;
+extern const ProtobufCMessageDescriptor ecs__event_cast_req__descriptor;
+extern const ProtobufCMessageDescriptor ecs__event_cast_ans__descriptor;
+extern const ProtobufCMessageDescriptor ecs__event_cast_ntf__descriptor;
 extern const ProtobufCMessageDescriptor ecs__master__descriptor;
 
 PROTOBUF_C_END_DECLS
index 5f6451f..97977af 100644 (file)
@@ -23,9 +23,9 @@ const ProtobufCEnumValue ecs__master__type__enum_values_by_number[18] =
   { "MONITOR_NTF", "ECS__MASTER__TYPE__MONITOR_NTF", 14 },
   { "NFC_REQ", "ECS__MASTER__TYPE__NFC_REQ", 101 },
   { "NFC_NTF", "ECS__MASTER__TYPE__NFC_NTF", 102 },
-  { "TETHERING_REQ", "ECS__MASTER__TYPE__TETHERING_REQ", 103 },
-  { "TETHERING_ANS", "ECS__MASTER__TYPE__TETHERING_ANS", 104 },
-  { "TETHERING_NTF", "ECS__MASTER__TYPE__TETHERING_NTF", 105 },
+  { "EVENTCAST_REQ", "ECS__MASTER__TYPE__EVENTCAST_REQ", 103 },
+  { "EVENTCAST_ANS", "ECS__MASTER__TYPE__EVENTCAST_ANS", 104 },
+  { "EVENTCAST_NTF", "ECS__MASTER__TYPE__EVENTCAST_NTF", 105 },
 };
 static const ProtobufCIntRange ecs__master__type__value_ranges[] = {
 {2, 0},{101, 13},{0, 18}
@@ -37,6 +37,9 @@ const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[18] =
   { "DEVICE_ANS", 8 },
   { "DEVICE_NTF", 9 },
   { "DEVICE_REQ", 7 },
+  { "EVENTCAST_ANS", 16 },
+  { "EVENTCAST_NTF", 17 },
+  { "EVENTCAST_REQ", 15 },
   { "INJECTOR_ANS", 5 },
   { "INJECTOR_NTF", 6 },
   { "INJECTOR_REQ", 4 },
@@ -47,9 +50,6 @@ const ProtobufCEnumValueIndex ecs__master__type__enum_values_by_name[18] =
   { "MONITOR_REQ", 10 },
   { "NFC_NTF", 14 },
   { "NFC_REQ", 13 },
-  { "TETHERING_ANS", 16 },
-  { "TETHERING_NTF", 17 },
-  { "TETHERING_REQ", 15 },
 };
 const ProtobufCEnumDescriptor ecs__master__type__descriptor =
 {
index 5a11824..b855d79 100644 (file)
@@ -28,9 +28,9 @@ typedef enum _ECS__MasterType {
   ECS__MASTER__TYPE__MONITOR_NTF = 14,
   ECS__MASTER__TYPE__NFC_REQ = 101,
   ECS__MASTER__TYPE__NFC_NTF = 102,
-  ECS__MASTER__TYPE__TETHERING_REQ = 103,
-  ECS__MASTER__TYPE__TETHERING_ANS = 104,
-  ECS__MASTER__TYPE__TETHERING_NTF = 105
+  ECS__MASTER__TYPE__EVENTCAST_REQ = 103,
+  ECS__MASTER__TYPE__EVENTCAST_ANS = 104,
+  ECS__MASTER__TYPE__EVENTCAST_NTF = 105
 } ECS__MasterType;
 
 /* --- messages --- */
index 0f37f39..dbeabab 100644 (file)
@@ -99,7 +99,7 @@ message NfcNtf {
        optional bytes data = 2;
 }
 
-message TetheringReq {
+message EventCastReq {
        required string category = 1;
        required int32 length = 2;
        required int32 group = 3;
@@ -107,7 +107,7 @@ message TetheringReq {
        optional bytes data = 5;
 }
 
-message TetheringAns {
+message EventCastAns {
        required int32 errcode = 1;
        optional string errstr = 2;
        required string category = 3;
@@ -117,7 +117,7 @@ message TetheringAns {
        optional bytes data = 7;
 }
 
-message TetheringNtf {
+message EventCastNtf {
        required string category = 1;
        required int32 length = 2;
        required int32 group = 3;
@@ -152,9 +152,9 @@ message Master {
        optional NfcReq nfc_req = 101;
        optional NfcNtf nfc_ntf = 102;
 
-       optional TetheringReq tethering_req = 103;
-       optional TetheringAns tethering_ans = 104;
-       optional TetheringNtf tethering_ntf = 105;
+       optional EventCastReq eventcast_req = 103;
+       optional EventCastAns eventcast_ans = 104;
+       optional EventCastNtf eventcast_ntf = 105;
 }
 
 
index c4b563c..4b55f7c 100644 (file)
@@ -3,8 +3,8 @@ package ECS;
 option java_package = "org.tizen.ecp.msg.genmsg.ecs";
 
 enum Master_Type {
-    CHECKVERSION_REQ = 2;
-    CHECKVERSION_ANS = 3;
+       CHECKVERSION_REQ = 2;
+       CHECKVERSION_ANS = 3;
        KEEPALIVE_REQ = 4;
        KEEPALIVE_ANS = 5;
        INJECTOR_REQ = 6;
@@ -21,7 +21,7 @@ enum Master_Type {
        NFC_REQ = 101;
        NFC_NTF = 102;
 
-       TETHERING_REQ = 103;
-       TETHERING_ANS = 104;
-       TETHERING_NTF = 105;
+       EVENTCAST_REQ = 103;
+       EVENTCAST_ANS = 104;
+       EVENTCAST_NTF = 105;
 }
index 7e10d18..0f47b12 100644 (file)
@@ -46,12 +46,17 @@ static EmulatorConfigInfo _emul_info = {0,};
 static EmulatorConfigState _emul_state;
 
 /* misc */
+char remote_bin_path[PATH_MAX] = { 0, };
 char bin_path[PATH_MAX] = { 0, };
 #ifdef SUPPORT_LEGACY_ARGS
 // for compatibility
 char log_path[PATH_MAX] = { 0, };
 #endif
 
+const char *get_remote_bin_path(void)
+{
+    return remote_bin_path;
+}
 
 const char *get_bin_path(void)
 {
@@ -186,6 +191,19 @@ void set_emul_vm_base_port(int port)
     _emul_info.vm_base_port = port;
     _emul_info.device_serial_number = port + 1;
     _emul_info.ecs_port = port + 3;
+    _emul_info.serial_port = port + 4;
+    _emul_info.spice_port = port + 5;
+    _emul_info.websocket_port = port + 6;
+}
+
+int get_emul_websocket_port(void)
+{
+    return _emul_info.websocket_port;
+}
+
+int get_emul_spice_port(void)
+{
+    return _emul_info.spice_port;
 }
 
 void set_emul_ecs_port(int port)
@@ -208,6 +226,11 @@ int get_emul_ecs_port(void)
     return _emul_info.ecs_port;
 }
 
+int get_emul_serial_port(void)
+{
+    return _emul_info.serial_port;
+}
+
 /* current emulator condition */
 int get_emulator_condition(void)
 {
index 464becd..5c9d599 100644 (file)
@@ -59,6 +59,9 @@ enum {
     MOUSE_WHEELUP = 4,
     MOUSE_WHEELDOWN = 5,
     MOUSE_MOVE = 6,
+    MOUSE_DOUBLECLICK = 7,
+    PS2_DOWN = 8,
+    PS2_UP = 9,
 };
 
 /* keep it consistent with emulator-skin definition */
@@ -92,8 +95,11 @@ typedef  struct EmulatorConfigInfo {
     int vm_base_port;
     int device_serial_number;
     int ecs_port;
+    int spice_port;
+    int websocket_port;
     char *vm_name;
     /* add here */
+    int serial_port;
 } EmulatorConfigInfo;
 
 typedef struct EmulatorConfigState {
@@ -107,11 +113,13 @@ typedef struct EmulatorConfigState {
 } EmulatorConfigState;
 
 /* misc */
+extern char remote_bin_path[];
 extern char bin_path[];
 #ifdef SUPPORT_LEGACY_ARGS
 extern char log_path[];
 #endif
 
+char const *get_remote_bin_path(void);
 char const *get_bin_path(void);
 char const *get_log_path(void);
 
@@ -144,6 +152,9 @@ int get_emul_max_touch_point(void);
 int get_emul_vm_base_port(void);
 int get_device_serial_number(void);
 int get_emul_ecs_port(void);
+int get_emul_serial_port(void);
+int get_emul_spice_port(void);
+int get_emul_websocket_port(void);
 
 int get_emulator_condition(void);
 short get_emul_rotation(void);
index 73a2544..1b7fb56 100644 (file)
@@ -66,7 +66,10 @@ char maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 char tizen_target_path[PATH_MAX];
 char tizen_target_img_path[PATH_MAX];
 
-int enable_yagl = 0;
+#ifdef CONFIG_YAGL
+extern bool yagl_enabled(void);
+#endif /* CONFIG_YAGL */
+
 int enable_spice = 0;
 
 int _skin_argc;
@@ -195,17 +198,19 @@ static void print_options_info(void)
 }
 
 #define PROXY_BUFFER_LEN  128
-#define DEFAULT_QEMU_DNS_IP "10.0.2.3"
 static void prepare_basic_features(gchar * const kernel_cmdline)
 {
     char http_proxy[PROXY_BUFFER_LEN] ={ 0, },
         https_proxy[PROXY_BUFFER_LEN] = { 0, },
         ftp_proxy[PROXY_BUFFER_LEN] = { 0, },
-        socks_proxy[PROXY_BUFFER_LEN] = { 0, },
-        dns[PROXY_BUFFER_LEN] = { 0, };
+        socks_proxy[PROXY_BUFFER_LEN] = { 0, };
 
     set_base_port();
 
+#if defined(CONFIG_SPICE) && defined(CONFIG_LINUX)
+    clean_websocket_port(SIGKILL);
+#endif
+
     check_vm_lock();
     make_vm_lock();
 
@@ -219,13 +224,11 @@ static void prepare_basic_features(gchar * const kernel_cmdline)
     sdb_setup();
 
     get_host_proxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
-    /* using "DNS" provided by default QEMU */
-    g_strlcpy(dns, DEFAULT_QEMU_DNS_IP, strlen(DEFAULT_QEMU_DNS_IP) + 1);
 
     gchar * const tmp_str = g_strdup_printf(" sdb_port=%d,"
         " http_proxy=%s https_proxy=%s ftp_proxy=%s socks_proxy=%s"
-        " dns1=%s vm_resolution=%dx%d", get_emul_vm_base_port(),
-        http_proxy, https_proxy, ftp_proxy, socks_proxy, dns,
+        " vm_resolution=%dx%d", get_emul_vm_base_port(),
+        http_proxy, https_proxy, ftp_proxy, socks_proxy,
         get_emul_resolution_width(), get_emul_resolution_height());
 
     g_strlcat(kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE);
@@ -237,14 +240,27 @@ static void prepare_basic_features(gchar * const kernel_cmdline)
 static void prepare_opengl_acceleration(gchar * const kernel_cmdline)
 {
     int capability_check_gl = 0;
+    bool enable_yagl = yagl_enabled();
 
     if (enable_yagl) {
         capability_check_gl = check_gl();
 
-        if (capability_check_gl != 0) {
+        if (capability_check_gl == 1) {
             enable_yagl = 0;
-            LOG_INFO("<WARNING> GL acceleration was disabled due to the fail of GL check!\n");
+            LOG_WARNING("GL acceleration was disabled "
+                        "due to the fail of GL check!\n");
+#ifndef CONFIG_LINUX
+        }
+#else
+        } else if (capability_check_gl == 2) {
+            LOG_WARNING("You are using invalid graphic card driver for "
+                 "the emulator.\nIt can cause serious problems.\n"
+                 "You have to use the lastest vendor-provided "
+                 "graphic card driver.\n\nFor more information, "
+                 "see under ubuntu driver help page.\n"
+                 "https://help.ubuntu.com/community/BinaryDriverHowto/\n");
         }
+#endif
     }
 
     gchar * const tmp_str = g_strdup_printf(" yagl=%d", enable_yagl);
index d683dbd..7a5df2b 100644 (file)
@@ -33,7 +33,7 @@
 #include "emul_state.h"
 
 #define LINE_LIMIT 1024
-#define TOKEN_LIMIT 128
+#define TOKEN_LIMIT 1024
 #define OPTION_LIMIT 256
 
 struct variable {
@@ -93,6 +93,7 @@ void set_variable(const char * const arg1, const char * const arg2,
 
     var->name = name;
     var->value = value;
+
     QTAILQ_INSERT_TAIL(&variables, var, entry);
 }
 
@@ -137,7 +138,16 @@ static char *substitute_variables(char *src)
     int i = 0;
     int start_index = -1;
     int end_index = -1;
-    char *str = g_strdup(src);
+    char *str;
+
+    // strip ""
+    int len = strlen(src);
+    if (src[0] == '"' && src[len - 1] == '"') {
+        src[len - 1] = '\0';
+        str = g_strdup(src + 1);
+    } else {
+        str = g_strdup(src);
+    }
 
     for (i = 0; str[i]; ++i) {
         if(str[i] == '$' && str[i + 1] && str[i + 1] == '{') {
@@ -199,7 +209,7 @@ static char *substitute_variables(char *src)
 
 bool load_profile_default(const char * const conf, const char * const profile)
 {
-    int classification = 0;
+    int classification = -1;
     char str[LINE_LIMIT];
     char *filename;
     FILE *file = NULL;
@@ -233,21 +243,24 @@ bool load_profile_default(const char * const conf, const char * const profile)
 
             do {
                 if (!str[i] ||
-                    (!in_quote &&
-                        (str[i] == ' ' || str[i] == '\t' || str[i] == '#'
-                        || str[i] == '\r' || str[i] == '\n')) ||
-                    (in_quote && str[i] == '"')) {
+                        (!in_quote &&
+                         (str[i] == ' ' || str[i] == '\t' || str[i] == '#'
+                          || str[i] == '\r' || str[i] == '\n'))) {
                     if (start_index != -1) {
-                        g_strlcpy(token, str + start_index,
-                            i - start_index + 1);
+                        int len = i - start_index + 1;
+                        if (len < TOKEN_LIMIT) {
+                            g_strlcpy(token, str + start_index, len);
+                        }
+                        else {
+                            // TODO: error handling...
+                        }
                     }
                 }
+                else if (str[i] == '"') {
+                    in_quote = in_quote ? false : true;
+                }
                 else {
                     if (start_index < 0) {
-                        if (str[i] == '"') {
-                            in_quote = true;
-                            ++i;
-                        }
                         start_index = i;
                     }
                 }
@@ -275,6 +288,10 @@ bool load_profile_default(const char * const conf, const char * const profile)
 
             // process line
             switch (classification) {
+            case -1: // error
+                fprintf(stderr, "conf file error !!!\n");
+                // TODO: assert ??
+                break;
             case 0: // default variables
                 {
                     gchar **splitted = g_strsplit(token, "=", 2);
@@ -296,6 +313,7 @@ bool load_profile_default(const char * const conf, const char * const profile)
         }
     }
 
+    fclose(file);
     return true;
 }
 
similarity index 70%
rename from tizen/src/tethering/Makefile.objs
rename to tizen/src/eventcast/Makefile.objs
index 9aa4799..d6bc934 100644 (file)
@@ -1,4 +1,4 @@
-obj-y += genmsg/tethering.pb-c.o # protobuf-c.o
+obj-y += genmsg/eventcast.pb-c.o # protobuf-c.o
 obj-y += common.o
 obj-y += sensor.o
 obj-y += touch.o
similarity index 55%
rename from tizen/src/tethering/common.c
rename to tizen/src/eventcast/common.c
index 408d919..0a8fb35 100644 (file)
@@ -27,6 +27,7 @@
  * - S-Core Co., Ltd
  *
  */
+
 #ifndef __WIN32
 #include <sys/ioctl.h>
 #else
 #include "common.h"
 #include "sensor.h"
 #include "touch.h"
-// #include "display.h"
 #include "emul_state.h"
-#include "ecs/ecs_tethering.h"
-#include "genmsg/tethering.pb-c.h"
+#include "ecs/ecs_eventcast.h"
+#include "genmsg/eventcast.pb-c.h"
 
 #include "util/new_debug_ch.h"
 
-DECLARE_DEBUG_CHANNEL(app_tethering);
+DECLARE_DEBUG_CHANNEL(eventcast);
 
-#define TETHERING_MSG_HANDSHAKE_KEY     100
+#define EVENTCAST_MSG_HANDSHAKE_KEY     100
 #define MSG_BUF_SIZE    255
 #define MSG_LEN_SIZE    4
 
@@ -61,23 +61,21 @@ DECLARE_DEBUG_CHANNEL(app_tethering);
 #endif
 
 #define SEND_BUF_MAX_SIZE 4096
+static const char *loopback = "127.0.0.1";
+
+enum connection_type {
+    NONE = 0,
+    USB,
+    WIFI,
+};
 
-typedef struct tethering_recv_buf {
+typedef struct eventcast_recv_buf {
     uint32_t len;
     uint32_t stack_size;
     char data[MSG_BUF_SIZE];
-} tethering_recv_buf;
-
-#if 0
-typedef struct input_device_list {
-    int type;
-    void *opaque;
+} eventcast_recv_buf;
 
-    QTAILQ_ENTRY(input_device_list) node;
-} input_device_list;
-#endif
-
-typedef struct _TetheringState {
+typedef struct _EventcastState {
     int fd;
 
     // server address
@@ -86,66 +84,42 @@ typedef struct _TetheringState {
 
     // connection state
     int status;
+    int type;
 
     // receiver handling thread
     QemuThread thread;
     QemuMutex mutex;
 
-    tethering_recv_buf recv_buf;
+    eventcast_recv_buf recv_buf;
 
     // device state
     QTAILQ_HEAD(device, input_device_list) device;
     int device_node_cnt;
 
-} TetheringState;
+} EventcastState;
 
-static TetheringState *tethering_client;
-static tethering_recv_buf recv_buf;
-// static bool app_state = false;
+static EventcastState *eventcast_client = NULL;
+static eventcast_recv_buf recv_buf;
 
-static void end_tethering_socket(int sockfd);
-static void set_tethering_connection_status(int status);
+static void end_eventcast_socket(int sockfd);
+static void set_eventcast_connection_status(int status);
 #if 0
-static void set_tethering_app_state(bool state);
-static bool get_tethering_app_state(void);
+static void set_eventcast_app_state(bool state);
+static bool get_eventcast_app_state(void);
 #endif
 
-#if 0
-int add_input_device(void *opaque)
-{
-    input_device_list *elem = (input_device_list *)opaque;
-
-    if (!tethering_client) {
-        return -1;
-    }
-
-    QTAILQ_INSERT_TAIL(&tethering_client->device, elem, node);
-
-    return (tethering_client->device_node_cnt++);
-}
-
-int remove_input_device(void *opaque)
-{
-    if (!tethering_client) {
-        return -1;
-    }
-
-    QTAILQ_REMOVE(&tethering_client->device, opaque, node);
-
-    tethering_client->device_node_cnt--;
-}
-#endif
+static bool is_notifier = false;
 
 // create master message
-static void *build_tethering_msg(Tethering__TetheringMsg* msg, int *payloadsize)
+static void *build_eventcast_msg(Eventcast__EventCastMsg* msg, int *payloadsize)
 {
     void *buf = NULL;
     int msg_packed_size = 0;
 
-    msg_packed_size = tethering__tethering_msg__get_packed_size(msg);
+    msg_packed_size = eventcast__event_cast_msg__get_packed_size(msg);
     *payloadsize = msg_packed_size + MSG_LEN_SIZE;
 
-    LOG_TRACE("create tethering_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize);
+    LOG_TRACE("create eventcast_msg. msg_packed_size %d, payloadsize %d\n", msg_packed_size, *payloadsize);
 
     buf = g_malloc(*payloadsize);
     if (!buf) {
@@ -153,7 +127,7 @@ static void *build_tethering_msg(Tethering__TetheringMsg* msg, int *payloadsize)
         return NULL;
     }
 
-    tethering__tethering_msg__pack(msg, buf + MSG_LEN_SIZE);
+    eventcast__event_cast_msg__pack(msg, buf + MSG_LEN_SIZE);
 
     LOG_TRACE("msg_packed_size 1 %x\n", msg_packed_size);
     msg_packed_size = htonl(msg_packed_size);
@@ -166,7 +140,7 @@ static void *build_tethering_msg(Tethering__TetheringMsg* msg, int *payloadsize)
 
 bool send_msg_to_controller(void *msg)
 {
-    Tethering__TetheringMsg * tetheringMsg = (Tethering__TetheringMsg *)msg;
+    Eventcast__EventCastMsg * eventcastMsg = (Eventcast__EventCastMsg *)msg;
 
     void *buf = NULL;
     int payload_size = 0, sent_size = 0;
@@ -175,17 +149,17 @@ bool send_msg_to_controller(void *msg)
     bool ret = true;
     uint32_t buf_offset = 0;
 
-    buf = build_tethering_msg(tetheringMsg, &payload_size);
+    buf = build_eventcast_msg(eventcastMsg, &payload_size);
     if (!buf) {
         return false;
     }
 
-    if (!tethering_client) {
-        LOG_SEVERE("TetheringState is NULL\n");
+    if (!eventcast_client) {
+        LOG_SEVERE("EventcastState is NULL\n");
         g_free(buf);
         return false;
     }
-    sockfd = tethering_client->fd;
+    sockfd = eventcast_client->fd;
 
     total_buf_size = payload_size;
     do {
@@ -198,6 +172,7 @@ bool send_msg_to_controller(void *msg)
             if (errno == EAGAIN) {
                 fd_set writefds;
                 struct timeval timeout;
+                int result = 0;
 
                 FD_ZERO(&writefds);
                 FD_SET(sockfd, &writefds);
@@ -205,9 +180,10 @@ bool send_msg_to_controller(void *msg)
                 timeout.tv_sec = 1;
                 timeout.tv_usec = 0;
 
-                ret = select(sockfd + 1, NULL, &writefds, NULL, &timeout);
-                if (ret < 0) {
-                    LOG_INFO("not possible to send data\n");
+                result = select(sockfd + 1, NULL, &writefds, NULL, &timeout);
+                if (result < 0) {
+                    LOG_SEVERE("not possible to send data\n");
+                    ret = false;
                     break;
                 }
                 LOG_TRACE("possible to send data\n");
@@ -232,14 +208,14 @@ bool send_msg_to_controller(void *msg)
 
 static bool send_handshake_req_msg(void)
 {
-    Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
-    Tethering__HandShakeReq req = TETHERING__HAND_SHAKE_REQ__INIT;
+    Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT;
+    Eventcast__HandShakeReq req = EVENTCAST__HAND_SHAKE_REQ__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
-    req.key = TETHERING_MSG_HANDSHAKE_KEY;
+    req.key = EVENTCAST_MSG_HANDSHAKE_KEY;
 
-    msg.type = TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ;
+    msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ;
     msg.handshakereq = &req;
 
     LOG_TRACE("send handshake_req message\n");
@@ -252,14 +228,14 @@ static bool send_handshake_req_msg(void)
 
 static bool send_emul_state_msg(void)
 {
-    Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
-    Tethering__EmulatorState emul_state = TETHERING__EMULATOR_STATE__INIT;
+    Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT;
+    Eventcast__EmulatorState emul_state = EVENTCAST__EMULATOR_STATE__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
-    emul_state.state = TETHERING__CONNECTION_STATE__DISCONNECTED;
+    emul_state.state = EVENTCAST__CONNECTION_STATE__DISCONNECTED;
 
-    msg.type = TETHERING__TETHERING_MSG__TYPE__EMUL_STATE;
+    msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE;
     msg.emulstate = &emul_state;
 
     LOG_INFO("send emulator_state message\n");
@@ -271,14 +247,14 @@ static bool send_emul_state_msg(void)
 }
 
 // event messages
-static bool build_event_msg(Tethering__EventMsg *event)
+static bool build_event_msg(Eventcast__EventMsg *event)
 {
     bool ret = false;
-    Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
+    Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
-    msg.type = TETHERING__TETHERING_MSG__TYPE__EVENT_MSG;
+    msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG;
     msg.eventmsg = event;
 
     ret = send_msg_to_controller(&msg);
@@ -288,17 +264,17 @@ static bool build_event_msg(Tethering__EventMsg *event)
     return ret;
 }
 
-static bool send_event_start_ans_msg(Tethering__MessageResult result)
+static bool send_event_start_ans_msg(Eventcast__MessageResult result)
 {
     bool ret = false;
-    Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT;
-    Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
+    Eventcast__EventMsg event = EVENTCAST__EVENT_MSG__INIT;
+    Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     start_ans.result = result;
 
-    event.type = TETHERING__EVENT_MSG__TYPE__START_ANS;
+    event.type = EVENTCAST__EVENT_MSG__TYPE__START_ANS;
     event.startans = &start_ans;
 
     LOG_TRACE("send event_start_ans message\n");
@@ -309,19 +285,19 @@ static bool send_event_start_ans_msg(Tethering__MessageResult result)
     return ret;
 }
 
-static bool send_set_event_status_msg(Tethering__EventType event_type,
-                                    Tethering__State status)
+static bool send_set_event_status_msg(Eventcast__EventType event_type,
+                                    Eventcast__State status)
 {
     bool ret = false;
-    Tethering__EventMsg event = TETHERING__EVENT_MSG__INIT;
-    Tethering__SetEventStatus event_status = TETHERING__SET_EVENT_STATUS__INIT;
+    Eventcast__EventMsg event = EVENTCAST__EVENT_MSG__INIT;
+    Eventcast__SetEventStatus event_status = EVENTCAST__SET_EVENT_STATUS__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     event_status.type = event_type;
     event_status.state = status;
 
-    event.type = TETHERING__EVENT_MSG__TYPE__EVENT_STATUS;
+    event.type = EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS;
     event.setstatus = &event_status;
 
     LOG_TRACE("send event_set_event_status message\n");
@@ -333,67 +309,61 @@ static bool send_set_event_status_msg(Tethering__EventType event_type,
 }
 
 // message handlers
-static void msgproc_tethering_handshake_ans(Tethering__HandShakeAns *msg)
+static void msgproc_eventcast_handshake_ans(Eventcast__HandShakeAns *msg)
 {
-    // FIXME: handle handshake answer
-    //  ans = msg->result;
+    // handle handshake answer
 }
 
-static void msgproc_app_state_msg(Tethering__AppState *msg)
+static void msgproc_app_state_msg(Eventcast__AppState *msg)
 {
-    int status = TETHERING__STATE__DISABLED;
+    int status = EVENTCAST__STATE__DISABLED;
 
-    if (msg->state == TETHERING__CONNECTION_STATE__TERMINATED) {
+    if (msg->state == EVENTCAST__CONNECTION_STATE__TERMINATED) {
         LOG_INFO("app is terminated\n");
 
-        // set_tethering_app_state(false);
-        set_tethering_sensor_status(status);
-        set_tethering_touch_status(status);
+        // set_eventcast_app_state(false);
+        set_eventcast_sensor_status(status);
+        set_eventcast_touch_status(status);
 
-        disconnect_tethering_app();
-    } else {
-        // does nothing
+        disconnect_eventcast_app();
     }
 }
 
-static bool msgproc_tethering_event_msg(Tethering__EventMsg *msg)
+static bool msgproc_eventcast_event_msg(Eventcast__EventMsg *msg)
 {
     bool ret = true;
 
     switch(msg->type) {
-    case TETHERING__EVENT_MSG__TYPE__START_REQ:
+    case EVENTCAST__EVENT_MSG__TYPE__START_REQ:
     {
         int touch_status = 0;
 
         LOG_TRACE("EVENT_MSG_TYPE_START_REQ\n");
-        send_set_event_status_msg(TETHERING__EVENT_TYPE__SENSOR,
-                                TETHERING__STATE__ENABLED);
+        send_set_event_status_msg(EVENTCAST__EVENT_TYPE__SENSOR,
+                                EVENTCAST__STATE__ENABLED);
 
         // TODO: check sensor device whether it exists or not
-        // set_tethering_sensor_status(ENABLED);
-        set_tethering_sensor_status(TETHERING__STATE__ENABLED);
+        set_eventcast_sensor_status(EVENTCAST__STATE__ENABLED);
 
         if (is_emul_input_touch_enable()) {
-            touch_status = TETHERING__STATE__ENABLED;
-            // set_tethering_touch_status(ENABLED);
+            touch_status = EVENTCAST__STATE__ENABLED;
         } else {
-            touch_status = TETHERING__STATE__DISABLED;
-            // set_tethering_touch_status(DISABLED);
+            touch_status = EVENTCAST__STATE__DISABLED;
         }
-        set_tethering_touch_status(touch_status);
+        set_eventcast_touch_status(touch_status);
 
         LOG_TRACE("send touch event_status msg: %d\n", touch_status);
-        send_set_event_status_msg(TETHERING__EVENT_TYPE__TOUCH, touch_status);
+        send_set_event_status_msg(EVENTCAST__EVENT_TYPE__TOUCH, touch_status);
 
         LOG_TRACE("send event_start_ans msg: %d\n", touch_status);
-        send_event_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
+        send_event_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS);
     }
         break;
-    case TETHERING__EVENT_MSG__TYPE__TERMINATE:
+    case EVENTCAST__EVENT_MSG__TYPE__TERMINATE:
         break;
 
     default:
-        LOG_WARNING("invalid event_msg type\n");
+        LOG_TRACE("invalid event_msg type\n");
         ret = false;
         break;
     }
@@ -401,37 +371,37 @@ static bool msgproc_tethering_event_msg(Tethering__EventMsg *msg)
     return ret;
 }
 
-static bool handle_tethering_msg_from_controller(char *data, int len)
+static bool handle_eventcast_msg_from_controller(char *data, int len)
 {
-    Tethering__TetheringMsg *tethering = NULL;
+    Eventcast__EventCastMsg *eventcast = NULL;
     bool ret = true;
 
-    tethering = tethering__tethering_msg__unpack(NULL, (size_t)len,
+    eventcast = eventcast__event_cast_msg__unpack(NULL, (size_t)len,
                                             (const uint8_t *)data);
 
-    if (!tethering) {
-        LOG_SEVERE("no tethering massage\n");
+    if (!eventcast) {
+        LOG_SEVERE("no eventcast massage\n");
         return false;
     }
 
-    switch (tethering->type) {
-    case TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS:
+    switch (eventcast->type) {
+    case EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS:
     {
         // TODO: set the result of handshake_ans to
-        Tethering__HandShakeAns *msg = tethering->handshakeans;
+        Eventcast__HandShakeAns *msg = eventcast->handshakeans;
         if (!msg) {
             ret = false;
         } else {
-            msgproc_tethering_handshake_ans(msg);
+            msgproc_eventcast_handshake_ans(msg);
             LOG_TRACE("receive handshake answer\n");
 
-            set_tethering_connection_status(CONNECTED);
+            set_eventcast_connection_status(CONNECTED);
         }
     }
         break;
-    case TETHERING__TETHERING_MSG__TYPE__APP_STATE:
+    case EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE:
     {
-        Tethering__AppState *msg = tethering->appstate;
+        Eventcast__AppState *msg = eventcast->appstate;
 
         LOG_TRACE("receive app_state msg\n");
         if (!msg) {
@@ -441,57 +411,42 @@ static bool handle_tethering_msg_from_controller(char *data, int len)
         }
     }
         break;
-    case TETHERING__TETHERING_MSG__TYPE__EVENT_MSG:
+    case EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG:
     {
-        Tethering__EventMsg *msg = tethering->eventmsg;
+        Eventcast__EventMsg *msg = eventcast->eventmsg;
 
         LOG_TRACE("receive event_msg\n");
         if (!msg) {
             ret = false;
         } else {
-            msgproc_tethering_event_msg(msg);
+            msgproc_eventcast_event_msg(msg);
         }
     }
         break;
-    case TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG:
+    case EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG:
     {
-        Tethering__SensorMsg *msg = tethering->sensormsg;
+        Eventcast__SensorMsg *msg = eventcast->sensormsg;
 
         LOG_TRACE("receive sensor_msg\n");
         if (!msg) {
             ret = false;
         } else {
-            msgproc_tethering_sensor_msg(msg);
+            msgproc_eventcast_sensor_msg(msg);
         }
     }
         break;
-    case TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG:
+    case EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG:
     {
-        Tethering__TouchMsg *msg = tethering->touchmsg;
+        Eventcast__TouchMsg *msg = eventcast->touchmsg;
 
         LOG_TRACE("receive touch_msg\n");
         if (!msg) {
             ret = false;
         } else {
-            msgproc_tethering_touch_msg(msg);
-        }
-    }
-        break;
-
-#if 0
-    case TETHERING__TETHERING_MSG__TYPE__DISPLAY_MSG:
-    {
-        Tethering__DisplayMsg *msg = tethering->displaymsg;
-
-        LOG_TRACE("receive display_msg\n");
-        if (!msg) {
-            ret = false;
-        } else {
-            msgproc_tethering_display_msg(msg);
+            msgproc_eventcast_touch_msg(msg);
         }
     }
         break;
-#endif
 
     default:
         LOG_WARNING("invalid type message\n");
@@ -499,33 +454,32 @@ static bool handle_tethering_msg_from_controller(char *data, int len)
         break;
     }
 
-//    g_free(data);
-    tethering__tethering_msg__free_unpacked(tethering, NULL);
+    eventcast__event_cast_msg__free_unpacked(eventcast, NULL);
     return ret;
 }
 
-static void reset_tethering_recv_buf(void *opaque)
+static void reset_eventcast_recv_buf(void *opaque)
 {
-    memset(opaque, 0x00, sizeof(tethering_recv_buf));
+    memset(opaque, 0x00, sizeof(eventcast_recv_buf));
 }
 
-// tethering client socket
-static void tethering_io_handler(void *opaque)
+// eventcast client socket
+static void eventcast_io_handler(void *opaque)
 {
     int payloadsize = 0, read_size = 0;
     int to_read_bytes = 0;
     int sockfd = 0, ret = 0;
 
-    if (!tethering_client) {
+    if (!eventcast_client) {
         return;
     }
-    sockfd = tethering_client->fd;
+    sockfd = eventcast_client->fd;
 
 #ifndef CONFIG_WIN32
     ret = ioctl(sockfd, FIONREAD, &to_read_bytes);
     if (ret < 0) {
         perror("invalid ioctl opertion\n");
-        disconnect_tethering_app();
+        disconnect_eventcast_app();
         return;
     }
 
@@ -534,7 +488,7 @@ static void tethering_io_handler(void *opaque)
     ret = ioctlsocket(sockfd, FIONREAD, &to_read_bytes_long);
     if (ret < 0) {
         perror("invalid ioctl opertion\n");
-        disconnect_tethering_app();
+        disconnect_eventcast_app();
         return;
     }
 
@@ -544,7 +498,7 @@ static void tethering_io_handler(void *opaque)
     LOG_TRACE("ioctl: ret: %d, FIONREAD: %d\n", ret, to_read_bytes);
     if (to_read_bytes == 0) {
         LOG_INFO("there is no read data\n");
-        disconnect_tethering_app();
+        disconnect_eventcast_app();
         return;
     }
 
@@ -579,7 +533,7 @@ static void tethering_io_handler(void *opaque)
                     to_read_bytes, 0);
     if (read_size == 0) {
         LOG_SEVERE("failed to read data\n");
-        disconnect_tethering_app();
+        disconnect_eventcast_app();
         return;
     }
 
@@ -593,34 +547,24 @@ static void tethering_io_handler(void *opaque)
             return;
         } else {
             memcpy(snd_buf, recv_buf.data, recv_buf.stack_size);
-            handle_tethering_msg_from_controller(snd_buf, recv_buf.stack_size);
+            handle_eventcast_msg_from_controller(snd_buf, recv_buf.stack_size);
             g_free(snd_buf);
-            reset_tethering_recv_buf(&recv_buf);
+            reset_eventcast_recv_buf(&recv_buf);
         }
     }
 }
 
 // socket functions
-static int start_tethering_socket(const char *ipaddress, int port)
+static int start_eventcast_socket(const char *ipaddress, int port)
 {
     struct sockaddr_in addr;
-
-    gchar serveraddr[32] = { 0, };
-    int sock = -1;
-    int ret = 0;
+    int sock = -1, ret = 0;
 
     addr.sin_family = AF_INET;
     addr.sin_port = htons(port); // i.e. 1234
 
-    if (ipaddress == NULL) {
-        g_strlcpy(serveraddr, "127.0.0.1", sizeof(serveraddr));
-    } else {
-        g_strlcpy(serveraddr, ipaddress, sizeof(serveraddr));
-    }
-
-    LOG_INFO("server ip address: %s, port: %d\n", serveraddr, port);
-    ret = inet_aton(serveraddr, &addr.sin_addr);
-
+    LOG_INFO("server ip address: %s, port: %d\n", ipaddress, port);
+    ret = inet_aton(ipaddress, &addr.sin_addr);
     if (ret == 0) {
         LOG_SEVERE("inet_aton failure\n");
         return -1;
@@ -628,21 +572,21 @@ static int start_tethering_socket(const char *ipaddress, int port)
 
     sock = qemu_socket(PF_INET, SOCK_STREAM, 0);
     if (sock < 0) {
-        // set_tethering_connection_status(DISCONNECTED);
-        LOG_SEVERE("tethering socket creation is failed\n", sock);
+        // set_eventcast_connection_status(DISCONNECTED);
+        LOG_SEVERE("eventcast socket creation is failed\n", sock);
         return -1;
     }
-    LOG_INFO("tethering socket is created: %d\n", sock);
+    LOG_INFO("eventcast socket is created: %d\n", sock);
 
     qemu_set_nonblock(sock);
 
-    set_tethering_connection_status(CONNECTING);
+    set_eventcast_connection_status(CONNECTING);
 
     while (1) {
         ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
 
         if (ret == 0) {
-            LOG_INFO("tethering socket is connected.\n");
+            LOG_INFO("eventcast socket is connected.\n");
             break;
         } else {
             int connection_errno = socket_error();
@@ -689,97 +633,123 @@ static int start_tethering_socket(const char *ipaddress, int port)
         }
     }
 
-    if (ret < 0 && ret != -EISCONN) {
+    if (ret < 0) {
         if (ret == -ECONNREFUSED) {
             LOG_INFO("socket connection is refused\n");
-            set_tethering_connection_status(CONNREFUSED);
+            set_eventcast_connection_status(CONNREFUSED);
         }
-        LOG_TRACE("close socket\n");
-        end_tethering_socket(sock);
+        LOG_INFO("close socket\n");
+        end_eventcast_socket(sock);
         sock = -1;
     }
 
     return sock;
 }
 
-static void end_tethering_socket(int sockfd)
+static void end_eventcast_socket(int sockfd)
 {
-    int status = TETHERING__STATE__DISABLED;
+    int status = EVENTCAST__STATE__DISABLED;
 
     LOG_TRACE("enter: %s\n", __func__);
 
+    LOG_INFO("close eventcast socket\n");
     if (closesocket(sockfd) < 0) {
         perror("closesocket failure");
         return;
     }
 
-    tethering_client->fd = -1;
+    eventcast_client->fd = -1;
 
-    LOG_INFO("close tethering socket\n");
-    set_tethering_connection_status(DISCONNECTED);
-    set_tethering_sensor_status(status);
-    set_tethering_touch_status(status);
+    set_eventcast_connection_status(DISCONNECTED);
+    set_eventcast_sensor_status(status);
+    set_eventcast_touch_status(status);
 
     LOG_TRACE("leave: %s\n", __func__);
 }
 
 #if 0
-static void set_tethering_app_state(bool state)
+static void set_eventcast_app_state(bool state)
 {
-    LOG_TRACE("set tethering_app state: %d", state);
+    LOG_TRACE("set eventcast_app state: %d", state);
     app_state = state;
 }
 
-static bool get_tethering_app_state(void)
+static bool get_eventcast_app_state(void)
 {
     return app_state;
 }
 #endif
 
-// ecs <-> tethering
-int get_tethering_connection_status(void)
+// ecs <-> eventcast
+int get_eventcast_connection_status(void)
 {
     int status = 0;
 
-    if (!tethering_client) {
-        return -1;
+    if (!eventcast_client) {
+        LOG_INFO("eventcast_client is null\n");
+        LOG_INFO("connection status: %d\n", status);
+        return DISCONNECTED;
     }
 
-    qemu_mutex_lock(&tethering_client->mutex);
-    status = tethering_client->status;
-    qemu_mutex_unlock(&tethering_client->mutex);
+    qemu_mutex_lock(&eventcast_client->mutex);
+    status = eventcast_client->status;
+    qemu_mutex_unlock(&eventcast_client->mutex);
+
+    LOG_INFO("connection status: %d\n", status);
 
     return status;
 }
 
-static void set_tethering_connection_status(int status)
+int get_eventcast_connected_port(void)
 {
-    if (!tethering_client) {
+    if (!eventcast_client) {
+        LOG_SEVERE("eventcast_client is null\n");
+        return 0;
+    }
+
+    LOG_TRACE("connected port: %d\n", eventcast_client->port);
+    return eventcast_client->port;
+}
+
+const char *get_eventcast_connected_ipaddr(void)
+{
+    if (!eventcast_client) {
+        LOG_SEVERE("eventcast client is null\n");
+        return NULL;
+    }
+
+    LOG_TRACE("connected ip address: %s\n", eventcast_client->ipaddress);
+    return eventcast_client->ipaddress;
+}
+
+static void set_eventcast_connection_status(int status)
+{
+    if (!eventcast_client) {
         return;
     }
 
-    qemu_mutex_lock(&tethering_client->mutex);
-    tethering_client->status = status;
-    qemu_mutex_unlock(&tethering_client->mutex);
+    qemu_mutex_lock(&eventcast_client->mutex);
+    eventcast_client->status = status;
+    qemu_mutex_unlock(&eventcast_client->mutex);
 
-    send_tethering_connection_status_ecp();
+    send_eventcast_connection_status_ecp();
 }
 
-static void tethering_notify_exit(Notifier *notifier, void *data)
+static void eventcast_notify_exit(Notifier *notifier, void *data)
 {
-    LOG_INFO("tethering_notify_exit\n");
-    disconnect_tethering_app();
+    LOG_INFO("eventcast_notify_exit\n");
+    disconnect_eventcast_app();
 }
-static Notifier tethering_exit = { .notify = tethering_notify_exit };
+static Notifier eventcast_exit = { .notify = eventcast_notify_exit };
 
-static void *initialize_tethering_socket(void *opaque);
-// static void release_tethering_thread(void *opaque);
+static void *initialize_eventcast_socket(void *opaque);
 
-int connect_tethering_app(const char *ipaddress, int port)
+int connect_eventcast_app(const char *ipaddress, int port)
 {
-    TetheringState *client = NULL;
+    EventcastState *client = NULL;
+    int ipaddr_len = 0;
 
-    client = g_malloc0(sizeof(TetheringState));
+    client = g_malloc0(sizeof(EventcastState));
     if (!client) {
         return -1;
     }
@@ -787,55 +757,60 @@ int connect_tethering_app(const char *ipaddress, int port)
     client->port = port;
 
     if (ipaddress) {
-        int ipaddr_len = 0;
-
         ipaddr_len = strlen(ipaddress);
-
-        client->ipaddress = g_malloc0(ipaddr_len + 1);
-        if (!client->ipaddress) {
-            g_free(client);
-            return -1;
-        }
-
-        g_strlcpy(client->ipaddress, ipaddress, ipaddr_len);
+        client->type = WIFI;
     } else {
-        client->ipaddress = NULL;
+        ipaddr_len = strlen(loopback);
+        ipaddress = loopback;
+        client->type = USB;
     }
 
-    tethering_client = client;
+    client->ipaddress = g_malloc0(ipaddr_len + 1);
+    if (!client->ipaddress) {
+        LOG_SEVERE("failed to allocate ipaddress buffer\n");
+        g_free(client);
+        return -1;
+    }
+    g_strlcpy(client->ipaddress, ipaddress, ipaddr_len + 1);
+    LOG_INFO("connection info. ip %s, port %d type %d\n",
+        client->ipaddress, client->port, client->type);
 
-    qemu_mutex_init(&tethering_client->mutex);
+    eventcast_client = client;
 
-    qemu_thread_create(&tethering_client->thread, "tethering-io-thread",
-            initialize_tethering_socket, client,
+    qemu_mutex_init(&eventcast_client->mutex);
+    qemu_thread_create(&eventcast_client->thread, "eventcast-io-thread",
+            initialize_eventcast_socket, client,
             QEMU_THREAD_DETACHED);
 
     return 0;
 }
 
-int disconnect_tethering_app(void)
+int disconnect_eventcast_app(void)
 {
     int sock = 0;
 
-    LOG_TRACE("disconnect app from ecp\n");
-    if (!tethering_client) {
-        LOG_SEVERE("tethering client instance is NULL\n");
+    LOG_INFO("disconnect evencast_client from app\n");
+    if (!eventcast_client) {
+        LOG_SEVERE("eventcast client instance is NULL\n");
         return -1;
     }
 
-    sock = tethering_client->fd;
+    sock = eventcast_client->fd;
     if (sock < 0) {
-        LOG_SEVERE("tethering socket is terminated or not ready\n");
+        LOG_SEVERE("eventcast socket is already terminated or not ready\n");
         return -1;
     } else {
         send_emul_state_msg();
-        end_tethering_socket(sock);
+        end_eventcast_socket(sock);
     }
 
+    g_free(eventcast_client);
+    eventcast_client = NULL;
+
     return 0;
 }
 
-static int tethering_loop(int sockfd)
+static int eventcast_loop(int sockfd)
 {
     int ret = 0;
     fd_set readfds;
@@ -852,55 +827,49 @@ static int tethering_loop(int sockfd)
 
     if (ret > 0) {
         LOG_TRACE("ready for read operation!!\n");
-        tethering_io_handler(socket);
+        eventcast_io_handler(socket);
     }
 
     return ret;
 }
 
-static void *initialize_tethering_socket(void *opaque)
+static void *initialize_eventcast_socket(void *opaque)
 {
-    TetheringState *client = (TetheringState *)opaque;
-    LOG_TRACE("callback function for tethering_thread\n");
+    EventcastState *client = (EventcastState *)opaque;
+    LOG_TRACE("callback function for eventcast_thread\n");
 
     if (!client) {
-        LOG_SEVERE("TetheringState is NULL\n");
+        LOG_SEVERE("EventcastState is NULL\n");
         return NULL;
     }
 
-    client->fd = start_tethering_socket(client->ipaddress, client->port);
+    client->fd = start_eventcast_socket(client->ipaddress, client->port);
     if (client->fd < 0) {
-        LOG_SEVERE("failed to start tethering_socket\n");
-        // tethering_sock = -1;
+        LOG_SEVERE("failed to start eventcast_socket\n");
         return NULL;
     }
-    LOG_TRACE("tethering_sock: %d\n", client->fd);
+    LOG_TRACE("eventcast_sock: %d\n", client->fd);
 
-    reset_tethering_recv_buf(&recv_buf);
+    reset_eventcast_recv_buf(&recv_buf);
     send_handshake_req_msg();
 
-    emulator_add_exit_notifier(&tethering_exit);
+    if (!is_notifier) {
+        LOG_INFO("add eventcast_exit_notifier\n");
+        emulator_add_exit_notifier(&eventcast_exit);
+        is_notifier = true;
+    }
 
     while (1) {
         qemu_mutex_lock(&client->mutex);
         if (client->status == DISCONNECTED) {
             qemu_mutex_unlock(&client->mutex);
-            LOG_INFO("disconnected socket. destroy this thread\n");
+            LOG_INFO("disconnected socket and destory this thread\n");
             break;
         }
         qemu_mutex_unlock(&client->mutex);
 
-        tethering_loop(client->fd);
+        eventcast_loop(client->fd);
     }
 
     return client;
 }
-
-#if 0
-static void release_tethering_thread(void *opaque)
-{
-    TetheringState *client = (TetheringState *)opaque;
-
-    qemu_thread_join(&client->thread);
-}
-#endif
similarity index 75%
rename from tizen/src/tethering/common.h
rename to tizen/src/eventcast/common.h
index 3a882c8..e568e7c 100644 (file)
  *
  */
 
-#include "qemu/queue.h"
+#ifndef __EVENTCAST_COMMON_H__
+#define __EVENTCAST_COMMON_H__
 
-typedef struct input_device_list {
-    int type;
-    void *opaque;
-
-    QTAILQ_ENTRY(input_device_list) node;
-} input_device_list;
-
-// common
 enum connection_status {
-    CONNECTED = 1,
-    DISCONNECTED,
+    DISCONNECTED = 0,
+    CONNECTED,
     CONNECTING,
     CONNREFUSED,
 };
@@ -52,10 +45,14 @@ enum touch_status {
 
 bool send_msg_to_controller(void *msg);
 
-int connect_tethering_app(const char *ipaddress, int port);
+int connect_eventcast_app(const char *ipaddress, int port);
+
+int disconnect_eventcast_app(void);
+
+int get_eventcast_connection_status(void);
 
-int disconnect_tethering_app(void);
+int get_eventcast_connected_port(void);
 
-int get_tethering_connection_status(void);
+const char *get_eventcast_connected_ipaddr(void);
 
-int add_input_device(void *opaque);
+#endif /* __EVENTCAST_COMMON_H__ */
similarity index 91%
rename from tizen/src/tethering/encode_fb.c
rename to tizen/src/eventcast/encode_fb.c
index 8f4f717..48d457d 100644 (file)
 
 #include "emulator_common.h"
 #include "emul_state.h"
-
-#ifdef CONFIG_SDL
-#include "display/maru_sdl.h"
-#endif
-#ifdef CONFIG_USE_SHM
-#include "display/maru_shm.h"
-#endif
-
 #include "skin/maruskin_operation.h"
 #include "encode_fb.h"
 
 
 #include "util/new_debug_ch.h"
 
-DECLARE_DEBUG_CHANNEL(app_tethering);
+DECLARE_DEBUG_CHANNEL(eventcast);
 
-#ifdef CONFIG_WEBP
-static void *encode_webp(void);
+#if !defined(CONFIG_SDL) && !defined(CONFIG_USE_SHM)
+bool maru_extract_framebuffer(void *buffer)
+{
+    LOG_INFO("SDL or SHM module is not enabled");
+    return false;
+}
 #endif
-static void *encode_png(void);
 
-void *encode_framebuffer(int encoder)
+#ifdef CONFIG_WEBP
+/*
+ *  webp functions
+ */
+static void *encode_webp(void)
 {
-    void *output = NULL;
+    int width = 0, height = 0, image_stride = 0;
+    size_t ret = 0;
 
-#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
-    struct timespec start, end;
+    struct encode_mem *container = NULL;
+    uint8_t *surface = NULL;
+    uint32_t surface_size = 0;
 
-    clock_gettime(CLOCK_MONOTONIC, &start);
-#endif
+    container = g_malloc(sizeof(struct encode_mem));
+    if (!container) {
+        LOG_SEVERE("failed to allocate encode_mem\n");
+        return NULL;
+    }
 
-#ifdef CONFIG_WEBP
-    if (encoder == 0) {
-        output = encode_webp();
-    } else if (encoder == 1) {
-        output = encode_png();
+    container->buffer = NULL;
+    container->length = 0;
+
+    width = get_emul_resolution_width();
+    height = get_emul_resolution_height();
+
+    image_stride = width * 4;
+    LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
+        width, height, image_stride, (image_stride * height));
+
+    surface_size = width * height * 4;
+
+    surface = g_malloc0(surface_size);
+    if (!surface) {
+        LOG_SEVERE("failed to allocate framebuffer\n");
+        return NULL;
     }
-#else
-    output = encode_png();
-#endif
 
-#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
-    clock_gettime(CLOCK_MONOTONIC, &end);
+    if (!maru_extract_framebuffer(surface)) {
+        LOG_SEVERE("failed to extract framebuffer\n");
+        g_free(surface);
+        return NULL;
+    }
 
-    LOG_TRACE("encoding time: %.5f seconds\n",
-        ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) -
-        ((double)start.tv_sec + (1.0e-9 * start.tv_nsec)));
-#endif
+    container = g_malloc(sizeof(struct encode_mem));
+    if (!container) {
+        LOG_SEVERE("failed to allocate encode_mem\n");
+        g_free(surface);
+        return NULL;
+    }
 
-    return output;
+    container->buffer = NULL;
+    container->length = 0;
+
+    ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width,
+            height, image_stride, &container->buffer);
+    LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
+
+    container->length = (int)ret;
+
+    g_free(surface);
+
+    return container;
 }
+#endif
 
+#ifdef CONFIG_PNG
+/*
+ *  png functions
+ */
 static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t len)
 {
     struct encode_mem *p = (struct encode_mem *)png_get_io_ptr(png_ptr);
@@ -104,10 +137,10 @@ static void user_write_data(png_structp png_ptr, png_bytep data, png_size_t len)
 
     if (!p->buffer) {
         LOG_SEVERE("failed to allocate \n");
+    } else {
+        memcpy(p->buffer + p->length, data, len);
+        p->length += len;
     }
-
-    memcpy(p->buffer + p->length, data, len);
-    p->length += len;
 }
 
 static void user_flush_data(png_structp png_ptr)
@@ -162,7 +195,7 @@ static void *encode_png(void)
 
     LOG_TRACE("png_create_info_struct\n");
     info_ptr = png_create_info_struct(png_ptr);
-    if (!png_ptr) {
+    if (!info_ptr) {
         LOG_SEVERE("png_create_info_struct failure\n");
         g_free(surface);
         png_destroy_write_struct(&png_ptr, &info_ptr);
@@ -232,65 +265,44 @@ static void *encode_png(void)
 
     return container;
 }
+#endif
 
-#ifdef CONFIG_WEBP
-static void *encode_webp(void)
+void *encode_framebuffer(int encoder)
 {
-    int width = 0, height = 0, image_stride = 0;
-    size_t ret = 0;
-
-    struct encode_mem *container = NULL;
-    uint8_t *surface = NULL;
-    uint32_t surface_size = 0;
-
-    container = g_malloc(sizeof(struct encode_mem));
-    if (!container) {
-        LOG_SEVERE("failed to allocate encode_mem\n");
-        return NULL;
-    }
-
-    container->buffer = NULL;
-    container->length = 0;
-
-    width = get_emul_resolution_width();
-    height = get_emul_resolution_height();
+    void *output = NULL;
 
-    image_stride = width * 4;
-    LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
-        width, height, image_stride, (image_stride * height));
+#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
+    struct timespec start, end;
 
-    surface_size = width * height * 4;
+    clock_gettime(CLOCK_MONOTONIC, &start);
+#endif
 
-    surface = g_malloc0(surface_size);
-    if (!surface) {
-        LOG_SEVERE("failed to allocate framebuffer\n");
-        return NULL;
-    }
+#ifdef CONFIG_PNG
+    output = encode_png();
+#endif
 
-    if (!maru_extract_framebuffer(surface)) {
-        LOG_SEVERE("failed to extract framebuffer\n");
-        g_free(surface);
-        return NULL;
-    }
+#if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
+    clock_gettime(CLOCK_MONOTONIC, &end);
 
-    container = g_malloc(sizeof(struct encode_mem));
-    if (!container) {
-        LOG_SEVERE("failed to allocate encode_mem\n");
-        g_free(surface);
-        return NULL;
-    }
+    LOG_TRACE("encoding time: %.5f seconds\n",
+        ((double)end.tv_sec + (1.0e-9 * end.tv_nsec)) -
+        ((double)start.tv_sec + (1.0e-9 * start.tv_nsec)));
+#endif
 
-    container->buffer = NULL;
-    container->length = 0;
+    LOG_TRACE("encode framebuffer: %p\n", output);
 
-    ret = WebPEncodeLosslessBGRA((const uint8_t *)surface, width,
-            height, image_stride, &container->buffer);
-    LOG_TRACE("lossless encode framebuffer via webp. result %zu\n", ret);
+    return output;
+}
 
-    container->length = (int)ret;
+static bool display_dirty = false;
 
-    g_free(surface);
+void set_display_dirty(bool dirty)
+{
+    // LOG_TRACE("qemu display update: %d\n", display_dirty);
+    display_dirty = dirty;
+}
 
-    return container;
+bool is_display_dirty(void)
+{
+    return display_dirty;
 }
-#endif
similarity index 83%
rename from tizen/src/tethering/encode_fb.h
rename to tizen/src/eventcast/encode_fb.h
index 330fc3a..158ecff 100644 (file)
  *
  */
 
+#ifndef __EVENTCAST_ENCODE_FB_H__
+#define __EVENTCAST_ENCODE_FB_H__
+
 struct encode_mem {
     uint8_t *buffer;
     uint32_t length;
 };
 
 void *encode_framebuffer(int encoder);
+
+bool maru_extract_framebuffer(void *buffer);
+
+void set_display_dirty(bool dirty);
+
+bool is_display_dirty(void);
+
+#endif /* __EVENTCAST_ENCODE_FB_H__ */
diff --git a/tizen/src/eventcast/genmsg/eventcast.pb-c.c b/tizen/src/eventcast/genmsg/eventcast.pb-c.c
new file mode 100644 (file)
index 0000000..bfc55e8
--- /dev/null
@@ -0,0 +1,2314 @@
+/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C_NO_DEPRECATED
+#define PROTOBUF_C_NO_DEPRECATED
+#endif
+
+#include "eventcast.pb-c.h"
+void   eventcast__hand_shake_req__init
+                     (Eventcast__HandShakeReq         *message)
+{
+  static Eventcast__HandShakeReq init_value = EVENTCAST__HAND_SHAKE_REQ__INIT;
+  *message = init_value;
+}
+size_t eventcast__hand_shake_req__get_packed_size
+                     (const Eventcast__HandShakeReq *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__hand_shake_req__pack
+                     (const Eventcast__HandShakeReq *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__hand_shake_req__pack_to_buffer
+                     (const Eventcast__HandShakeReq *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__HandShakeReq *
+       eventcast__hand_shake_req__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__HandShakeReq *)
+     protobuf_c_message_unpack (&eventcast__hand_shake_req__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__hand_shake_req__free_unpacked
+                     (Eventcast__HandShakeReq *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_req__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__hand_shake_ans__init
+                     (Eventcast__HandShakeAns         *message)
+{
+  static Eventcast__HandShakeAns init_value = EVENTCAST__HAND_SHAKE_ANS__INIT;
+  *message = init_value;
+}
+size_t eventcast__hand_shake_ans__get_packed_size
+                     (const Eventcast__HandShakeAns *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__hand_shake_ans__pack
+                     (const Eventcast__HandShakeAns *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__hand_shake_ans__pack_to_buffer
+                     (const Eventcast__HandShakeAns *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__HandShakeAns *
+       eventcast__hand_shake_ans__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__HandShakeAns *)
+     protobuf_c_message_unpack (&eventcast__hand_shake_ans__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__hand_shake_ans__free_unpacked
+                     (Eventcast__HandShakeAns *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hand_shake_ans__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__emulator_state__init
+                     (Eventcast__EmulatorState         *message)
+{
+  static Eventcast__EmulatorState init_value = EVENTCAST__EMULATOR_STATE__INIT;
+  *message = init_value;
+}
+size_t eventcast__emulator_state__get_packed_size
+                     (const Eventcast__EmulatorState *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__emulator_state__pack
+                     (const Eventcast__EmulatorState *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__emulator_state__pack_to_buffer
+                     (const Eventcast__EmulatorState *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__EmulatorState *
+       eventcast__emulator_state__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__EmulatorState *)
+     protobuf_c_message_unpack (&eventcast__emulator_state__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__emulator_state__free_unpacked
+                     (Eventcast__EmulatorState *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__emulator_state__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__app_state__init
+                     (Eventcast__AppState         *message)
+{
+  static Eventcast__AppState init_value = EVENTCAST__APP_STATE__INIT;
+  *message = init_value;
+}
+size_t eventcast__app_state__get_packed_size
+                     (const Eventcast__AppState *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__app_state__pack
+                     (const Eventcast__AppState *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__app_state__pack_to_buffer
+                     (const Eventcast__AppState *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__AppState *
+       eventcast__app_state__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__AppState *)
+     protobuf_c_message_unpack (&eventcast__app_state__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__app_state__free_unpacked
+                     (Eventcast__AppState *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__app_state__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__start_req__init
+                     (Eventcast__StartReq         *message)
+{
+  static Eventcast__StartReq init_value = EVENTCAST__START_REQ__INIT;
+  *message = init_value;
+}
+size_t eventcast__start_req__get_packed_size
+                     (const Eventcast__StartReq *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__start_req__pack
+                     (const Eventcast__StartReq *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__start_req__pack_to_buffer
+                     (const Eventcast__StartReq *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__StartReq *
+       eventcast__start_req__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__StartReq *)
+     protobuf_c_message_unpack (&eventcast__start_req__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__start_req__free_unpacked
+                     (Eventcast__StartReq *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_req__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__start_ans__init
+                     (Eventcast__StartAns         *message)
+{
+  static Eventcast__StartAns init_value = EVENTCAST__START_ANS__INIT;
+  *message = init_value;
+}
+size_t eventcast__start_ans__get_packed_size
+                     (const Eventcast__StartAns *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__start_ans__pack
+                     (const Eventcast__StartAns *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__start_ans__pack_to_buffer
+                     (const Eventcast__StartAns *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__StartAns *
+       eventcast__start_ans__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__StartAns *)
+     protobuf_c_message_unpack (&eventcast__start_ans__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__start_ans__free_unpacked
+                     (Eventcast__StartAns *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__start_ans__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__set_event_status__init
+                     (Eventcast__SetEventStatus         *message)
+{
+  static Eventcast__SetEventStatus init_value = EVENTCAST__SET_EVENT_STATUS__INIT;
+  *message = init_value;
+}
+size_t eventcast__set_event_status__get_packed_size
+                     (const Eventcast__SetEventStatus *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__set_event_status__pack
+                     (const Eventcast__SetEventStatus *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__set_event_status__pack_to_buffer
+                     (const Eventcast__SetEventStatus *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__SetEventStatus *
+       eventcast__set_event_status__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__SetEventStatus *)
+     protobuf_c_message_unpack (&eventcast__set_event_status__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__set_event_status__free_unpacked
+                     (Eventcast__SetEventStatus *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_event_status__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__event_msg__init
+                     (Eventcast__EventMsg         *message)
+{
+  static Eventcast__EventMsg init_value = EVENTCAST__EVENT_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__event_msg__get_packed_size
+                     (const Eventcast__EventMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__event_msg__pack
+                     (const Eventcast__EventMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__event_msg__pack_to_buffer
+                     (const Eventcast__EventMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__EventMsg *
+       eventcast__event_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__EventMsg *)
+     protobuf_c_message_unpack (&eventcast__event_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__event_msg__free_unpacked
+                     (Eventcast__EventMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__event_terminate__init
+                     (Eventcast__EventTerminate         *message)
+{
+  static Eventcast__EventTerminate init_value = EVENTCAST__EVENT_TERMINATE__INIT;
+  *message = init_value;
+}
+size_t eventcast__event_terminate__get_packed_size
+                     (const Eventcast__EventTerminate *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__event_terminate__pack
+                     (const Eventcast__EventTerminate *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__event_terminate__pack_to_buffer
+                     (const Eventcast__EventTerminate *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__EventTerminate *
+       eventcast__event_terminate__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__EventTerminate *)
+     protobuf_c_message_unpack (&eventcast__event_terminate__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__event_terminate__free_unpacked
+                     (Eventcast__EventTerminate *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_terminate__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__set_sensor_status__init
+                     (Eventcast__SetSensorStatus         *message)
+{
+  static Eventcast__SetSensorStatus init_value = EVENTCAST__SET_SENSOR_STATUS__INIT;
+  *message = init_value;
+}
+size_t eventcast__set_sensor_status__get_packed_size
+                     (const Eventcast__SetSensorStatus *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__set_sensor_status__pack
+                     (const Eventcast__SetSensorStatus *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__set_sensor_status__pack_to_buffer
+                     (const Eventcast__SetSensorStatus *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__SetSensorStatus *
+       eventcast__set_sensor_status__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__SetSensorStatus *)
+     protobuf_c_message_unpack (&eventcast__set_sensor_status__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__set_sensor_status__free_unpacked
+                     (Eventcast__SetSensorStatus *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__set_sensor_status__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__sensor_data__init
+                     (Eventcast__SensorData         *message)
+{
+  static Eventcast__SensorData init_value = EVENTCAST__SENSOR_DATA__INIT;
+  *message = init_value;
+}
+size_t eventcast__sensor_data__get_packed_size
+                     (const Eventcast__SensorData *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__sensor_data__pack
+                     (const Eventcast__SensorData *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__sensor_data__pack_to_buffer
+                     (const Eventcast__SensorData *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__SensorData *
+       eventcast__sensor_data__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__SensorData *)
+     protobuf_c_message_unpack (&eventcast__sensor_data__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__sensor_data__free_unpacked
+                     (Eventcast__SensorData *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_data__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__sensor_msg__init
+                     (Eventcast__SensorMsg         *message)
+{
+  static Eventcast__SensorMsg init_value = EVENTCAST__SENSOR_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__sensor_msg__get_packed_size
+                     (const Eventcast__SensorMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__sensor_msg__pack
+                     (const Eventcast__SensorMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__sensor_msg__pack_to_buffer
+                     (const Eventcast__SensorMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__SensorMsg *
+       eventcast__sensor_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__SensorMsg *)
+     protobuf_c_message_unpack (&eventcast__sensor_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__sensor_msg__free_unpacked
+                     (Eventcast__SensorMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__sensor_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__resolution__init
+                     (Eventcast__Resolution         *message)
+{
+  static Eventcast__Resolution init_value = EVENTCAST__RESOLUTION__INIT;
+  *message = init_value;
+}
+size_t eventcast__resolution__get_packed_size
+                     (const Eventcast__Resolution *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__resolution__pack
+                     (const Eventcast__Resolution *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__resolution__pack_to_buffer
+                     (const Eventcast__Resolution *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__Resolution *
+       eventcast__resolution__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__Resolution *)
+     protobuf_c_message_unpack (&eventcast__resolution__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__resolution__free_unpacked
+                     (Eventcast__Resolution *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__resolution__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__display_msg__init
+                     (Eventcast__DisplayMsg         *message)
+{
+  static Eventcast__DisplayMsg init_value = EVENTCAST__DISPLAY_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__display_msg__get_packed_size
+                     (const Eventcast__DisplayMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__display_msg__pack
+                     (const Eventcast__DisplayMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__display_msg__pack_to_buffer
+                     (const Eventcast__DisplayMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__DisplayMsg *
+       eventcast__display_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__DisplayMsg *)
+     protobuf_c_message_unpack (&eventcast__display_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__display_msg__free_unpacked
+                     (Eventcast__DisplayMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__display_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__touch_max_count__init
+                     (Eventcast__TouchMaxCount         *message)
+{
+  static Eventcast__TouchMaxCount init_value = EVENTCAST__TOUCH_MAX_COUNT__INIT;
+  *message = init_value;
+}
+size_t eventcast__touch_max_count__get_packed_size
+                     (const Eventcast__TouchMaxCount *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__touch_max_count__pack
+                     (const Eventcast__TouchMaxCount *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__touch_max_count__pack_to_buffer
+                     (const Eventcast__TouchMaxCount *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__TouchMaxCount *
+       eventcast__touch_max_count__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__TouchMaxCount *)
+     protobuf_c_message_unpack (&eventcast__touch_max_count__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__touch_max_count__free_unpacked
+                     (Eventcast__TouchMaxCount *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_max_count__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__touch_data__init
+                     (Eventcast__TouchData         *message)
+{
+  static Eventcast__TouchData init_value = EVENTCAST__TOUCH_DATA__INIT;
+  *message = init_value;
+}
+size_t eventcast__touch_data__get_packed_size
+                     (const Eventcast__TouchData *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__touch_data__pack
+                     (const Eventcast__TouchData *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__touch_data__pack_to_buffer
+                     (const Eventcast__TouchData *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__TouchData *
+       eventcast__touch_data__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__TouchData *)
+     protobuf_c_message_unpack (&eventcast__touch_data__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__touch_data__free_unpacked
+                     (Eventcast__TouchData *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_data__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__hwkey_msg__init
+                     (Eventcast__HWKeyMsg         *message)
+{
+  static Eventcast__HWKeyMsg init_value = EVENTCAST__HWKEY_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__hwkey_msg__get_packed_size
+                     (const Eventcast__HWKeyMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__hwkey_msg__pack
+                     (const Eventcast__HWKeyMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__hwkey_msg__pack_to_buffer
+                     (const Eventcast__HWKeyMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__HWKeyMsg *
+       eventcast__hwkey_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__HWKeyMsg *)
+     protobuf_c_message_unpack (&eventcast__hwkey_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__hwkey_msg__free_unpacked
+                     (Eventcast__HWKeyMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__hwkey_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__touch_msg__init
+                     (Eventcast__TouchMsg         *message)
+{
+  static Eventcast__TouchMsg init_value = EVENTCAST__TOUCH_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__touch_msg__get_packed_size
+                     (const Eventcast__TouchMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__touch_msg__pack
+                     (const Eventcast__TouchMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__touch_msg__pack_to_buffer
+                     (const Eventcast__TouchMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__TouchMsg *
+       eventcast__touch_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__TouchMsg *)
+     protobuf_c_message_unpack (&eventcast__touch_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__touch_msg__free_unpacked
+                     (Eventcast__TouchMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__touch_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void   eventcast__event_cast_msg__init
+                     (Eventcast__EventCastMsg         *message)
+{
+  static Eventcast__EventCastMsg init_value = EVENTCAST__EVENT_CAST_MSG__INIT;
+  *message = init_value;
+}
+size_t eventcast__event_cast_msg__get_packed_size
+                     (const Eventcast__EventCastMsg *message)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor);
+  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t eventcast__event_cast_msg__pack
+                     (const Eventcast__EventCastMsg *message,
+                      uint8_t       *out)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor);
+  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t eventcast__event_cast_msg__pack_to_buffer
+                     (const Eventcast__EventCastMsg *message,
+                      ProtobufCBuffer *buffer)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor);
+  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+Eventcast__EventCastMsg *
+       eventcast__event_cast_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data)
+{
+  return (Eventcast__EventCastMsg *)
+     protobuf_c_message_unpack (&eventcast__event_cast_msg__descriptor,
+                                allocator, len, data);
+}
+void   eventcast__event_cast_msg__free_unpacked
+                     (Eventcast__EventCastMsg *message,
+                      ProtobufCAllocator *allocator)
+{
+  PROTOBUF_C_ASSERT (message->base.descriptor == &eventcast__event_cast_msg__descriptor);
+  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+static const ProtobufCFieldDescriptor eventcast__hand_shake_req__field_descriptors[1] =
+{
+  {
+    "key",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_INT32,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__HandShakeReq, key),
+    NULL,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__hand_shake_req__field_indices_by_name[] = {
+  0,   /* field[0] = key */
+};
+static const ProtobufCIntRange eventcast__hand_shake_req__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__hand_shake_req__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.HandShakeReq",
+  "HandShakeReq",
+  "Eventcast__HandShakeReq",
+  "eventcast",
+  sizeof(Eventcast__HandShakeReq),
+  1,
+  eventcast__hand_shake_req__field_descriptors,
+  eventcast__hand_shake_req__field_indices_by_name,
+  1,  eventcast__hand_shake_req__number_ranges,
+  (ProtobufCMessageInit) eventcast__hand_shake_req__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__hand_shake_ans__field_descriptors[1] =
+{
+  {
+    "result",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__HandShakeAns, result),
+    &eventcast__message_result__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__hand_shake_ans__field_indices_by_name[] = {
+  0,   /* field[0] = result */
+};
+static const ProtobufCIntRange eventcast__hand_shake_ans__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__hand_shake_ans__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.HandShakeAns",
+  "HandShakeAns",
+  "Eventcast__HandShakeAns",
+  "eventcast",
+  sizeof(Eventcast__HandShakeAns),
+  1,
+  eventcast__hand_shake_ans__field_descriptors,
+  eventcast__hand_shake_ans__field_indices_by_name,
+  1,  eventcast__hand_shake_ans__number_ranges,
+  (ProtobufCMessageInit) eventcast__hand_shake_ans__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__emulator_state__field_descriptors[1] =
+{
+  {
+    "state",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EmulatorState, state),
+    &eventcast__connection_state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__emulator_state__field_indices_by_name[] = {
+  0,   /* field[0] = state */
+};
+static const ProtobufCIntRange eventcast__emulator_state__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__emulator_state__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.EmulatorState",
+  "EmulatorState",
+  "Eventcast__EmulatorState",
+  "eventcast",
+  sizeof(Eventcast__EmulatorState),
+  1,
+  eventcast__emulator_state__field_descriptors,
+  eventcast__emulator_state__field_indices_by_name,
+  1,  eventcast__emulator_state__number_ranges,
+  (ProtobufCMessageInit) eventcast__emulator_state__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__app_state__field_descriptors[1] =
+{
+  {
+    "state",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__AppState, state),
+    &eventcast__connection_state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__app_state__field_indices_by_name[] = {
+  0,   /* field[0] = state */
+};
+static const ProtobufCIntRange eventcast__app_state__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__app_state__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.AppState",
+  "AppState",
+  "Eventcast__AppState",
+  "eventcast",
+  sizeof(Eventcast__AppState),
+  1,
+  eventcast__app_state__field_descriptors,
+  eventcast__app_state__field_indices_by_name,
+  1,  eventcast__app_state__number_ranges,
+  (ProtobufCMessageInit) eventcast__app_state__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+#define eventcast__start_req__field_descriptors NULL
+#define eventcast__start_req__field_indices_by_name NULL
+#define eventcast__start_req__number_ranges NULL
+const ProtobufCMessageDescriptor eventcast__start_req__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.StartReq",
+  "StartReq",
+  "Eventcast__StartReq",
+  "eventcast",
+  sizeof(Eventcast__StartReq),
+  0,
+  eventcast__start_req__field_descriptors,
+  eventcast__start_req__field_indices_by_name,
+  0,  eventcast__start_req__number_ranges,
+  (ProtobufCMessageInit) eventcast__start_req__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__start_ans__field_descriptors[1] =
+{
+  {
+    "result",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__StartAns, result),
+    &eventcast__message_result__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__start_ans__field_indices_by_name[] = {
+  0,   /* field[0] = result */
+};
+static const ProtobufCIntRange eventcast__start_ans__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__start_ans__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.StartAns",
+  "StartAns",
+  "Eventcast__StartAns",
+  "eventcast",
+  sizeof(Eventcast__StartAns),
+  1,
+  eventcast__start_ans__field_descriptors,
+  eventcast__start_ans__field_indices_by_name,
+  1,  eventcast__start_ans__number_ranges,
+  (ProtobufCMessageInit) eventcast__start_ans__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__set_event_status__field_descriptors[2] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SetEventStatus, type),
+    &eventcast__event_type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "state",
+    2,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SetEventStatus, state),
+    &eventcast__state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__set_event_status__field_indices_by_name[] = {
+  1,   /* field[1] = state */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__set_event_status__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 2 }
+};
+const ProtobufCMessageDescriptor eventcast__set_event_status__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.SetEventStatus",
+  "SetEventStatus",
+  "Eventcast__SetEventStatus",
+  "eventcast",
+  sizeof(Eventcast__SetEventStatus),
+  2,
+  eventcast__set_event_status__field_descriptors,
+  eventcast__set_event_status__field_indices_by_name,
+  1,  eventcast__set_event_status__number_ranges,
+  (ProtobufCMessageInit) eventcast__set_event_status__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+const ProtobufCEnumValue eventcast__event_msg__type__enum_values_by_number[4] =
+{
+  { "START_REQ", "EVENTCAST__EVENT_MSG__TYPE__START_REQ", 2 },
+  { "START_ANS", "EVENTCAST__EVENT_MSG__TYPE__START_ANS", 3 },
+  { "TERMINATE", "EVENTCAST__EVENT_MSG__TYPE__TERMINATE", 4 },
+  { "EVENT_STATUS", "EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS", 5 },
+};
+static const ProtobufCIntRange eventcast__event_msg__type__value_ranges[] = {
+{2, 0},{0, 4}
+};
+const ProtobufCEnumValueIndex eventcast__event_msg__type__enum_values_by_name[4] =
+{
+  { "EVENT_STATUS", 3 },
+  { "START_ANS", 1 },
+  { "START_REQ", 0 },
+  { "TERMINATE", 2 },
+};
+const ProtobufCEnumDescriptor eventcast__event_msg__type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.EventMsg.TYPE",
+  "TYPE",
+  "Eventcast__EventMsg__TYPE",
+  "eventcast",
+  4,
+  eventcast__event_msg__type__enum_values_by_number,
+  4,
+  eventcast__event_msg__type__enum_values_by_name,
+  1,
+  eventcast__event_msg__type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor eventcast__event_msg__field_descriptors[5] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, type),
+    &eventcast__event_msg__type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startReq",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, startreq),
+    &eventcast__start_req__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startAns",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, startans),
+    &eventcast__start_ans__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "terminate",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, terminate),
+    &eventcast__event_terminate__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "setStatus",
+    5,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventMsg, setstatus),
+    &eventcast__set_event_status__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__event_msg__field_indices_by_name[] = {
+  4,   /* field[4] = setStatus */
+  2,   /* field[2] = startAns */
+  1,   /* field[1] = startReq */
+  3,   /* field[3] = terminate */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__event_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 5 }
+};
+const ProtobufCMessageDescriptor eventcast__event_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.EventMsg",
+  "EventMsg",
+  "Eventcast__EventMsg",
+  "eventcast",
+  sizeof(Eventcast__EventMsg),
+  5,
+  eventcast__event_msg__field_descriptors,
+  eventcast__event_msg__field_indices_by_name,
+  1,  eventcast__event_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__event_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+#define eventcast__event_terminate__field_descriptors NULL
+#define eventcast__event_terminate__field_indices_by_name NULL
+#define eventcast__event_terminate__number_ranges NULL
+const ProtobufCMessageDescriptor eventcast__event_terminate__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.EventTerminate",
+  "EventTerminate",
+  "Eventcast__EventTerminate",
+  "eventcast",
+  sizeof(Eventcast__EventTerminate),
+  0,
+  eventcast__event_terminate__field_descriptors,
+  eventcast__event_terminate__field_indices_by_name,
+  0,  eventcast__event_terminate__number_ranges,
+  (ProtobufCMessageInit) eventcast__event_terminate__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__set_sensor_status__field_descriptors[2] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SetSensorStatus, type),
+    &eventcast__sensor_type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "state",
+    2,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SetSensorStatus, state),
+    &eventcast__state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__set_sensor_status__field_indices_by_name[] = {
+  1,   /* field[1] = state */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__set_sensor_status__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 2 }
+};
+const ProtobufCMessageDescriptor eventcast__set_sensor_status__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.SetSensorStatus",
+  "SetSensorStatus",
+  "Eventcast__SetSensorStatus",
+  "eventcast",
+  sizeof(Eventcast__SetSensorStatus),
+  2,
+  eventcast__set_sensor_status__field_descriptors,
+  eventcast__set_sensor_status__field_indices_by_name,
+  1,  eventcast__set_sensor_status__number_ranges,
+  (ProtobufCMessageInit) eventcast__set_sensor_status__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+char eventcast__sensor_data__x__default_value[] = "0";
+char eventcast__sensor_data__y__default_value[] = "0";
+char eventcast__sensor_data__z__default_value[] = "0";
+static const ProtobufCFieldDescriptor eventcast__sensor_data__field_descriptors[4] =
+{
+  {
+    "sensor",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorData, sensor),
+    &eventcast__sensor_type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "x",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_STRING,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorData, x),
+    NULL,
+    &eventcast__sensor_data__x__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "y",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_STRING,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorData, y),
+    NULL,
+    &eventcast__sensor_data__y__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "z",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_STRING,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorData, z),
+    NULL,
+    &eventcast__sensor_data__z__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__sensor_data__field_indices_by_name[] = {
+  0,   /* field[0] = sensor */
+  1,   /* field[1] = x */
+  2,   /* field[2] = y */
+  3,   /* field[3] = z */
+};
+static const ProtobufCIntRange eventcast__sensor_data__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 4 }
+};
+const ProtobufCMessageDescriptor eventcast__sensor_data__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.SensorData",
+  "SensorData",
+  "Eventcast__SensorData",
+  "eventcast",
+  sizeof(Eventcast__SensorData),
+  4,
+  eventcast__sensor_data__field_descriptors,
+  eventcast__sensor_data__field_indices_by_name,
+  1,  eventcast__sensor_data__number_ranges,
+  (ProtobufCMessageInit) eventcast__sensor_data__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+const ProtobufCEnumValue eventcast__sensor_msg__type__enum_values_by_number[5] =
+{
+  { "START_REQ", "EVENTCAST__SENSOR_MSG__TYPE__START_REQ", 2 },
+  { "START_ANS", "EVENTCAST__SENSOR_MSG__TYPE__START_ANS", 3 },
+  { "TERMINATE", "EVENTCAST__SENSOR_MSG__TYPE__TERMINATE", 4 },
+  { "SENSOR_STATUS", "EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS", 5 },
+  { "SENSOR_DATA", "EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA", 6 },
+};
+static const ProtobufCIntRange eventcast__sensor_msg__type__value_ranges[] = {
+{2, 0},{0, 5}
+};
+const ProtobufCEnumValueIndex eventcast__sensor_msg__type__enum_values_by_name[5] =
+{
+  { "SENSOR_DATA", 4 },
+  { "SENSOR_STATUS", 3 },
+  { "START_ANS", 1 },
+  { "START_REQ", 0 },
+  { "TERMINATE", 2 },
+};
+const ProtobufCEnumDescriptor eventcast__sensor_msg__type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.SensorMsg.Type",
+  "Type",
+  "Eventcast__SensorMsg__Type",
+  "eventcast",
+  5,
+  eventcast__sensor_msg__type__enum_values_by_number,
+  5,
+  eventcast__sensor_msg__type__enum_values_by_name,
+  1,
+  eventcast__sensor_msg__type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor eventcast__sensor_msg__field_descriptors[6] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, type),
+    &eventcast__sensor_msg__type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startReq",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, startreq),
+    &eventcast__start_req__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startAns",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, startans),
+    &eventcast__start_ans__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "terminate",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, terminate),
+    &eventcast__event_terminate__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "setStatus",
+    5,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, setstatus),
+    &eventcast__set_sensor_status__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "data",
+    6,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__SensorMsg, data),
+    &eventcast__sensor_data__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__sensor_msg__field_indices_by_name[] = {
+  5,   /* field[5] = data */
+  4,   /* field[4] = setStatus */
+  2,   /* field[2] = startAns */
+  1,   /* field[1] = startReq */
+  3,   /* field[3] = terminate */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__sensor_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 6 }
+};
+const ProtobufCMessageDescriptor eventcast__sensor_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.SensorMsg",
+  "SensorMsg",
+  "Eventcast__SensorMsg",
+  "eventcast",
+  sizeof(Eventcast__SensorMsg),
+  6,
+  eventcast__sensor_msg__field_descriptors,
+  eventcast__sensor_msg__field_indices_by_name,
+  1,  eventcast__sensor_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__sensor_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__resolution__field_descriptors[2] =
+{
+  {
+    "width",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_INT32,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__Resolution, width),
+    NULL,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "height",
+    2,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_INT32,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__Resolution, height),
+    NULL,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__resolution__field_indices_by_name[] = {
+  1,   /* field[1] = height */
+  0,   /* field[0] = width */
+};
+static const ProtobufCIntRange eventcast__resolution__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 2 }
+};
+const ProtobufCMessageDescriptor eventcast__resolution__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.Resolution",
+  "Resolution",
+  "Eventcast__Resolution",
+  "eventcast",
+  sizeof(Eventcast__Resolution),
+  2,
+  eventcast__resolution__field_descriptors,
+  eventcast__resolution__field_indices_by_name,
+  1,  eventcast__resolution__number_ranges,
+  (ProtobufCMessageInit) eventcast__resolution__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__display_msg__field_descriptors[2] =
+{
+  {
+    "frameRate",
+    1,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_INT32,
+    PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, has_framerate),
+    PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, framerate),
+    NULL,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "imageData",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_BYTES,
+    PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, has_imagedata),
+    PROTOBUF_C_OFFSETOF(Eventcast__DisplayMsg, imagedata),
+    NULL,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__display_msg__field_indices_by_name[] = {
+  0,   /* field[0] = frameRate */
+  1,   /* field[1] = imageData */
+};
+static const ProtobufCIntRange eventcast__display_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 2 }
+};
+const ProtobufCMessageDescriptor eventcast__display_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.DisplayMsg",
+  "DisplayMsg",
+  "Eventcast__DisplayMsg",
+  "eventcast",
+  sizeof(Eventcast__DisplayMsg),
+  2,
+  eventcast__display_msg__field_descriptors,
+  eventcast__display_msg__field_indices_by_name,
+  1,  eventcast__display_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__display_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const int32_t eventcast__touch_max_count__max__default_value = 10;
+static const ProtobufCFieldDescriptor eventcast__touch_max_count__field_descriptors[1] =
+{
+  {
+    "max",
+    1,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_INT32,
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMaxCount, has_max),
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMaxCount, max),
+    NULL,
+    &eventcast__touch_max_count__max__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__touch_max_count__field_indices_by_name[] = {
+  0,   /* field[0] = max */
+};
+static const ProtobufCIntRange eventcast__touch_max_count__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__touch_max_count__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.TouchMaxCount",
+  "TouchMaxCount",
+  "Eventcast__TouchMaxCount",
+  "eventcast",
+  sizeof(Eventcast__TouchMaxCount),
+  1,
+  eventcast__touch_max_count__field_descriptors,
+  eventcast__touch_max_count__field_indices_by_name,
+  1,  eventcast__touch_max_count__number_ranges,
+  (ProtobufCMessageInit) eventcast__touch_max_count__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const int32_t eventcast__touch_data__index__default_value = 0;
+static const float eventcast__touch_data__x_point__default_value = 0;
+static const float eventcast__touch_data__y_point__default_value = 0;
+static const ProtobufCFieldDescriptor eventcast__touch_data__field_descriptors[4] =
+{
+  {
+    "index",
+    1,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_INT32,
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_index),
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, index),
+    NULL,
+    &eventcast__touch_data__index__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "xPoint",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_FLOAT,
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_xpoint),
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, xpoint),
+    NULL,
+    &eventcast__touch_data__x_point__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "yPoint",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_FLOAT,
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_ypoint),
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, ypoint),
+    NULL,
+    &eventcast__touch_data__y_point__default_value,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "state",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_ENUM,
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, has_state),
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchData, state),
+    &eventcast__touch_state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__touch_data__field_indices_by_name[] = {
+  0,   /* field[0] = index */
+  3,   /* field[3] = state */
+  1,   /* field[1] = xPoint */
+  2,   /* field[2] = yPoint */
+};
+static const ProtobufCIntRange eventcast__touch_data__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 4 }
+};
+const ProtobufCMessageDescriptor eventcast__touch_data__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.TouchData",
+  "TouchData",
+  "Eventcast__TouchData",
+  "eventcast",
+  sizeof(Eventcast__TouchData),
+  4,
+  eventcast__touch_data__field_descriptors,
+  eventcast__touch_data__field_indices_by_name,
+  1,  eventcast__touch_data__number_ranges,
+  (ProtobufCMessageInit) eventcast__touch_data__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor eventcast__hwkey_msg__field_descriptors[1] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__HWKeyMsg, type),
+    &eventcast__hwkey_type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__hwkey_msg__field_indices_by_name[] = {
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__hwkey_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 1 }
+};
+const ProtobufCMessageDescriptor eventcast__hwkey_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.HWKeyMsg",
+  "HWKeyMsg",
+  "Eventcast__HWKeyMsg",
+  "eventcast",
+  sizeof(Eventcast__HWKeyMsg),
+  1,
+  eventcast__hwkey_msg__field_descriptors,
+  eventcast__hwkey_msg__field_indices_by_name,
+  1,  eventcast__hwkey_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__hwkey_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+const ProtobufCEnumValue eventcast__touch_msg__type__enum_values_by_number[8] =
+{
+  { "START_REQ", "EVENTCAST__TOUCH_MSG__TYPE__START_REQ", 2 },
+  { "START_ANS", "EVENTCAST__TOUCH_MSG__TYPE__START_ANS", 3 },
+  { "TERMINATE", "EVENTCAST__TOUCH_MSG__TYPE__TERMINATE", 4 },
+  { "MAX_COUNT", "EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT", 5 },
+  { "TOUCH_DATA", "EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA", 6 },
+  { "RESOLUTION", "EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION", 7 },
+  { "DISPLAY_MSG", "EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG", 8 },
+  { "HWKEY_MSG", "EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG", 9 },
+};
+static const ProtobufCIntRange eventcast__touch_msg__type__value_ranges[] = {
+{2, 0},{0, 8}
+};
+const ProtobufCEnumValueIndex eventcast__touch_msg__type__enum_values_by_name[8] =
+{
+  { "DISPLAY_MSG", 6 },
+  { "HWKEY_MSG", 7 },
+  { "MAX_COUNT", 3 },
+  { "RESOLUTION", 5 },
+  { "START_ANS", 1 },
+  { "START_REQ", 0 },
+  { "TERMINATE", 2 },
+  { "TOUCH_DATA", 4 },
+};
+const ProtobufCEnumDescriptor eventcast__touch_msg__type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.TouchMsg.Type",
+  "Type",
+  "Eventcast__TouchMsg__Type",
+  "eventcast",
+  8,
+  eventcast__touch_msg__type__enum_values_by_number,
+  8,
+  eventcast__touch_msg__type__enum_values_by_name,
+  1,
+  eventcast__touch_msg__type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor eventcast__touch_msg__field_descriptors[9] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, type),
+    &eventcast__touch_msg__type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startReq",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, startreq),
+    &eventcast__start_req__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "startAns",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, startans),
+    &eventcast__start_ans__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "terminate",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, terminate),
+    &eventcast__event_terminate__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "maxCount",
+    5,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, maxcount),
+    &eventcast__touch_max_count__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "touchData",
+    6,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, touchdata),
+    &eventcast__touch_data__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "resolution",
+    7,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, resolution),
+    &eventcast__resolution__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "display",
+    8,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, display),
+    &eventcast__display_msg__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "hwkey",
+    9,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__TouchMsg, hwkey),
+    &eventcast__hwkey_msg__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__touch_msg__field_indices_by_name[] = {
+  7,   /* field[7] = display */
+  8,   /* field[8] = hwkey */
+  4,   /* field[4] = maxCount */
+  6,   /* field[6] = resolution */
+  2,   /* field[2] = startAns */
+  1,   /* field[1] = startReq */
+  3,   /* field[3] = terminate */
+  5,   /* field[5] = touchData */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__touch_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 9 }
+};
+const ProtobufCMessageDescriptor eventcast__touch_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.TouchMsg",
+  "TouchMsg",
+  "Eventcast__TouchMsg",
+  "eventcast",
+  sizeof(Eventcast__TouchMsg),
+  9,
+  eventcast__touch_msg__field_descriptors,
+  eventcast__touch_msg__field_indices_by_name,
+  1,  eventcast__touch_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__touch_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+const ProtobufCEnumValue eventcast__event_cast_msg__type__enum_values_by_number[7] =
+{
+  { "HANDSHAKE_REQ", "EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ", 2 },
+  { "HANDSHAKE_ANS", "EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS", 3 },
+  { "EMUL_STATE", "EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE", 4 },
+  { "APP_STATE", "EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE", 5 },
+  { "EVENT_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG", 6 },
+  { "SENSOR_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG", 7 },
+  { "TOUCH_MSG", "EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG", 8 },
+};
+static const ProtobufCIntRange eventcast__event_cast_msg__type__value_ranges[] = {
+{2, 0},{0, 7}
+};
+const ProtobufCEnumValueIndex eventcast__event_cast_msg__type__enum_values_by_name[7] =
+{
+  { "APP_STATE", 3 },
+  { "EMUL_STATE", 2 },
+  { "EVENT_MSG", 4 },
+  { "HANDSHAKE_ANS", 1 },
+  { "HANDSHAKE_REQ", 0 },
+  { "SENSOR_MSG", 5 },
+  { "TOUCH_MSG", 6 },
+};
+const ProtobufCEnumDescriptor eventcast__event_cast_msg__type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.EventCastMsg.Type",
+  "Type",
+  "Eventcast__EventCastMsg__Type",
+  "eventcast",
+  7,
+  eventcast__event_cast_msg__type__enum_values_by_number,
+  7,
+  eventcast__event_cast_msg__type__enum_values_by_name,
+  1,
+  eventcast__event_cast_msg__type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+static const ProtobufCFieldDescriptor eventcast__event_cast_msg__field_descriptors[8] =
+{
+  {
+    "type",
+    1,
+    PROTOBUF_C_LABEL_REQUIRED,
+    PROTOBUF_C_TYPE_ENUM,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, type),
+    &eventcast__event_cast_msg__type__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "handShakeReq",
+    2,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, handshakereq),
+    &eventcast__hand_shake_req__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "handShakeAns",
+    3,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, handshakeans),
+    &eventcast__hand_shake_ans__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "emulState",
+    4,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, emulstate),
+    &eventcast__emulator_state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "appState",
+    5,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, appstate),
+    &eventcast__app_state__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "eventMsg",
+    6,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, eventmsg),
+    &eventcast__event_msg__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "sensorMsg",
+    7,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, sensormsg),
+    &eventcast__sensor_msg__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+  {
+    "touchMsg",
+    8,
+    PROTOBUF_C_LABEL_OPTIONAL,
+    PROTOBUF_C_TYPE_MESSAGE,
+    0,   /* quantifier_offset */
+    PROTOBUF_C_OFFSETOF(Eventcast__EventCastMsg, touchmsg),
+    &eventcast__touch_msg__descriptor,
+    NULL,
+    0,            /* packed */
+    0,NULL,NULL    /* reserved1,reserved2, etc */
+  },
+};
+static const unsigned eventcast__event_cast_msg__field_indices_by_name[] = {
+  4,   /* field[4] = appState */
+  3,   /* field[3] = emulState */
+  5,   /* field[5] = eventMsg */
+  2,   /* field[2] = handShakeAns */
+  1,   /* field[1] = handShakeReq */
+  6,   /* field[6] = sensorMsg */
+  7,   /* field[7] = touchMsg */
+  0,   /* field[0] = type */
+};
+static const ProtobufCIntRange eventcast__event_cast_msg__number_ranges[1 + 1] =
+{
+  { 1, 0 },
+  { 0, 8 }
+};
+const ProtobufCMessageDescriptor eventcast__event_cast_msg__descriptor =
+{
+  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
+  "eventcast.EventCastMsg",
+  "EventCastMsg",
+  "Eventcast__EventCastMsg",
+  "eventcast",
+  sizeof(Eventcast__EventCastMsg),
+  8,
+  eventcast__event_cast_msg__field_descriptors,
+  eventcast__event_cast_msg__field_indices_by_name,
+  1,  eventcast__event_cast_msg__number_ranges,
+  (ProtobufCMessageInit) eventcast__event_cast_msg__init,
+  NULL,NULL,NULL    /* reserved[123] */
+};
+const ProtobufCEnumValue eventcast__message_result__enum_values_by_number[3] =
+{
+  { "SUCCESS", "EVENTCAST__MESSAGE_RESULT__SUCCESS", 1 },
+  { "FAILURE", "EVENTCAST__MESSAGE_RESULT__FAILURE", 2 },
+  { "CANCEL", "EVENTCAST__MESSAGE_RESULT__CANCEL", 3 },
+};
+static const ProtobufCIntRange eventcast__message_result__value_ranges[] = {
+{1, 0},{0, 3}
+};
+const ProtobufCEnumValueIndex eventcast__message_result__enum_values_by_name[3] =
+{
+  { "CANCEL", 2 },
+  { "FAILURE", 1 },
+  { "SUCCESS", 0 },
+};
+const ProtobufCEnumDescriptor eventcast__message_result__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.MessageResult",
+  "MessageResult",
+  "Eventcast__MessageResult",
+  "eventcast",
+  3,
+  eventcast__message_result__enum_values_by_number,
+  3,
+  eventcast__message_result__enum_values_by_name,
+  1,
+  eventcast__message_result__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__connection_state__enum_values_by_number[3] =
+{
+  { "CONNECTED", "EVENTCAST__CONNECTION_STATE__CONNECTED", 1 },
+  { "DISCONNECTED", "EVENTCAST__CONNECTION_STATE__DISCONNECTED", 2 },
+  { "TERMINATED", "EVENTCAST__CONNECTION_STATE__TERMINATED", 3 },
+};
+static const ProtobufCIntRange eventcast__connection_state__value_ranges[] = {
+{1, 0},{0, 3}
+};
+const ProtobufCEnumValueIndex eventcast__connection_state__enum_values_by_name[3] =
+{
+  { "CONNECTED", 0 },
+  { "DISCONNECTED", 1 },
+  { "TERMINATED", 2 },
+};
+const ProtobufCEnumDescriptor eventcast__connection_state__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.ConnectionState",
+  "ConnectionState",
+  "Eventcast__ConnectionState",
+  "eventcast",
+  3,
+  eventcast__connection_state__enum_values_by_number,
+  3,
+  eventcast__connection_state__enum_values_by_name,
+  1,
+  eventcast__connection_state__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__event_type__enum_values_by_number[2] =
+{
+  { "SENSOR", "EVENTCAST__EVENT_TYPE__SENSOR", 1 },
+  { "TOUCH", "EVENTCAST__EVENT_TYPE__TOUCH", 2 },
+};
+static const ProtobufCIntRange eventcast__event_type__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex eventcast__event_type__enum_values_by_name[2] =
+{
+  { "SENSOR", 0 },
+  { "TOUCH", 1 },
+};
+const ProtobufCEnumDescriptor eventcast__event_type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.EventType",
+  "EventType",
+  "Eventcast__EventType",
+  "eventcast",
+  2,
+  eventcast__event_type__enum_values_by_number,
+  2,
+  eventcast__event_type__enum_values_by_name,
+  1,
+  eventcast__event_type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__state__enum_values_by_number[2] =
+{
+  { "ENABLED", "EVENTCAST__STATE__ENABLED", 1 },
+  { "DISABLED", "EVENTCAST__STATE__DISABLED", 2 },
+};
+static const ProtobufCIntRange eventcast__state__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex eventcast__state__enum_values_by_name[2] =
+{
+  { "DISABLED", 1 },
+  { "ENABLED", 0 },
+};
+const ProtobufCEnumDescriptor eventcast__state__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.State",
+  "State",
+  "Eventcast__State",
+  "eventcast",
+  2,
+  eventcast__state__enum_values_by_number,
+  2,
+  eventcast__state__enum_values_by_name,
+  1,
+  eventcast__state__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__sensor_type__enum_values_by_number[5] =
+{
+  { "ACCEL", "EVENTCAST__SENSOR_TYPE__ACCEL", 1 },
+  { "MAGNETIC", "EVENTCAST__SENSOR_TYPE__MAGNETIC", 2 },
+  { "GYROSCOPE", "EVENTCAST__SENSOR_TYPE__GYROSCOPE", 3 },
+  { "PROXIMITY", "EVENTCAST__SENSOR_TYPE__PROXIMITY", 4 },
+  { "LIGHT", "EVENTCAST__SENSOR_TYPE__LIGHT", 5 },
+};
+static const ProtobufCIntRange eventcast__sensor_type__value_ranges[] = {
+{1, 0},{0, 5}
+};
+const ProtobufCEnumValueIndex eventcast__sensor_type__enum_values_by_name[5] =
+{
+  { "ACCEL", 0 },
+  { "GYROSCOPE", 2 },
+  { "LIGHT", 4 },
+  { "MAGNETIC", 1 },
+  { "PROXIMITY", 3 },
+};
+const ProtobufCEnumDescriptor eventcast__sensor_type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.SensorType",
+  "SensorType",
+  "Eventcast__SensorType",
+  "eventcast",
+  5,
+  eventcast__sensor_type__enum_values_by_number,
+  5,
+  eventcast__sensor_type__enum_values_by_name,
+  1,
+  eventcast__sensor_type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__touch_state__enum_values_by_number[2] =
+{
+  { "PRESSED", "EVENTCAST__TOUCH_STATE__PRESSED", 1 },
+  { "RELEASED", "EVENTCAST__TOUCH_STATE__RELEASED", 2 },
+};
+static const ProtobufCIntRange eventcast__touch_state__value_ranges[] = {
+{1, 0},{0, 2}
+};
+const ProtobufCEnumValueIndex eventcast__touch_state__enum_values_by_name[2] =
+{
+  { "PRESSED", 0 },
+  { "RELEASED", 1 },
+};
+const ProtobufCEnumDescriptor eventcast__touch_state__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.TouchState",
+  "TouchState",
+  "Eventcast__TouchState",
+  "eventcast",
+  2,
+  eventcast__touch_state__enum_values_by_number,
+  2,
+  eventcast__touch_state__enum_values_by_name,
+  1,
+  eventcast__touch_state__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
+const ProtobufCEnumValue eventcast__hwkey_type__enum_values_by_number[6] =
+{
+  { "MENU", "EVENTCAST__HWKEY_TYPE__MENU", 1 },
+  { "HOME", "EVENTCAST__HWKEY_TYPE__HOME", 2 },
+  { "BACK", "EVENTCAST__HWKEY_TYPE__BACK", 3 },
+  { "POWER", "EVENTCAST__HWKEY_TYPE__POWER", 4 },
+  { "VOLUME_UP", "EVENTCAST__HWKEY_TYPE__VOLUME_UP", 5 },
+  { "VOLUME_DOWN", "EVENTCAST__HWKEY_TYPE__VOLUME_DOWN", 6 },
+};
+static const ProtobufCIntRange eventcast__hwkey_type__value_ranges[] = {
+{1, 0},{0, 6}
+};
+const ProtobufCEnumValueIndex eventcast__hwkey_type__enum_values_by_name[6] =
+{
+  { "BACK", 2 },
+  { "HOME", 1 },
+  { "MENU", 0 },
+  { "POWER", 3 },
+  { "VOLUME_DOWN", 5 },
+  { "VOLUME_UP", 4 },
+};
+const ProtobufCEnumDescriptor eventcast__hwkey_type__descriptor =
+{
+  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
+  "eventcast.HWKeyType",
+  "HWKeyType",
+  "Eventcast__HWKeyType",
+  "eventcast",
+  6,
+  eventcast__hwkey_type__enum_values_by_number,
+  6,
+  eventcast__hwkey_type__enum_values_by_name,
+  1,
+  eventcast__hwkey_type__value_ranges,
+  NULL,NULL,NULL,NULL   /* reserved[1234] */
+};
diff --git a/tizen/src/eventcast/genmsg/eventcast.pb-c.h b/tizen/src/eventcast/genmsg/eventcast.pb-c.h
new file mode 100644 (file)
index 0000000..6d78492
--- /dev/null
@@ -0,0 +1,798 @@
+/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
+
+#ifndef PROTOBUF_C_eventcast_2eproto__INCLUDED
+#define PROTOBUF_C_eventcast_2eproto__INCLUDED
+
+#include "../../../distrib/protobuf/protobuf-c.h"
+
+PROTOBUF_C_BEGIN_DECLS
+
+
+typedef struct _Eventcast__HandShakeReq Eventcast__HandShakeReq;
+typedef struct _Eventcast__HandShakeAns Eventcast__HandShakeAns;
+typedef struct _Eventcast__EmulatorState Eventcast__EmulatorState;
+typedef struct _Eventcast__AppState Eventcast__AppState;
+typedef struct _Eventcast__StartReq Eventcast__StartReq;
+typedef struct _Eventcast__StartAns Eventcast__StartAns;
+typedef struct _Eventcast__SetEventStatus Eventcast__SetEventStatus;
+typedef struct _Eventcast__EventMsg Eventcast__EventMsg;
+typedef struct _Eventcast__EventTerminate Eventcast__EventTerminate;
+typedef struct _Eventcast__SetSensorStatus Eventcast__SetSensorStatus;
+typedef struct _Eventcast__SensorData Eventcast__SensorData;
+typedef struct _Eventcast__SensorMsg Eventcast__SensorMsg;
+typedef struct _Eventcast__Resolution Eventcast__Resolution;
+typedef struct _Eventcast__DisplayMsg Eventcast__DisplayMsg;
+typedef struct _Eventcast__TouchMaxCount Eventcast__TouchMaxCount;
+typedef struct _Eventcast__TouchData Eventcast__TouchData;
+typedef struct _Eventcast__HWKeyMsg Eventcast__HWKeyMsg;
+typedef struct _Eventcast__TouchMsg Eventcast__TouchMsg;
+typedef struct _Eventcast__EventCastMsg Eventcast__EventCastMsg;
+
+
+/* --- enums --- */
+
+typedef enum _Eventcast__EventMsg__TYPE {
+  EVENTCAST__EVENT_MSG__TYPE__START_REQ = 2,
+  EVENTCAST__EVENT_MSG__TYPE__START_ANS = 3,
+  EVENTCAST__EVENT_MSG__TYPE__TERMINATE = 4,
+  EVENTCAST__EVENT_MSG__TYPE__EVENT_STATUS = 5
+} Eventcast__EventMsg__TYPE;
+typedef enum _Eventcast__SensorMsg__Type {
+  EVENTCAST__SENSOR_MSG__TYPE__START_REQ = 2,
+  EVENTCAST__SENSOR_MSG__TYPE__START_ANS = 3,
+  EVENTCAST__SENSOR_MSG__TYPE__TERMINATE = 4,
+  EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS = 5,
+  EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA = 6
+} Eventcast__SensorMsg__Type;
+typedef enum _Eventcast__TouchMsg__Type {
+  EVENTCAST__TOUCH_MSG__TYPE__START_REQ = 2,
+  EVENTCAST__TOUCH_MSG__TYPE__START_ANS = 3,
+  EVENTCAST__TOUCH_MSG__TYPE__TERMINATE = 4,
+  EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT = 5,
+  EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA = 6,
+  EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION = 7,
+  EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG = 8,
+  EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG = 9
+} Eventcast__TouchMsg__Type;
+typedef enum _Eventcast__EventCastMsg__Type {
+  EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_REQ = 2,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__HANDSHAKE_ANS = 3,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__EMUL_STATE = 4,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__APP_STATE = 5,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__EVENT_MSG = 6,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG = 7,
+  EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG = 8
+} Eventcast__EventCastMsg__Type;
+typedef enum _Eventcast__MessageResult {
+  EVENTCAST__MESSAGE_RESULT__SUCCESS = 1,
+  EVENTCAST__MESSAGE_RESULT__FAILURE = 2,
+  EVENTCAST__MESSAGE_RESULT__CANCEL = 3
+} Eventcast__MessageResult;
+typedef enum _Eventcast__ConnectionState {
+  EVENTCAST__CONNECTION_STATE__CONNECTED = 1,
+  EVENTCAST__CONNECTION_STATE__DISCONNECTED = 2,
+  EVENTCAST__CONNECTION_STATE__TERMINATED = 3
+} Eventcast__ConnectionState;
+typedef enum _Eventcast__EventType {
+  EVENTCAST__EVENT_TYPE__SENSOR = 1,
+  EVENTCAST__EVENT_TYPE__TOUCH = 2
+} Eventcast__EventType;
+typedef enum _Eventcast__State {
+  EVENTCAST__STATE__ENABLED = 1,
+  EVENTCAST__STATE__DISABLED = 2
+} Eventcast__State;
+typedef enum _Eventcast__SensorType {
+  EVENTCAST__SENSOR_TYPE__ACCEL = 1,
+  EVENTCAST__SENSOR_TYPE__MAGNETIC = 2,
+  EVENTCAST__SENSOR_TYPE__GYROSCOPE = 3,
+  EVENTCAST__SENSOR_TYPE__PROXIMITY = 4,
+  EVENTCAST__SENSOR_TYPE__LIGHT = 5
+} Eventcast__SensorType;
+typedef enum _Eventcast__TouchState {
+  EVENTCAST__TOUCH_STATE__PRESSED = 1,
+  EVENTCAST__TOUCH_STATE__RELEASED = 2
+} Eventcast__TouchState;
+typedef enum _Eventcast__HWKeyType {
+  EVENTCAST__HWKEY_TYPE__MENU = 1,
+  EVENTCAST__HWKEY_TYPE__HOME = 2,
+  EVENTCAST__HWKEY_TYPE__BACK = 3,
+  EVENTCAST__HWKEY_TYPE__POWER = 4,
+  EVENTCAST__HWKEY_TYPE__VOLUME_UP = 5,
+  EVENTCAST__HWKEY_TYPE__VOLUME_DOWN = 6
+} Eventcast__HWKeyType;
+
+/* --- messages --- */
+
+struct  _Eventcast__HandShakeReq
+{
+  ProtobufCMessage base;
+  int32_t key;
+};
+#define EVENTCAST__HAND_SHAKE_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__hand_shake_req__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__HandShakeAns
+{
+  ProtobufCMessage base;
+  Eventcast__MessageResult result;
+};
+#define EVENTCAST__HAND_SHAKE_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__hand_shake_ans__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__EmulatorState
+{
+  ProtobufCMessage base;
+  Eventcast__ConnectionState state;
+};
+#define EVENTCAST__EMULATOR_STATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__emulator_state__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__AppState
+{
+  ProtobufCMessage base;
+  Eventcast__ConnectionState state;
+};
+#define EVENTCAST__APP_STATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__app_state__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__StartReq
+{
+  ProtobufCMessage base;
+};
+#define EVENTCAST__START_REQ__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__start_req__descriptor) \
+     }
+
+
+struct  _Eventcast__StartAns
+{
+  ProtobufCMessage base;
+  Eventcast__MessageResult result;
+};
+#define EVENTCAST__START_ANS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__start_ans__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__SetEventStatus
+{
+  ProtobufCMessage base;
+  Eventcast__EventType type;
+  Eventcast__State state;
+};
+#define EVENTCAST__SET_EVENT_STATUS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__set_event_status__descriptor) \
+    , 0, 0 }
+
+
+struct  _Eventcast__EventMsg
+{
+  ProtobufCMessage base;
+  Eventcast__EventMsg__TYPE type;
+  Eventcast__StartReq *startreq;
+  Eventcast__StartAns *startans;
+  Eventcast__EventTerminate *terminate;
+  Eventcast__SetEventStatus *setstatus;
+};
+#define EVENTCAST__EVENT_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_msg__descriptor) \
+    , 0, NULL, NULL, NULL, NULL }
+
+
+struct  _Eventcast__EventTerminate
+{
+  ProtobufCMessage base;
+};
+#define EVENTCAST__EVENT_TERMINATE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_terminate__descriptor) \
+     }
+
+
+struct  _Eventcast__SetSensorStatus
+{
+  ProtobufCMessage base;
+  Eventcast__SensorType type;
+  Eventcast__State state;
+};
+#define EVENTCAST__SET_SENSOR_STATUS__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__set_sensor_status__descriptor) \
+    , 0, 0 }
+
+
+struct  _Eventcast__SensorData
+{
+  ProtobufCMessage base;
+  Eventcast__SensorType sensor;
+  char *x;
+  char *y;
+  char *z;
+};
+extern char eventcast__sensor_data__x__default_value[];
+extern char eventcast__sensor_data__y__default_value[];
+extern char eventcast__sensor_data__z__default_value[];
+#define EVENTCAST__SENSOR_DATA__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__sensor_data__descriptor) \
+    , 0, eventcast__sensor_data__x__default_value, eventcast__sensor_data__y__default_value, eventcast__sensor_data__z__default_value }
+
+
+struct  _Eventcast__SensorMsg
+{
+  ProtobufCMessage base;
+  Eventcast__SensorMsg__Type type;
+  Eventcast__StartReq *startreq;
+  Eventcast__StartAns *startans;
+  Eventcast__EventTerminate *terminate;
+  Eventcast__SetSensorStatus *setstatus;
+  Eventcast__SensorData *data;
+};
+#define EVENTCAST__SENSOR_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__sensor_msg__descriptor) \
+    , 0, NULL, NULL, NULL, NULL, NULL }
+
+
+struct  _Eventcast__Resolution
+{
+  ProtobufCMessage base;
+  int32_t width;
+  int32_t height;
+};
+#define EVENTCAST__RESOLUTION__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__resolution__descriptor) \
+    , 0, 0 }
+
+
+struct  _Eventcast__DisplayMsg
+{
+  ProtobufCMessage base;
+  protobuf_c_boolean has_framerate;
+  int32_t framerate;
+  protobuf_c_boolean has_imagedata;
+  ProtobufCBinaryData imagedata;
+};
+#define EVENTCAST__DISPLAY_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__display_msg__descriptor) \
+    , 0,0, 0,{0,NULL} }
+
+
+struct  _Eventcast__TouchMaxCount
+{
+  ProtobufCMessage base;
+  protobuf_c_boolean has_max;
+  int32_t max;
+};
+#define EVENTCAST__TOUCH_MAX_COUNT__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_max_count__descriptor) \
+    , 0,10 }
+
+
+struct  _Eventcast__TouchData
+{
+  ProtobufCMessage base;
+  protobuf_c_boolean has_index;
+  int32_t index;
+  protobuf_c_boolean has_xpoint;
+  float xpoint;
+  protobuf_c_boolean has_ypoint;
+  float ypoint;
+  protobuf_c_boolean has_state;
+  Eventcast__TouchState state;
+};
+#define EVENTCAST__TOUCH_DATA__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_data__descriptor) \
+    , 0,0, 0,0, 0,0, 0,0 }
+
+
+struct  _Eventcast__HWKeyMsg
+{
+  ProtobufCMessage base;
+  Eventcast__HWKeyType type;
+};
+#define EVENTCAST__HWKEY_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__hwkey_msg__descriptor) \
+    , 0 }
+
+
+struct  _Eventcast__TouchMsg
+{
+  ProtobufCMessage base;
+  Eventcast__TouchMsg__Type type;
+  Eventcast__StartReq *startreq;
+  Eventcast__StartAns *startans;
+  Eventcast__EventTerminate *terminate;
+  Eventcast__TouchMaxCount *maxcount;
+  Eventcast__TouchData *touchdata;
+  Eventcast__Resolution *resolution;
+  Eventcast__DisplayMsg *display;
+  Eventcast__HWKeyMsg *hwkey;
+};
+#define EVENTCAST__TOUCH_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__touch_msg__descriptor) \
+    , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+
+struct  _Eventcast__EventCastMsg
+{
+  ProtobufCMessage base;
+  Eventcast__EventCastMsg__Type type;
+  Eventcast__HandShakeReq *handshakereq;
+  Eventcast__HandShakeAns *handshakeans;
+  Eventcast__EmulatorState *emulstate;
+  Eventcast__AppState *appstate;
+  Eventcast__EventMsg *eventmsg;
+  Eventcast__SensorMsg *sensormsg;
+  Eventcast__TouchMsg *touchmsg;
+};
+#define EVENTCAST__EVENT_CAST_MSG__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&eventcast__event_cast_msg__descriptor) \
+    , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+
+/* Eventcast__HandShakeReq methods */
+void   eventcast__hand_shake_req__init
+                     (Eventcast__HandShakeReq         *message);
+size_t eventcast__hand_shake_req__get_packed_size
+                     (const Eventcast__HandShakeReq   *message);
+size_t eventcast__hand_shake_req__pack
+                     (const Eventcast__HandShakeReq   *message,
+                      uint8_t             *out);
+size_t eventcast__hand_shake_req__pack_to_buffer
+                     (const Eventcast__HandShakeReq   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__HandShakeReq *
+       eventcast__hand_shake_req__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__hand_shake_req__free_unpacked
+                     (Eventcast__HandShakeReq *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__HandShakeAns methods */
+void   eventcast__hand_shake_ans__init
+                     (Eventcast__HandShakeAns         *message);
+size_t eventcast__hand_shake_ans__get_packed_size
+                     (const Eventcast__HandShakeAns   *message);
+size_t eventcast__hand_shake_ans__pack
+                     (const Eventcast__HandShakeAns   *message,
+                      uint8_t             *out);
+size_t eventcast__hand_shake_ans__pack_to_buffer
+                     (const Eventcast__HandShakeAns   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__HandShakeAns *
+       eventcast__hand_shake_ans__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__hand_shake_ans__free_unpacked
+                     (Eventcast__HandShakeAns *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__EmulatorState methods */
+void   eventcast__emulator_state__init
+                     (Eventcast__EmulatorState         *message);
+size_t eventcast__emulator_state__get_packed_size
+                     (const Eventcast__EmulatorState   *message);
+size_t eventcast__emulator_state__pack
+                     (const Eventcast__EmulatorState   *message,
+                      uint8_t             *out);
+size_t eventcast__emulator_state__pack_to_buffer
+                     (const Eventcast__EmulatorState   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__EmulatorState *
+       eventcast__emulator_state__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__emulator_state__free_unpacked
+                     (Eventcast__EmulatorState *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__AppState methods */
+void   eventcast__app_state__init
+                     (Eventcast__AppState         *message);
+size_t eventcast__app_state__get_packed_size
+                     (const Eventcast__AppState   *message);
+size_t eventcast__app_state__pack
+                     (const Eventcast__AppState   *message,
+                      uint8_t             *out);
+size_t eventcast__app_state__pack_to_buffer
+                     (const Eventcast__AppState   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__AppState *
+       eventcast__app_state__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__app_state__free_unpacked
+                     (Eventcast__AppState *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__StartReq methods */
+void   eventcast__start_req__init
+                     (Eventcast__StartReq         *message);
+size_t eventcast__start_req__get_packed_size
+                     (const Eventcast__StartReq   *message);
+size_t eventcast__start_req__pack
+                     (const Eventcast__StartReq   *message,
+                      uint8_t             *out);
+size_t eventcast__start_req__pack_to_buffer
+                     (const Eventcast__StartReq   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__StartReq *
+       eventcast__start_req__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__start_req__free_unpacked
+                     (Eventcast__StartReq *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__StartAns methods */
+void   eventcast__start_ans__init
+                     (Eventcast__StartAns         *message);
+size_t eventcast__start_ans__get_packed_size
+                     (const Eventcast__StartAns   *message);
+size_t eventcast__start_ans__pack
+                     (const Eventcast__StartAns   *message,
+                      uint8_t             *out);
+size_t eventcast__start_ans__pack_to_buffer
+                     (const Eventcast__StartAns   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__StartAns *
+       eventcast__start_ans__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__start_ans__free_unpacked
+                     (Eventcast__StartAns *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__SetEventStatus methods */
+void   eventcast__set_event_status__init
+                     (Eventcast__SetEventStatus         *message);
+size_t eventcast__set_event_status__get_packed_size
+                     (const Eventcast__SetEventStatus   *message);
+size_t eventcast__set_event_status__pack
+                     (const Eventcast__SetEventStatus   *message,
+                      uint8_t             *out);
+size_t eventcast__set_event_status__pack_to_buffer
+                     (const Eventcast__SetEventStatus   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__SetEventStatus *
+       eventcast__set_event_status__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__set_event_status__free_unpacked
+                     (Eventcast__SetEventStatus *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__EventMsg methods */
+void   eventcast__event_msg__init
+                     (Eventcast__EventMsg         *message);
+size_t eventcast__event_msg__get_packed_size
+                     (const Eventcast__EventMsg   *message);
+size_t eventcast__event_msg__pack
+                     (const Eventcast__EventMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__event_msg__pack_to_buffer
+                     (const Eventcast__EventMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__EventMsg *
+       eventcast__event_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__event_msg__free_unpacked
+                     (Eventcast__EventMsg *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__EventTerminate methods */
+void   eventcast__event_terminate__init
+                     (Eventcast__EventTerminate         *message);
+size_t eventcast__event_terminate__get_packed_size
+                     (const Eventcast__EventTerminate   *message);
+size_t eventcast__event_terminate__pack
+                     (const Eventcast__EventTerminate   *message,
+                      uint8_t             *out);
+size_t eventcast__event_terminate__pack_to_buffer
+                     (const Eventcast__EventTerminate   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__EventTerminate *
+       eventcast__event_terminate__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__event_terminate__free_unpacked
+                     (Eventcast__EventTerminate *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__SetSensorStatus methods */
+void   eventcast__set_sensor_status__init
+                     (Eventcast__SetSensorStatus         *message);
+size_t eventcast__set_sensor_status__get_packed_size
+                     (const Eventcast__SetSensorStatus   *message);
+size_t eventcast__set_sensor_status__pack
+                     (const Eventcast__SetSensorStatus   *message,
+                      uint8_t             *out);
+size_t eventcast__set_sensor_status__pack_to_buffer
+                     (const Eventcast__SetSensorStatus   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__SetSensorStatus *
+       eventcast__set_sensor_status__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__set_sensor_status__free_unpacked
+                     (Eventcast__SetSensorStatus *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__SensorData methods */
+void   eventcast__sensor_data__init
+                     (Eventcast__SensorData         *message);
+size_t eventcast__sensor_data__get_packed_size
+                     (const Eventcast__SensorData   *message);
+size_t eventcast__sensor_data__pack
+                     (const Eventcast__SensorData   *message,
+                      uint8_t             *out);
+size_t eventcast__sensor_data__pack_to_buffer
+                     (const Eventcast__SensorData   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__SensorData *
+       eventcast__sensor_data__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__sensor_data__free_unpacked
+                     (Eventcast__SensorData *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__SensorMsg methods */
+void   eventcast__sensor_msg__init
+                     (Eventcast__SensorMsg         *message);
+size_t eventcast__sensor_msg__get_packed_size
+                     (const Eventcast__SensorMsg   *message);
+size_t eventcast__sensor_msg__pack
+                     (const Eventcast__SensorMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__sensor_msg__pack_to_buffer
+                     (const Eventcast__SensorMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__SensorMsg *
+       eventcast__sensor_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__sensor_msg__free_unpacked
+                     (Eventcast__SensorMsg *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__Resolution methods */
+void   eventcast__resolution__init
+                     (Eventcast__Resolution         *message);
+size_t eventcast__resolution__get_packed_size
+                     (const Eventcast__Resolution   *message);
+size_t eventcast__resolution__pack
+                     (const Eventcast__Resolution   *message,
+                      uint8_t             *out);
+size_t eventcast__resolution__pack_to_buffer
+                     (const Eventcast__Resolution   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__Resolution *
+       eventcast__resolution__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__resolution__free_unpacked
+                     (Eventcast__Resolution *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__DisplayMsg methods */
+void   eventcast__display_msg__init
+                     (Eventcast__DisplayMsg         *message);
+size_t eventcast__display_msg__get_packed_size
+                     (const Eventcast__DisplayMsg   *message);
+size_t eventcast__display_msg__pack
+                     (const Eventcast__DisplayMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__display_msg__pack_to_buffer
+                     (const Eventcast__DisplayMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__DisplayMsg *
+       eventcast__display_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__display_msg__free_unpacked
+                     (Eventcast__DisplayMsg *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__TouchMaxCount methods */
+void   eventcast__touch_max_count__init
+                     (Eventcast__TouchMaxCount         *message);
+size_t eventcast__touch_max_count__get_packed_size
+                     (const Eventcast__TouchMaxCount   *message);
+size_t eventcast__touch_max_count__pack
+                     (const Eventcast__TouchMaxCount   *message,
+                      uint8_t             *out);
+size_t eventcast__touch_max_count__pack_to_buffer
+                     (const Eventcast__TouchMaxCount   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__TouchMaxCount *
+       eventcast__touch_max_count__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__touch_max_count__free_unpacked
+                     (Eventcast__TouchMaxCount *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__TouchData methods */
+void   eventcast__touch_data__init
+                     (Eventcast__TouchData         *message);
+size_t eventcast__touch_data__get_packed_size
+                     (const Eventcast__TouchData   *message);
+size_t eventcast__touch_data__pack
+                     (const Eventcast__TouchData   *message,
+                      uint8_t             *out);
+size_t eventcast__touch_data__pack_to_buffer
+                     (const Eventcast__TouchData   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__TouchData *
+       eventcast__touch_data__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__touch_data__free_unpacked
+                     (Eventcast__TouchData *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__HWKeyMsg methods */
+void   eventcast__hwkey_msg__init
+                     (Eventcast__HWKeyMsg         *message);
+size_t eventcast__hwkey_msg__get_packed_size
+                     (const Eventcast__HWKeyMsg   *message);
+size_t eventcast__hwkey_msg__pack
+                     (const Eventcast__HWKeyMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__hwkey_msg__pack_to_buffer
+                     (const Eventcast__HWKeyMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__HWKeyMsg *
+       eventcast__hwkey_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__hwkey_msg__free_unpacked
+                     (Eventcast__HWKeyMsg *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__TouchMsg methods */
+void   eventcast__touch_msg__init
+                     (Eventcast__TouchMsg         *message);
+size_t eventcast__touch_msg__get_packed_size
+                     (const Eventcast__TouchMsg   *message);
+size_t eventcast__touch_msg__pack
+                     (const Eventcast__TouchMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__touch_msg__pack_to_buffer
+                     (const Eventcast__TouchMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__TouchMsg *
+       eventcast__touch_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__touch_msg__free_unpacked
+                     (Eventcast__TouchMsg *message,
+                      ProtobufCAllocator *allocator);
+/* Eventcast__EventCastMsg methods */
+void   eventcast__event_cast_msg__init
+                     (Eventcast__EventCastMsg         *message);
+size_t eventcast__event_cast_msg__get_packed_size
+                     (const Eventcast__EventCastMsg   *message);
+size_t eventcast__event_cast_msg__pack
+                     (const Eventcast__EventCastMsg   *message,
+                      uint8_t             *out);
+size_t eventcast__event_cast_msg__pack_to_buffer
+                     (const Eventcast__EventCastMsg   *message,
+                      ProtobufCBuffer     *buffer);
+Eventcast__EventCastMsg *
+       eventcast__event_cast_msg__unpack
+                     (ProtobufCAllocator  *allocator,
+                      size_t               len,
+                      const uint8_t       *data);
+void   eventcast__event_cast_msg__free_unpacked
+                     (Eventcast__EventCastMsg *message,
+                      ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*Eventcast__HandShakeReq_Closure)
+                 (const Eventcast__HandShakeReq *message,
+                  void *closure_data);
+typedef void (*Eventcast__HandShakeAns_Closure)
+                 (const Eventcast__HandShakeAns *message,
+                  void *closure_data);
+typedef void (*Eventcast__EmulatorState_Closure)
+                 (const Eventcast__EmulatorState *message,
+                  void *closure_data);
+typedef void (*Eventcast__AppState_Closure)
+                 (const Eventcast__AppState *message,
+                  void *closure_data);
+typedef void (*Eventcast__StartReq_Closure)
+                 (const Eventcast__StartReq *message,
+                  void *closure_data);
+typedef void (*Eventcast__StartAns_Closure)
+                 (const Eventcast__StartAns *message,
+                  void *closure_data);
+typedef void (*Eventcast__SetEventStatus_Closure)
+                 (const Eventcast__SetEventStatus *message,
+                  void *closure_data);
+typedef void (*Eventcast__EventMsg_Closure)
+                 (const Eventcast__EventMsg *message,
+                  void *closure_data);
+typedef void (*Eventcast__EventTerminate_Closure)
+                 (const Eventcast__EventTerminate *message,
+                  void *closure_data);
+typedef void (*Eventcast__SetSensorStatus_Closure)
+                 (const Eventcast__SetSensorStatus *message,
+                  void *closure_data);
+typedef void (*Eventcast__SensorData_Closure)
+                 (const Eventcast__SensorData *message,
+                  void *closure_data);
+typedef void (*Eventcast__SensorMsg_Closure)
+                 (const Eventcast__SensorMsg *message,
+                  void *closure_data);
+typedef void (*Eventcast__Resolution_Closure)
+                 (const Eventcast__Resolution *message,
+                  void *closure_data);
+typedef void (*Eventcast__DisplayMsg_Closure)
+                 (const Eventcast__DisplayMsg *message,
+                  void *closure_data);
+typedef void (*Eventcast__TouchMaxCount_Closure)
+                 (const Eventcast__TouchMaxCount *message,
+                  void *closure_data);
+typedef void (*Eventcast__TouchData_Closure)
+                 (const Eventcast__TouchData *message,
+                  void *closure_data);
+typedef void (*Eventcast__HWKeyMsg_Closure)
+                 (const Eventcast__HWKeyMsg *message,
+                  void *closure_data);
+typedef void (*Eventcast__TouchMsg_Closure)
+                 (const Eventcast__TouchMsg *message,
+                  void *closure_data);
+typedef void (*Eventcast__EventCastMsg_Closure)
+                 (const Eventcast__EventCastMsg *message,
+                  void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCEnumDescriptor    eventcast__message_result__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__connection_state__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__event_type__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__state__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__sensor_type__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__touch_state__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__hwkey_type__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__hand_shake_req__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__hand_shake_ans__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__emulator_state__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__app_state__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__start_req__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__start_ans__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__set_event_status__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__event_msg__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__event_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__event_terminate__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__set_sensor_status__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__sensor_data__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__sensor_msg__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__sensor_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__resolution__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__display_msg__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__touch_max_count__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__touch_data__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__hwkey_msg__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__touch_msg__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__touch_msg__type__descriptor;
+extern const ProtobufCMessageDescriptor eventcast__event_cast_msg__descriptor;
+extern const ProtobufCEnumDescriptor    eventcast__event_cast_msg__type__descriptor;
+
+PROTOBUF_C_END_DECLS
+
+
+#endif  /* PROTOBUF_eventcast_2eproto__INCLUDED */
similarity index 90%
rename from tizen/src/tethering/msg/tethering.proto
rename to tizen/src/eventcast/msg/eventcast.proto
index cf1c01c..559458f 100644 (file)
@@ -1,8 +1,8 @@
-package tethering;
+package eventcast;
 
-option java_package = "device.tethering.genmsg";
+option java_package = "device.eventcast.genmsg";
 
-// protoc-c --c_out=../genmsg tethering.proto
+// protoc-c --c_out=../genmsg eventcast.proto
 
 // define value
 enum MessageResult {
@@ -158,6 +158,19 @@ message TouchData {
        optional TouchState state = 4;
 }
 
+enum HWKeyType {
+       MENU = 1;
+       HOME = 2;
+       BACK = 3;
+       POWER = 4;
+       VOLUME_UP = 5;
+       VOLUME_DOWN = 6;
+}
+
+message HWKeyMsg {
+    required HWKeyType type = 1;
+}
+
 message TouchMsg {
        enum Type {
                START_REQ = 2;
@@ -167,6 +180,7 @@ message TouchMsg {
                TOUCH_DATA = 6;
                RESOLUTION = 7;
                DISPLAY_MSG = 8;
+               HWKEY_MSG = 9;
        }
        required Type type = 1;
        optional StartReq startReq = 2;
@@ -176,9 +190,10 @@ message TouchMsg {
        optional TouchData touchData = 6;
        optional Resolution resolution = 7;
        optional DisplayMsg display = 8;
+       optional HWKeyMsg hwkey = 9;
 }
 
-message TetheringMsg {
+message EventCastMsg {
        enum Type {
                HANDSHAKE_REQ = 2;
                HANDSHAKE_ANS = 3;
similarity index 57%
rename from tizen/src/tethering/sensor.c
rename to tizen/src/eventcast/sensor.c
index 14589e5..8ceaafc 100644 (file)
 
 #include "sensor.h"
 #include "common.h"
-#include "ecs/ecs_tethering.h"
-#include "genmsg/tethering.pb-c.h"
+#include "ecs/ecs_eventcast.h"
+#include "genmsg/eventcast.pb-c.h"
 
 #include "util/new_debug_ch.h"
 
-DECLARE_DEBUG_CHANNEL(app_tethering);
+DECLARE_DEBUG_CHANNEL(eventcast);
 
 typedef struct sensor_state {
     bool is_sensor_event;
@@ -68,46 +68,20 @@ enum sensor_level {
     level_magnetic = 13
 };
 
-static int sensor_device_status;
-
-#if 0
-static void init_sensor_state(void)
-{
-    input_device_list *device = NULL;
-    sensor_state *sensor = NULL;
-    int ret = 0;
-
-    device = g_malloc0(sizeof(device));
-    if (!device) {
-        return;
-    }
-
-    sensor = g_malloc0(sizeof(sensor_state));
-    if (!sensor) {
-        g_free(device);
-        return;
-    }
+#define ACCEL_ADJUST    100000
+#define GYRO_ADJUST     17.50
 
-    device->type = TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG;
-    device->opaque = sensor;
-
-    ret = add_input_device(device);
-    if (ret < 0) {
-        g_free(sensor);
-        g_free(device);
-    }
-}
-#endif
+static int sensor_device_status;
 
 // create a sensor message.
-static bool build_sensor_msg(Tethering__SensorMsg *sensor)
+static bool build_sensor_msg(Eventcast__SensorMsg *sensor)
 {
     bool ret = false;
-    Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
+    Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
-    msg.type = TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG;
+    msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__SENSOR_MSG;
     msg.sensormsg = sensor;
 
     ret = send_msg_to_controller(&msg);
@@ -117,17 +91,17 @@ static bool build_sensor_msg(Tethering__SensorMsg *sensor)
     return ret;
 }
 
-static bool send_sensor_start_ans_msg(Tethering__MessageResult result)
+static bool send_sensor_start_ans_msg(Eventcast__MessageResult result)
 {
     bool ret = false;
-    Tethering__SensorMsg event = TETHERING__SENSOR_MSG__INIT;
-    Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
+    Eventcast__SensorMsg event = EVENTCAST__SENSOR_MSG__INIT;
+    Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     start_ans.result = result;
 
-    event.type = TETHERING__SENSOR_MSG__TYPE__START_ANS;
+    event.type = EVENTCAST__SENSOR_MSG__TYPE__START_ANS;
     event.startans = &start_ans;
 
     LOG_TRACE("send sensor_start_ans message\n");
@@ -138,21 +112,21 @@ static bool send_sensor_start_ans_msg(Tethering__MessageResult result)
     return ret;
 }
 
-static bool send_set_sensor_status_msg(Tethering__SensorType sensor_type,
-                                    Tethering__State status)
+static bool send_set_sensor_status_msg(Eventcast__SensorType sensor_type,
+                                    Eventcast__State status)
 {
     bool ret = false;
 
-    Tethering__SensorMsg sensor = TETHERING__SENSOR_MSG__INIT;
-    Tethering__SetSensorStatus sensor_status =
-                            TETHERING__SET_SENSOR_STATUS__INIT;
+    Eventcast__SensorMsg sensor = EVENTCAST__SENSOR_MSG__INIT;
+    Eventcast__SetSensorStatus sensor_status =
+                            EVENTCAST__SET_SENSOR_STATUS__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     sensor_status.type = sensor_type;
     sensor_status.state = status;
 
-    sensor.type = TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS;
+    sensor.type = EVENTCAST__SENSOR_MSG__TYPE__SENSOR_STATUS;
     sensor.setstatus = &sensor_status;
 
     LOG_TRACE("send sensor_set_event_status message\n");
@@ -163,7 +137,7 @@ static bool send_set_sensor_status_msg(Tethering__SensorType sensor_type,
     return ret;
 }
 
-static void set_sensor_data(Tethering__SensorData *data)
+static void set_sensor_data(Eventcast__SensorData *data)
 {
     /*
      * data format for sensor device
@@ -173,59 +147,61 @@ static void set_sensor_data(Tethering__SensorData *data)
      */
 
     switch(data->sensor) {
-    case TETHERING__SENSOR_TYPE__ACCEL:
+    case EVENTCAST__SENSOR_TYPE__ACCEL:
     {
         char tmp[255] = {0};
 
-        sprintf(tmp, "%d\n%d\n%s\n%s\n%s\n",
-                level_accel, 3, data->x, data->y, data->z);
-        send_tethering_sensor_data(tmp, strlen(tmp));
+        sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n",
+                level_accel, 3, (atof(data->x) * ACCEL_ADJUST),
+                (atof(data->y) * ACCEL_ADJUST), (atof(data->z) * ACCEL_ADJUST));
+        send_eventcast_sensor_data(tmp, strlen(tmp));
 
         LOG_TRACE("sensor_accel x: %s, y: %s, z: %s\n",
             data->x, data->y, data->z);
     }
         break;
-    case TETHERING__SENSOR_TYPE__MAGNETIC:
+    case EVENTCAST__SENSOR_TYPE__MAGNETIC:
     {
         char tmp[255] = {0};
 
         sprintf(tmp, "%d\n%d\n%s\n%s\n%s\n",
                 level_magnetic, 3, data->x, data->y, data->z);
-        send_tethering_sensor_data(tmp, strlen(tmp));
+        send_eventcast_sensor_data(tmp, strlen(tmp));
 
         LOG_TRACE("sensor_mag x: %s, y: %s, z: %s\n",
             data->x, data->y, data->z);
     }
         break;
-    case TETHERING__SENSOR_TYPE__GYROSCOPE:
+    case EVENTCAST__SENSOR_TYPE__GYROSCOPE:
     {
         char tmp[255] = {0};
 
-        sprintf(tmp, "%d\n%d\n%s\n%s\n%s\n",
-                level_gyro, 3, data->x, data->y, data->z);
-        send_tethering_sensor_data(tmp, strlen(tmp));
+        sprintf(tmp, "%d\n%d\n%lf\n%lf\n%lf\n",
+                level_gyro, 3, (atof(data->x) / GYRO_ADJUST),
+                (atof(data->y) / GYRO_ADJUST), (atof(data->z) / GYRO_ADJUST));
+        send_eventcast_sensor_data(tmp, strlen(tmp));
 
         LOG_TRACE("sensor_gyro x: %s, y: %s, z: %s\n",
             data->x, data->y, data->z);
     }
         break;
-    case TETHERING__SENSOR_TYPE__PROXIMITY:
+    case EVENTCAST__SENSOR_TYPE__PROXIMITY:
     {
         char tmp[255] = {0};
         double x = (double)(atoi(data->x));
 
         sprintf(tmp, "%d\n%d\n%.1f\n", level_proxi, 1, x);
-        send_tethering_sensor_data(tmp, strlen(tmp));
+        send_eventcast_sensor_data(tmp, strlen(tmp));
 
         LOG_TRACE("sensor_proxi x: %.1f, %s\n", x, tmp);
     }
         break;
-    case TETHERING__SENSOR_TYPE__LIGHT:
+    case EVENTCAST__SENSOR_TYPE__LIGHT:
     {
         char tmp[255] = {0};
 
         sprintf(tmp, "%d\n%d\n%s%s\n", level_light, 2, data->x, data->y);
-        send_tethering_sensor_data(tmp, strlen(tmp));
+        send_eventcast_sensor_data(tmp, strlen(tmp));
 
         LOG_TRACE("sensor_light x: %s\n", data->x);
     }
@@ -236,39 +212,36 @@ static void set_sensor_data(Tethering__SensorData *data)
     }
 }
 
-bool msgproc_tethering_sensor_msg(void *message)
+bool msgproc_eventcast_sensor_msg(void *message)
 {
     bool ret = true;
-    Tethering__SensorMsg *msg = (Tethering__SensorMsg *)message;
+    Eventcast__SensorMsg *msg = (Eventcast__SensorMsg *)message;
 
     switch(msg->type) {
-    case TETHERING__SENSOR_MSG__TYPE__START_REQ:
+    case EVENTCAST__SENSOR_MSG__TYPE__START_REQ:
         LOG_TRACE("SENSOR_MSG_TYPE_START_REQ\n");
 
-        // TODO
-        // init_sensor_state();
-
         // set sensor type.
-        send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__ACCEL,
-                                TETHERING__STATE__ENABLED);
-        send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__MAGNETIC,
-                                TETHERING__STATE__ENABLED);
-        send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__GYROSCOPE,
-                                TETHERING__STATE__ENABLED);
-        send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__PROXIMITY,
-                                TETHERING__STATE__ENABLED);
-        send_set_sensor_status_msg(TETHERING__SENSOR_TYPE__LIGHT,
-                                TETHERING__STATE__ENABLED);
+        send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__ACCEL,
+                                EVENTCAST__STATE__ENABLED);
+        send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__MAGNETIC,
+                                EVENTCAST__STATE__ENABLED);
+        send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__GYROSCOPE,
+                                EVENTCAST__STATE__ENABLED);
+        send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__PROXIMITY,
+                                EVENTCAST__STATE__ENABLED);
+        send_set_sensor_status_msg(EVENTCAST__SENSOR_TYPE__LIGHT,
+                                EVENTCAST__STATE__ENABLED);
 
         LOG_TRACE("SENSOR_MSG_TYPE_START_ANS\n");
-        send_sensor_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
+        send_sensor_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS);
 
         break;
-    case TETHERING__SENSOR_MSG__TYPE__TERMINATE:
+    case EVENTCAST__SENSOR_MSG__TYPE__TERMINATE:
         LOG_TRACE("SENSOR_MSG_TYPE_TERMINATE\n");
         break;
 
-    case TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA:
+    case EVENTCAST__SENSOR_MSG__TYPE__SENSOR_DATA:
         LOG_TRACE("SENSOR_MSG_TYPE_SENSOR_DATA\n");
         set_sensor_data(msg->data);
         break;
@@ -281,13 +254,13 @@ bool msgproc_tethering_sensor_msg(void *message)
     return ret;
 }
 
-int get_tethering_sensor_status(void)
+int get_eventcast_sensor_status(void)
 {
     return sensor_device_status;
 }
 
-void set_tethering_sensor_status(int status)
+void set_eventcast_sensor_status(int status)
 {
     sensor_device_status = status;
-    send_tethering_sensor_status_ecp();
+    send_eventcast_sensor_status_ecp();
 }
similarity index 81%
rename from tizen/src/tethering/sensor.h
rename to tizen/src/eventcast/sensor.h
index 42ece22..32cb80b 100644 (file)
  *
  */
 
-bool msgproc_tethering_sensor_msg(void *msg);
+#ifndef __EVENTCAST_SENSOR_H__
+#define __EVENTCAST_SENSOR_H__
 
-int get_tethering_sensor_status(void);
+bool msgproc_eventcast_sensor_msg(void *msg);
 
-void set_tethering_sensor_status(int status);
+int get_eventcast_sensor_status(void);
+
+void set_eventcast_sensor_status(int status);
+
+#endif /* __EVENTCAST_SENSOR_H__ */
similarity index 57%
rename from tizen/src/tethering/touch.c
rename to tizen/src/eventcast/touch.c
index 625cbbf..5d2ae70 100644 (file)
 #include "common.h"
 #include "touch.h"
 #include "encode_fb.h"
-#include "genmsg/tethering.pb-c.h"
-#include "ecs/ecs_tethering.h"
+#include "genmsg/eventcast.pb-c.h"
+#include "ecs/ecs_eventcast.h"
 #include "util/new_debug_ch.h"
 
-DECLARE_DEBUG_CHANNEL(app_tethering);
+DECLARE_DEBUG_CHANNEL(eventcast);
 
-typedef struct touch_state {
-    bool is_touch_event;
-    bool is_touch_supported;
-
-    // int touch_max_point;
-    // display_state *display;
-} touch_event;
-
-// static bool is_touch_event;
 static int touch_device_status;
-
-// static void set_touch_event_status(bool status);
 static bool send_display_image_data(void);
 
-#if 0
-touch_state *init_touch_state(void)
-{
-    input_device_list *device = NULL;
-    touch_state *touch = NULL;
-    int ret = 0;
-
-    device = g_malloc0(sizeof(device));
-    if (!device) {
-        return NULL;
-    }
-
-    touch = g_malloc0(sizeof(touch_state));
-    if (!touch) {
-        g_free(device);
-        return NULL;
-    }
-
-    device->type = TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG;
-    device->opaque = touch;
+#define HARD_KEY_MENU 169
+#define HARD_KEY_BACK 158
 
-    ret = add_input_device(device);
-    if (ret < 0) {
-        g_free(touch);
-        g_free(device);
-    }
-
-    return touch;
-}
-#endif
-
-static bool build_touch_msg(Tethering__TouchMsg *touch)
+static bool build_touch_msg(Eventcast__TouchMsg *touch)
 {
     bool ret = false;
-    Tethering__TetheringMsg msg = TETHERING__TETHERING_MSG__INIT;
+    Eventcast__EventCastMsg msg = EVENTCAST__EVENT_CAST_MSG__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
-    msg.type = TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG;
+    msg.type = EVENTCAST__EVENT_CAST_MSG__TYPE__TOUCH_MSG;
     msg.touchmsg = touch;
 
-    LOG_TRACE("touch message size: %d\n", tethering__tethering_msg__get_packed_size(&msg));
+    LOG_TRACE("touch message size: %d\n", eventcast__event_cast_msg__get_packed_size(&msg));
     ret = send_msg_to_controller(&msg);
 
     LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
@@ -102,18 +63,18 @@ static bool build_touch_msg(Tethering__TouchMsg *touch)
     return ret;
 }
 
-static bool send_touch_start_ans_msg(Tethering__MessageResult result)
+static bool send_touch_start_ans_msg(Eventcast__MessageResult result)
 {
     bool ret = false;
 
-    Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT;
-    Tethering__StartAns start_ans = TETHERING__START_ANS__INIT;
+    Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT;
+    Eventcast__StartAns start_ans = EVENTCAST__START_ANS__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     start_ans.result = result;
 
-    mt.type = TETHERING__TOUCH_MSG__TYPE__START_ANS;
+    mt.type = EVENTCAST__TOUCH_MSG__TYPE__START_ANS;
     mt.startans = &start_ans;
 
     ret = build_touch_msg(&mt);
@@ -127,15 +88,15 @@ static bool send_set_touch_max_count(void)
 {
     bool ret = false;
 
-    Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT;
-    Tethering__TouchMaxCount touch_cnt =
-        TETHERING__TOUCH_MAX_COUNT__INIT;
+    Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT;
+    Eventcast__TouchMaxCount touch_cnt =
+        EVENTCAST__TOUCH_MAX_COUNT__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     touch_cnt.max = get_emul_max_touch_point();
 
-    mt.type = TETHERING__TOUCH_MSG__TYPE__MAX_COUNT;
+    mt.type = EVENTCAST__TOUCH_MSG__TYPE__MAX_COUNT;
     mt.maxcount = &touch_cnt;
 
     LOG_TRACE("send touch max count: %d\n", touch_cnt.max);
@@ -146,20 +107,20 @@ static bool send_set_touch_max_count(void)
     return ret;
 }
 
-static void set_touch_data(Tethering__TouchData *data)
+static void set_touch_data(Eventcast__TouchData *data)
 {
     float x = 0.0, y = 0.0;
     int32_t index = 0, state = 0;
 
     switch(data->state) {
-    case TETHERING__TOUCH_STATE__PRESSED:
+    case EVENTCAST__TOUCH_STATE__PRESSED:
         LOG_TRACE("touch pressed\n");
         index = data->index;
         x = data->xpoint;
         y = data->ypoint;
         state = PRESSED;
         break;
-    case TETHERING__TOUCH_STATE__RELEASED:
+    case EVENTCAST__TOUCH_STATE__RELEASED:
         LOG_TRACE("touch released\n");
         index = data->index;
         x = data->xpoint;
@@ -172,22 +133,22 @@ static void set_touch_data(Tethering__TouchData *data)
     }
 
     LOG_TRACE("set touch_data. index: %d, x: %lf, y: %lf\n", index, x, y);
-    send_tethering_touch_data(x, y, index, state);
+    send_eventcast_touch_data(x, y, index, state);
 }
 
 static bool send_set_touch_resolution(void)
 {
     bool ret = false;
 
-    Tethering__TouchMsg mt = TETHERING__TOUCH_MSG__INIT;
-    Tethering__Resolution resolution = TETHERING__RESOLUTION__INIT;
+    Eventcast__TouchMsg mt = EVENTCAST__TOUCH_MSG__INIT;
+    Eventcast__Resolution resolution = EVENTCAST__RESOLUTION__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
     resolution.width = get_emul_resolution_width();
     resolution.height = get_emul_resolution_height();
 
-    mt.type = TETHERING__TOUCH_MSG__TYPE__RESOLUTION;
+    mt.type = EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION;
     mt.resolution = &resolution;
 
     LOG_TRACE("send touch resolution: %dx%d\n",
@@ -199,40 +160,32 @@ static bool send_set_touch_resolution(void)
     return ret;
 }
 
-#if 0
-static void set_touch_event_status(bool status)
-{
-    is_touch_event = status;
-
-    LOG_TRACE("set touch_event status: %d\n", status);
-}
-
-static void set_hwkey_data(Tethering__HWKeyMsg *msg)
+static void set_hwkey_data(Eventcast__HWKeyMsg *msg)
 {
     int32_t keycode = 0;
 
     switch (msg->type) {
-    case TETHERING__HWKEY_TYPE__MENU:
-        // keycode = HARD_KEY_ ;
+    case EVENTCAST__HWKEY_TYPE__MENU:
+        keycode = HARD_KEY_MENU;
         break;
 
-    case TETHERING__HWKEY_TYPE__HOME:
+    case EVENTCAST__HWKEY_TYPE__HOME:
         keycode = HARD_KEY_HOME;
         break;
 
-    case TETHERING__HWKEY_TYPE__BACK:
-        // keycode = ;
+    case EVENTCAST__HWKEY_TYPE__BACK:
+        keycode = HARD_KEY_BACK;
         break;
 
-    case TETHERING__HWKEY_TYPE__POWER:
+    case EVENTCAST__HWKEY_TYPE__POWER:
         keycode = HARD_KEY_POWER;
         break;
 
-    case TETHERING__HWKEY_TYPE__VOLUMEUP:
+    case EVENTCAST__HWKEY_TYPE__VOLUME_UP:
         keycode = HARD_KEY_VOL_UP;
         break;
 
-    case TETHERING__HWKEY_TYPE__VOLUMEDOWN:
+    case EVENTCAST__HWKEY_TYPE__VOLUME_DOWN:
         keycode = HARD_KEY_VOL_DOWN;
         break;
 
@@ -241,62 +194,46 @@ static void set_hwkey_data(Tethering__HWKeyMsg *msg)
     }
 
     LOG_TRACE("convert hwkey msg to keycode: %d\n", keycode);
-    send_tethering_hwkey_data(keycode);
-}
-#endif
-
-static bool is_display_dirty = false;
-
-void set_display_dirty(bool dirty)
-{
-    LOG_TRACE("qemu display update: %d\n", is_display_dirty);
-    is_display_dirty = dirty;
+    send_eventcast_hwkey_data(keycode);
 }
 
-// bool msgproc_tethering_touch_msg(Tethering__TouchMsg *msg)
-bool msgproc_tethering_touch_msg(void *message)
+bool msgproc_eventcast_touch_msg(void *message)
 {
     bool ret = true;
-    Tethering__TouchMsg *msg = (Tethering__TouchMsg *)message;
-
-    // touch_state *state = NULL;
+    Eventcast__TouchMsg *msg = (Eventcast__TouchMsg *)message;
 
     switch(msg->type) {
-    case TETHERING__TOUCH_MSG__TYPE__START_REQ:
+    case EVENTCAST__TOUCH_MSG__TYPE__START_REQ:
         LOG_TRACE("TOUCH_MSG_TYPE_START\n");
-        // state = init_touch_state();
-
-        // it means that app starts to send touch values.
-        // set_touch_event_status(true);
-
         send_set_touch_max_count();
         send_set_touch_resolution();
-
-        ret = send_touch_start_ans_msg(TETHERING__MESSAGE_RESULT__SUCCESS);
+        ret = send_touch_start_ans_msg(EVENTCAST__MESSAGE_RESULT__SUCCESS);
         break;
-    case TETHERING__TOUCH_MSG__TYPE__TERMINATE:
+    case EVENTCAST__TOUCH_MSG__TYPE__TERMINATE:
         LOG_TRACE("TOUCH_MSG_TYPE_TERMINATE\n");
-
-        // it means that app stops to send touch values.
-        // set_touch_event_status(false);
         break;
 
-    case TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA:
+    case EVENTCAST__TOUCH_MSG__TYPE__TOUCH_DATA:
+        LOG_TRACE("TOUCH_MSG_TYPE_TOUCH_DATA\n");
         set_touch_data(msg->touchdata);
         break;
 
-    case TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG:
-        if (is_display_dirty) {
+    case EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG:
+        LOG_TRACE("TOUCH_MSG_TYPE_DISPLAY_MSG\n");
+
+        if (is_display_dirty()) {
+            LOG_TRACE("display dirty status!! send the image\n");
+
             send_display_image_data();
-            is_display_dirty = false;
+            set_display_dirty(false);
         }
         break;
 
-#if 0
-    case TETHERING__TOUCH_MSG__TYPE__HWKEY_MSG:
+    case EVENTCAST__TOUCH_MSG__TYPE__HWKEY_MSG:
+        LOG_TRACE("TOUCH_MSG_TYPE_HWKEY_MSG\n");
         set_hwkey_data(msg->hwkey);
         break;
-#endif
+
     default:
         LOG_TRACE("invalid touch_msg\n");
         ret = false;
@@ -306,15 +243,15 @@ bool msgproc_tethering_touch_msg(void *message)
     return ret;
 }
 
-int get_tethering_touch_status(void)
+int get_eventcast_touch_status(void)
 {
     return touch_device_status;
 }
 
-void set_tethering_touch_status(int status)
+void set_eventcast_touch_status(int status)
 {
     touch_device_status = status;
-    send_tethering_touch_status_ecp();
+    send_eventcast_touch_status_ecp();
 }
 
 static void dump_display_image_data(struct encode_mem *image)
@@ -335,8 +272,8 @@ static bool send_display_image_data(void)
     bool ret = false;
     struct encode_mem *image = NULL;
 
-    Tethering__TouchMsg touch = TETHERING__TOUCH_MSG__INIT;
-    Tethering__DisplayMsg display = TETHERING__DISPLAY_MSG__INIT;
+    Eventcast__TouchMsg touch = EVENTCAST__TOUCH_MSG__INIT;
+    Eventcast__DisplayMsg display = EVENTCAST__DISPLAY_MSG__INIT;
 
     LOG_TRACE("enter: %s\n", __func__);
 
@@ -353,7 +290,7 @@ static bool send_display_image_data(void)
     display.imagedata.len = image->length;
     display.imagedata.data = image->buffer;
 
-    touch.type = TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG;
+    touch.type = EVENTCAST__TOUCH_MSG__TYPE__DISPLAY_MSG;
     touch.display = &display;
 
     ret = build_touch_msg(&touch);
@@ -363,5 +300,6 @@ static bool send_display_image_data(void)
     g_free(image);
 
     LOG_TRACE("leave: %s, ret: %d\n", __func__, ret);
+
     return ret;
 }
similarity index 82%
rename from tizen/src/tethering/touch.h
rename to tizen/src/eventcast/touch.h
index 251a68b..9d5a68d 100644 (file)
  *
  */
 
+#ifndef __EVENTCAST_TOUCH_H__
+#define __EVENTCAST_TOUCH_H__
+
 enum {
     ENCODE_WEBP = 0,
     ENCODE_PNG,
 };
 
-bool msgproc_tethering_touch_msg(void *message);
+bool msgproc_eventcast_touch_msg(void *message);
 
-int get_tethering_touch_status(void);
+int get_eventcast_touch_status(void);
 
-void set_tethering_touch_status(int status);
+void set_eventcast_touch_status(int status);
 
-void set_display_dirty(bool dirty);
+#endif /* __EVENTCAST_TOUCH_H__ */
index e0feeb0..592dfa4 100644 (file)
 #include "emulator_common.h"
 #include "maru_pm.h"
 
-#define MAX_IDE_BUS 2
-
-static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
-static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
-static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
-
 /* maru specialized device init */
 static void maru_device_init(void)
 {
index c983364..2fcf610 100644 (file)
@@ -34,7 +34,7 @@
 #include "util/sdb.h"
 
 /* define debug channel */
-MULTI_DEBUG_CHANNEL(tizen, maru_pm);
+MULTI_DEBUG_CHANNEL(tizen, power_mgr);
 
 ACPIREGS *maru_pm_ar;
 acpi_update_sci_fn maru_pm_update_sci;
index 511f6ae..408a68c 100644 (file)
@@ -1,8 +1,8 @@
-obj-y += maru_brillcodec_device.o
+obj-$(CONFIG_LIBAV) += maru_brillcodec_device.o
+obj-$(CONFIG_LIBAV) += maru_brillcodec.o
 ifdef CONFIG_LINUX
 LIBS += -ldl
 endif
-obj-y += maru_brillcodec.o
 obj-$(CONFIG_DXVA2) += maru_dxva2_plugin.o
 obj-$(CONFIG_VAAPI) += maru_brillcodec_vaapi.o
 
@@ -25,8 +25,8 @@ LIBS += -framework Cocoa -framework QTKit -framework CoreVideo
 LIBS += -framework AppKit
 endif
 
-maru_brillcodec.o-cflags := $(LIBAV_CFLAGS)
 maru_brillcodec_device.o-cflags := $(LIBAV_CFLAGS)
+maru_brillcodec.o-cflags := $(LIBAV_CFLAGS)
 ifdef CONFIG_DXVA2
 maru_dxva2_plugin.o-cflags := $(LIBAV_CFLAGS)
 endif
index 7cc309f..a6eb9a2 100644 (file)
@@ -39,7 +39,7 @@
 #include "skin/maruskin_server.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(tizen, maru-brightness);
+MULTI_DEBUG_CHANNEL(tizen, brightness);
 
 #define QEMU_DEV_NAME           "maru-brightness"
 
index 694dea4..882d833 100644 (file)
@@ -43,7 +43,7 @@
 #include "hw/maru_device_ids.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(tizen, maru-camera);
+MULTI_DEBUG_CHANNEL(tizen, camera);
 
 #define MARU_PCI_CAMERA_DEVICE_NAME     "maru-camera"
 
index 24c560f..3f9cec5 100644 (file)
@@ -32,7 +32,7 @@
 #include "maru_camera_darwin.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(tizen, camera_darwin);
+MULTI_DEBUG_CHANNEL(tizen, camera);
 
 static void UYVYToYUV420(unsigned char *bufsrc, unsigned char *bufdest,
                          int width, int height);
index 46df90c..b470da3 100644 (file)
@@ -38,7 +38,7 @@
 #include "maru_camera_darwin.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(tizen, maru-camera);
+MULTI_DEBUG_CHANNEL(tizen, camera);
 
 #define MARUCAM_THREAD_NAME    "marucam_worker_thread"
 
index c4e1340..406478b 100644 (file)
@@ -41,7 +41,7 @@
 #include <libv4l2.h>
 #include <libv4lconvert.h>
 
-MULTI_DEBUG_CHANNEL(tizen, maru-camera);
+MULTI_DEBUG_CHANNEL(tizen, camera);
 
 #define MARUCAM_THREAD_NAME    "marucam_worker_thread"
 
@@ -228,15 +228,17 @@ static void marucam_reset_controls(void)
     for (i = 0; i < ARRAY_SIZE(qctrl_tbl); i++) {
         if (qctrl_tbl[i].hit) {
             struct v4l2_control ctrl = {0,};
-            qctrl_tbl[i].hit = 0;
             ctrl.id = qctrl_tbl[i].id;
             ctrl.value = qctrl_tbl[i].init_val;
+            qctrl_tbl[i].hit = qctrl_tbl[i].init_val = 0;
+            qctrl_tbl[i].min = qctrl_tbl[i].max = qctrl_tbl[i].step = 0;
             if (xioctl(v4l2_fd, VIDIOC_S_CTRL, &ctrl) < 0) {
                 ERR("Failed to reset control value: id(0x%x), errstr(%s)\n",
                     ctrl.id, strerror(errno));
             }
         }
     }
+    TRACE("[%s] Reset done\n", __func__);
 }
 
 static int32_t value_convert_from_guest(int32_t min, int32_t max, int32_t value)
@@ -531,7 +533,6 @@ notify_buffer_ready(MaruCamState *state, uint32_t buf_index)
             return;
         }
         if (state->req_frame == 0) {
-            TRACE("There is no request\n");
             qemu_mutex_unlock(&state->thread_mutex);
             return;
         }
@@ -859,6 +860,8 @@ void marucam_device_open(MaruCamState *state)
           "errstr(%s)\n", dst_fmt.fmt.pix.pixelformat, dst_fmt.fmt.pix.width,
           dst_fmt.fmt.pix.height, strerror(errno));
         param->errCode = errno;
+        v4l2_close(v4l2_fd);
+        v4l2_fd = -1;
         return;
     }
     TRACE("Set the default format: w:h(%dx%d), fmt(0x%x), size(%d), "
@@ -1146,6 +1149,9 @@ void marucam_device_qctrl(MaruCamState *state)
     CLEAR(ctrl);
     ctrl.id = param->stack[0];
 
+    /* NOTICE: Tizen MMFW hardcoded for control name
+               Do Not Modified the name
+    */
     switch (ctrl.id) {
     case V4L2_CID_BRIGHTNESS:
         TRACE("Query : BRIGHTNESS\n");
@@ -1180,25 +1186,44 @@ void marucam_device_qctrl(MaruCamState *state)
         param->errCode = errno;
         return;
     } else {
-        struct v4l2_control sctrl;
+        struct v4l2_control sctrl, gctrl;
         CLEAR(sctrl);
-        sctrl.id = ctrl.id;
+        CLEAR(gctrl);
+        sctrl.id = gctrl.id = ctrl.id;
+        if (xioctl(v4l2_fd, VIDIOC_G_CTRL, &gctrl) < 0) {
+            ERR("[%s] Failed to get video control value: id(0x%x), "
+                "errstr(%s)\n",
+                __func__, gctrl.id, strerror(errno));
+            param->errCode = errno;
+            return;
+        }
+
+        qctrl_tbl[i].hit = 1;
+        qctrl_tbl[i].min = ctrl.minimum;
+        qctrl_tbl[i].max = ctrl.maximum;
+        qctrl_tbl[i].step = ctrl.step;
+        qctrl_tbl[i].init_val = gctrl.value;
+
         if ((ctrl.maximum + ctrl.minimum) == 0) {
             sctrl.value = 0;
         } else {
             sctrl.value = (ctrl.maximum + ctrl.minimum) / 2;
         }
+
         if (xioctl(v4l2_fd, VIDIOC_S_CTRL, &sctrl) < 0) {
-            ERR("Failed to set control value: id(0x%x), value(%d), "
-                "errstr(%s)\n", sctrl.id, sctrl.value, strerror(errno));
+            ERR("[%s] Failed to set control value: id(0x%x), value(%d), "
+                "errstr(%s)\n",
+                __func__, sctrl.id, sctrl.value, strerror(errno));
             param->errCode = errno;
             return;
         }
-        qctrl_tbl[i].hit = 1;
-        qctrl_tbl[i].min = ctrl.minimum;
-        qctrl_tbl[i].max = ctrl.maximum;
-        qctrl_tbl[i].step = ctrl.step;
-        qctrl_tbl[i].init_val = ctrl.default_value;
+
+        INFO("Query Control: id(0x%x), name(%s), min(%d), max(%d), "
+             "step(%d), def_value(%d)\n"
+             "flags(0x%x), get_value(%d), set_value(%d)\n",
+             ctrl.id, ctrl.name, ctrl.minimum, ctrl.maximum,
+             ctrl.step, ctrl.default_value, ctrl.flags,
+             gctrl.value, sctrl.value);
     }
 
     /* set fixed values by FW configuration file */
index 11e0e24..c38a785 100644 (file)
@@ -30,8 +30,6 @@
 #ifndef _MARU_CAMERA_INTERFACE_H_
 #define _MARU_CAMERA_INTERFACE_H_
 
-extern int hax_enabled(void);
-
 static const WCHAR HWCPinName[] = L"HWCInputPin\0";
 static const WCHAR HWCFilterName[] = L"HWCFilter\0";
 
index 719006f..72bfbbb 100644 (file)
@@ -29,6 +29,7 @@
 
 
 #include "qemu-common.h"
+#include "sysemu/hax.h"
 #include "maru_camera_common.h"
 #include "debug_ch.h"
 
@@ -39,7 +40,7 @@
 #include "mmsystem.h"    /* for MAKEFOURCC macro */
 #include "maru_camera_win32_interface.h"
 
-MULTI_DEBUG_CHANNEL(tizen, maru-camera);
+MULTI_DEBUG_CHANNEL(tizen, camera);
 
 /*
  * COM Interface implementations
diff --git a/tizen/src/hw/pci/maru_codec.c b/tizen/src/hw/pci/maru_codec.c
deleted file mode 100644 (file)
index 2c9b2db..0000000
+++ /dev/null
@@ -1,1690 +0,0 @@
-/*
- * Virtual Codec device
- *
- * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Contact:
- *  Kitae Kim <kt920.kim@samsung.com>
- *  SeokYeon Hwang <syeon.hwang@samsung.com>
- *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *  DongKyun Yun
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include "maru_codec.h"
-#include "qemu-common.h"
-
-#define MARU_CODEC_DEV_NAME     "codec"
-#define MARU_CODEC_VERSION      14
-
-/*  Needs 16M to support 1920x1080 video resolution.
- *  Output size for encoding has to be greater than (width * height * 6)
- */
-#define MARU_CODEC_MEM_SIZE     (2 * 16 * 1024 * 1024)
-#define MARU_CODEC_REG_SIZE     (256)
-#define MARU_CODEC_IRQ 0x7f
-
-#define GEN_MASK(x) ((1<<(x))-1)
-#define ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) & ~GEN_MASK(x))
-#define ROUND_UP_2(x) ROUND_UP_X(x, 1)
-#define ROUND_UP_4(x) ROUND_UP_X(x, 2)
-#define ROUND_UP_8(x) ROUND_UP_X(x, 3)
-#define DIV_ROUND_UP_X(v, x) (((v) + GEN_MASK(x)) >> (x))
-
-typedef struct PixFmtInfo {
-    uint8_t x_chroma_shift;
-    uint8_t y_chroma_shift;
-} PixFmtInfo;
-
-static PixFmtInfo pix_fmt_info[PIX_FMT_NB];
-
-/* define debug channel */
-MULTI_DEBUG_CHANNEL(qemu, marucodec);
-
-void codec_thread_init(SVCodecState *s)
-{
-    int index = 0;
-    QemuThread *pthread = NULL;
-    TRACE("Enter, %s\n", __func__);
-
-    pthread = g_malloc0(sizeof(QemuThread) * CODEC_MAX_THREAD);
-    if (!pthread) {
-        ERR("Failed to allocate wrk_thread memory.\n");
-        return;
-    }
-    qemu_cond_init(&s->codec_thread.cond);
-    qemu_mutex_init(&s->codec_thread.mutex);
-
-    qemu_mutex_lock(&s->thread_mutex);
-    s->isrunning = 1;
-    qemu_mutex_unlock(&s->thread_mutex);
-
-    for (; index < CODEC_MAX_THREAD; index++) {
-        qemu_thread_create(&pthread[index], codec_worker_thread, (void *)s,
-            QEMU_THREAD_JOINABLE);
-    }
-
-    s->codec_thread.wrk_thread = pthread;
-    TRACE("Leave, %s\n", __func__);
-}
-
-void codec_thread_exit(SVCodecState *s)
-{
-    TRACE("Enter, %s\n", __func__);
-    int index;
-
-    /* stop to run dedicated threads. */
-    s->isrunning = 0;
-
-    for (index = 0; index < CODEC_MAX_THREAD; index++) {
-        qemu_thread_join(&s->codec_thread.wrk_thread[index]);
-    }
-
-    TRACE("destroy mutex and conditional.\n");
-    qemu_mutex_destroy(&s->codec_thread.mutex);
-    qemu_cond_destroy(&s->codec_thread.cond);
-
-    TRACE("Leave, %s\n", __func__);
-}
-
-void wake_codec_worker_thread(SVCodecState *s)
-{
-    TRACE("Enter, %s\n", __func__);
-
-    qemu_cond_signal(&s->codec_thread.cond);
-    TRACE("sent a conditional signal to a worker thread.\n");
-
-    TRACE("Leave, %s\n", __func__);
-}
-
-void *codec_worker_thread(void *opaque)
-{
-    SVCodecState *s = (SVCodecState *)opaque;
-    QemuThread thread;
-    AVCodecContext *avctx;
-
-    TRACE("Enter, %s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    while (s->isrunning) {
-        TRACE("wait for conditional signal.\n");
-        qemu_cond_wait(&s->codec_thread.cond, &s->thread_mutex);
-
-        qemu_thread_get_self(&thread);
-#ifdef CONFIG_LINUX
-        TRACE("wake up a worker thread. :%x\n", thread.thread);
-#endif
-        avctx = s->codec_ctx[s->codec_param.ctx_index].avctx;
-        if (avctx) {
-            if (avctx->codec->decode) {
-                decode_codec(s);
-            } else {
-                encode_codec(s);
-            }
-        } else {
-            ERR("there is a synchrous problem "
-                "between each context.\n");
-            continue;
-        }
-
-        s->codec_thread.state = MARU_CODEC_IRQ;
-        qemu_bh_schedule(s->tx_bh);
-    }
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("Leave, %s\n", __func__);
-
-    return NULL;
-}
-
-int decode_codec(SVCodecState *s)
-{
-    AVCodecContext *avctx;
-    uint32_t len = 0, ctx_index;
-
-    TRACE("Enter, %s\n", __func__);
-
-    qemu_mutex_lock(&s->codec_thread.mutex);
-    ctx_index = s->codec_param.ctx_index;
-    qemu_mutex_unlock(&s->codec_thread.mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
-        len = qemu_avcodec_decode_video(s, ctx_index);
-    } else {
-        len = qemu_avcodec_decode_audio(s, ctx_index);
-    }
-
-    TRACE("Leave, %s\n", __func__);
-    return len;
-}
-
-int encode_codec(SVCodecState *s)
-{
-    AVCodecContext *avctx;
-    uint32_t len = 0, ctx_index;
-
-    TRACE("Enter, %s\n", __func__);
-
-    qemu_mutex_unlock(&s->thread_mutex);
-
-    ctx_index = s->codec_param.ctx_index;
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
-        len = qemu_avcodec_encode_video(s, ctx_index);
-    } else {
-        len = qemu_avcodec_encode_audio(s, ctx_index);
-    }
-
-    qemu_mutex_lock(&s->thread_mutex);
-
-    TRACE("Leave, %s\n", __func__);
-    return len;
-}
-
-static int qemu_serialize_rational(const AVRational *elem, uint8_t *buff)
-{
-    int size = 0;
-
-    memcpy(buff + size, &elem->num, sizeof(elem->num));
-    size += sizeof(elem->num);
-    memcpy(buff + size, &elem->den, sizeof(elem->den));
-    size += sizeof(elem->den);
-
-    return size;
-}
-
-static int qemu_deserialize_rational(const uint8_t *buff, AVRational *elem)
-{
-    int size = 0;
-
-    memset(elem, 0, sizeof(*elem));
-
-    memcpy(&elem->num, buff + size, sizeof(elem->num));
-    size += sizeof(elem->num);
-    memcpy(&elem->den, buff + size, sizeof(elem->den));
-    size += sizeof(elem->den);
-
-    return size;
-}
-
-static int qemu_serialize_frame(const AVFrame *elem, uint8_t *buff)
-{
-    int size = 0;
-
-    memcpy(buff + size, &elem->key_frame, sizeof(elem->key_frame));
-    size += sizeof(elem->key_frame);
-    memcpy(buff + size, &elem->pict_type, sizeof(elem->pict_type));
-    size += sizeof(elem->pict_type);
-    memcpy(buff + size, &elem->pts, sizeof(elem->pts));
-    size += sizeof(elem->pts);
-    memcpy(buff + size, &elem->coded_picture_number,
-            sizeof(elem->coded_picture_number));
-    size += sizeof(elem->coded_picture_number);
-    memcpy(buff + size, &elem->display_picture_number,
-            sizeof(elem->display_picture_number));
-    size += sizeof(elem->display_picture_number);
-    memcpy(buff + size, &elem->quality, sizeof(elem->quality));
-    size += sizeof(elem->quality);
-    memcpy(buff + size, &elem->age, sizeof(elem->age));
-    size += sizeof(elem->age);
-    memcpy(buff + size, &elem->reference, sizeof(elem->reference));
-    size += sizeof(elem->reference);
-    memcpy(buff + size, &elem->reordered_opaque,
-            sizeof(elem->reordered_opaque));
-    size += sizeof(elem->reordered_opaque);
-    memcpy(buff + size, &elem->repeat_pict, sizeof(elem->repeat_pict));
-    size += sizeof(elem->repeat_pict);
-    memcpy(buff + size, &elem->interlaced_frame,
-            sizeof(elem->interlaced_frame));
-    size += sizeof(elem->interlaced_frame);
-
-    return size;
-}
-
-static int qemu_deserialize_frame(const uint8_t *buff, AVFrame *elem)
-{
-    int size = 0;
-
-    memset(elem, 0, sizeof(*elem));
-
-    memcpy(&elem->linesize, buff + size, sizeof(elem->linesize));
-    size += sizeof(elem->linesize);
-    memcpy(&elem->key_frame, buff + size, sizeof(elem->key_frame));
-    size += sizeof(elem->key_frame);
-    memcpy(&elem->pict_type, buff + size, sizeof(elem->pict_type));
-    size += sizeof(elem->pict_type);
-    memcpy(&elem->pts, buff + size, sizeof(elem->pts));
-    size += sizeof(elem->pts);
-    memcpy(&elem->coded_picture_number, buff + size,
-            sizeof(elem->coded_picture_number));
-    size += sizeof(elem->coded_picture_number);
-    memcpy(&elem->display_picture_number, buff + size,
-            sizeof(elem->display_picture_number));
-    size += sizeof(elem->display_picture_number);
-    memcpy(&elem->quality, buff + size, sizeof(elem->quality));
-    size += sizeof(elem->quality);
-    memcpy(&elem->age, buff + size, sizeof(elem->age));
-    size += sizeof(elem->age);
-    memcpy(&elem->reference, buff + size, sizeof(elem->reference));
-    size += sizeof(elem->reference);
-    memcpy(&elem->qstride, buff + size, sizeof(elem->qstride));
-    size += sizeof(elem->qstride);
-    memcpy(&elem->motion_subsample_log2, buff + size,
-            sizeof(elem->motion_subsample_log2));
-    size += sizeof(elem->motion_subsample_log2);
-    memcpy(&elem->error, buff + size, sizeof(elem->error));
-    size += sizeof(elem->error);
-    memcpy(&elem->type, buff + size, sizeof(elem->type));
-    size += sizeof(elem->type);
-    memcpy(&elem->repeat_pict, buff + size, sizeof(elem->repeat_pict));
-    size += sizeof(elem->repeat_pict);
-    memcpy(&elem->qscale_type, buff + size, sizeof(elem->qscale_type));
-    size += sizeof(elem->qscale_type);
-    memcpy(&elem->interlaced_frame, buff + size,
-            sizeof(elem->interlaced_frame));
-    size += sizeof(elem->interlaced_frame);
-    memcpy(&elem->top_field_first, buff + size, sizeof(elem->top_field_first));
-    size += sizeof(elem->top_field_first);
-    memcpy(&elem->palette_has_changed, buff + size,
-            sizeof(elem->palette_has_changed));
-    size += sizeof(elem->palette_has_changed);
-    memcpy(&elem->buffer_hints, buff + size, sizeof(elem->buffer_hints));
-    size += sizeof(elem->buffer_hints);
-    memcpy(&elem->reordered_opaque, buff + size,
-            sizeof(elem->reordered_opaque));
-    size += sizeof(elem->reordered_opaque);
-
-    return size;
-}
-
-void qemu_parser_init(SVCodecState *s, int ctx_index)
-{
-    TRACE("[%s] Enter\n", __func__);
-
-    s->codec_ctx[ctx_index].parser_buf = NULL;
-    s->codec_ctx[ctx_index].parser_use = false;
-
-    TRACE("[%s] Leave\n", __func__);
-}
-
-void qemu_reset_codec_info(SVCodecState *s, uint32_t value)
-{
-    int ctx_idx;
-
-    TRACE("[%s] Enter\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    for (ctx_idx = 0; ctx_idx < CODEC_CONTEXT_MAX; ctx_idx++) {
-        if (s->codec_ctx[ctx_idx].file_index == value) {
-            TRACE("reset %d context\n", ctx_idx);
-            qemu_mutex_unlock(&s->thread_mutex);
-            qemu_av_free(s, ctx_idx);
-            qemu_mutex_lock(&s->thread_mutex);
-            s->codec_ctx[ctx_idx].avctx_use = false;
-            break;
-        }
-    }
-    qemu_parser_init(s, ctx_idx);
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("[%s] Leave\n", __func__);
-}
-
-/* void av_register_all() */
-void qemu_av_register_all(void)
-{
-    av_register_all();
-    TRACE("av_register_all\n");
-}
-
-/* int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic) */
-int qemu_avcodec_get_buffer(AVCodecContext *context, AVFrame *picture)
-{
-    int ret;
-    TRACE("avcodec_default_get_buffer\n");
-
-    picture->reordered_opaque = context->reordered_opaque;
-    picture->opaque = NULL;
-
-    ret = avcodec_default_get_buffer(context, picture);
-
-    return ret;
-}
-
-/* void avcodec_default_release_buffer(AVCodecContext *ctx, AVFrame *frame) */
-void qemu_avcodec_release_buffer(AVCodecContext *context, AVFrame *picture)
-{
-    TRACE("avcodec_default_release_buffer\n");
-    avcodec_default_release_buffer(context, picture);
-}
-
-static void qemu_init_pix_fmt_info(void)
-{
-    /* YUV formats */
-    pix_fmt_info[PIX_FMT_YUV420P].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUV420P].y_chroma_shift = 1;
-
-    pix_fmt_info[PIX_FMT_YUV422P].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUV422P].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_YUV444P].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUV444P].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_YUYV422].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUYV422].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_YUV410P].x_chroma_shift = 2;
-    pix_fmt_info[PIX_FMT_YUV410P].y_chroma_shift = 2;
-
-    pix_fmt_info[PIX_FMT_YUV411P].x_chroma_shift = 2;
-    pix_fmt_info[PIX_FMT_YUV411P].y_chroma_shift = 0;
-
-    /* JPEG YUV */
-    pix_fmt_info[PIX_FMT_YUVJ420P].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUVJ420P].y_chroma_shift = 1;
-
-    pix_fmt_info[PIX_FMT_YUVJ422P].x_chroma_shift = 1;
-    pix_fmt_info[PIX_FMT_YUVJ422P].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_YUVJ444P].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_YUVJ444P].y_chroma_shift = 0;
-
-    /* RGB formats */
-    pix_fmt_info[PIX_FMT_RGB24].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_RGB24].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_BGR24].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_BGR24].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_RGB32].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_RGB32].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_RGB565].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_RGB565].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_RGB555].x_chroma_shift = 0;
-    pix_fmt_info[PIX_FMT_RGB555].y_chroma_shift = 0;
-
-    pix_fmt_info[PIX_FMT_YUVA420P].x_chroma_shift = 1,
-    pix_fmt_info[PIX_FMT_YUVA420P].y_chroma_shift = 1;
-}
-
-static uint8_t *qemu_malloc_avpicture (int picture_size)
-{
-    uint8_t *ptr = NULL;
-
-    ptr = av_mallocz(picture_size);
-    if (!ptr) {
-        ERR("failed to allocate memory.\n");
-        return NULL;
-    }
-
-    return ptr;
-}
-
-static int qemu_avpicture_fill(AVPicture *picture, uint8_t *ptr,
-                                int pix_fmt, int width,
-                                int height, bool encode)
-{
-    int size, w2, h2, size2;
-    int stride, stride2;
-    int fsize;
-    PixFmtInfo *pinfo;
-
-    pinfo = &pix_fmt_info[pix_fmt];
-
-    switch (pix_fmt) {
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV411P:
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUVJ444P:
-        stride = ROUND_UP_4(width);
-        h2 = ROUND_UP_X(height, pinfo->y_chroma_shift);
-        size = stride * h2;
-        w2 = DIV_ROUND_UP_X(width, pinfo->x_chroma_shift);
-        stride2 = ROUND_UP_4(w2);
-        h2 = DIV_ROUND_UP_X(height, pinfo->y_chroma_shift);
-        size2 = stride2 * h2;
-        fsize = size + 2 * size2;
-        TRACE("stride: %d, stride2: %d, size: %d, size2: %d, fsize: %d\n",
-            stride, stride2, size, size2, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = picture->data[0] + size;
-        picture->data[2] = picture->data[1] + size2;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = stride2;
-        picture->linesize[2] = stride2;
-        picture->linesize[3] = 0;
-        TRACE("planes %d %d %d\n", 0, size, size + size2);
-        TRACE("strides %d %d %d\n", stride, stride2, stride2);
-        break;
-    case PIX_FMT_YUVA420P:
-        stride = ROUND_UP_4 (width);
-        h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-        size = stride * h2;
-        w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-        stride2 = ROUND_UP_4 (w2);
-        h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-        size2 = stride2 * h2;
-        fsize = 2 * size + 2 * size2;
-        TRACE("stride %d, stride2 %d, size %d, size2 %d, fsize %d\n",
-            stride, stride2, size, size2, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = picture->data[0] + size;
-        picture->data[2] = picture->data[1] + size2;
-        picture->data[3] = picture->data[2] + size2;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = stride2;
-        picture->linesize[2] = stride2;
-        picture->linesize[3] = stride;
-        TRACE("planes %d %d %d %d\n", 0, size, size + size2, size + 2 * size2);
-        TRACE("strides %d %d %d %d\n", stride, stride2, stride2, stride);
-        break;
-    case PIX_FMT_RGB24:
-    case PIX_FMT_BGR24:
-        stride = ROUND_UP_4 (width * 3);
-        fsize = stride * height;
-        TRACE("stride: %d, fsize: %d\n", stride, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_RGB32:
-        stride = width * 4;
-        fsize = stride * height;
-        TRACE("stride: %d, fsize: %d\n", stride, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_RGB555:
-    case PIX_FMT_RGB565:
-    case PIX_FMT_YUYV422:
-    case PIX_FMT_UYVY422:
-        stride = ROUND_UP_4 (width * 2);
-        fsize = stride * height;
-        TRACE("stride: %d, fsize: %d\n", stride, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_UYYVYY411:
-        /* FIXME, probably not the right stride */
-        stride = ROUND_UP_4 (width);
-        size = stride * height;
-        fsize = size + size / 2;
-        TRACE("stride %d, size %d, fsize %d\n", stride, size, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = width + width / 2;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_GRAY8:
-        stride = ROUND_UP_4 (width);
-        fsize = stride * height;
-        TRACE("stride %d, fsize %d\n", stride, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_MONOWHITE:
-    case PIX_FMT_MONOBLACK:
-        stride = ROUND_UP_4 ((width + 7) >> 3);
-        fsize = stride * height;
-        TRACE("stride %d, fsize %d\n", stride, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 0;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    case PIX_FMT_PAL8:
-        /* already forced to be with stride, so same result as other function */
-        stride = ROUND_UP_4 (width);
-        size = stride * height;
-        fsize = size + 256 * 4;
-        TRACE("stride %d, size %d, fsize %d\n", stride, size, fsize);
-        if (!encode && !ptr) {
-            ptr = qemu_malloc_avpicture(fsize);
-        }
-        picture->data[0] = ptr;
-        picture->data[1] = ptr + size;    /* palette is stored here as 256 32 bit words */
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        picture->linesize[0] = stride;
-        picture->linesize[1] = 4;
-        picture->linesize[2] = 0;
-        picture->linesize[3] = 0;
-        break;
-    default:
-        picture->data[0] = NULL;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        fsize = -1;
-        ERR("pixel format: %d was wrong.\n", pix_fmt);
-        break;
-    }
-
-    return fsize;
-}
-
-/* int avcodec_open(AVCodecContext *avctx, AVCodec *codec) */
-int qemu_avcodec_open(SVCodecState *s)
-{
-    AVCodecContext *avctx;
-    AVCodec *codec;
-    enum CodecID codec_id;
-    off_t offset;
-    int ret = -1;
-    int bEncode = 0;
-    int size = 0;
-    int ctx_index = 0;
-
-    av_register_all();
-    TRACE("av_register_all\n");
-
-    ctx_index = qemu_avcodec_alloc_context(s);
-    if (ctx_index < 0) {
-        return ret;
-    }
-
-    qemu_mutex_lock(&s->thread_mutex);
-    offset = s->codec_param.mmap_offset;
-    qemu_mutex_unlock(&s->thread_mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (!avctx) {
-        ERR("[%s] %d of AVCodecContext is NULL!\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return ret;
-    }
-
-    TRACE("[%s] Context Index:%d, offset:%d\n", __func__, ctx_index, offset);
-    memcpy(&avctx->bit_rate, (uint8_t *)s->vaddr + offset, sizeof(int));
-    size = sizeof(int);
-    memcpy(&avctx->bit_rate_tolerance,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->flags, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    size += qemu_deserialize_rational((uint8_t *)s->vaddr + offset + size,
-                                        &avctx->time_base);
-    memcpy(&avctx->width, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->height, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->gop_size, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->pix_fmt, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->sample_rate,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->channels, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->codec_tag, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->block_align,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->rc_strategy,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->strict_std_compliance,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->rc_qsquish,
-            (uint8_t *)s->vaddr + offset + size, sizeof(float));
-    size += sizeof(float);
-    size += qemu_deserialize_rational((uint8_t *)s->vaddr + offset + size,
-            &avctx->sample_aspect_ratio);
-    memcpy(&avctx->qmin, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->qmax, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->pre_me, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->trellis, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&avctx->extradata_size,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&codec_id, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&bEncode, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    TRACE("Context Index:%d, width:%d, height:%d\n",
-            ctx_index, avctx->width, avctx->height);
-
-    if (avctx->extradata_size > 0) {
-        avctx->extradata = (uint8_t *)av_mallocz(avctx->extradata_size +
-                             ROUND_UP_X(FF_INPUT_BUFFER_PADDING_SIZE, 4));
-        memcpy(avctx->extradata,
-                (uint8_t *)s->vaddr + offset + size, avctx->extradata_size);
-        size += avctx->extradata_size;
-    } else {
-        TRACE("[%s] allocate dummy extradata\n", __func__);
-        avctx->extradata =
-                av_mallocz(ROUND_UP_X(FF_INPUT_BUFFER_PADDING_SIZE, 4));
-    }
-
-    if (bEncode) {
-        TRACE("[%s] find encoder :%d\n", __func__, codec_id);
-        codec = avcodec_find_encoder(codec_id);
-    } else {
-        TRACE("[%s] find decoder :%d\n", __func__, codec_id);
-        codec = avcodec_find_decoder(codec_id);
-    }
-
-    if (!codec) {
-        ERR("[%s] failed to find codec of %d\n", __func__, codec_id);
-    }
-
-    if (codec->type == AVMEDIA_TYPE_AUDIO) {
-        s->codec_ctx[ctx_index].mem_index = s->codec_param.mem_index;
-        TRACE("set mem_index: %d into ctx_index: %d.\n",
-            s->codec_ctx[ctx_index].mem_index, ctx_index);
-    }
-
-#if 0
-    avctx->get_buffer = qemu_avcodec_get_buffer;
-    avctx->release_buffer = qemu_avcodec_release_buffer;
-#endif
-
-    ret = avcodec_open(avctx, codec);
-    if (ret != 0) {
-        ERR("[%s] avcodec_open failure, %d\n", __func__, ret);
-    }
-
-    memcpy((uint8_t *)s->vaddr + offset, &ctx_index, sizeof(int));
-    size = sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->pix_fmt, sizeof(int));
-    size += sizeof(int);
-    size += qemu_serialize_rational(&avctx->time_base,
-            (uint8_t *)s->vaddr + offset + size);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->channels, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->sample_fmt, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->codec_type, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->codec_id, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->coded_width, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->coded_height, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->ticks_per_frame, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->chroma_sample_location, sizeof(int));
-    size += sizeof(int);
-#if 0
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            avctx->priv_data, codec->priv_data_size);
-    size += codec->priv_data_size;
-#endif
-    memcpy((uint8_t *)s->vaddr + offset + size, &ret, sizeof(int));
-    size += sizeof(int);
-
-    TRACE("Leave, %s\n", __func__);
-    return ret;
-}
-
-/* int avcodec_close(AVCodecContext *avctx) */
-int qemu_avcodec_close(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx;
-    off_t offset;
-    int ret = -1;
-
-    TRACE("Enter, %s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    offset = s->codec_param.mmap_offset;
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (!avctx) {
-        ERR("[%s] %d of AVCodecContext is NULL\n", __func__, ctx_index);
-        memcpy((uint8_t *)s->vaddr + offset, &ret, sizeof(int));
-        qemu_mutex_unlock(&s->thread_mutex);
-        return ret;
-    }
-
-    ret = avcodec_close(avctx);
-    TRACE("after avcodec_close. ret:%d\n", ret);
-
-    memcpy((uint8_t *)s->vaddr + offset, &ret, sizeof(int));
-
-    qemu_mutex_unlock(&s->thread_mutex);
-
-    TRACE("[%s] Leave\n", __func__);
-    return ret;
-}
-
-/* AVCodecContext* avcodec_alloc_context (void) */
-int qemu_avcodec_alloc_context(SVCodecState *s)
-{
-    int index;
-
-    TRACE("[%s] Enter\n", __func__);
-
-    for (index = 0; index < CODEC_CONTEXT_MAX; index++) {
-        if (s->codec_ctx[index].avctx_use == false) {
-            TRACE("Succeeded to get %d of context.\n", index);
-            s->codec_ctx[index].avctx_use = true;
-            break;
-        }
-        TRACE("Failed to get context.\n");
-    }
-
-    if (index == CODEC_CONTEXT_MAX) {
-        ERR("Failed to get available codec context.");
-        ERR(" Try to run codec again.\n");
-        return -1;
-    }
-
-    TRACE("allocate %d of context and frame.\n", index);
-    s->codec_ctx[index].avctx = avcodec_alloc_context();
-    s->codec_ctx[index].frame = avcodec_alloc_frame();
-
-    s->codec_ctx[index].file_index = s->codec_param.file_index;
-    qemu_parser_init(s, index);
-    qemu_init_pix_fmt_info();
-
-    TRACE("[%s] Leave\n", __func__);
-
-    return index;
-}
-
-/* void av_free(void *ptr) */
-void qemu_av_free(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx;
-    AVFrame *avframe;
-
-    TRACE("enter %s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    avframe = s->codec_ctx[ctx_index].frame;
-
-    if (avctx && avctx->palctrl) {
-        av_free(avctx->palctrl);
-        avctx->palctrl = NULL;
-    }
-
-    if (avctx && avctx->extradata) {
-        TRACE("free extradata\n");
-        av_free(avctx->extradata);
-        avctx->extradata = NULL;
-    }
-
-    if (avctx && avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
-        int audio_idx = s->codec_ctx[ctx_index].mem_index;
-        TRACE("reset audio mem_idex: %d\n", __LINE__, audio_idx);
-        s->audio_codec_offset[audio_idx] = 0;
-    }
-
-    if (avctx) {
-        TRACE("free codec context of %d.\n", ctx_index);
-        av_free(avctx);
-        s->codec_ctx[ctx_index].avctx = NULL;
-    }
-
-    if (avframe) {
-        TRACE("free codec frame of %d.\n", ctx_index);
-        av_free(avframe);
-        s->codec_ctx[ctx_index].frame = NULL;
-    }
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("leave %s\n", __func__);
-}
-
-/* void avcodec_flush_buffers(AVCodecContext *avctx) */
-void qemu_avcodec_flush_buffers(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx;
-
-    TRACE("Enter\n");
-    qemu_mutex_lock(&s->thread_mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (avctx) {
-        avcodec_flush_buffers(avctx);
-    } else {
-        ERR("[%s] %d of AVCodecContext is NULL\n", __func__, ctx_index);
-    }
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("[%s] Leave\n", __func__);
-}
-
-/* int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
- *                          int *got_picture_ptr, const uint8_t *buf,
- *                          int buf_size)
- */
-int qemu_avcodec_decode_video(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx;
-    AVFrame *picture;
-    AVPacket avpkt;
-    int got_picture_ptr;
-    uint8_t *buf;
-    uint8_t *parser_buf;
-    bool parser_use;
-    int buf_size;
-    int size = 0;
-    int ret = -1;
-    off_t offset;
-
-    TRACE("Enter, %s\n", __func__);
-    qemu_mutex_lock(&s->codec_thread.mutex);
-
-    TRACE("[%s] Video Context Index : %d\n", __func__, ctx_index);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    picture = s->codec_ctx[ctx_index].frame;
-    if (!avctx || !picture) {
-        ERR("[%s] %d of Context or Frame is NULL!\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->codec_thread.mutex);
-        return ret;
-    }
-
-    offset = s->codec_param.mmap_offset;
-
-    parser_buf = s->codec_ctx[ctx_index].parser_buf;
-    parser_use = s->codec_ctx[ctx_index].parser_use;
-    TRACE("[%s] Parser Buffer : %p, Parser:%d\n", __func__,
-            parser_buf, parser_use);
-
-    memcpy(&avctx->reordered_opaque,
-            (uint8_t *)s->vaddr + offset, sizeof(int64_t));
-    size = sizeof(int64_t);
-    memcpy(&avctx->skip_frame,
-            (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-    memcpy(&buf_size, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-
-    picture->reordered_opaque = avctx->reordered_opaque;
-
-    if (parser_buf && parser_use) {
-        buf = parser_buf;
-    } else if (buf_size > 0) {
-        TRACE("[%s] not use parser, codec_id:%x\n", __func__, avctx->codec_id);
-        buf = (uint8_t *)s->vaddr + offset + size;
-        size += buf_size;
-    } else {
-        TRACE("There is no input buffer\n");
-        buf = NULL;
-    }
-
-    memset(&avpkt, 0, sizeof(AVPacket));
-    avpkt.data = buf;
-    avpkt.size = buf_size;
-    TRACE("packet buf:%p, size:%d\n", buf, buf_size);
-
-    ret = avcodec_decode_video2(avctx, picture, &got_picture_ptr, &avpkt);
-
-    TRACE("[%s] after decoding video, ret:%d\n", __func__, ret);
-    if (ret < 0) {
-        ERR("[%s] failed to decode video!!, ret:%d\n", __func__, ret);
-    } else {
-        if (ret == 0) {
-            TRACE("[%s] no frame. packet size:%d\n", __func__, avpkt.size);
-        }
-        TRACE("decoded frame number:%d\n", avctx->frame_number);
-    }
-
-    memcpy((uint8_t *)s->vaddr + offset, &avctx->pix_fmt, sizeof(int));
-    size = sizeof(int);
-    size += qemu_serialize_rational(&avctx->time_base,
-                                    (uint8_t *)s->vaddr + offset + size);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->width, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->height, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->has_b_frames, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->frame_number, sizeof(int));
-    size += sizeof(int);
-    size += qemu_serialize_rational(&avctx->sample_aspect_ratio,
-                                    (uint8_t *)s->vaddr + offset + size);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->internal_buffer_count, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->profile, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->level, sizeof(int));
-    size += sizeof(int);
-    size += qemu_serialize_frame(picture, (uint8_t *)s->vaddr + offset + size);
-
-    memcpy((uint8_t *)s->vaddr + offset + size, &got_picture_ptr, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &ret, sizeof(int));
-    size += sizeof(int);
-
-#if 0
-    memcpy((uint8_t *)s->vaddr + offset + size, dst.data[0], numbytes);
-    av_free(buffer);
-
-    if (parser_buf && parser_use) {
-        TRACE("[%s] Free input buffer after decoding video\n", __func__);
-        TRACE("[%s] input buffer : %p, %p\n",
-            __func__, avpkt.data, parser_buf);
-        av_free(avpkt.data);
-        s->codec_ctx[ctx_index].parser_buf = NULL;
-    }
-#endif
-
-    qemu_mutex_unlock(&s->codec_thread.mutex);
-    TRACE("Leave, %s\n", __func__);
-
-    return ret;
-}
-
-/* int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf,
- *                          int buf_size, const AVFrame *pict)
- */
-int qemu_avcodec_encode_video(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx = NULL;
-    AVFrame *pict = NULL;
-    uint8_t *inputBuf = NULL;
-    int outbufSize = 0;
-    int bPict = -1;
-    int size = 0;
-    int ret = -1;
-    off_t offset;
-
-    TRACE("Enter, %s\n", __func__);
-    qemu_mutex_lock(&s->codec_thread.mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    pict = s->codec_ctx[ctx_index].frame;
-    if (!avctx || !pict) {
-        ERR("[%s] %d of Context or Frame is NULL\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return ret;
-    }
-
-    offset = s->codec_param.mmap_offset;
-
-    size = sizeof(int);
-    memcpy(&bPict, (uint8_t *)s->vaddr + offset, size);
-    TRACE("[%s] avframe is :%d\n", __func__, bPict);
-
-    if (bPict == 0) {
-        memcpy(&outbufSize, (uint8_t *)s->vaddr + offset + size, size);
-        size += sizeof(int);
-        size +=
-            qemu_deserialize_frame((uint8_t *)s->vaddr + offset + size, pict);
-
-        inputBuf = (uint8_t *)s->vaddr + offset + size;
-        if (!inputBuf) {
-            ERR("[%s] failed to get input buffer\n", __func__);
-            return ret;
-        }
-
-        ret = qemu_avpicture_fill((AVPicture *)pict, inputBuf, avctx->pix_fmt,
-                            avctx->width, avctx->height, true);
-
-        if (ret < 0) {
-            ERR("after avpicture_fill, ret:%d\n", ret);
-        }
-        TRACE("before encode video, ticks_per_frame:%d, pts:%lld\n",
-               avctx->ticks_per_frame, pict->pts);
-    } else {
-        TRACE("flush encoded buffers\n");
-        pict = NULL;
-    }
-
-    ret = avcodec_encode_video(avctx, (uint8_t *)s->vaddr + offset,
-                                outbufSize, pict);
-    TRACE("encode video, ret:%d, pts:%lld, outbuf size:%d\n",
-            ret, pict->pts, outbufSize);
-
-    if (ret < 0) {
-        ERR("failed to encode video.\n");
-    }
-
-    memcpy((uint8_t *)s->vaddr + offset + outbufSize, &ret, sizeof(int));
-
-    qemu_mutex_unlock(&s->codec_thread.mutex);
-    TRACE("Leave, %s\n", __func__);
-
-    return ret;
-}
-
-/*
- *  int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
- *                            int *frame_size_ptr, AVPacket *avpkt)
- */
-int qemu_avcodec_decode_audio(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx;
-    AVPacket avpkt;
-    int16_t *samples;
-    int frame_size_ptr;
-    uint8_t *buf;
-    uint8_t *parser_buf;
-    bool parser_use;
-    int buf_size, outbuf_size;
-    int size;
-    int ret = -1;
-    off_t offset;
-
-    TRACE("Enter, %s\n", __func__);
-
-    TRACE("Audio Context Index : %d\n", ctx_index);
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (!avctx) {
-        ERR("[%s] %d of Context is NULL!\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->codec_thread.mutex);
-        return ret;
-    }
-
-    if (!avctx->codec) {
-        ERR("[%s] %d of Codec is NULL\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->codec_thread.mutex);
-        return ret;
-    }
-
-    offset = s->codec_param.mmap_offset;
-
-    parser_buf = s->codec_ctx[ctx_index].parser_buf;
-    parser_use = s->codec_ctx[ctx_index].parser_use;
-
-    memcpy(&buf_size, (uint8_t *)s->vaddr + offset, sizeof(int));
-    size = sizeof(int);
-    if (parser_buf && parser_use) {
-        TRACE("[%s] use parser, buf:%p codec_id:%x\n",
-                __func__, parser_buf, avctx->codec_id);
-        buf = parser_buf;
-    } else if (buf_size > 0) {
-        TRACE("[%s] not use parser, codec_id:%x\n", __func__, avctx->codec_id);
-        buf = (uint8_t *)s->vaddr + offset + size;
-        size += buf_size;
-    } else {
-        TRACE("no input buffer\n");
-        buf = NULL;
-    }
-
-    av_init_packet(&avpkt);
-    avpkt.data = buf;
-    avpkt.size = buf_size;
-
-    frame_size_ptr = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-    outbuf_size = frame_size_ptr;
-    samples = av_malloc(frame_size_ptr);
-
-    ret = avcodec_decode_audio3(avctx, samples, &frame_size_ptr, &avpkt);
-    TRACE("after decoding audio!, ret:%d\n", ret);
-
-    memcpy((uint8_t *)s->vaddr + offset, &avctx->bit_rate, sizeof(int));
-    size = sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->sample_rate, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->channels, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-        &avctx->channel_layout, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy((uint8_t *)s->vaddr + offset + size, &avctx->sub_id, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->frame_size, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size,
-            &avctx->frame_number, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, samples, outbuf_size);
-    size += outbuf_size;
-    memcpy((uint8_t *)s->vaddr + offset + size, &frame_size_ptr, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &ret, sizeof(int));
-    size += sizeof(int);
-
-    TRACE("before free input buffer and output buffer!\n");
-    if (samples) {
-        TRACE("release allocated audio buffer.\n");
-        av_free(samples);
-        samples = NULL;
-    }
-
-    if (parser_buf && parser_use) {
-        TRACE("[%s] free parser buf\n", __func__);
-        av_free(avpkt.data);
-        s->codec_ctx[ctx_index].parser_buf = NULL;
-    }
-
-    TRACE("[%s] Leave\n", __func__);
-
-    return ret;
-}
-
-int qemu_avcodec_encode_audio(SVCodecState *s, int ctx_index)
-{
-    WARN("[%s] Does not support audio encoder using FFmpeg\n", __func__);
-    return 0;
-}
-
-/* void av_picture_copy(AVPicture *dst, const AVPicture *src,
- *                      enum PixelFormat pix_fmt, int width, int height)
- */
-void qemu_av_picture_copy(SVCodecState *s, int ctx_index)
-{
-    AVCodecContext *avctx = NULL;
-    AVPicture dst;
-    AVPicture *src = NULL;
-    int numBytes = 0;
-    uint8_t *buffer = NULL;
-    off_t offset = 0;
-
-    TRACE("Enter :%s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    src = (AVPicture *)s->codec_ctx[ctx_index].frame;
-    if (!avctx && !src) {
-        ERR("[%s] %d of context or frame is NULL\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return;
-    }
-
-    offset = s->codec_param.mmap_offset;
-
-    numBytes = qemu_avpicture_fill(&dst, NULL, avctx->pix_fmt,
-                                  avctx->width, avctx->height, false);
-    TRACE("after avpicture_fill: %d\n", numBytes);
-    if (numBytes < 0) {
-        ERR("picture size:%d is wrong.\n", numBytes);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return;
-    }
-
-    av_picture_copy(&dst, src, avctx->pix_fmt, avctx->width, avctx->height);
-    buffer = dst.data[0];
-    memcpy((uint8_t *)s->vaddr + offset, buffer, numBytes);
-    TRACE("after copy image buffer from host to guest.\n");
-
-    if (buffer) {
-        TRACE("release allocated video frame.\n");
-        av_free(buffer);
-    }
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("Leave :%s\n", __func__);
-}
-
-/* AVCodecParserContext *av_parser_init(int codec_id) */
-void qemu_av_parser_init(SVCodecState *s, int ctx_index)
-{
-    AVCodecParserContext *parser_ctx = NULL;
-    AVCodecContext *avctx;
-
-    TRACE("Enter :%s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (!avctx) {
-        ERR("[%s] %d of AVCodecContext is NULL!!\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return;
-    }
-
-    TRACE("before av_parser_init, codec_type:%d codec_id:%x\n",
-            avctx->codec_type, avctx->codec_id);
-
-    parser_ctx = av_parser_init(avctx->codec_id);
-    if (parser_ctx) {
-        TRACE("[%s] using parser\n", __func__);
-        s->codec_ctx[ctx_index].parser_use = true;
-    } else {
-        TRACE("[%s] no parser\n", __func__);
-        s->codec_ctx[ctx_index].parser_use = false;
-    }
-    s->codec_ctx[ctx_index].parser_ctx = parser_ctx;
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("[%s] Leave\n", __func__);
-}
-
-/* int av_parser_parse(AVCodecParserContext *s, AVCodecContext *avctx,
- *                     uint8_t **poutbuf, int *poutbuf_size,
- *                     const uint8_t *buf, int buf_size,
- *                     int64_t pts, int64_t dts)
- */
-int qemu_av_parser_parse(SVCodecState *s, int ctx_index)
-{
-    AVCodecParserContext *parser_ctx = NULL;
-    AVCodecContext *avctx = NULL;
-    uint8_t *poutbuf;
-    int poutbuf_size = 0;
-    uint8_t *inbuf = NULL;
-    int inbuf_size;
-    int64_t pts;
-    int64_t dts;
-    int64_t pos;
-    int size, ret = -1;
-    off_t offset;
-
-    TRACE("Enter %s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    parser_ctx = s->codec_ctx[ctx_index].parser_ctx;
-    avctx = s->codec_ctx[ctx_index].avctx;
-    if (!avctx) {
-        ERR("[%s] %d of AVCodecContext is NULL\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return ret;
-    }
-
-    if (!parser_ctx) {
-        ERR("[%s] %d of AVCodecParserContext is NULL\n", __func__, ctx_index);
-        qemu_mutex_unlock(&s->thread_mutex);
-        return ret;
-    }
-
-    offset = s->codec_param.mmap_offset;
-
-    memcpy(&parser_ctx->pts,
-        (uint8_t *)s->vaddr + offset, sizeof(int64_t));
-    size = sizeof(int64_t);
-    memcpy(&parser_ctx->dts,
-        (uint8_t *)s->vaddr + offset + size, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy(&parser_ctx->pos,
-        (uint8_t *)s->vaddr + offset + size, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy(&pts, (uint8_t *)s->vaddr + offset + size, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy(&dts, (uint8_t *)s->vaddr + offset + size, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy(&pos, (uint8_t *)s->vaddr + offset + size, sizeof(int64_t));
-    size += sizeof(int64_t);
-    memcpy(&inbuf_size, (uint8_t *)s->vaddr + offset + size, sizeof(int));
-    size += sizeof(int);
-
-    if (inbuf_size > 0) {
-        inbuf = av_mallocz(inbuf_size);
-        memcpy(inbuf, (uint8_t *)s->vaddr + offset + size, inbuf_size);
-    } else {
-        inbuf = NULL;
-        INFO("input buffer size for parser is zero.\n");
-    }
-
-    TRACE("[%s] inbuf:%p inbuf_size :%d\n", __func__, inbuf, inbuf_size);
-    ret = av_parser_parse2(parser_ctx, avctx, &poutbuf, &poutbuf_size,
-                           inbuf, inbuf_size, pts, dts, pos);
-    TRACE("after parsing, outbuf size :%d, ret:%d\n", poutbuf_size, ret);
-
-    if (poutbuf) {
-        s->codec_ctx[ctx_index].parser_buf = poutbuf;
-    }
-
-    TRACE("[%s] inbuf : %p, outbuf : %p\n", __func__, inbuf, poutbuf);
-    memcpy((uint8_t *)s->vaddr + offset, &parser_ctx->pts, sizeof(int64_t));
-    size = sizeof(int64_t);
-    memcpy((uint8_t *)s->vaddr + offset + size, &poutbuf_size, sizeof(int));
-    size += sizeof(int);
-    memcpy((uint8_t *)s->vaddr + offset + size, &ret, sizeof(int));
-    size += sizeof(int);
-    if (poutbuf && poutbuf_size > 0) {
-        memcpy((uint8_t *)s->vaddr + offset + size, poutbuf, poutbuf_size);
-    } else {
-        av_free(inbuf);
-    }
-
-#if 0
-    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
-        TRACE("[%s] free parser inbuf\n", __func__);
-        av_free(inbuf);
-    }
-#endif
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("Leave, %s\n", __func__);
-
-    return ret;
-}
-
-/* void av_parser_close(AVCodecParserContext *s) */
-void qemu_av_parser_close(SVCodecState *s, int ctx_index)
-{
-    AVCodecParserContext *parser_ctx;
-
-    TRACE("Enter, %s\n", __func__);
-    qemu_mutex_lock(&s->thread_mutex);
-
-    parser_ctx = s->codec_ctx[ctx_index].parser_ctx;
-    if (!parser_ctx) {
-        ERR("AVCodecParserContext is NULL\n");
-        qemu_mutex_unlock(&s->thread_mutex);
-        return;
-    }
-    av_parser_close(parser_ctx);
-
-    qemu_mutex_unlock(&s->thread_mutex);
-    TRACE("Leave, %s\n", __func__);
-}
-
-int codec_operate(uint32_t api_index, uint32_t ctx_index, SVCodecState *s)
-{
-    int ret = -1;
-
-    TRACE("[%s] context : %d\n", __func__, ctx_index);
-    switch (api_index) {
-    /* FFMPEG API */
-    case EMUL_AV_REGISTER_ALL:
-        qemu_av_register_all();
-        break;
-    case EMUL_AVCODEC_OPEN:
-        ret = qemu_avcodec_open(s);
-        break;
-    case EMUL_AVCODEC_CLOSE:
-        ret = qemu_avcodec_close(s, ctx_index);
-        qemu_av_free(s, ctx_index);
-        break;
-    case EMUL_AVCODEC_FLUSH_BUFFERS:
-        qemu_avcodec_flush_buffers(s, ctx_index);
-        break;
-    case EMUL_AVCODEC_DECODE_VIDEO:
-    case EMUL_AVCODEC_ENCODE_VIDEO:
-    case EMUL_AVCODEC_DECODE_AUDIO:
-    case EMUL_AVCODEC_ENCODE_AUDIO:
-        wake_codec_worker_thread(s);
-        break;
-    case EMUL_AV_PICTURE_COPY:
-        qemu_av_picture_copy(s, ctx_index);
-        break;
-    case EMUL_AV_PARSER_INIT:
-        qemu_av_parser_init(s, ctx_index);
-        break;
-    case EMUL_AV_PARSER_PARSE:
-        ret = qemu_av_parser_parse(s, ctx_index);
-        break;
-    case EMUL_AV_PARSER_CLOSE:
-        qemu_av_parser_close(s, ctx_index);
-        break;
-    default:
-        WARN("api index %d does not exist!.\n", api_index);
-    }
-    return ret;
-}
-
-static uint32_t qemu_get_mmap_offset(SVCodecState *s)
-{
-    int index = 0;
-
-    for (; index < AUDIO_CODEC_MEM_OFFSET_MAX; index++)  {
-        if (s->audio_codec_offset[index] == 0) {
-            s->audio_codec_offset[index] = 1;
-            break;
-        }
-    }
-    TRACE("return mmap offset: %d\n", index);
-
-    return index;
-}
-
-/*
- *  Codec Device APIs
- */
-uint64_t codec_read(void *opaque, hwaddr addr, unsigned size)
-{
-    SVCodecState *s = (SVCodecState *)opaque;
-    uint64_t ret = 0;
-
-    switch (addr) {
-    case CODEC_CMD_GET_THREAD_STATE:
-        qemu_mutex_lock(&s->thread_mutex);
-        ret = s->codec_thread.state;
-        s->codec_thread.state = 0;
-        qemu_mutex_unlock(&s->thread_mutex);
-        TRACE("ret: %d, thread state: %d\n", ret, s->codec_thread.state);
-        qemu_irq_lower(s->dev.irq[0]);
-        break;
-    case CODEC_CMD_GET_VERSION:
-        ret = MARU_CODEC_VERSION;
-        TRACE("codec version: %d\n", ret);
-        break;
-    case CODEC_CMD_GET_DEVICE_MEM:
-        qemu_mutex_lock(&s->thread_mutex);
-        ret = s->device_mem_avail;
-        if (s->device_mem_avail != 1) {
-            s->device_mem_avail = 1;
-        }
-        qemu_mutex_unlock(&s->thread_mutex);
-        break;
-    case CODEC_CMD_GET_MMAP_OFFSET:
-        ret = qemu_get_mmap_offset(s);
-        TRACE("mem index: %d\n", ret);
-        break;
-    default:
-        ERR("no avaiable command for read. %d\n", addr);
-    }
-
-    return ret;
-}
-
-void codec_write(void *opaque, hwaddr addr,
-                uint64_t value, unsigned size)
-{
-    SVCodecState *s = (SVCodecState *)opaque;
-
-    switch (addr) {
-    case CODEC_CMD_API_INDEX:
-        codec_operate(value, s->codec_param.ctx_index, s);
-        break;
-    case CODEC_CMD_CONTEXT_INDEX:
-        s->codec_param.ctx_index = value;
-        TRACE("Context Index: %d\n", s->codec_param.ctx_index);
-        break;
-    case CODEC_CMD_FILE_INDEX:
-        s->codec_param.file_index = value;
-        break;
-    case CODEC_CMD_DEVICE_MEM_OFFSET:
-        s->codec_param.mmap_offset = value;
-        TRACE("MMAP Offset: %d\n", s->codec_param.mmap_offset);
-        break;
-    case CODEC_CMD_RESET_CODEC_INFO:
-        qemu_reset_codec_info(s, value);
-        break;
-    case CODEC_CMD_SET_DEVICE_MEM:
-        qemu_mutex_lock(&s->thread_mutex);
-        s->device_mem_avail = value;
-        qemu_mutex_unlock(&s->thread_mutex);
-        break;
-    case CODEC_CMD_SET_MMAP_OFFSET:
-        s->codec_param.mem_index = value;
-        break;
-    default:
-        ERR("no avaiable command for write. %d\n", addr);
-    }
-}
-
-static const MemoryRegionOps codec_mmio_ops = {
-    .read = codec_read,
-    .write = codec_write,
-    .endianness = DEVICE_LITTLE_ENDIAN,
-};
-
-static void codec_tx_bh(void *opaque)
-{
-    SVCodecState *s = (SVCodecState *)opaque;
-
-    int ctx_index;
-    AVCodecContext *ctx;
-
-    ctx_index = s->codec_param.ctx_index;
-    ctx = s->codec_ctx[ctx_index].avctx;
-
-    TRACE("Enter, %s\n", __func__);
-
-    /* raise irq as soon as a worker thread had finished a job*/
-    if (s->codec_thread.state) {
-        TRACE("raise codec irq. state:%d, codec:%d\n",
-              s->codec_thread.state, ctx->codec_type);
-        qemu_irq_raise(s->dev.irq[0]);
-    }
-
-    TRACE("Leave, %s\n", __func__);
-}
-
-static int codec_initfn(PCIDevice *dev)
-{
-    SVCodecState *s = DO_UPCAST(SVCodecState, dev, dev);
-    uint8_t *pci_conf = s->dev.config;
-
-    INFO("[%s] device init\n", __func__);
-
-    memset(&s->codec_param, 0, sizeof(SVCodecParam));
-
-    qemu_mutex_init(&s->thread_mutex);
-    codec_thread_init(s);
-    s->tx_bh = qemu_bh_new(codec_tx_bh, s);
-
-    pci_config_set_interrupt_pin(pci_conf, 1);
-
-    memory_region_init_ram(&s->vram, OBJECT(s), "codec.ram", MARU_CODEC_MEM_SIZE);
-    s->vaddr = memory_region_get_ram_ptr(&s->vram);
-
-    memory_region_init_io(&s->mmio, OBJECT(s), &codec_mmio_ops, s,
-                        "codec-mmio", MARU_CODEC_REG_SIZE);
-
-    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
-    pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio);
-
-    return 0;
-}
-
-static void codec_exitfn(PCIDevice *dev)
-{
-    SVCodecState *s = DO_UPCAST(SVCodecState, dev, dev);
-    INFO("[%s] device exit\n", __func__);
-
-    qemu_bh_delete(s->tx_bh);
-
-    memory_region_destroy(&s->vram);
-    memory_region_destroy(&s->mmio);
-}
-
-int codec_init(PCIBus *bus)
-{
-    INFO("[%s] device create\n", __func__);
-    pci_create_simple(bus, -1, MARU_CODEC_DEV_NAME);
-    return 0;
-}
-
-static void codec_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->init = codec_initfn;
-    k->exit = codec_exitfn;
-    k->vendor_id = PCI_VENDOR_ID_TIZEN;
-    k->device_id = PCI_DEVICE_ID_VIRTUAL_CODEC;
-    k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;
-    dc->desc = "Virtual Codec device for Tizen emulator";
-}
-
-static TypeInfo codec_info = {
-    .name          = MARU_CODEC_DEV_NAME,
-    .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(SVCodecState),
-    .class_init    = codec_class_init,
-};
-
-static void codec_register_types(void)
-{
-    type_register_static(&codec_info);
-}
-
-type_init(codec_register_types)
diff --git a/tizen/src/hw/pci/maru_codec.h b/tizen/src/hw/pci/maru_codec.h
deleted file mode 100644 (file)
index 999d232..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Virtual Codec device
- *
- * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Contact:
- *  Kitae Kim <kt920.kim@samsung.com>
- *  SeokYeon Hwang <syeon.hwang@samsung.com>
- *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include "hw/hw.h"
-#include "sysemu/kvm.h"
-#include "hw/pci/pci.h"
-#include "hw/pci/pci_ids.h"
-#include "qemu/thread.h"
-#include "debug_ch.h"
-#include "maru_device_ids.h"
-
-#include <libavformat/avformat.h>
-
-#define CODEC_CONTEXT_MAX                      1024
-#define VIDEO_CODEC_MEM_OFFSET_MAX     16
-#define AUDIO_CODEC_MEM_OFFSET_MAX     64
-
-#define CODEC_MAX_THREAD       10
-
-/*
- *  Codec Device Structures
- */
-typedef struct _SVCodecParam {
-    uint32_t        api_index;
-    uint32_t        ctx_index;
-    uint32_t        file_index;
-    uint32_t        mem_index;
-    uint32_t        mmap_offset;
-} SVCodecParam;
-
-typedef struct _SVCodecContext {
-    AVCodecContext          *avctx;
-    AVFrame                 *frame;
-    AVCodecParserContext    *parser_ctx;
-    uint8_t                 *parser_buf;
-    uint8_t                 parser_use;
-    uint8_t                 avctx_use;
-    uint32_t                file_index;
-       uint32_t                                mem_index;
-} SVCodecContext;
-
-typedef struct _SVCodecThreadPool {
-       QemuThread                      *wrk_thread;
-       QemuMutex                       mutex;
-       QemuCond                        cond;
-       uint32_t                        state;
-       uint8_t                         isrunning;
-} SVCodecThreadPool;
-
-typedef struct _SVCodecState {
-    PCIDevice           dev;
-
-    uint8_t             *vaddr;
-    MemoryRegion        vram;
-    MemoryRegion        mmio;
-
-    QEMUBH              *tx_bh;
-    QemuMutex           thread_mutex;
-
-    SVCodecContext      codec_ctx[CODEC_CONTEXT_MAX];
-    SVCodecParam        codec_param;
-       SVCodecThreadPool       codec_thread;
-       uint8_t                         audio_codec_offset[AUDIO_CODEC_MEM_OFFSET_MAX];
-       uint8_t                         device_mem_avail;
-       uint8_t                         isrunning;
-} SVCodecState;
-
-enum codec_io_cmd {
-    CODEC_CMD_API_INDEX         = 0x00,
-    CODEC_CMD_CONTEXT_INDEX     = 0x04,
-       CODEC_CMD_FILE_INDEX            = 0x08,
-    CODEC_CMD_DEVICE_MEM_OFFSET        = 0x0c,
-    CODEC_CMD_GET_THREAD_STATE = 0x10,
-    CODEC_CMD_GET_VERSION       = 0x14,
-    CODEC_CMD_GET_DEVICE_MEM    = 0x18,
-    CODEC_CMD_SET_DEVICE_MEM   = 0x1C,
-    CODEC_CMD_GET_MMAP_OFFSET  = 0x20,
-    CODEC_CMD_SET_MMAP_OFFSET  = 0x24,
-    CODEC_CMD_RESET_CODEC_INFO  = 0x28,
-};
-
-enum {
-    EMUL_AV_REGISTER_ALL = 1,
-    EMUL_AVCODEC_OPEN,
-    EMUL_AVCODEC_CLOSE,
-    EMUL_AVCODEC_FLUSH_BUFFERS,
-    EMUL_AVCODEC_DECODE_VIDEO,
-    EMUL_AVCODEC_ENCODE_VIDEO,
-    EMUL_AVCODEC_DECODE_AUDIO,
-    EMUL_AVCODEC_ENCODE_AUDIO,
-    EMUL_AV_PICTURE_COPY,
-    EMUL_AV_PARSER_INIT,
-    EMUL_AV_PARSER_PARSE,
-    EMUL_AV_PARSER_CLOSE,
-};
-
-
-/*
- *  Codec Thread Functions
- */
-void codec_thread_init(SVCodecState *s);
-void codec_thread_exit(SVCodecState *s);
-void *codec_worker_thread(void *opaque);
-void wake_codec_worker_thread(SVCodecState *s);
-int decode_codec(SVCodecState *s);
-int encode_codec(SVCodecState *s);
-
-/*
- *  Codec Device Functions
- */
-int codec_init(PCIBus *bus);
-uint64_t codec_read(void *opaque, hwaddr addr,
-                    unsigned size);
-void codec_write(void *opaque, hwaddr addr,
-                uint64_t value, unsigned size);
-int codec_operate(uint32_t api_index, uint32_t ctx_index,
-                SVCodecState *state);
-
-/*
- *  Codec Helper Functions
- */
-void qemu_parser_init(SVCodecState *s, int ctx_index);
-void qemu_codec_close(SVCodecState *s, uint32_t value);
-void qemu_get_codec_ver(SVCodecState *s);
-void qemu_reset_codec_info(SVCodecState *s, uint32_t value);
-
-/*
- *  FFMPEG Functions
- */
-void qemu_av_register_all(void);
-int qemu_avcodec_open(SVCodecState *s);
-int qemu_avcodec_close(SVCodecState *s, int ctx_index);
-int qemu_avcodec_alloc_context(SVCodecState *s);
-void qemu_avcodec_flush_buffers(SVCodecState *s, int ctx_index);
-int qemu_avcodec_decode_video(SVCodecState *s, int ctx_index);
-int qemu_avcodec_encode_video(SVCodecState *s, int ctx_index);
-int qemu_avcodec_decode_audio(SVCodecState *s, int ctx_index);
-int qemu_avcodec_encode_audio(SVCodecState *s, int ctx_index);
-void qemu_av_picture_copy(SVCodecState *s, int ctx_index);
-void qemu_av_parser_init(SVCodecState *s, int ctx_index);
-int qemu_av_parser_parse(SVCodecState *s, int ctx_index);
-void qemu_av_parser_close(SVCodecState *s, int ctx_index);
-int qemu_avcodec_get_buffer(AVCodecContext *context, AVFrame *picture);
-void qemu_avcodec_release_buffer(AVCodecContext *context, AVFrame *picture);
-void qemu_av_free(SVCodecState *s, int ctx_index);
index 3f1b7e8..6ed8703 100644 (file)
@@ -32,7 +32,7 @@
 #include "maru_usb_touchscreen.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, usb_touchscreen);
+MULTI_DEBUG_CHANNEL(qemu, usb_tsp);
 
 
 #define MAX_TOUCH_EVENT_CNT 128
index 455c33b..03b863d 100644 (file)
@@ -32,7 +32,7 @@
 #include "emul_state.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-esm);
+MULTI_DEBUG_CHANNEL(qemu, esm);
 
 
 #define SYSTEM_MODE_LAYER 1
index d3ff432..7e7a417 100644 (file)
@@ -33,7 +33,7 @@
 #include "debug_ch.h"
 #include "ecs/ecs.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-evdi);
+MULTI_DEBUG_CHANNEL(qemu, evdi);
 
 #define EVDI_DEVICE_NAME "virtio-evdi"
 
index f1f1fdb..eb7139a 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "maru_virtio_jack.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-jack);
+MULTI_DEBUG_CHANNEL(qemu, jack);
 
 #define JACK_DEVICE_NAME  "jack"
 #define _MAX_BUF          1024
@@ -80,6 +80,14 @@ int get_jack_usb(void) {
     return usb_online;
 }
 
+void set_jack_earjack(int online){
+    earjack_online = online;
+}
+
+int get_jack_earjack(void) {
+    return earjack_online;
+}
+
 static void set_jack_data (enum jack_types type, char* data, int len)
 {
     if (len < 0 || len > __MAX_BUF_JACK) {
index 615db82..3608d38 100644 (file)
@@ -82,6 +82,9 @@ int get_jack_charger(void);
 void set_jack_usb(int online);
 int get_jack_usb(void);
 
+void set_jack_earjack(int online);
+int get_jack_earjack(void);
+
 #ifdef __cplusplus
 }
 #endif
index 7132d51..745934b 100644 (file)
@@ -33,7 +33,7 @@
 #include "debug_ch.h"
 
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-kbd);
+MULTI_DEBUG_CHANNEL(qemu, keyboard);
 
 VirtIOKeyboard *vkbd;
 VirtQueueElement elem;
index ce632e6..e7a68b7 100644 (file)
@@ -33,7 +33,7 @@
 #include "debug_ch.h"
 #include "ecs/ecs.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-nfc);
+MULTI_DEBUG_CHANNEL(qemu, nfc);
 
 #define NFC_DEVICE_NAME "virtio-nfc"
 
@@ -63,8 +63,46 @@ typedef struct NFCBuf {
     QTAILQ_ENTRY(NFCBuf) next;
 } NFCBuf;
 
+
+static char nfc_data [NFC_MAX_BUF_SIZE] = {'0',};
 static pthread_mutex_t recv_buf_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+static void send_nfc_data_to_ecs(const char* data)
+{
+    type_length length = 0;
+    type_group group = 15;
+    type_action action = 0;
+    int buf_len = strlen(data);
+    int message_len =  buf_len + 14;
+
+    char* ecs_message = (char*) malloc(message_len + 1);
+    if (!ecs_message)
+        return;
+
+    memset(ecs_message, 0, message_len + 1);
+
+    length = (unsigned short) buf_len;
+    action = 0;
+
+    memcpy(ecs_message, MESSAGE_TYPE_NFC, 3);
+    memcpy(ecs_message + 10, &length, sizeof(unsigned short));
+    memcpy(ecs_message + 12, &group, sizeof(unsigned char));
+    memcpy(ecs_message + 13, &action, sizeof(unsigned char));
+    memcpy(ecs_message + 14, data, buf_len);
+
+    TRACE("ntf_to_injector- len: %d, group: %d, action: %d, data: %s\n", length, group, action, data);
+
+    send_device_ntf(ecs_message, message_len);
+
+    if (ecs_message)
+        free(ecs_message);
+}
+
+void get_nfc_data(void)
+{
+    send_nfc_data_to_ecs(nfc_data);
+}
+
 bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len)
 {
     if(vio_nfc == NULL) {
@@ -96,7 +134,7 @@ bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const u
     _msg->info.client_type = type;
 
     pthread_mutex_lock(&recv_buf_mutex);
-
+    strcpy(nfc_data, data);
     QTAILQ_INSERT_TAIL(&nfc_recv_msg_queue, _msg, next);
 
     pthread_mutex_unlock(&recv_buf_mutex);
index 17c539a..5a991b6 100644 (file)
@@ -1,72 +1,73 @@
-/*\r
- * Virtio NFC Device\r
- *\r
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
- *\r
- * Contact:\r
- *  Munkyu Im <munkyu.im@samsung.com>\r
- *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
- *\r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- *\r
- */\r
-\r
-#ifndef MARU_VIRTIO_NFC_H_\r
-#define MARU_VIRTIO_NFC_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include "hw/virtio/virtio.h"\r
-\r
-enum request_cmd_nfc {\r
-       request_nfc_get = 0,\r
-       request_nfc_set,\r
-       request_nfc_answer\r
-};\r
-\r
-\r
-/* device protocol */\r
-\r
-#define __MAX_BUF_SIZE 1024\r
-\r
-\r
-typedef struct VirtIONFC{\r
-    VirtIODevice    vdev;\r
-    VirtQueue       *rvq;\r
-    VirtQueue          *svq;\r
-    DeviceState     *qdev;\r
-\r
-    QEMUBH *bh;\r
-} VirtIONFC;\r
-\r
-\r
-#define TYPE_VIRTIO_NFC "virtio-nfc-device"\r
-#define VIRTIO_NFC(obj) \\r
-        OBJECT_CHECK(VirtIONFC, (obj), TYPE_VIRTIO_NFC)\r
-\r
-\r
-bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-\r
-#endif /* MARU_VIRTIO_NFC_H_ */\r
+/*
+ * Virtio NFC Device
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact:
+ *  Munkyu Im <munkyu.im@samsung.com>
+ *  YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef MARU_VIRTIO_NFC_H_
+#define MARU_VIRTIO_NFC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hw/virtio/virtio.h"
+
+enum request_cmd_nfc {
+       request_nfc_get = 0,
+       request_nfc_set,
+       request_nfc_answer
+};
+
+
+/* device protocol */
+
+#define __MAX_BUF_SIZE 1024
+#define MESSAGE_TYPE_NFC "nfc"
+
+typedef struct VirtIONFC{
+    VirtIODevice    vdev;
+    VirtQueue       *rvq;
+    VirtQueue          *svq;
+    DeviceState     *qdev;
+
+    QEMUBH *bh;
+} VirtIONFC;
+
+
+#define TYPE_VIRTIO_NFC "virtio-nfc-device"
+#define VIRTIO_NFC(obj) \
+        OBJECT_CHECK(VirtIONFC, (obj), TYPE_VIRTIO_NFC)
+
+
+bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len);
+void get_nfc_data(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* MARU_VIRTIO_NFC_H_ */
index c275fdd..38dd4fd 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "maru_virtio_power.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-power);
+MULTI_DEBUG_CHANNEL(qemu, power);
 
 #define POWER_DEVICE_NAME  "power_supply"
 #define _MAX_BUF           1024
index 6efedac..09b2100 100644 (file)
@@ -34,7 +34,7 @@
 #include "debug_ch.h"
 #include "ecs/ecs.h"
 
-MULTI_DEBUG_CHANNEL(qemu, virtio-sensor);
+MULTI_DEBUG_CHANNEL(qemu, sensor);
 
 #define SENSOR_DEVICE_NAME  "sensor"
 #define _MAX_BUF            1024
index 4e60b8b..85b5960 100644 (file)
@@ -33,7 +33,7 @@
 #include "emul_state.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, touchscreen);
+MULTI_DEBUG_CHANNEL(qemu, tsp);
 
 
 #define DEVICE_NAME "virtio-touchscreen"
index 6206cd4..3e6bb10 100644 (file)
@@ -34,7 +34,7 @@
 #include "util/new_debug_ch.h"
 #include "ecs/ecs.h"
 
-DECLARE_DEBUG_CHANNEL(virtio-vmodem);
+DECLARE_DEBUG_CHANNEL(vmodem);
 
 #define VMODEM_DEVICE_NAME "virtio-vmodem"
 
index b1c27b1..305116c 100644 (file)
                        <classpath refid="classpath" />
                        <class name="org.tizen.emulator.skin.EmulatorShmSkin" />
                </javah>
-               <exec dir="native_src" executable="gcc" failifexecutionfails="false">
+               <exec dir="native_src" executable="cc" failifexecutionfails="false">
                        <arg line="-mmacosx-version-min=10.4" />
                        <arg line="-c" />
                        <arg line="share.c" />
                        <arg line="share.o" />
                        <arg line="-I${env.JAVA_JNI_H_INCLUDE_PATH}" />
                </exec>
-               <exec dir="native_src" executable="gcc" failifexecutionfails="false">
+               <exec dir="native_src" executable="cc" failifexecutionfails="false">
                        <arg line="-dynamiclib" />
                        <arg line="share.o" />
                        <arg line="-o" />
index d7262f6..2ecbba9 100755 (executable)
@@ -5,5 +5,5 @@
 javah -classpath ../emulator-skin.jar:../lib/swt.jar -jni org.tizen.emulator.skin.EmulatorShmSkin
 rm ./org_tizen_emulator_skin_EmulatorShmSkin_PollFBThread.h
 #TODO: jdk path
-gcc -c share.c -o share.o -I/System/Library/Frameworks/JavaVM.framework/Headers
-gcc -dynamiclib share.o -o libshared.dylib
+cc -c share.c -o share.o -I/System/Library/Frameworks/JavaVM.framework/Headers
+cc -dynamiclib share.o -o libshared.dylib
index 4063908..b96d48e 100644 (file)
@@ -106,7 +106,7 @@ JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_shmdt
         fflush(stderr);
         perror("share.c: ");
 
-        shm_info.shm_nattch = -1;
+        shm_info.shm_nattch = 0;
     }
 
     fprintf(stdout, "share.c: clean up the shared memory\n");
@@ -129,7 +129,7 @@ JNIEXPORT jint JNICALL Java_org_tizen_emulator_skin_EmulatorShmSkin_shmdt
             perror("share.c: ");
             return 2;
         }
-    } else if (shm_info.shm_nattch != -1) {
+    } else {
         fprintf(stdout, "share.c: number of current attaches = %d\n",
             (int)shm_info.shm_nattch);
         fflush(stdout);
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default.dbi b/tizen/src/skin/client/skins/wearable-360x480-1btn/default.dbi
new file mode 100644 (file)
index 0000000..11c28d6
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/emulator/skin/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <dbi_version>2.2</dbi_version>
+    <rotations>
+        <rotation name="Portrait">
+            <display id="0">
+                <region left="26" top="60" width="360" height="480"/>
+            </display>
+            <imageList>
+                <mainImage>default_0.png</mainImage>
+                <keyPressedImage>default_0_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="412" top="116" width="12" height="80" update="true"/>
+                    <eventInfo>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation name="Landscape">
+            <display id="0">
+                <region left="60" top="38" width="480" height="360"/>
+            </display>
+            <imageList>
+                <mainImage>default_L90.png</mainImage>
+                <keyPressedImage>default_L90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="116" top="0" width="80" height="12" update="true"/>
+                    <eventInfo>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation name="Reverse Portrait">
+            <display id="0">
+                <region left="38" top="60" width="360" height="480"/>
+            </display>
+            <imageList>
+                <mainImage>default_180.png</mainImage>
+                <keyPressedImage>default_180_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="0" top="404" width="12" height="80" update="true"/>
+                    <eventInfo>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation name="Reverse Landscape">
+            <display id="0">
+                <region left="60" top="26" width="480" height="360"/>
+            </display>
+            <imageList>
+                <mainImage>default_R90.png</mainImage>
+                <keyPressedImage>default_R90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="404" top="412" width="80" height="12" update="true"/>
+                    <eventInfo>
+                        <keyCode>116</keyCode>
+                        <keyName>Power</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+    </rotations>
+    <hover>
+        <color B="255" G="255" R="255" />
+    </hover>
+    <popupMenu>
+        <scaleItem visible="false" />
+        <keywindowItem visible="false" />
+        <hostKeyboardItem visible="false" />
+        <ramdumpItem visible="false" />
+    </popupMenu>
+</EmulatorUI>
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0.png
new file mode 100644 (file)
index 0000000..e0ad03f
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0_p.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0_p.png
new file mode 100644 (file)
index 0000000..8d37efa
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_0_p.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180.png
new file mode 100644 (file)
index 0000000..18d069c
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180_p.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180_p.png
new file mode 100644 (file)
index 0000000..da4a6d1
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_180_p.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90.png
new file mode 100644 (file)
index 0000000..e9da28d
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90_p.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90_p.png
new file mode 100644 (file)
index 0000000..6da71a8
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_L90_p.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90.png
new file mode 100644 (file)
index 0000000..c2a610f
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90_p.png b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90_p.png
new file mode 100644 (file)
index 0000000..6fdaf19
Binary files /dev/null and b/tizen/src/skin/client/skins/wearable-360x480-1btn/default_R90_p.png differ
diff --git a/tizen/src/skin/client/skins/wearable-360x480-1btn/info.ini b/tizen/src/skin/client/skins/wearable-360x480-1btn/info.ini
new file mode 100644 (file)
index 0000000..97aa980
--- /dev/null
@@ -0,0 +1,4 @@
+skin.name=Wearable 360x480
+resolution.width=360
+resolution.height=480
+manager.priority=1
index e4a959d..a5fecc4 100755 (executable)
@@ -161,6 +161,7 @@ public class EmulatorSkin {
        public boolean isKeyWindow;
        public boolean isOnKbd;
        private PopupMenu popupMenu;
+       private Timer closeTimer;
 
        public Color colorVM;
        private KeyWindowKeeper keyWindowKeeper;
@@ -200,6 +201,7 @@ public class EmulatorSkin {
                this.isOnInterpolation = true;
                this.isOnKbd = false;
                this.isKeyWindow = false;
+               this.closeTimer = new Timer();
 
                int style = SWT.NO_TRIM | SWT.DOUBLE_BUFFERED;
                this.shell = new Shell(Display.getDefault(), style);
@@ -408,6 +410,7 @@ public class EmulatorSkin {
                                logger.info("Main Window is closed");
 
                                if (isShutdownRequested) {
+                                       closeTimer.cancel();
                                        removeShellListeners();
                                        removeCanvasListeners();
 
@@ -490,10 +493,12 @@ public class EmulatorSkin {
 
                                                /* block for a while */
                                                try {
-                                                       /* In Close emulation,
-                                                        * 1000ms parameter was used for sleep function.
-                                                        * So, we need a bigger value than that.*/
-                                                       new Timer().schedule(new TimerTask() {
+                                                       /*
+                                                        * In Close emulation, 1000ms parameter was used for
+                                                        * sleep function. So, we need a bigger value than
+                                                        * that.
+                                                        */
+                                                       closeTimer.schedule(new TimerTask() {
                                                                @Override
                                                                public void run() {
                                                                        demanderFlag.set(false);
@@ -1801,12 +1806,20 @@ public class EmulatorSkin {
                                                        "-s", "emulator-" + portSdb, "shell");
                                } else if (SwtUtil.isMacPlatform()) {
                                        procSdb.command("./sdbscript", "emulator-" + portSdb);
-                                       /* procSdb.command( "/usr/X11/bin/uxterm", "-T",
-                                                       "emulator-" + portSdb, "-e", sdbPath,"shell"); */
+                                       /*
+                                        * procSdb.command( "/usr/X11/bin/uxterm", "-T", "emulator-"
+                                        * + portSdb, "-e", sdbPath, "shell");
+                                        */
                                } else { /* Linux */
-                                       procSdb.command("/usr/bin/gnome-terminal",
-                                                       "--title=" + SkinUtil.makeEmulatorName(config),
-                                                       "-x", sdbPath, "-s", "emulator-" + portSdb, "shell");
+                                       String sdbCmd = sdbPath + " -s" + " emulator-" + portSdb + " shell";
+
+                                       /* Work Around :
+                                        * To close a factory gnome-terminal(first instance) after the SDB session
+                                        * period, suicide command should be reserved by host shell on Ubuntu.
+                                        */
+                                       procSdb.command("/usr/bin/gnome-terminal", "--disable-factory",
+                                                       "--title=" + SkinUtil.makeEmulatorName(config), "-x",
+                                                       "bash", "-c", sdbCmd + "; kill -9 `ps -p $$ -o ppid=`");
                                }
 
                                logger.info(procSdb.command().toString());
index 96563d2..afe51ba 100644 (file)
@@ -278,7 +278,7 @@ public class PopupMenu {
                        int cnt = advancedSubMenu.getItemCount();
                        if (cnt > 0) {
                                MenuItem endItem = advancedSubMenu.getItem(cnt - 1);
-                               if ((endItem.getStyle() & SWT.SEPARATOR) != 0) {
+                               if (endItem != null && (endItem.getStyle() & SWT.SEPARATOR) != 0) {
                                        logger.info("delete unnecessary separator");
 
                                        endItem.dispose();
@@ -345,7 +345,7 @@ public class PopupMenu {
                int cnt = menu.getItemCount();
                if (cnt > 0) {
                        MenuItem endItem = menu.getItem(cnt - 1);
-                       if ((endItem.getStyle() & SWT.SEPARATOR) != 0) {
+                       if (endItem != null && (endItem.getStyle() & SWT.SEPARATOR) != 0) {
                                logger.info("delete unnecessary separator");
 
                                endItem.dispose();
index 5001a1c..da8f8af 100644 (file)
@@ -48,7 +48,7 @@
 #include "util/maru_err_table.h"
 #endif
 
-MULTI_DEBUG_CHANNEL(qemu, skin_client);
+MULTI_DEBUG_CHANNEL(qemu, skinclient);
 
 
 #define SKIN_SERVER_READY_TIME 3 /* second */
@@ -112,11 +112,17 @@ static void *run_skin_client(void *arg)
 
     /* display */
     char buf_display_shm[8] = { 0, };
-#ifdef CONFIG_USE_SHM
-    strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */
-#else
-    strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */
-#endif
+    switch (display_type) {
+    case DT_MARU_SDL:
+        strcpy(buf_display_shm, OPT_BOOLEAN_FALSE); /* maru_sdl */
+        break;
+    case DT_MARU_SHM:
+        strcpy(buf_display_shm, OPT_BOOLEAN_TRUE); /* maru_shm */
+        break;
+    default:
+        ERR("Can not enter here.\n");
+        break;
+    }
 
     /* input */
     char buf_input[12] = { 0, };
index 0dbdc65..3a15284 100644 (file)
@@ -31,7 +31,7 @@
 #include "emul_state.h"
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, skin_keymap);
+MULTI_DEBUG_CHANNEL(qemu, skinkeymap);
 
 #ifdef KEYMAP_DEBUG
 static void trace_binary(int decimal)
index c064143..0d5378c 100644 (file)
 #include "hw/maru_pm.h"
 #include "util/maru_device_hotplug.h"
 #include "ecs/ecs.h"
+#include "hw/virtio/maru_virtio_evdi.h"
 
 #ifdef CONFIG_HAX
 #include "target-i386/hax-i386.h"
 #endif
 
-MULTI_DEBUG_CHANNEL(qemu, skin_operation);
+MULTI_DEBUG_CHANNEL(qemu, skin_op);
 
 
 #define RESUME_KEY_SEND_INTERVAL 500 /* milli-seconds */
@@ -75,8 +76,7 @@ extern pthread_mutex_t mutex_screenshot;
 extern pthread_cond_t cond_screenshot;
 
 static void* run_timed_shutdown_thread(void* args);
-static void send_to_emuld(const char* request_type,
-    int request_size, const char* send_buf, int buf_size);
+static void send_shutdown_to_emuld(void);
 
 
 void start_display(uint64 handle_id,
@@ -97,7 +97,7 @@ void do_grabbing_enable(bool on)
 {
     INFO("skin grabbing enable : %d\n", on);
 
-    maru_display_invalidate(on);
+    maru_display_set_invalidate(on);
 }
 
 void do_mouse_event(int button_type, int event_type,
@@ -474,6 +474,7 @@ DetailInfo* get_detail_info(int qemu_argc, char** qemu_argv)
     hax_err_len = sprintf( hax_error + hax_err_len, "%s", "hax_error=" );
 
     int error = 0;
+// FIXME: ret_hax_init is no longer exist...
     if ( !ret_hax_init ) {
         if ( -ENOSPC == ret_hax_init ) {
             error = 1;
@@ -562,7 +563,7 @@ void do_interpolation_enable(bool on)
 {
     INFO("interpolation enable : %d\n", on);
 
-    maru_display_interpolation(on);
+    maru_display_set_interpolation(on);
 }
 
 void do_ram_dump(void)
@@ -618,7 +619,7 @@ int is_requested_shutdown_qemu_gracefully(void)
 
 static void* run_timed_shutdown_thread(void* args)
 {
-    send_to_emuld("system\n\n\n\n", 10, "shutdown", 8);
+    send_shutdown_to_emuld();
 
     int sleep_interval_time = 1000; /* milli-seconds */
 
@@ -640,40 +641,22 @@ static void* run_timed_shutdown_thread(void* args)
     return NULL;
 }
 
-static void send_to_emuld(const char* request_type,
-    int request_size, const char* send_buf, int buf_size)
+#define ECS_HEADER_SIZE 14
+static void send_shutdown_to_emuld(void)
 {
-    char addr[128];
-    int s = 0;
-    int device_serial_number = get_device_serial_number();
-    snprintf(addr, 128, ":%u", (uint16_t) ( device_serial_number + SDB_TCP_EMULD_INDEX));
-
-    //TODO: Error handling
-    s = inet_connect(addr, NULL);
-
-    if ( s < 0 ) {
-        ERR( "can't create socket to emulator daemon in guest\n" );
-        ERR( "[127.0.0.1:%d/tcp] connect fail (%d:%s)\n" , device_serial_number + SDB_TCP_EMULD_INDEX , errno, strerror(errno) );
+    int ret;
+    char* sndbuf = (char*) g_malloc0(sizeof(char) * ECS_HEADER_SIZE);
+    if (!sndbuf) {
+        LOG_SEVERE("failed to allocate buffer to send shutdown\n");
         return;
     }
 
-    if(send( s, (char*)request_type, request_size, 0 ) < 0) {
-        ERR("failed to send to emuld\n");
-    }
-    if(send( s, (char*)&buf_size, 4, 0 ) < 0) {
-        ERR("failed to send to emuld\n");
-    }
-    if(send( s, (char*)send_buf, buf_size, 0 ) < 0) {
-        ERR("failed to send to emuld\n");
-    }
-
-    INFO( "send to emuld [req_type:%s, send_data:%s, send_size:%d] 127.0.0.1:%d/tcp \n",
-            request_type, send_buf, buf_size, device_serial_number + SDB_TCP_EMULD_INDEX );
+    memcpy(sndbuf, "system", 6);
 
-#ifdef CONFIG_WIN32
-    closesocket( s );
-#else
-    close( s );
-#endif
+    ret = send_to_evdi(route_ij, sndbuf, ECS_HEADER_SIZE);
+    if (!ret) {
+        LOG_SEVERE("fail to send evdi shutdown system call to emuld.\n");
+    }
 
+    g_free(sndbuf);
 }
index e8229ee..fcc7b8d 100644 (file)
@@ -57,7 +57,7 @@
 
 #include "debug_ch.h"
 
-MULTI_DEBUG_CHANNEL(qemu, skin_server);
+MULTI_DEBUG_CHANNEL(qemu, skinserver);
 
 
 #define MAX_REQ_ID 0x7fffffff
@@ -506,6 +506,7 @@ static void parse_skinconfig_prop(void)
     if (buf_size > read_cnt) {
         WARN("Failed to fread for %s\n", SKIN_CONFIG_PROP);
     }
+    buf[read_cnt] = '\0';
 
     fclose(fp);
 
@@ -1082,7 +1083,7 @@ static void* run_skin_server(void* args)
                         do_host_kbd_enable(true);
                     }
 
-                    send_host_keyboard_ntf((on == 0) ? 0 : 1);
+                    //send_host_keyboard_ntf((on == 0) ? 0 : 1);
                     break;
                 }
                 case RECV_INTERPOLATION_STATE: {
diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.c b/tizen/src/tethering/genmsg/tethering.pb-c.c
deleted file mode 100644 (file)
index 0620a77..0000000
+++ /dev/null
@@ -1,2182 +0,0 @@
-/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
-
-/* Do not generate deprecated warnings for self */
-#ifndef PROTOBUF_C_NO_DEPRECATED
-#define PROTOBUF_C_NO_DEPRECATED
-#endif
-
-#include "tethering.pb-c.h"
-void   tethering__hand_shake_req__init
-                     (Tethering__HandShakeReq         *message)
-{
-  static Tethering__HandShakeReq init_value = TETHERING__HAND_SHAKE_REQ__INIT;
-  *message = init_value;
-}
-size_t tethering__hand_shake_req__get_packed_size
-                     (const Tethering__HandShakeReq *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__hand_shake_req__pack
-                     (const Tethering__HandShakeReq *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__hand_shake_req__pack_to_buffer
-                     (const Tethering__HandShakeReq *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__HandShakeReq *
-       tethering__hand_shake_req__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__HandShakeReq *)
-     protobuf_c_message_unpack (&tethering__hand_shake_req__descriptor,
-                                allocator, len, data);
-}
-void   tethering__hand_shake_req__free_unpacked
-                     (Tethering__HandShakeReq *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_req__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__hand_shake_ans__init
-                     (Tethering__HandShakeAns         *message)
-{
-  static Tethering__HandShakeAns init_value = TETHERING__HAND_SHAKE_ANS__INIT;
-  *message = init_value;
-}
-size_t tethering__hand_shake_ans__get_packed_size
-                     (const Tethering__HandShakeAns *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__hand_shake_ans__pack
-                     (const Tethering__HandShakeAns *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__hand_shake_ans__pack_to_buffer
-                     (const Tethering__HandShakeAns *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__HandShakeAns *
-       tethering__hand_shake_ans__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__HandShakeAns *)
-     protobuf_c_message_unpack (&tethering__hand_shake_ans__descriptor,
-                                allocator, len, data);
-}
-void   tethering__hand_shake_ans__free_unpacked
-                     (Tethering__HandShakeAns *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__hand_shake_ans__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__emulator_state__init
-                     (Tethering__EmulatorState         *message)
-{
-  static Tethering__EmulatorState init_value = TETHERING__EMULATOR_STATE__INIT;
-  *message = init_value;
-}
-size_t tethering__emulator_state__get_packed_size
-                     (const Tethering__EmulatorState *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__emulator_state__pack
-                     (const Tethering__EmulatorState *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__emulator_state__pack_to_buffer
-                     (const Tethering__EmulatorState *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__EmulatorState *
-       tethering__emulator_state__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__EmulatorState *)
-     protobuf_c_message_unpack (&tethering__emulator_state__descriptor,
-                                allocator, len, data);
-}
-void   tethering__emulator_state__free_unpacked
-                     (Tethering__EmulatorState *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__emulator_state__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__app_state__init
-                     (Tethering__AppState         *message)
-{
-  static Tethering__AppState init_value = TETHERING__APP_STATE__INIT;
-  *message = init_value;
-}
-size_t tethering__app_state__get_packed_size
-                     (const Tethering__AppState *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__app_state__pack
-                     (const Tethering__AppState *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__app_state__pack_to_buffer
-                     (const Tethering__AppState *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__AppState *
-       tethering__app_state__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__AppState *)
-     protobuf_c_message_unpack (&tethering__app_state__descriptor,
-                                allocator, len, data);
-}
-void   tethering__app_state__free_unpacked
-                     (Tethering__AppState *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__app_state__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__start_req__init
-                     (Tethering__StartReq         *message)
-{
-  static Tethering__StartReq init_value = TETHERING__START_REQ__INIT;
-  *message = init_value;
-}
-size_t tethering__start_req__get_packed_size
-                     (const Tethering__StartReq *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__start_req__pack
-                     (const Tethering__StartReq *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__start_req__pack_to_buffer
-                     (const Tethering__StartReq *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__StartReq *
-       tethering__start_req__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__StartReq *)
-     protobuf_c_message_unpack (&tethering__start_req__descriptor,
-                                allocator, len, data);
-}
-void   tethering__start_req__free_unpacked
-                     (Tethering__StartReq *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_req__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__start_ans__init
-                     (Tethering__StartAns         *message)
-{
-  static Tethering__StartAns init_value = TETHERING__START_ANS__INIT;
-  *message = init_value;
-}
-size_t tethering__start_ans__get_packed_size
-                     (const Tethering__StartAns *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__start_ans__pack
-                     (const Tethering__StartAns *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__start_ans__pack_to_buffer
-                     (const Tethering__StartAns *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__StartAns *
-       tethering__start_ans__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__StartAns *)
-     protobuf_c_message_unpack (&tethering__start_ans__descriptor,
-                                allocator, len, data);
-}
-void   tethering__start_ans__free_unpacked
-                     (Tethering__StartAns *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__start_ans__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__set_event_status__init
-                     (Tethering__SetEventStatus         *message)
-{
-  static Tethering__SetEventStatus init_value = TETHERING__SET_EVENT_STATUS__INIT;
-  *message = init_value;
-}
-size_t tethering__set_event_status__get_packed_size
-                     (const Tethering__SetEventStatus *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__set_event_status__pack
-                     (const Tethering__SetEventStatus *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__set_event_status__pack_to_buffer
-                     (const Tethering__SetEventStatus *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__SetEventStatus *
-       tethering__set_event_status__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__SetEventStatus *)
-     protobuf_c_message_unpack (&tethering__set_event_status__descriptor,
-                                allocator, len, data);
-}
-void   tethering__set_event_status__free_unpacked
-                     (Tethering__SetEventStatus *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_event_status__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__event_msg__init
-                     (Tethering__EventMsg         *message)
-{
-  static Tethering__EventMsg init_value = TETHERING__EVENT_MSG__INIT;
-  *message = init_value;
-}
-size_t tethering__event_msg__get_packed_size
-                     (const Tethering__EventMsg *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__event_msg__pack
-                     (const Tethering__EventMsg *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__event_msg__pack_to_buffer
-                     (const Tethering__EventMsg *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__EventMsg *
-       tethering__event_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__EventMsg *)
-     protobuf_c_message_unpack (&tethering__event_msg__descriptor,
-                                allocator, len, data);
-}
-void   tethering__event_msg__free_unpacked
-                     (Tethering__EventMsg *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_msg__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__event_terminate__init
-                     (Tethering__EventTerminate         *message)
-{
-  static Tethering__EventTerminate init_value = TETHERING__EVENT_TERMINATE__INIT;
-  *message = init_value;
-}
-size_t tethering__event_terminate__get_packed_size
-                     (const Tethering__EventTerminate *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__event_terminate__pack
-                     (const Tethering__EventTerminate *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__event_terminate__pack_to_buffer
-                     (const Tethering__EventTerminate *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__EventTerminate *
-       tethering__event_terminate__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__EventTerminate *)
-     protobuf_c_message_unpack (&tethering__event_terminate__descriptor,
-                                allocator, len, data);
-}
-void   tethering__event_terminate__free_unpacked
-                     (Tethering__EventTerminate *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__event_terminate__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__set_sensor_status__init
-                     (Tethering__SetSensorStatus         *message)
-{
-  static Tethering__SetSensorStatus init_value = TETHERING__SET_SENSOR_STATUS__INIT;
-  *message = init_value;
-}
-size_t tethering__set_sensor_status__get_packed_size
-                     (const Tethering__SetSensorStatus *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__set_sensor_status__pack
-                     (const Tethering__SetSensorStatus *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__set_sensor_status__pack_to_buffer
-                     (const Tethering__SetSensorStatus *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__SetSensorStatus *
-       tethering__set_sensor_status__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__SetSensorStatus *)
-     protobuf_c_message_unpack (&tethering__set_sensor_status__descriptor,
-                                allocator, len, data);
-}
-void   tethering__set_sensor_status__free_unpacked
-                     (Tethering__SetSensorStatus *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__set_sensor_status__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__sensor_data__init
-                     (Tethering__SensorData         *message)
-{
-  static Tethering__SensorData init_value = TETHERING__SENSOR_DATA__INIT;
-  *message = init_value;
-}
-size_t tethering__sensor_data__get_packed_size
-                     (const Tethering__SensorData *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__sensor_data__pack
-                     (const Tethering__SensorData *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__sensor_data__pack_to_buffer
-                     (const Tethering__SensorData *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__SensorData *
-       tethering__sensor_data__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__SensorData *)
-     protobuf_c_message_unpack (&tethering__sensor_data__descriptor,
-                                allocator, len, data);
-}
-void   tethering__sensor_data__free_unpacked
-                     (Tethering__SensorData *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_data__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__sensor_msg__init
-                     (Tethering__SensorMsg         *message)
-{
-  static Tethering__SensorMsg init_value = TETHERING__SENSOR_MSG__INIT;
-  *message = init_value;
-}
-size_t tethering__sensor_msg__get_packed_size
-                     (const Tethering__SensorMsg *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__sensor_msg__pack
-                     (const Tethering__SensorMsg *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__sensor_msg__pack_to_buffer
-                     (const Tethering__SensorMsg *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__SensorMsg *
-       tethering__sensor_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__SensorMsg *)
-     protobuf_c_message_unpack (&tethering__sensor_msg__descriptor,
-                                allocator, len, data);
-}
-void   tethering__sensor_msg__free_unpacked
-                     (Tethering__SensorMsg *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__sensor_msg__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__resolution__init
-                     (Tethering__Resolution         *message)
-{
-  static Tethering__Resolution init_value = TETHERING__RESOLUTION__INIT;
-  *message = init_value;
-}
-size_t tethering__resolution__get_packed_size
-                     (const Tethering__Resolution *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__resolution__pack
-                     (const Tethering__Resolution *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__resolution__pack_to_buffer
-                     (const Tethering__Resolution *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__Resolution *
-       tethering__resolution__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__Resolution *)
-     protobuf_c_message_unpack (&tethering__resolution__descriptor,
-                                allocator, len, data);
-}
-void   tethering__resolution__free_unpacked
-                     (Tethering__Resolution *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__resolution__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__display_msg__init
-                     (Tethering__DisplayMsg         *message)
-{
-  static Tethering__DisplayMsg init_value = TETHERING__DISPLAY_MSG__INIT;
-  *message = init_value;
-}
-size_t tethering__display_msg__get_packed_size
-                     (const Tethering__DisplayMsg *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__display_msg__pack
-                     (const Tethering__DisplayMsg *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__display_msg__pack_to_buffer
-                     (const Tethering__DisplayMsg *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__DisplayMsg *
-       tethering__display_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__DisplayMsg *)
-     protobuf_c_message_unpack (&tethering__display_msg__descriptor,
-                                allocator, len, data);
-}
-void   tethering__display_msg__free_unpacked
-                     (Tethering__DisplayMsg *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__display_msg__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__touch_max_count__init
-                     (Tethering__TouchMaxCount         *message)
-{
-  static Tethering__TouchMaxCount init_value = TETHERING__TOUCH_MAX_COUNT__INIT;
-  *message = init_value;
-}
-size_t tethering__touch_max_count__get_packed_size
-                     (const Tethering__TouchMaxCount *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__touch_max_count__pack
-                     (const Tethering__TouchMaxCount *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__touch_max_count__pack_to_buffer
-                     (const Tethering__TouchMaxCount *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__TouchMaxCount *
-       tethering__touch_max_count__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__TouchMaxCount *)
-     protobuf_c_message_unpack (&tethering__touch_max_count__descriptor,
-                                allocator, len, data);
-}
-void   tethering__touch_max_count__free_unpacked
-                     (Tethering__TouchMaxCount *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_max_count__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__touch_data__init
-                     (Tethering__TouchData         *message)
-{
-  static Tethering__TouchData init_value = TETHERING__TOUCH_DATA__INIT;
-  *message = init_value;
-}
-size_t tethering__touch_data__get_packed_size
-                     (const Tethering__TouchData *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__touch_data__pack
-                     (const Tethering__TouchData *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__touch_data__pack_to_buffer
-                     (const Tethering__TouchData *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__TouchData *
-       tethering__touch_data__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__TouchData *)
-     protobuf_c_message_unpack (&tethering__touch_data__descriptor,
-                                allocator, len, data);
-}
-void   tethering__touch_data__free_unpacked
-                     (Tethering__TouchData *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_data__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__touch_msg__init
-                     (Tethering__TouchMsg         *message)
-{
-  static Tethering__TouchMsg init_value = TETHERING__TOUCH_MSG__INIT;
-  *message = init_value;
-}
-size_t tethering__touch_msg__get_packed_size
-                     (const Tethering__TouchMsg *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__touch_msg__pack
-                     (const Tethering__TouchMsg *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__touch_msg__pack_to_buffer
-                     (const Tethering__TouchMsg *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__TouchMsg *
-       tethering__touch_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__TouchMsg *)
-     protobuf_c_message_unpack (&tethering__touch_msg__descriptor,
-                                allocator, len, data);
-}
-void   tethering__touch_msg__free_unpacked
-                     (Tethering__TouchMsg *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__touch_msg__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-void   tethering__tethering_msg__init
-                     (Tethering__TetheringMsg         *message)
-{
-  static Tethering__TetheringMsg init_value = TETHERING__TETHERING_MSG__INIT;
-  *message = init_value;
-}
-size_t tethering__tethering_msg__get_packed_size
-                     (const Tethering__TetheringMsg *message)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor);
-  return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
-}
-size_t tethering__tethering_msg__pack
-                     (const Tethering__TetheringMsg *message,
-                      uint8_t       *out)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor);
-  return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
-}
-size_t tethering__tethering_msg__pack_to_buffer
-                     (const Tethering__TetheringMsg *message,
-                      ProtobufCBuffer *buffer)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor);
-  return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
-}
-Tethering__TetheringMsg *
-       tethering__tethering_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data)
-{
-  return (Tethering__TetheringMsg *)
-     protobuf_c_message_unpack (&tethering__tethering_msg__descriptor,
-                                allocator, len, data);
-}
-void   tethering__tethering_msg__free_unpacked
-                     (Tethering__TetheringMsg *message,
-                      ProtobufCAllocator *allocator)
-{
-  PROTOBUF_C_ASSERT (message->base.descriptor == &tethering__tethering_msg__descriptor);
-  protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
-}
-static const ProtobufCFieldDescriptor tethering__hand_shake_req__field_descriptors[1] =
-{
-  {
-    "key",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_INT32,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__HandShakeReq, key),
-    NULL,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__hand_shake_req__field_indices_by_name[] = {
-  0,   /* field[0] = key */
-};
-static const ProtobufCIntRange tethering__hand_shake_req__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__hand_shake_req__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.HandShakeReq",
-  "HandShakeReq",
-  "Tethering__HandShakeReq",
-  "tethering",
-  sizeof(Tethering__HandShakeReq),
-  1,
-  tethering__hand_shake_req__field_descriptors,
-  tethering__hand_shake_req__field_indices_by_name,
-  1,  tethering__hand_shake_req__number_ranges,
-  (ProtobufCMessageInit) tethering__hand_shake_req__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__hand_shake_ans__field_descriptors[1] =
-{
-  {
-    "result",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__HandShakeAns, result),
-    &tethering__message_result__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__hand_shake_ans__field_indices_by_name[] = {
-  0,   /* field[0] = result */
-};
-static const ProtobufCIntRange tethering__hand_shake_ans__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__hand_shake_ans__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.HandShakeAns",
-  "HandShakeAns",
-  "Tethering__HandShakeAns",
-  "tethering",
-  sizeof(Tethering__HandShakeAns),
-  1,
-  tethering__hand_shake_ans__field_descriptors,
-  tethering__hand_shake_ans__field_indices_by_name,
-  1,  tethering__hand_shake_ans__number_ranges,
-  (ProtobufCMessageInit) tethering__hand_shake_ans__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__emulator_state__field_descriptors[1] =
-{
-  {
-    "state",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EmulatorState, state),
-    &tethering__connection_state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__emulator_state__field_indices_by_name[] = {
-  0,   /* field[0] = state */
-};
-static const ProtobufCIntRange tethering__emulator_state__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__emulator_state__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.EmulatorState",
-  "EmulatorState",
-  "Tethering__EmulatorState",
-  "tethering",
-  sizeof(Tethering__EmulatorState),
-  1,
-  tethering__emulator_state__field_descriptors,
-  tethering__emulator_state__field_indices_by_name,
-  1,  tethering__emulator_state__number_ranges,
-  (ProtobufCMessageInit) tethering__emulator_state__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__app_state__field_descriptors[1] =
-{
-  {
-    "state",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__AppState, state),
-    &tethering__connection_state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__app_state__field_indices_by_name[] = {
-  0,   /* field[0] = state */
-};
-static const ProtobufCIntRange tethering__app_state__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__app_state__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.AppState",
-  "AppState",
-  "Tethering__AppState",
-  "tethering",
-  sizeof(Tethering__AppState),
-  1,
-  tethering__app_state__field_descriptors,
-  tethering__app_state__field_indices_by_name,
-  1,  tethering__app_state__number_ranges,
-  (ProtobufCMessageInit) tethering__app_state__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-#define tethering__start_req__field_descriptors NULL
-#define tethering__start_req__field_indices_by_name NULL
-#define tethering__start_req__number_ranges NULL
-const ProtobufCMessageDescriptor tethering__start_req__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.StartReq",
-  "StartReq",
-  "Tethering__StartReq",
-  "tethering",
-  sizeof(Tethering__StartReq),
-  0,
-  tethering__start_req__field_descriptors,
-  tethering__start_req__field_indices_by_name,
-  0,  tethering__start_req__number_ranges,
-  (ProtobufCMessageInit) tethering__start_req__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__start_ans__field_descriptors[1] =
-{
-  {
-    "result",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__StartAns, result),
-    &tethering__message_result__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__start_ans__field_indices_by_name[] = {
-  0,   /* field[0] = result */
-};
-static const ProtobufCIntRange tethering__start_ans__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__start_ans__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.StartAns",
-  "StartAns",
-  "Tethering__StartAns",
-  "tethering",
-  sizeof(Tethering__StartAns),
-  1,
-  tethering__start_ans__field_descriptors,
-  tethering__start_ans__field_indices_by_name,
-  1,  tethering__start_ans__number_ranges,
-  (ProtobufCMessageInit) tethering__start_ans__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__set_event_status__field_descriptors[2] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SetEventStatus, type),
-    &tethering__event_type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "state",
-    2,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SetEventStatus, state),
-    &tethering__state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__set_event_status__field_indices_by_name[] = {
-  1,   /* field[1] = state */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__set_event_status__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 2 }
-};
-const ProtobufCMessageDescriptor tethering__set_event_status__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.SetEventStatus",
-  "SetEventStatus",
-  "Tethering__SetEventStatus",
-  "tethering",
-  sizeof(Tethering__SetEventStatus),
-  2,
-  tethering__set_event_status__field_descriptors,
-  tethering__set_event_status__field_indices_by_name,
-  1,  tethering__set_event_status__number_ranges,
-  (ProtobufCMessageInit) tethering__set_event_status__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-const ProtobufCEnumValue tethering__event_msg__type__enum_values_by_number[4] =
-{
-  { "START_REQ", "TETHERING__EVENT_MSG__TYPE__START_REQ", 2 },
-  { "START_ANS", "TETHERING__EVENT_MSG__TYPE__START_ANS", 3 },
-  { "TERMINATE", "TETHERING__EVENT_MSG__TYPE__TERMINATE", 4 },
-  { "EVENT_STATUS", "TETHERING__EVENT_MSG__TYPE__EVENT_STATUS", 5 },
-};
-static const ProtobufCIntRange tethering__event_msg__type__value_ranges[] = {
-{2, 0},{0, 4}
-};
-const ProtobufCEnumValueIndex tethering__event_msg__type__enum_values_by_name[4] =
-{
-  { "EVENT_STATUS", 3 },
-  { "START_ANS", 1 },
-  { "START_REQ", 0 },
-  { "TERMINATE", 2 },
-};
-const ProtobufCEnumDescriptor tethering__event_msg__type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.EventMsg.TYPE",
-  "TYPE",
-  "Tethering__EventMsg__TYPE",
-  "tethering",
-  4,
-  tethering__event_msg__type__enum_values_by_number,
-  4,
-  tethering__event_msg__type__enum_values_by_name,
-  1,
-  tethering__event_msg__type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-static const ProtobufCFieldDescriptor tethering__event_msg__field_descriptors[5] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EventMsg, type),
-    &tethering__event_msg__type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startReq",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EventMsg, startreq),
-    &tethering__start_req__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startAns",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EventMsg, startans),
-    &tethering__start_ans__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "terminate",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EventMsg, terminate),
-    &tethering__event_terminate__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "setStatus",
-    5,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__EventMsg, setstatus),
-    &tethering__set_event_status__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__event_msg__field_indices_by_name[] = {
-  4,   /* field[4] = setStatus */
-  2,   /* field[2] = startAns */
-  1,   /* field[1] = startReq */
-  3,   /* field[3] = terminate */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__event_msg__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 5 }
-};
-const ProtobufCMessageDescriptor tethering__event_msg__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.EventMsg",
-  "EventMsg",
-  "Tethering__EventMsg",
-  "tethering",
-  sizeof(Tethering__EventMsg),
-  5,
-  tethering__event_msg__field_descriptors,
-  tethering__event_msg__field_indices_by_name,
-  1,  tethering__event_msg__number_ranges,
-  (ProtobufCMessageInit) tethering__event_msg__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-#define tethering__event_terminate__field_descriptors NULL
-#define tethering__event_terminate__field_indices_by_name NULL
-#define tethering__event_terminate__number_ranges NULL
-const ProtobufCMessageDescriptor tethering__event_terminate__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.EventTerminate",
-  "EventTerminate",
-  "Tethering__EventTerminate",
-  "tethering",
-  sizeof(Tethering__EventTerminate),
-  0,
-  tethering__event_terminate__field_descriptors,
-  tethering__event_terminate__field_indices_by_name,
-  0,  tethering__event_terminate__number_ranges,
-  (ProtobufCMessageInit) tethering__event_terminate__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__set_sensor_status__field_descriptors[2] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SetSensorStatus, type),
-    &tethering__sensor_type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "state",
-    2,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SetSensorStatus, state),
-    &tethering__state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__set_sensor_status__field_indices_by_name[] = {
-  1,   /* field[1] = state */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__set_sensor_status__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 2 }
-};
-const ProtobufCMessageDescriptor tethering__set_sensor_status__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.SetSensorStatus",
-  "SetSensorStatus",
-  "Tethering__SetSensorStatus",
-  "tethering",
-  sizeof(Tethering__SetSensorStatus),
-  2,
-  tethering__set_sensor_status__field_descriptors,
-  tethering__set_sensor_status__field_indices_by_name,
-  1,  tethering__set_sensor_status__number_ranges,
-  (ProtobufCMessageInit) tethering__set_sensor_status__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-char tethering__sensor_data__x__default_value[] = "0";
-char tethering__sensor_data__y__default_value[] = "0";
-char tethering__sensor_data__z__default_value[] = "0";
-static const ProtobufCFieldDescriptor tethering__sensor_data__field_descriptors[4] =
-{
-  {
-    "sensor",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorData, sensor),
-    &tethering__sensor_type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "x",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_STRING,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorData, x),
-    NULL,
-    &tethering__sensor_data__x__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "y",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_STRING,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorData, y),
-    NULL,
-    &tethering__sensor_data__y__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "z",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_STRING,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorData, z),
-    NULL,
-    &tethering__sensor_data__z__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__sensor_data__field_indices_by_name[] = {
-  0,   /* field[0] = sensor */
-  1,   /* field[1] = x */
-  2,   /* field[2] = y */
-  3,   /* field[3] = z */
-};
-static const ProtobufCIntRange tethering__sensor_data__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 4 }
-};
-const ProtobufCMessageDescriptor tethering__sensor_data__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.SensorData",
-  "SensorData",
-  "Tethering__SensorData",
-  "tethering",
-  sizeof(Tethering__SensorData),
-  4,
-  tethering__sensor_data__field_descriptors,
-  tethering__sensor_data__field_indices_by_name,
-  1,  tethering__sensor_data__number_ranges,
-  (ProtobufCMessageInit) tethering__sensor_data__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-const ProtobufCEnumValue tethering__sensor_msg__type__enum_values_by_number[5] =
-{
-  { "START_REQ", "TETHERING__SENSOR_MSG__TYPE__START_REQ", 2 },
-  { "START_ANS", "TETHERING__SENSOR_MSG__TYPE__START_ANS", 3 },
-  { "TERMINATE", "TETHERING__SENSOR_MSG__TYPE__TERMINATE", 4 },
-  { "SENSOR_STATUS", "TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS", 5 },
-  { "SENSOR_DATA", "TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA", 6 },
-};
-static const ProtobufCIntRange tethering__sensor_msg__type__value_ranges[] = {
-{2, 0},{0, 5}
-};
-const ProtobufCEnumValueIndex tethering__sensor_msg__type__enum_values_by_name[5] =
-{
-  { "SENSOR_DATA", 4 },
-  { "SENSOR_STATUS", 3 },
-  { "START_ANS", 1 },
-  { "START_REQ", 0 },
-  { "TERMINATE", 2 },
-};
-const ProtobufCEnumDescriptor tethering__sensor_msg__type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.SensorMsg.Type",
-  "Type",
-  "Tethering__SensorMsg__Type",
-  "tethering",
-  5,
-  tethering__sensor_msg__type__enum_values_by_number,
-  5,
-  tethering__sensor_msg__type__enum_values_by_name,
-  1,
-  tethering__sensor_msg__type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-static const ProtobufCFieldDescriptor tethering__sensor_msg__field_descriptors[6] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, type),
-    &tethering__sensor_msg__type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startReq",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, startreq),
-    &tethering__start_req__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startAns",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, startans),
-    &tethering__start_ans__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "terminate",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, terminate),
-    &tethering__event_terminate__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "setStatus",
-    5,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, setstatus),
-    &tethering__set_sensor_status__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "data",
-    6,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__SensorMsg, data),
-    &tethering__sensor_data__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__sensor_msg__field_indices_by_name[] = {
-  5,   /* field[5] = data */
-  4,   /* field[4] = setStatus */
-  2,   /* field[2] = startAns */
-  1,   /* field[1] = startReq */
-  3,   /* field[3] = terminate */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__sensor_msg__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 6 }
-};
-const ProtobufCMessageDescriptor tethering__sensor_msg__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.SensorMsg",
-  "SensorMsg",
-  "Tethering__SensorMsg",
-  "tethering",
-  sizeof(Tethering__SensorMsg),
-  6,
-  tethering__sensor_msg__field_descriptors,
-  tethering__sensor_msg__field_indices_by_name,
-  1,  tethering__sensor_msg__number_ranges,
-  (ProtobufCMessageInit) tethering__sensor_msg__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__resolution__field_descriptors[2] =
-{
-  {
-    "width",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_INT32,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__Resolution, width),
-    NULL,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "height",
-    2,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_INT32,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__Resolution, height),
-    NULL,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__resolution__field_indices_by_name[] = {
-  1,   /* field[1] = height */
-  0,   /* field[0] = width */
-};
-static const ProtobufCIntRange tethering__resolution__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 2 }
-};
-const ProtobufCMessageDescriptor tethering__resolution__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.Resolution",
-  "Resolution",
-  "Tethering__Resolution",
-  "tethering",
-  sizeof(Tethering__Resolution),
-  2,
-  tethering__resolution__field_descriptors,
-  tethering__resolution__field_indices_by_name,
-  1,  tethering__resolution__number_ranges,
-  (ProtobufCMessageInit) tethering__resolution__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const ProtobufCFieldDescriptor tethering__display_msg__field_descriptors[2] =
-{
-  {
-    "frameRate",
-    1,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_INT32,
-    PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, has_framerate),
-    PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, framerate),
-    NULL,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "imageData",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_BYTES,
-    PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, has_imagedata),
-    PROTOBUF_C_OFFSETOF(Tethering__DisplayMsg, imagedata),
-    NULL,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__display_msg__field_indices_by_name[] = {
-  0,   /* field[0] = frameRate */
-  1,   /* field[1] = imageData */
-};
-static const ProtobufCIntRange tethering__display_msg__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 2 }
-};
-const ProtobufCMessageDescriptor tethering__display_msg__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.DisplayMsg",
-  "DisplayMsg",
-  "Tethering__DisplayMsg",
-  "tethering",
-  sizeof(Tethering__DisplayMsg),
-  2,
-  tethering__display_msg__field_descriptors,
-  tethering__display_msg__field_indices_by_name,
-  1,  tethering__display_msg__number_ranges,
-  (ProtobufCMessageInit) tethering__display_msg__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const int32_t tethering__touch_max_count__max__default_value = 10;
-static const ProtobufCFieldDescriptor tethering__touch_max_count__field_descriptors[1] =
-{
-  {
-    "max",
-    1,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_INT32,
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMaxCount, has_max),
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMaxCount, max),
-    NULL,
-    &tethering__touch_max_count__max__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__touch_max_count__field_indices_by_name[] = {
-  0,   /* field[0] = max */
-};
-static const ProtobufCIntRange tethering__touch_max_count__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 1 }
-};
-const ProtobufCMessageDescriptor tethering__touch_max_count__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.TouchMaxCount",
-  "TouchMaxCount",
-  "Tethering__TouchMaxCount",
-  "tethering",
-  sizeof(Tethering__TouchMaxCount),
-  1,
-  tethering__touch_max_count__field_descriptors,
-  tethering__touch_max_count__field_indices_by_name,
-  1,  tethering__touch_max_count__number_ranges,
-  (ProtobufCMessageInit) tethering__touch_max_count__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-static const int32_t tethering__touch_data__index__default_value = 0;
-static const float tethering__touch_data__x_point__default_value = 0;
-static const float tethering__touch_data__y_point__default_value = 0;
-static const ProtobufCFieldDescriptor tethering__touch_data__field_descriptors[4] =
-{
-  {
-    "index",
-    1,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_INT32,
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_index),
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, index),
-    NULL,
-    &tethering__touch_data__index__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "xPoint",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_FLOAT,
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_xpoint),
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, xpoint),
-    NULL,
-    &tethering__touch_data__x_point__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "yPoint",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_FLOAT,
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_ypoint),
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, ypoint),
-    NULL,
-    &tethering__touch_data__y_point__default_value,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "state",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_ENUM,
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, has_state),
-    PROTOBUF_C_OFFSETOF(Tethering__TouchData, state),
-    &tethering__touch_state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__touch_data__field_indices_by_name[] = {
-  0,   /* field[0] = index */
-  3,   /* field[3] = state */
-  1,   /* field[1] = xPoint */
-  2,   /* field[2] = yPoint */
-};
-static const ProtobufCIntRange tethering__touch_data__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 4 }
-};
-const ProtobufCMessageDescriptor tethering__touch_data__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.TouchData",
-  "TouchData",
-  "Tethering__TouchData",
-  "tethering",
-  sizeof(Tethering__TouchData),
-  4,
-  tethering__touch_data__field_descriptors,
-  tethering__touch_data__field_indices_by_name,
-  1,  tethering__touch_data__number_ranges,
-  (ProtobufCMessageInit) tethering__touch_data__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-const ProtobufCEnumValue tethering__touch_msg__type__enum_values_by_number[7] =
-{
-  { "START_REQ", "TETHERING__TOUCH_MSG__TYPE__START_REQ", 2 },
-  { "START_ANS", "TETHERING__TOUCH_MSG__TYPE__START_ANS", 3 },
-  { "TERMINATE", "TETHERING__TOUCH_MSG__TYPE__TERMINATE", 4 },
-  { "MAX_COUNT", "TETHERING__TOUCH_MSG__TYPE__MAX_COUNT", 5 },
-  { "TOUCH_DATA", "TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA", 6 },
-  { "RESOLUTION", "TETHERING__TOUCH_MSG__TYPE__RESOLUTION", 7 },
-  { "DISPLAY_MSG", "TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG", 8 },
-};
-static const ProtobufCIntRange tethering__touch_msg__type__value_ranges[] = {
-{2, 0},{0, 7}
-};
-const ProtobufCEnumValueIndex tethering__touch_msg__type__enum_values_by_name[7] =
-{
-  { "DISPLAY_MSG", 6 },
-  { "MAX_COUNT", 3 },
-  { "RESOLUTION", 5 },
-  { "START_ANS", 1 },
-  { "START_REQ", 0 },
-  { "TERMINATE", 2 },
-  { "TOUCH_DATA", 4 },
-};
-const ProtobufCEnumDescriptor tethering__touch_msg__type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.TouchMsg.Type",
-  "Type",
-  "Tethering__TouchMsg__Type",
-  "tethering",
-  7,
-  tethering__touch_msg__type__enum_values_by_number,
-  7,
-  tethering__touch_msg__type__enum_values_by_name,
-  1,
-  tethering__touch_msg__type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-static const ProtobufCFieldDescriptor tethering__touch_msg__field_descriptors[8] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, type),
-    &tethering__touch_msg__type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startReq",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, startreq),
-    &tethering__start_req__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "startAns",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, startans),
-    &tethering__start_ans__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "terminate",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, terminate),
-    &tethering__event_terminate__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "maxCount",
-    5,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, maxcount),
-    &tethering__touch_max_count__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "touchData",
-    6,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, touchdata),
-    &tethering__touch_data__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "resolution",
-    7,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, resolution),
-    &tethering__resolution__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "display",
-    8,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TouchMsg, display),
-    &tethering__display_msg__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__touch_msg__field_indices_by_name[] = {
-  7,   /* field[7] = display */
-  4,   /* field[4] = maxCount */
-  6,   /* field[6] = resolution */
-  2,   /* field[2] = startAns */
-  1,   /* field[1] = startReq */
-  3,   /* field[3] = terminate */
-  5,   /* field[5] = touchData */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__touch_msg__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 8 }
-};
-const ProtobufCMessageDescriptor tethering__touch_msg__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.TouchMsg",
-  "TouchMsg",
-  "Tethering__TouchMsg",
-  "tethering",
-  sizeof(Tethering__TouchMsg),
-  8,
-  tethering__touch_msg__field_descriptors,
-  tethering__touch_msg__field_indices_by_name,
-  1,  tethering__touch_msg__number_ranges,
-  (ProtobufCMessageInit) tethering__touch_msg__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-const ProtobufCEnumValue tethering__tethering_msg__type__enum_values_by_number[7] =
-{
-  { "HANDSHAKE_REQ", "TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ", 2 },
-  { "HANDSHAKE_ANS", "TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS", 3 },
-  { "EMUL_STATE", "TETHERING__TETHERING_MSG__TYPE__EMUL_STATE", 4 },
-  { "APP_STATE", "TETHERING__TETHERING_MSG__TYPE__APP_STATE", 5 },
-  { "EVENT_MSG", "TETHERING__TETHERING_MSG__TYPE__EVENT_MSG", 6 },
-  { "SENSOR_MSG", "TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG", 7 },
-  { "TOUCH_MSG", "TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG", 8 },
-};
-static const ProtobufCIntRange tethering__tethering_msg__type__value_ranges[] = {
-{2, 0},{0, 7}
-};
-const ProtobufCEnumValueIndex tethering__tethering_msg__type__enum_values_by_name[7] =
-{
-  { "APP_STATE", 3 },
-  { "EMUL_STATE", 2 },
-  { "EVENT_MSG", 4 },
-  { "HANDSHAKE_ANS", 1 },
-  { "HANDSHAKE_REQ", 0 },
-  { "SENSOR_MSG", 5 },
-  { "TOUCH_MSG", 6 },
-};
-const ProtobufCEnumDescriptor tethering__tethering_msg__type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.TetheringMsg.Type",
-  "Type",
-  "Tethering__TetheringMsg__Type",
-  "tethering",
-  7,
-  tethering__tethering_msg__type__enum_values_by_number,
-  7,
-  tethering__tethering_msg__type__enum_values_by_name,
-  1,
-  tethering__tethering_msg__type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-static const ProtobufCFieldDescriptor tethering__tethering_msg__field_descriptors[8] =
-{
-  {
-    "type",
-    1,
-    PROTOBUF_C_LABEL_REQUIRED,
-    PROTOBUF_C_TYPE_ENUM,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, type),
-    &tethering__tethering_msg__type__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "handShakeReq",
-    2,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, handshakereq),
-    &tethering__hand_shake_req__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "handShakeAns",
-    3,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, handshakeans),
-    &tethering__hand_shake_ans__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "emulState",
-    4,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, emulstate),
-    &tethering__emulator_state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "appState",
-    5,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, appstate),
-    &tethering__app_state__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "eventMsg",
-    6,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, eventmsg),
-    &tethering__event_msg__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "sensorMsg",
-    7,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, sensormsg),
-    &tethering__sensor_msg__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-  {
-    "touchMsg",
-    8,
-    PROTOBUF_C_LABEL_OPTIONAL,
-    PROTOBUF_C_TYPE_MESSAGE,
-    0,   /* quantifier_offset */
-    PROTOBUF_C_OFFSETOF(Tethering__TetheringMsg, touchmsg),
-    &tethering__touch_msg__descriptor,
-    NULL,
-    0,            /* packed */
-    0,NULL,NULL    /* reserved1,reserved2, etc */
-  },
-};
-static const unsigned tethering__tethering_msg__field_indices_by_name[] = {
-  4,   /* field[4] = appState */
-  3,   /* field[3] = emulState */
-  5,   /* field[5] = eventMsg */
-  2,   /* field[2] = handShakeAns */
-  1,   /* field[1] = handShakeReq */
-  6,   /* field[6] = sensorMsg */
-  7,   /* field[7] = touchMsg */
-  0,   /* field[0] = type */
-};
-static const ProtobufCIntRange tethering__tethering_msg__number_ranges[1 + 1] =
-{
-  { 1, 0 },
-  { 0, 8 }
-};
-const ProtobufCMessageDescriptor tethering__tethering_msg__descriptor =
-{
-  PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
-  "tethering.TetheringMsg",
-  "TetheringMsg",
-  "Tethering__TetheringMsg",
-  "tethering",
-  sizeof(Tethering__TetheringMsg),
-  8,
-  tethering__tethering_msg__field_descriptors,
-  tethering__tethering_msg__field_indices_by_name,
-  1,  tethering__tethering_msg__number_ranges,
-  (ProtobufCMessageInit) tethering__tethering_msg__init,
-  NULL,NULL,NULL    /* reserved[123] */
-};
-const ProtobufCEnumValue tethering__message_result__enum_values_by_number[3] =
-{
-  { "SUCCESS", "TETHERING__MESSAGE_RESULT__SUCCESS", 1 },
-  { "FAILURE", "TETHERING__MESSAGE_RESULT__FAILURE", 2 },
-  { "CANCEL", "TETHERING__MESSAGE_RESULT__CANCEL", 3 },
-};
-static const ProtobufCIntRange tethering__message_result__value_ranges[] = {
-{1, 0},{0, 3}
-};
-const ProtobufCEnumValueIndex tethering__message_result__enum_values_by_name[3] =
-{
-  { "CANCEL", 2 },
-  { "FAILURE", 1 },
-  { "SUCCESS", 0 },
-};
-const ProtobufCEnumDescriptor tethering__message_result__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.MessageResult",
-  "MessageResult",
-  "Tethering__MessageResult",
-  "tethering",
-  3,
-  tethering__message_result__enum_values_by_number,
-  3,
-  tethering__message_result__enum_values_by_name,
-  1,
-  tethering__message_result__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-const ProtobufCEnumValue tethering__connection_state__enum_values_by_number[3] =
-{
-  { "CONNECTED", "TETHERING__CONNECTION_STATE__CONNECTED", 1 },
-  { "DISCONNECTED", "TETHERING__CONNECTION_STATE__DISCONNECTED", 2 },
-  { "TERMINATED", "TETHERING__CONNECTION_STATE__TERMINATED", 3 },
-};
-static const ProtobufCIntRange tethering__connection_state__value_ranges[] = {
-{1, 0},{0, 3}
-};
-const ProtobufCEnumValueIndex tethering__connection_state__enum_values_by_name[3] =
-{
-  { "CONNECTED", 0 },
-  { "DISCONNECTED", 1 },
-  { "TERMINATED", 2 },
-};
-const ProtobufCEnumDescriptor tethering__connection_state__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.ConnectionState",
-  "ConnectionState",
-  "Tethering__ConnectionState",
-  "tethering",
-  3,
-  tethering__connection_state__enum_values_by_number,
-  3,
-  tethering__connection_state__enum_values_by_name,
-  1,
-  tethering__connection_state__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-const ProtobufCEnumValue tethering__event_type__enum_values_by_number[2] =
-{
-  { "SENSOR", "TETHERING__EVENT_TYPE__SENSOR", 1 },
-  { "TOUCH", "TETHERING__EVENT_TYPE__TOUCH", 2 },
-};
-static const ProtobufCIntRange tethering__event_type__value_ranges[] = {
-{1, 0},{0, 2}
-};
-const ProtobufCEnumValueIndex tethering__event_type__enum_values_by_name[2] =
-{
-  { "SENSOR", 0 },
-  { "TOUCH", 1 },
-};
-const ProtobufCEnumDescriptor tethering__event_type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.EventType",
-  "EventType",
-  "Tethering__EventType",
-  "tethering",
-  2,
-  tethering__event_type__enum_values_by_number,
-  2,
-  tethering__event_type__enum_values_by_name,
-  1,
-  tethering__event_type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-const ProtobufCEnumValue tethering__state__enum_values_by_number[2] =
-{
-  { "ENABLED", "TETHERING__STATE__ENABLED", 1 },
-  { "DISABLED", "TETHERING__STATE__DISABLED", 2 },
-};
-static const ProtobufCIntRange tethering__state__value_ranges[] = {
-{1, 0},{0, 2}
-};
-const ProtobufCEnumValueIndex tethering__state__enum_values_by_name[2] =
-{
-  { "DISABLED", 1 },
-  { "ENABLED", 0 },
-};
-const ProtobufCEnumDescriptor tethering__state__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.State",
-  "State",
-  "Tethering__State",
-  "tethering",
-  2,
-  tethering__state__enum_values_by_number,
-  2,
-  tethering__state__enum_values_by_name,
-  1,
-  tethering__state__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-const ProtobufCEnumValue tethering__sensor_type__enum_values_by_number[5] =
-{
-  { "ACCEL", "TETHERING__SENSOR_TYPE__ACCEL", 1 },
-  { "MAGNETIC", "TETHERING__SENSOR_TYPE__MAGNETIC", 2 },
-  { "GYROSCOPE", "TETHERING__SENSOR_TYPE__GYROSCOPE", 3 },
-  { "PROXIMITY", "TETHERING__SENSOR_TYPE__PROXIMITY", 4 },
-  { "LIGHT", "TETHERING__SENSOR_TYPE__LIGHT", 5 },
-};
-static const ProtobufCIntRange tethering__sensor_type__value_ranges[] = {
-{1, 0},{0, 5}
-};
-const ProtobufCEnumValueIndex tethering__sensor_type__enum_values_by_name[5] =
-{
-  { "ACCEL", 0 },
-  { "GYROSCOPE", 2 },
-  { "LIGHT", 4 },
-  { "MAGNETIC", 1 },
-  { "PROXIMITY", 3 },
-};
-const ProtobufCEnumDescriptor tethering__sensor_type__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.SensorType",
-  "SensorType",
-  "Tethering__SensorType",
-  "tethering",
-  5,
-  tethering__sensor_type__enum_values_by_number,
-  5,
-  tethering__sensor_type__enum_values_by_name,
-  1,
-  tethering__sensor_type__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
-const ProtobufCEnumValue tethering__touch_state__enum_values_by_number[2] =
-{
-  { "PRESSED", "TETHERING__TOUCH_STATE__PRESSED", 1 },
-  { "RELEASED", "TETHERING__TOUCH_STATE__RELEASED", 2 },
-};
-static const ProtobufCIntRange tethering__touch_state__value_ranges[] = {
-{1, 0},{0, 2}
-};
-const ProtobufCEnumValueIndex tethering__touch_state__enum_values_by_name[2] =
-{
-  { "PRESSED", 0 },
-  { "RELEASED", 1 },
-};
-const ProtobufCEnumDescriptor tethering__touch_state__descriptor =
-{
-  PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC,
-  "tethering.TouchState",
-  "TouchState",
-  "Tethering__TouchState",
-  "tethering",
-  2,
-  tethering__touch_state__enum_values_by_number,
-  2,
-  tethering__touch_state__enum_values_by_name,
-  1,
-  tethering__touch_state__value_ranges,
-  NULL,NULL,NULL,NULL   /* reserved[1234] */
-};
diff --git a/tizen/src/tethering/genmsg/tethering.pb-c.h b/tizen/src/tethering/genmsg/tethering.pb-c.h
deleted file mode 100644 (file)
index a2fc957..0000000
+++ /dev/null
@@ -1,753 +0,0 @@
-/* Generated by the protocol buffer compiler.  DO NOT EDIT! */
-
-#ifndef PROTOBUF_C_tethering_2eproto__INCLUDED
-#define PROTOBUF_C_tethering_2eproto__INCLUDED
-
-#include "../../../distrib/protobuf/protobuf-c.h"
-
-PROTOBUF_C_BEGIN_DECLS
-
-
-typedef struct _Tethering__HandShakeReq Tethering__HandShakeReq;
-typedef struct _Tethering__HandShakeAns Tethering__HandShakeAns;
-typedef struct _Tethering__EmulatorState Tethering__EmulatorState;
-typedef struct _Tethering__AppState Tethering__AppState;
-typedef struct _Tethering__StartReq Tethering__StartReq;
-typedef struct _Tethering__StartAns Tethering__StartAns;
-typedef struct _Tethering__SetEventStatus Tethering__SetEventStatus;
-typedef struct _Tethering__EventMsg Tethering__EventMsg;
-typedef struct _Tethering__EventTerminate Tethering__EventTerminate;
-typedef struct _Tethering__SetSensorStatus Tethering__SetSensorStatus;
-typedef struct _Tethering__SensorData Tethering__SensorData;
-typedef struct _Tethering__SensorMsg Tethering__SensorMsg;
-typedef struct _Tethering__Resolution Tethering__Resolution;
-typedef struct _Tethering__DisplayMsg Tethering__DisplayMsg;
-typedef struct _Tethering__TouchMaxCount Tethering__TouchMaxCount;
-typedef struct _Tethering__TouchData Tethering__TouchData;
-typedef struct _Tethering__TouchMsg Tethering__TouchMsg;
-typedef struct _Tethering__TetheringMsg Tethering__TetheringMsg;
-
-
-/* --- enums --- */
-
-typedef enum _Tethering__EventMsg__TYPE {
-  TETHERING__EVENT_MSG__TYPE__START_REQ = 2,
-  TETHERING__EVENT_MSG__TYPE__START_ANS = 3,
-  TETHERING__EVENT_MSG__TYPE__TERMINATE = 4,
-  TETHERING__EVENT_MSG__TYPE__EVENT_STATUS = 5
-} Tethering__EventMsg__TYPE;
-typedef enum _Tethering__SensorMsg__Type {
-  TETHERING__SENSOR_MSG__TYPE__START_REQ = 2,
-  TETHERING__SENSOR_MSG__TYPE__START_ANS = 3,
-  TETHERING__SENSOR_MSG__TYPE__TERMINATE = 4,
-  TETHERING__SENSOR_MSG__TYPE__SENSOR_STATUS = 5,
-  TETHERING__SENSOR_MSG__TYPE__SENSOR_DATA = 6
-} Tethering__SensorMsg__Type;
-typedef enum _Tethering__TouchMsg__Type {
-  TETHERING__TOUCH_MSG__TYPE__START_REQ = 2,
-  TETHERING__TOUCH_MSG__TYPE__START_ANS = 3,
-  TETHERING__TOUCH_MSG__TYPE__TERMINATE = 4,
-  TETHERING__TOUCH_MSG__TYPE__MAX_COUNT = 5,
-  TETHERING__TOUCH_MSG__TYPE__TOUCH_DATA = 6,
-  TETHERING__TOUCH_MSG__TYPE__RESOLUTION = 7,
-  TETHERING__TOUCH_MSG__TYPE__DISPLAY_MSG = 8
-} Tethering__TouchMsg__Type;
-typedef enum _Tethering__TetheringMsg__Type {
-  TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_REQ = 2,
-  TETHERING__TETHERING_MSG__TYPE__HANDSHAKE_ANS = 3,
-  TETHERING__TETHERING_MSG__TYPE__EMUL_STATE = 4,
-  TETHERING__TETHERING_MSG__TYPE__APP_STATE = 5,
-  TETHERING__TETHERING_MSG__TYPE__EVENT_MSG = 6,
-  TETHERING__TETHERING_MSG__TYPE__SENSOR_MSG = 7,
-  TETHERING__TETHERING_MSG__TYPE__TOUCH_MSG = 8
-} Tethering__TetheringMsg__Type;
-typedef enum _Tethering__MessageResult {
-  TETHERING__MESSAGE_RESULT__SUCCESS = 1,
-  TETHERING__MESSAGE_RESULT__FAILURE = 2,
-  TETHERING__MESSAGE_RESULT__CANCEL = 3
-} Tethering__MessageResult;
-typedef enum _Tethering__ConnectionState {
-  TETHERING__CONNECTION_STATE__CONNECTED = 1,
-  TETHERING__CONNECTION_STATE__DISCONNECTED = 2,
-  TETHERING__CONNECTION_STATE__TERMINATED = 3
-} Tethering__ConnectionState;
-typedef enum _Tethering__EventType {
-  TETHERING__EVENT_TYPE__SENSOR = 1,
-  TETHERING__EVENT_TYPE__TOUCH = 2
-} Tethering__EventType;
-typedef enum _Tethering__State {
-  TETHERING__STATE__ENABLED = 1,
-  TETHERING__STATE__DISABLED = 2
-} Tethering__State;
-typedef enum _Tethering__SensorType {
-  TETHERING__SENSOR_TYPE__ACCEL = 1,
-  TETHERING__SENSOR_TYPE__MAGNETIC = 2,
-  TETHERING__SENSOR_TYPE__GYROSCOPE = 3,
-  TETHERING__SENSOR_TYPE__PROXIMITY = 4,
-  TETHERING__SENSOR_TYPE__LIGHT = 5
-} Tethering__SensorType;
-typedef enum _Tethering__TouchState {
-  TETHERING__TOUCH_STATE__PRESSED = 1,
-  TETHERING__TOUCH_STATE__RELEASED = 2
-} Tethering__TouchState;
-
-/* --- messages --- */
-
-struct  _Tethering__HandShakeReq
-{
-  ProtobufCMessage base;
-  int32_t key;
-};
-#define TETHERING__HAND_SHAKE_REQ__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__hand_shake_req__descriptor) \
-    , 0 }
-
-
-struct  _Tethering__HandShakeAns
-{
-  ProtobufCMessage base;
-  Tethering__MessageResult result;
-};
-#define TETHERING__HAND_SHAKE_ANS__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__hand_shake_ans__descriptor) \
-    , 0 }
-
-
-struct  _Tethering__EmulatorState
-{
-  ProtobufCMessage base;
-  Tethering__ConnectionState state;
-};
-#define TETHERING__EMULATOR_STATE__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__emulator_state__descriptor) \
-    , 0 }
-
-
-struct  _Tethering__AppState
-{
-  ProtobufCMessage base;
-  Tethering__ConnectionState state;
-};
-#define TETHERING__APP_STATE__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__app_state__descriptor) \
-    , 0 }
-
-
-struct  _Tethering__StartReq
-{
-  ProtobufCMessage base;
-};
-#define TETHERING__START_REQ__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__start_req__descriptor) \
-     }
-
-
-struct  _Tethering__StartAns
-{
-  ProtobufCMessage base;
-  Tethering__MessageResult result;
-};
-#define TETHERING__START_ANS__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__start_ans__descriptor) \
-    , 0 }
-
-
-struct  _Tethering__SetEventStatus
-{
-  ProtobufCMessage base;
-  Tethering__EventType type;
-  Tethering__State state;
-};
-#define TETHERING__SET_EVENT_STATUS__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__set_event_status__descriptor) \
-    , 0, 0 }
-
-
-struct  _Tethering__EventMsg
-{
-  ProtobufCMessage base;
-  Tethering__EventMsg__TYPE type;
-  Tethering__StartReq *startreq;
-  Tethering__StartAns *startans;
-  Tethering__EventTerminate *terminate;
-  Tethering__SetEventStatus *setstatus;
-};
-#define TETHERING__EVENT_MSG__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__event_msg__descriptor) \
-    , 0, NULL, NULL, NULL, NULL }
-
-
-struct  _Tethering__EventTerminate
-{
-  ProtobufCMessage base;
-};
-#define TETHERING__EVENT_TERMINATE__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__event_terminate__descriptor) \
-     }
-
-
-struct  _Tethering__SetSensorStatus
-{
-  ProtobufCMessage base;
-  Tethering__SensorType type;
-  Tethering__State state;
-};
-#define TETHERING__SET_SENSOR_STATUS__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__set_sensor_status__descriptor) \
-    , 0, 0 }
-
-
-struct  _Tethering__SensorData
-{
-  ProtobufCMessage base;
-  Tethering__SensorType sensor;
-  char *x;
-  char *y;
-  char *z;
-};
-extern char tethering__sensor_data__x__default_value[];
-extern char tethering__sensor_data__y__default_value[];
-extern char tethering__sensor_data__z__default_value[];
-#define TETHERING__SENSOR_DATA__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__sensor_data__descriptor) \
-    , 0, tethering__sensor_data__x__default_value, tethering__sensor_data__y__default_value, tethering__sensor_data__z__default_value }
-
-
-struct  _Tethering__SensorMsg
-{
-  ProtobufCMessage base;
-  Tethering__SensorMsg__Type type;
-  Tethering__StartReq *startreq;
-  Tethering__StartAns *startans;
-  Tethering__EventTerminate *terminate;
-  Tethering__SetSensorStatus *setstatus;
-  Tethering__SensorData *data;
-};
-#define TETHERING__SENSOR_MSG__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__sensor_msg__descriptor) \
-    , 0, NULL, NULL, NULL, NULL, NULL }
-
-
-struct  _Tethering__Resolution
-{
-  ProtobufCMessage base;
-  int32_t width;
-  int32_t height;
-};
-#define TETHERING__RESOLUTION__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__resolution__descriptor) \
-    , 0, 0 }
-
-
-struct  _Tethering__DisplayMsg
-{
-  ProtobufCMessage base;
-  protobuf_c_boolean has_framerate;
-  int32_t framerate;
-  protobuf_c_boolean has_imagedata;
-  ProtobufCBinaryData imagedata;
-};
-#define TETHERING__DISPLAY_MSG__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__display_msg__descriptor) \
-    , 0,0, 0,{0,NULL} }
-
-
-struct  _Tethering__TouchMaxCount
-{
-  ProtobufCMessage base;
-  protobuf_c_boolean has_max;
-  int32_t max;
-};
-#define TETHERING__TOUCH_MAX_COUNT__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_max_count__descriptor) \
-    , 0,10 }
-
-
-struct  _Tethering__TouchData
-{
-  ProtobufCMessage base;
-  protobuf_c_boolean has_index;
-  int32_t index;
-  protobuf_c_boolean has_xpoint;
-  float xpoint;
-  protobuf_c_boolean has_ypoint;
-  float ypoint;
-  protobuf_c_boolean has_state;
-  Tethering__TouchState state;
-};
-#define TETHERING__TOUCH_DATA__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_data__descriptor) \
-    , 0,0, 0,0, 0,0, 0,0 }
-
-
-struct  _Tethering__TouchMsg
-{
-  ProtobufCMessage base;
-  Tethering__TouchMsg__Type type;
-  Tethering__StartReq *startreq;
-  Tethering__StartAns *startans;
-  Tethering__EventTerminate *terminate;
-  Tethering__TouchMaxCount *maxcount;
-  Tethering__TouchData *touchdata;
-  Tethering__Resolution *resolution;
-  Tethering__DisplayMsg *display;
-};
-#define TETHERING__TOUCH_MSG__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__touch_msg__descriptor) \
-    , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-
-
-struct  _Tethering__TetheringMsg
-{
-  ProtobufCMessage base;
-  Tethering__TetheringMsg__Type type;
-  Tethering__HandShakeReq *handshakereq;
-  Tethering__HandShakeAns *handshakeans;
-  Tethering__EmulatorState *emulstate;
-  Tethering__AppState *appstate;
-  Tethering__EventMsg *eventmsg;
-  Tethering__SensorMsg *sensormsg;
-  Tethering__TouchMsg *touchmsg;
-};
-#define TETHERING__TETHERING_MSG__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&tethering__tethering_msg__descriptor) \
-    , 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
-
-
-/* Tethering__HandShakeReq methods */
-void   tethering__hand_shake_req__init
-                     (Tethering__HandShakeReq         *message);
-size_t tethering__hand_shake_req__get_packed_size
-                     (const Tethering__HandShakeReq   *message);
-size_t tethering__hand_shake_req__pack
-                     (const Tethering__HandShakeReq   *message,
-                      uint8_t             *out);
-size_t tethering__hand_shake_req__pack_to_buffer
-                     (const Tethering__HandShakeReq   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__HandShakeReq *
-       tethering__hand_shake_req__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__hand_shake_req__free_unpacked
-                     (Tethering__HandShakeReq *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__HandShakeAns methods */
-void   tethering__hand_shake_ans__init
-                     (Tethering__HandShakeAns         *message);
-size_t tethering__hand_shake_ans__get_packed_size
-                     (const Tethering__HandShakeAns   *message);
-size_t tethering__hand_shake_ans__pack
-                     (const Tethering__HandShakeAns   *message,
-                      uint8_t             *out);
-size_t tethering__hand_shake_ans__pack_to_buffer
-                     (const Tethering__HandShakeAns   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__HandShakeAns *
-       tethering__hand_shake_ans__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__hand_shake_ans__free_unpacked
-                     (Tethering__HandShakeAns *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__EmulatorState methods */
-void   tethering__emulator_state__init
-                     (Tethering__EmulatorState         *message);
-size_t tethering__emulator_state__get_packed_size
-                     (const Tethering__EmulatorState   *message);
-size_t tethering__emulator_state__pack
-                     (const Tethering__EmulatorState   *message,
-                      uint8_t             *out);
-size_t tethering__emulator_state__pack_to_buffer
-                     (const Tethering__EmulatorState   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__EmulatorState *
-       tethering__emulator_state__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__emulator_state__free_unpacked
-                     (Tethering__EmulatorState *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__AppState methods */
-void   tethering__app_state__init
-                     (Tethering__AppState         *message);
-size_t tethering__app_state__get_packed_size
-                     (const Tethering__AppState   *message);
-size_t tethering__app_state__pack
-                     (const Tethering__AppState   *message,
-                      uint8_t             *out);
-size_t tethering__app_state__pack_to_buffer
-                     (const Tethering__AppState   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__AppState *
-       tethering__app_state__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__app_state__free_unpacked
-                     (Tethering__AppState *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__StartReq methods */
-void   tethering__start_req__init
-                     (Tethering__StartReq         *message);
-size_t tethering__start_req__get_packed_size
-                     (const Tethering__StartReq   *message);
-size_t tethering__start_req__pack
-                     (const Tethering__StartReq   *message,
-                      uint8_t             *out);
-size_t tethering__start_req__pack_to_buffer
-                     (const Tethering__StartReq   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__StartReq *
-       tethering__start_req__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__start_req__free_unpacked
-                     (Tethering__StartReq *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__StartAns methods */
-void   tethering__start_ans__init
-                     (Tethering__StartAns         *message);
-size_t tethering__start_ans__get_packed_size
-                     (const Tethering__StartAns   *message);
-size_t tethering__start_ans__pack
-                     (const Tethering__StartAns   *message,
-                      uint8_t             *out);
-size_t tethering__start_ans__pack_to_buffer
-                     (const Tethering__StartAns   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__StartAns *
-       tethering__start_ans__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__start_ans__free_unpacked
-                     (Tethering__StartAns *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__SetEventStatus methods */
-void   tethering__set_event_status__init
-                     (Tethering__SetEventStatus         *message);
-size_t tethering__set_event_status__get_packed_size
-                     (const Tethering__SetEventStatus   *message);
-size_t tethering__set_event_status__pack
-                     (const Tethering__SetEventStatus   *message,
-                      uint8_t             *out);
-size_t tethering__set_event_status__pack_to_buffer
-                     (const Tethering__SetEventStatus   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__SetEventStatus *
-       tethering__set_event_status__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__set_event_status__free_unpacked
-                     (Tethering__SetEventStatus *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__EventMsg methods */
-void   tethering__event_msg__init
-                     (Tethering__EventMsg         *message);
-size_t tethering__event_msg__get_packed_size
-                     (const Tethering__EventMsg   *message);
-size_t tethering__event_msg__pack
-                     (const Tethering__EventMsg   *message,
-                      uint8_t             *out);
-size_t tethering__event_msg__pack_to_buffer
-                     (const Tethering__EventMsg   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__EventMsg *
-       tethering__event_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__event_msg__free_unpacked
-                     (Tethering__EventMsg *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__EventTerminate methods */
-void   tethering__event_terminate__init
-                     (Tethering__EventTerminate         *message);
-size_t tethering__event_terminate__get_packed_size
-                     (const Tethering__EventTerminate   *message);
-size_t tethering__event_terminate__pack
-                     (const Tethering__EventTerminate   *message,
-                      uint8_t             *out);
-size_t tethering__event_terminate__pack_to_buffer
-                     (const Tethering__EventTerminate   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__EventTerminate *
-       tethering__event_terminate__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__event_terminate__free_unpacked
-                     (Tethering__EventTerminate *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__SetSensorStatus methods */
-void   tethering__set_sensor_status__init
-                     (Tethering__SetSensorStatus         *message);
-size_t tethering__set_sensor_status__get_packed_size
-                     (const Tethering__SetSensorStatus   *message);
-size_t tethering__set_sensor_status__pack
-                     (const Tethering__SetSensorStatus   *message,
-                      uint8_t             *out);
-size_t tethering__set_sensor_status__pack_to_buffer
-                     (const Tethering__SetSensorStatus   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__SetSensorStatus *
-       tethering__set_sensor_status__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__set_sensor_status__free_unpacked
-                     (Tethering__SetSensorStatus *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__SensorData methods */
-void   tethering__sensor_data__init
-                     (Tethering__SensorData         *message);
-size_t tethering__sensor_data__get_packed_size
-                     (const Tethering__SensorData   *message);
-size_t tethering__sensor_data__pack
-                     (const Tethering__SensorData   *message,
-                      uint8_t             *out);
-size_t tethering__sensor_data__pack_to_buffer
-                     (const Tethering__SensorData   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__SensorData *
-       tethering__sensor_data__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__sensor_data__free_unpacked
-                     (Tethering__SensorData *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__SensorMsg methods */
-void   tethering__sensor_msg__init
-                     (Tethering__SensorMsg         *message);
-size_t tethering__sensor_msg__get_packed_size
-                     (const Tethering__SensorMsg   *message);
-size_t tethering__sensor_msg__pack
-                     (const Tethering__SensorMsg   *message,
-                      uint8_t             *out);
-size_t tethering__sensor_msg__pack_to_buffer
-                     (const Tethering__SensorMsg   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__SensorMsg *
-       tethering__sensor_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__sensor_msg__free_unpacked
-                     (Tethering__SensorMsg *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__Resolution methods */
-void   tethering__resolution__init
-                     (Tethering__Resolution         *message);
-size_t tethering__resolution__get_packed_size
-                     (const Tethering__Resolution   *message);
-size_t tethering__resolution__pack
-                     (const Tethering__Resolution   *message,
-                      uint8_t             *out);
-size_t tethering__resolution__pack_to_buffer
-                     (const Tethering__Resolution   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__Resolution *
-       tethering__resolution__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__resolution__free_unpacked
-                     (Tethering__Resolution *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__DisplayMsg methods */
-void   tethering__display_msg__init
-                     (Tethering__DisplayMsg         *message);
-size_t tethering__display_msg__get_packed_size
-                     (const Tethering__DisplayMsg   *message);
-size_t tethering__display_msg__pack
-                     (const Tethering__DisplayMsg   *message,
-                      uint8_t             *out);
-size_t tethering__display_msg__pack_to_buffer
-                     (const Tethering__DisplayMsg   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__DisplayMsg *
-       tethering__display_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__display_msg__free_unpacked
-                     (Tethering__DisplayMsg *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__TouchMaxCount methods */
-void   tethering__touch_max_count__init
-                     (Tethering__TouchMaxCount         *message);
-size_t tethering__touch_max_count__get_packed_size
-                     (const Tethering__TouchMaxCount   *message);
-size_t tethering__touch_max_count__pack
-                     (const Tethering__TouchMaxCount   *message,
-                      uint8_t             *out);
-size_t tethering__touch_max_count__pack_to_buffer
-                     (const Tethering__TouchMaxCount   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__TouchMaxCount *
-       tethering__touch_max_count__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__touch_max_count__free_unpacked
-                     (Tethering__TouchMaxCount *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__TouchData methods */
-void   tethering__touch_data__init
-                     (Tethering__TouchData         *message);
-size_t tethering__touch_data__get_packed_size
-                     (const Tethering__TouchData   *message);
-size_t tethering__touch_data__pack
-                     (const Tethering__TouchData   *message,
-                      uint8_t             *out);
-size_t tethering__touch_data__pack_to_buffer
-                     (const Tethering__TouchData   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__TouchData *
-       tethering__touch_data__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__touch_data__free_unpacked
-                     (Tethering__TouchData *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__TouchMsg methods */
-void   tethering__touch_msg__init
-                     (Tethering__TouchMsg         *message);
-size_t tethering__touch_msg__get_packed_size
-                     (const Tethering__TouchMsg   *message);
-size_t tethering__touch_msg__pack
-                     (const Tethering__TouchMsg   *message,
-                      uint8_t             *out);
-size_t tethering__touch_msg__pack_to_buffer
-                     (const Tethering__TouchMsg   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__TouchMsg *
-       tethering__touch_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__touch_msg__free_unpacked
-                     (Tethering__TouchMsg *message,
-                      ProtobufCAllocator *allocator);
-/* Tethering__TetheringMsg methods */
-void   tethering__tethering_msg__init
-                     (Tethering__TetheringMsg         *message);
-size_t tethering__tethering_msg__get_packed_size
-                     (const Tethering__TetheringMsg   *message);
-size_t tethering__tethering_msg__pack
-                     (const Tethering__TetheringMsg   *message,
-                      uint8_t             *out);
-size_t tethering__tethering_msg__pack_to_buffer
-                     (const Tethering__TetheringMsg   *message,
-                      ProtobufCBuffer     *buffer);
-Tethering__TetheringMsg *
-       tethering__tethering_msg__unpack
-                     (ProtobufCAllocator  *allocator,
-                      size_t               len,
-                      const uint8_t       *data);
-void   tethering__tethering_msg__free_unpacked
-                     (Tethering__TetheringMsg *message,
-                      ProtobufCAllocator *allocator);
-/* --- per-message closures --- */
-
-typedef void (*Tethering__HandShakeReq_Closure)
-                 (const Tethering__HandShakeReq *message,
-                  void *closure_data);
-typedef void (*Tethering__HandShakeAns_Closure)
-                 (const Tethering__HandShakeAns *message,
-                  void *closure_data);
-typedef void (*Tethering__EmulatorState_Closure)
-                 (const Tethering__EmulatorState *message,
-                  void *closure_data);
-typedef void (*Tethering__AppState_Closure)
-                 (const Tethering__AppState *message,
-                  void *closure_data);
-typedef void (*Tethering__StartReq_Closure)
-                 (const Tethering__StartReq *message,
-                  void *closure_data);
-typedef void (*Tethering__StartAns_Closure)
-                 (const Tethering__StartAns *message,
-                  void *closure_data);
-typedef void (*Tethering__SetEventStatus_Closure)
-                 (const Tethering__SetEventStatus *message,
-                  void *closure_data);
-typedef void (*Tethering__EventMsg_Closure)
-                 (const Tethering__EventMsg *message,
-                  void *closure_data);
-typedef void (*Tethering__EventTerminate_Closure)
-                 (const Tethering__EventTerminate *message,
-                  void *closure_data);
-typedef void (*Tethering__SetSensorStatus_Closure)
-                 (const Tethering__SetSensorStatus *message,
-                  void *closure_data);
-typedef void (*Tethering__SensorData_Closure)
-                 (const Tethering__SensorData *message,
-                  void *closure_data);
-typedef void (*Tethering__SensorMsg_Closure)
-                 (const Tethering__SensorMsg *message,
-                  void *closure_data);
-typedef void (*Tethering__Resolution_Closure)
-                 (const Tethering__Resolution *message,
-                  void *closure_data);
-typedef void (*Tethering__DisplayMsg_Closure)
-                 (const Tethering__DisplayMsg *message,
-                  void *closure_data);
-typedef void (*Tethering__TouchMaxCount_Closure)
-                 (const Tethering__TouchMaxCount *message,
-                  void *closure_data);
-typedef void (*Tethering__TouchData_Closure)
-                 (const Tethering__TouchData *message,
-                  void *closure_data);
-typedef void (*Tethering__TouchMsg_Closure)
-                 (const Tethering__TouchMsg *message,
-                  void *closure_data);
-typedef void (*Tethering__TetheringMsg_Closure)
-                 (const Tethering__TetheringMsg *message,
-                  void *closure_data);
-
-/* --- services --- */
-
-
-/* --- descriptors --- */
-
-extern const ProtobufCEnumDescriptor    tethering__message_result__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__connection_state__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__event_type__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__state__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__sensor_type__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__touch_state__descriptor;
-extern const ProtobufCMessageDescriptor tethering__hand_shake_req__descriptor;
-extern const ProtobufCMessageDescriptor tethering__hand_shake_ans__descriptor;
-extern const ProtobufCMessageDescriptor tethering__emulator_state__descriptor;
-extern const ProtobufCMessageDescriptor tethering__app_state__descriptor;
-extern const ProtobufCMessageDescriptor tethering__start_req__descriptor;
-extern const ProtobufCMessageDescriptor tethering__start_ans__descriptor;
-extern const ProtobufCMessageDescriptor tethering__set_event_status__descriptor;
-extern const ProtobufCMessageDescriptor tethering__event_msg__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__event_msg__type__descriptor;
-extern const ProtobufCMessageDescriptor tethering__event_terminate__descriptor;
-extern const ProtobufCMessageDescriptor tethering__set_sensor_status__descriptor;
-extern const ProtobufCMessageDescriptor tethering__sensor_data__descriptor;
-extern const ProtobufCMessageDescriptor tethering__sensor_msg__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__sensor_msg__type__descriptor;
-extern const ProtobufCMessageDescriptor tethering__resolution__descriptor;
-extern const ProtobufCMessageDescriptor tethering__display_msg__descriptor;
-extern const ProtobufCMessageDescriptor tethering__touch_max_count__descriptor;
-extern const ProtobufCMessageDescriptor tethering__touch_data__descriptor;
-extern const ProtobufCMessageDescriptor tethering__touch_msg__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__touch_msg__type__descriptor;
-extern const ProtobufCMessageDescriptor tethering__tethering_msg__descriptor;
-extern const ProtobufCEnumDescriptor    tethering__tethering_msg__type__descriptor;
-
-PROTOBUF_C_END_DECLS
-
-
-#endif  /* PROTOBUF_tethering_2eproto__INCLUDED */
index c2280cf..a9ae1e4 100644 (file)
@@ -76,7 +76,11 @@ static const GLubyte *(GLAPIENTRY *get_stringi)(GLenum, GLuint);
 static void (GLAPIENTRY *get_integerv)(GLenum, GLint*);
 static void (GLAPIENTRY *dummy)(void);
 
+#if defined(__linux__) && !defined(__APPLE__)
+static struct gl_context *check_gl_version(gl_version version, int *isGallium)
+#else
 static struct gl_context *check_gl_version(gl_version version)
+#endif
 {
     struct gl_context *ctx = NULL;
     int hw = 1;
@@ -115,6 +119,14 @@ static struct gl_context *check_gl_version(gl_version version)
     check_gl_log(gl_info, "+ GL_RENDERER = %s", (const char*)get_string(GL_RENDERER));
     check_gl_log(gl_info, "+ GL_VERSION = %s", (const char*)get_string(GL_VERSION));
 
+#if defined(__linux__) && !defined(__APPLE__)
+    if ((strstr((const char *)get_string(GL_RENDERER), "Gallium") != NULL)) {
+        *isGallium = 1;
+    } else {
+        *isGallium = 0;
+    }
+#endif
+
     if (!hw) {
         check_gl_context_destroy(ctx);
         ctx = NULL;
@@ -145,6 +157,11 @@ int check_gl(void)
     int have_es3 = 0;
     int have_es3_compatibility = 0;
     int have_es1 = 0;
+#if defined(__linux__) && !defined(__APPLE__)
+    int isGallium_2 = 0;
+    int isGallium_3_1 = 0;
+    int isGallium_3_2 = 0;
+#endif
 
     if (!check_gl_init()) {
         return 1;
@@ -156,9 +173,21 @@ int check_gl(void)
         goto out;
     }
 
+#if defined(__linux__) && !defined(__APPLE__)
+    ctx_2 = check_gl_version(gl_2, &isGallium_2);
+    ctx_3_1 = check_gl_version(gl_3_1, &isGallium_3_1);
+    ctx_3_2 = check_gl_version(gl_3_2, &isGallium_3_2);
+
+    if (isGallium_2 || isGallium_3_1 || isGallium_3_2) {
+        check_gl_log(gl_error, "Host has Gallium GL driver!");
+        res = 2;
+        goto out;
+    }
+#else
     ctx_2 = check_gl_version(gl_2);
     ctx_3_1 = check_gl_version(gl_3_1);
     ctx_3_2 = check_gl_version(gl_3_2);
+#endif
 
     if (!ctx_2 && !ctx_3_1 && !ctx_3_2) {
         check_gl_log(gl_info, "Host does not have hardware GL acceleration!");
index 70d7498..886c03a 100644 (file)
@@ -30,6 +30,7 @@
 #include "qemu/config-file.h"
 #include "hw/qdev.h"
 #include "monitor/qdev.h"
+#include "fsdev/qemu-fsdev.h"
 #include "qmp-commands.h"
 #include "sysemu/blockdev.h"
 #include "qemu/event_notifier.h"
@@ -44,6 +45,8 @@
 #define SDCARD_DRIVER               "virtio-blk-pci"
 #define SDCARD_DEFAULT_ID           "SDCARD0"
 
+#define FS_MOUNT_TAG                "fileshare"
+
 struct maru_device_hotplug {
     EventNotifier notifier;
 
@@ -53,6 +56,7 @@ struct maru_device_hotplug {
     // FIXME: Should we query device every time ??
     bool host_keyboard_attached;
     bool sdcard_attached;
+    bool hds_attached;
 };
 
 static struct maru_device_hotplug *state;
@@ -148,6 +152,64 @@ static bool do_sdcard_detach(void) {
     return true;
 }
 
+static bool do_hds_attach(const char * const file)
+{
+    QemuOpts *fsdev;
+    int ret;
+    QDict *qdict;
+
+    fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
+                             FS_MOUNT_TAG, 0, NULL);
+    if (!fsdev) {
+        return false;
+    }
+
+    qemu_opt_set(fsdev, "fsdriver", "local");
+    qemu_opt_set(fsdev, "path", file);
+    qemu_opt_set(fsdev, "security_model", "none");
+
+    ret = qemu_fsdev_add(fsdev);
+    if (ret != 0) {
+        return false;
+    }
+
+    qdict = qdict_new();
+    qdict_put(qdict, "driver", qstring_from_str("virtio-9p-pci"));
+    qdict_put(qdict, "fsdev", qstring_from_str(FS_MOUNT_TAG));
+    qdict_put(qdict, "mount_tag", qstring_from_str(FS_MOUNT_TAG));
+    qdict_put(qdict, "id", qstring_from_str(FS_MOUNT_TAG));
+
+    if (do_device_add(default_mon, qdict, NULL)) {
+        QDECREF(qdict);
+        return false;
+    }
+
+    QDECREF(qdict);
+
+    state->hds_attached = true;
+
+    return true;
+}
+
+static bool do_hds_detach(void)
+{
+    QDict *qdict = qdict_new();
+    qemu_fsdev_remove(FS_MOUNT_TAG);
+
+    qdict_put(qdict, "id", qstring_from_str(FS_MOUNT_TAG));
+
+    if (qmp_marshal_input_device_del(cur_mon, qdict, NULL)) {
+        QDECREF(qdict);
+        return false;
+    }
+
+    QDECREF(qdict);
+
+    state->hds_attached = false;
+
+    return true;
+}
+
 void do_hotplug(int command, void *opaque, size_t size)
 {
     if (command == ATTACH_SDCARD) {
@@ -177,6 +239,12 @@ static void device_hotplug_handler(EventNotifier *e)
     case DETACH_SDCARD:
         do_sdcard_detach();
         break;
+    case ATTACH_HDS:
+        do_hds_attach(state->opaque);
+        break;
+    case DETACH_HDS:
+        do_hds_detach();
+        break;
     default:
         break;
     }
@@ -211,3 +279,8 @@ bool is_sdcard_attached(void)
     return state->sdcard_attached;
 }
 
+bool is_hds_attached(void)
+{
+    return state->hds_attached;
+}
+
index 462baf3..69c8a97 100644 (file)
@@ -34,6 +34,8 @@ enum command {
     DETACH_HOST_KEYBOARD,
     ATTACH_SDCARD,
     DETACH_SDCARD,
+    ATTACH_HDS,
+    DETACH_HDS,
 };
 
 void maru_device_hotplug_init(void);
@@ -42,5 +44,6 @@ void do_hotplug(int command, void *opaque, size_t size);
 
 bool is_host_keyboard_attached(void);
 bool is_sdcard_attached(void);
+bool is_hds_attached(void);
 
 #endif // _MARU_DEVICE_HOTPLUG_H_
index 4f34fab..ad7d03f 100644 (file)
@@ -77,7 +77,7 @@ void maru_sighandler(int sig);
 char *get_canonical_path(char const *const path)
 {
     if ((int)g_path_is_absolute(path)) {
-        return (char *)path;
+        return (char *)g_strdup(path);
     }
 
     char *canonical_path;
index cddb692..8537ee3 100644 (file)
@@ -41,7 +41,7 @@ static char debugchfile[MAX_FILE_LEN] = {0, };
 static int fd = STDOUT_FILENO;
 
 static const char * const debug_classes[] =
-        {"SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "TRACE"};
+        {"SEVR", "WARN", "INFO", "CONF", "FINE", "TRCE"};
 
 #define MAX_DEBUG_OPTIONS 256
 
@@ -294,10 +294,12 @@ int dbg_log(enum _debug_class cls, struct _debug_channel *channel,
 
     if (!(_dbg_get_channel_flags(channel) & (1 << cls))) {
         return -1;
+    } else {
+        channel->name[MAX_NAME_LEN] = '\0';
     }
 
     ret += get_timeofday(buf_msg, sizeof(buf_msg));
-    ret += g_snprintf(buf_msg + ret, sizeof(buf_msg) - ret, "(%5d) [%s:%s] ",
+    ret += g_snprintf(buf_msg + ret, sizeof(buf_msg) - ret, "(%5d) [%4s:%10s] ",
                 qemu_get_thread_id(), debug_classes[cls], channel->name);
 
     va_start(valist, format);
index a0e0e23..6be8fb2 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <sys/types.h>
 
-#define MAX_NAME_LEN    15
+#define MAX_NAME_LEN    10
 // #define NO_DEBUG
 
 #ifdef __cplusplus
@@ -57,7 +57,7 @@ enum _debug_class
 struct _debug_channel
 {
     unsigned char flags;
-    char name[MAX_NAME_LEN];
+    char name[MAX_NAME_LEN + 1];
 };
 
 #ifndef NO_DEBUG
index 56913ae..9c86f1e 100644 (file)
@@ -381,3 +381,13 @@ void get_host_proxy_os(char *http_proxy, char *https_proxy, char *ftp_proxy, cha
         }
     }
 }
+
+bool make_sdcard_lock_os(char *sdcard)
+{
+    return make_sdcard_lock_posix(sdcard);
+}
+
+int remove_sdcard_lock_os(char *sdcard)
+{
+    return remove_sdcard_lock_posix(sdcard);
+}
index 53c5882..9708af8 100644 (file)
 #include <linux/version.h>
 #include <sys/utsname.h>
 #include <sys/sysinfo.h>
+#ifdef CONFIG_SPICE
+#include <dirent.h>
+#include "hw/virtio/maru_virtio_evdi.h"
+#endif
 
 MULTI_DEBUG_CHANNEL(emulator, osutil);
 
@@ -173,6 +177,11 @@ void set_bin_path_os(char const *const exec_argv)
     g_strlcpy(bin_path, link_path, strlen(link_path) - strlen(file_name) + 1);
 
     g_strlcat(bin_path, "/", PATH_MAX);
+
+#ifdef CONFIG_SPICE
+    g_strlcpy(remote_bin_path, link_path, strlen(link_path) - strlen(file_name) - 2);
+    g_strlcat(remote_bin_path, "remote/bin/", PATH_MAX);
+#endif
 }
 
 int get_number_of_processors(void)
@@ -445,3 +454,424 @@ void get_host_proxy_os(char *http_proxy, char *https_proxy, char *ftp_proxy, cha
     }
     pclose(output);
 }
+
+#ifdef CONFIG_SPICE
+#define PID_MAX_COUNT 256
+#define countof(X) ( (size_t) ( sizeof(X)/sizeof*(X) ) )
+const char *execution_file_websocket = "websockify.py";
+const char *execution_file_node = "node";
+const char *node_proc_name = "emulator-x86-web";
+static const char *sdb_push_path = "/home/developer/";
+static const char *must_have_pkgs[] = {"emuld", "spice-protocol", "spice-vdagent"};
+static const char *systemd_services[] = {"spice-vdagent.service", "spice-vdagentd.service"};
+
+void get_process_id(char const *process_name, char *first_param, int *pid, int *pscount)
+{
+    char cmdline[2048], dir_name[255];
+    int total_len = 0, current_len = 0;
+    struct dirent *dir_entry_p;
+    DIR *dir_p;
+    FILE *fp;
+    char *mptr;
+
+    dir_p = opendir("/proc/");
+    while (NULL != (dir_entry_p = readdir(dir_p))) {
+        /* Checking for numbered directories */
+        if (strspn(dir_entry_p->d_name, "0123456789") == strlen(dir_entry_p->d_name)) {
+            strcpy(dir_name, "/proc/");
+            strcat(dir_name, dir_entry_p->d_name);
+            strcat(dir_name, "/cmdline");
+
+            fp = fopen(dir_name, "rb");
+            if (fp == NULL) {
+                continue;
+            }
+
+            total_len = 0;
+            memset(cmdline, 0, sizeof(cmdline));
+            while (!feof(fp)) {
+                cmdline[total_len++] = fgetc(fp);
+            }
+
+            fclose(fp);
+            current_len = strlen(cmdline);
+            mptr = cmdline;
+            do {
+                if (strstr(mptr, process_name) != NULL) {
+                    if (!first_param || strstr(&cmdline[current_len + 1], first_param) != NULL) {
+                        if (sizeof(pid) < *pscount + 1) {
+                            ERR("PID array size is not enough.\n");
+                            return;
+                        }
+                        pid[*pscount] = atoi(dir_entry_p->d_name);
+                        INFO("get_process_id(%s %s) :Found. id = %d\n", process_name, first_param, pid[*pscount]);
+                        (*pscount)++;
+                    }
+                    break;
+                }
+
+                mptr = &cmdline[current_len + 1];
+                current_len += strlen(mptr) + 1;
+            } while (current_len < total_len);
+        }
+    }
+
+    closedir(dir_p);
+    if (*pscount == 0) {
+        INFO("get_process_id(%s %s) : id = 0 (could not find process)\n", process_name, first_param);
+    }
+}
+
+void execute_websocket(int port)
+{
+    char const *remote_bin_dir = get_remote_bin_path();
+    char const *relative_path = "../websocket/";
+    char websocket_path[strlen(remote_bin_dir) + strlen(execution_file_websocket) + strlen(relative_path) + 1];
+    int ret = -1;
+    char local_port[32];
+    char websocket_port[16];
+
+    memset(websocket_port, 0, sizeof(websocket_port));
+    sprintf(websocket_port, "%d", port);
+
+    memset(local_port, 0, sizeof(local_port));
+    sprintf(local_port, "localhost:%d", get_emul_spice_port());
+
+    memset(websocket_path, 0, sizeof(websocket_path));
+    sprintf(websocket_path, "%s%s%s", remote_bin_dir, relative_path, execution_file_websocket);
+
+    INFO("Exec [%s %s %s]\n", websocket_path, websocket_port, local_port);
+
+    ret = execl(websocket_path, execution_file_websocket, websocket_port, local_port, (char *)0);
+    if (ret == 127) {
+        ERR("Can't execute websocket.\n");
+    } else if (ret == -1) {
+        ERR("Fork error!\n");
+    }
+}
+
+void execute_nodejs(void)
+{
+    char const *remote_bin_dir = get_remote_bin_path();
+    char const *relative_path = "../web-viewer/bin/tty.js";
+    char webviewer_script[strlen(remote_bin_dir) + strlen(relative_path) + 1];
+    char nodejs_path[strlen(remote_bin_dir) + strlen(execution_file_node) + 1];
+    int ret = -1;
+
+    memset(webviewer_script, 0, sizeof(webviewer_script));
+    sprintf(webviewer_script, "%s%s", remote_bin_dir, relative_path);
+
+    memset(nodejs_path, 0, sizeof(nodejs_path));
+    sprintf(nodejs_path, "%s%s", remote_bin_dir, execution_file_node);
+
+    INFO("Exec [%s %s]\n", nodejs_path, webviewer_script);
+
+    ret = execl(nodejs_path, execution_file_node, webviewer_script, (char *)0);
+    if (ret == 127) {
+        ERR("Can't execute node server.\n");
+    } else if (ret == -1) {
+        ERR("Fork error!\n");
+    }
+}
+
+void clean_websocket_port(int signal)
+{
+    char websocket_port[16];
+    memset(websocket_port, 0, sizeof(websocket_port));
+    sprintf(websocket_port, "%d", get_emul_websocket_port());
+
+    int pscount = 0, i = 0;
+    int pid[PID_MAX_COUNT];
+
+    memset(pid, 0, PID_MAX_COUNT);
+    get_process_id(execution_file_websocket, websocket_port, pid, &pscount);
+    if (pscount > 0) {
+        for (i = 0; i < pscount; i++) {
+            INFO("Will be killed PID: %d\n", pid[i]);
+            kill(pid[i], signal);
+        }
+    }
+}
+
+static void websocket_notify_exit(Notifier *notifier, void *data)
+{
+    clean_websocket_port(SIGTERM);
+}
+
+static void nodejs_notify_exit(Notifier *notifier, void *data)
+{
+    int pscount = 0, i = 0;
+    int pid[PID_MAX_COUNT];
+
+    memset(pid, 0, sizeof(pid));
+    get_process_id("spicevmc", NULL, pid, &pscount);
+    if (pscount == 1) {
+        INFO("Detected the last spice emulator.\n");
+        memset(pid, 0, sizeof(pid));
+        pscount = 0;
+        get_process_id(node_proc_name, NULL, pid, &pscount);
+        for (i = 0; i < pscount; i++) {
+            INFO("Will be killed %s, PID: %d\n", node_proc_name, pid[i]);
+            kill(pid[i], SIGKILL);
+        }
+    }
+}
+
+static Notifier websocket_exit = { .notify = websocket_notify_exit };
+static Notifier nodejs_exit = { .notify = nodejs_notify_exit };
+
+void websocket_init(void)
+{
+    int pscount = 0;
+    char websocket_port[16];
+    int pid[PID_MAX_COUNT];
+
+    memset(websocket_port, 0, sizeof(websocket_port));
+    sprintf(websocket_port, "%d", get_emul_websocket_port());
+
+    memset(pid, 0, sizeof(pid));
+    get_process_id(execution_file_websocket, websocket_port, pid, &pscount);
+    emulator_add_exit_notifier(&websocket_exit);
+
+    if (pscount == 0) {
+        int pid = fork();
+        if (pid == 0) {
+            setsid();
+            execute_websocket(get_emul_websocket_port());
+        }
+    } else {
+       INFO("Aleady running websokify %s localhost:%d\n", websocket_port, get_emul_spice_port());
+    }
+}
+
+void nodejs_init(void)
+{
+    int pscount = 0;
+    int pid[PID_MAX_COUNT];
+
+    memset(pid, 0, sizeof(pid));
+    get_process_id(node_proc_name, NULL, pid, &pscount);
+    emulator_add_exit_notifier(&nodejs_exit);
+
+    if (pscount == 0) {
+        int pid = fork();
+        if (pid == 0) {
+            setsid();
+            execute_nodejs();
+        }
+    } else {
+       INFO("Aleady running node server.\n");
+    }
+}
+
+static int get_pkg_install_cnt(char const *pkg)
+{
+    FILE *fp;
+    char buf[255];
+    int pkg_cnt = 0;
+    char const *bin_dir = get_bin_path();
+    char const *relative_path = "../../sdb";
+    char cmd[strlen(bin_dir) + strlen(relative_path) + strlen(pkg) + 80];
+
+    /* check rpm pkg in guest */
+    sprintf(cmd, "%s%s -s emulator-%d shell \"rpm -qa | grep %s | wc -l\" 2>/dev/null",
+                                    bin_dir, relative_path, get_device_serial_number(), pkg);
+    fp = popen(cmd, "r");
+    if (fp == NULL) {
+        ERR("%s failed\n", cmd);
+        return -1;
+    }
+
+    /* The last output line is pkg cnt. */
+    memset(buf, 0, sizeof(buf));
+    while (fgets(buf, sizeof(buf), fp)) {
+        if (strlen(buf) == 0) {
+            pclose(fp);
+            return -1;
+        }
+    }
+    pclose(fp);
+    pkg_cnt = atoi(buf);
+
+    return pkg_cnt;
+}
+
+static bool send_cmd(char const *cmd)
+{
+    int sndlen = 15; /* HEADER(CMD + LENGTH + GROUP + ACTION) + 1 */
+    char* sndbuf;
+    bool ret = false;
+    short length = strlen(cmd);
+
+    sndlen += strlen(cmd);
+    sndbuf = (char*) g_malloc0(sndlen);
+    if (!sndbuf) {
+        ERR("g_malloc0 failed!\n");
+        return false;
+    }
+
+    memset(sndbuf, 0, sndlen);
+    memcpy(sndbuf, "cmd", 3);
+    memcpy(sndbuf + 10, &length, 2);
+    memcpy(sndbuf + 14, cmd, strlen(cmd));
+
+    TRACE("send to evdi: %s, %s\n", sndbuf, sndbuf + 14);
+
+    ret = send_to_evdi(route_ij, sndbuf, sndlen);
+    g_free(sndbuf);
+
+    if (!ret) {
+        ERR("send to evdi failed!\n");
+        return false;
+    }
+
+    return true;
+}
+
+static bool install_pkg(char const *pkg, char *installed_pkg)
+{
+    char const *bin_dir = get_bin_path();
+    char const *remote_bin_dir = get_remote_bin_path();
+    char const *relative_path = "../../sdb";
+    char pkg_fname[255];
+    char cmd[strlen(bin_dir) + strlen(relative_path) + sizeof(pkg_fname) + 48];
+    DIR *dir_p;
+    struct dirent *dir_entry_p;
+
+    /* to find a file, including pkg name */
+    dir_p = opendir(remote_bin_dir);
+    memset(pkg_fname, 0, sizeof(pkg_fname));
+    while (NULL != (dir_entry_p = readdir(dir_p))) {
+        if (strncmp(dir_entry_p->d_name, pkg, strlen(pkg)) == 0) {
+            strncpy(pkg_fname, dir_entry_p->d_name, strlen(dir_entry_p->d_name));
+            break;
+        }
+    }
+    closedir(dir_p);
+
+    if (strlen(pkg_fname) == 0) {
+        ERR("%s package is not exist in %s\n", pkg, remote_bin_dir);
+        return false;
+    }
+
+    /* sdb push pkg to guest */
+    memset(cmd, 0, sizeof(cmd));
+    sprintf(cmd, "%s%s -s emulator-%d push %s%s %s 2>/dev/null", bin_dir, relative_path,
+                        get_device_serial_number(), remote_bin_dir, pkg_fname, sdb_push_path);
+    int ret = system(cmd);
+    if (ret == 127) {
+        ERR("%s can't execute /bin/sh!\n", cmd);
+        return false;
+    } else if(ret == -1) {
+        ERR("%s fork error!\n", cmd);
+        return false;
+    }
+
+    /* install pkg */
+    memset(cmd, 0, sizeof(cmd));
+    sprintf(cmd, "rpm -i %s%s\n", sdb_push_path, pkg_fname);
+    if (send_cmd(cmd) == false) {
+        ERR("%s install failed\n", pkg_fname);
+        return false;
+    }
+
+    strncpy(installed_pkg, pkg_fname, strlen(pkg_fname));
+
+    return true;
+}
+
+static void* pkg_check_thread(void *args)
+{
+    int i = 0;
+    int repeat_cnt = 0;
+    int repeat_period = 500000;  /* 0.5 sec */
+    int repeat_max = 40;
+    int install_cnt = 0;
+    bool is_pkg_pushed = false;
+    char const *bin_dir = get_bin_path();
+    char const *relative_path = "../../sdb";
+    char cmd[strlen(bin_dir) + strlen(relative_path) + 80];
+    char installed_pkgs[countof(must_have_pkgs) - 1][255];
+
+    /* check sdb connection */
+    INFO("Waiting sdb connection...\n");
+    while (get_pkg_install_cnt(must_have_pkgs[0]) < 1) {
+        usleep(repeat_period);
+        if (++repeat_cnt == repeat_max) {
+            ERR("SDB connection failed\n");
+            pthread_exit(NULL);
+        }
+    }
+    INFO("SDB connected.\n");
+
+    /* pkg push and install */
+    for (i = 1; i < countof(must_have_pkgs); i++) {
+        if (get_pkg_install_cnt(must_have_pkgs[i]) < 1) {
+            INFO("Installing %s...\n", must_have_pkgs[i]);
+            memset(installed_pkgs[i - 1], 0, sizeof(installed_pkgs[i - 1]));
+            if (install_pkg(must_have_pkgs[i], installed_pkgs[i - 1]) == false) {
+                ERR("Install %s failed\n", must_have_pkgs[i]);
+                pthread_exit(NULL);
+            }
+
+            /* To make sure pkg is completely installed. */
+            repeat_cnt = 0;
+            while (get_pkg_install_cnt(must_have_pkgs[i]) < 1) {
+               usleep(repeat_period);
+               if (++repeat_cnt == repeat_max) {
+                   ERR("Install %s failed\n", must_have_pkgs[i]);
+                   pthread_exit(NULL);
+               }
+            }
+
+            install_cnt++;
+            is_pkg_pushed = true;
+            INFO("Installed %s\n", must_have_pkgs[i]);
+        } else {
+            INFO("Already installed %s\n", must_have_pkgs[i]);
+        }
+    }
+
+    /* start vdagent */
+    for (i = 0; i < countof(systemd_services); i++) {
+        memset(cmd, 0, sizeof(cmd));
+        sprintf(cmd, "systemctl start %s\n", systemd_services[i]);
+        if (send_cmd(cmd) == false) {
+            ERR("%s failed\n", cmd);
+        } else {
+            INFO("Started %s\n", systemd_services[i]);
+        }
+    }
+
+    /* delete vdagent pkgs */
+    if (is_pkg_pushed) {
+        for (; install_cnt > 0; install_cnt--) {
+            sprintf(cmd, "rm %s%s", sdb_push_path, installed_pkgs[install_cnt - 1]);
+            if (send_cmd(cmd) == false) {
+                ERR("%s%s delete failed\n", sdb_push_path, installed_pkgs[install_cnt - 1]);
+            } else {
+                TRACE("%s%s delete succeed\n", sdb_push_path, installed_pkgs[install_cnt - 1]);
+            }
+        }
+    }
+
+    pthread_exit(NULL);
+}
+
+void spice_pkg_install(void) {
+    QemuThread check_thread_id;
+    qemu_thread_create(&check_thread_id, "pkg_check_thread", pkg_check_thread, (void *)
+                                                  NULL, QEMU_THREAD_DETACHED);
+}
+#endif
+
+bool make_sdcard_lock_os(char *sdcard)
+{
+    return make_sdcard_lock_posix(sdcard);
+}
+
+
+int remove_sdcard_lock_os(char *sdcard)
+{
+    return remove_sdcard_lock_posix(sdcard);
+}
index eea34dc..9efef47 100644 (file)
@@ -55,6 +55,7 @@ static HANDLE g_hMapFile;
 static char *g_pBuf;
 
 extern char tizen_target_img_path[];
+static char g_sdcard[256] = {0,};
 
 static const char *pactempfile = ".autoproxy";
 
@@ -387,3 +388,89 @@ void get_host_proxy_os(char *http_proxy, char *https_proxy, char *ftp_proxy, cha
     free(proxyserver);
     RegCloseKey(hKey);
 }
+
+bool make_sdcard_lock_os(char *sdcard)
+{
+    char *lock_file = g_strdup_printf("%s.lck", sdcard);
+
+    HANDLE hFile = CreateFile(lock_file, GENERIC_READ,
+            0,
+            NULL,
+            CREATE_ALWAYS,
+            FILE_ATTRIBUTE_NORMAL,
+            NULL);
+
+    if (hFile == INVALID_HANDLE_VALUE) {
+        ERR("file open error : (%d)\n", GetLastError());
+        if(GetLastError() == 32) {
+            if(strcmp(g_sdcard, sdcard) == 0) {
+                INFO("try to mount same sdcard!\n");
+            }
+            return false;
+        }
+        return true;
+    }
+    INFO("Get file lock: %s\n", lock_file);
+    strncpy(g_sdcard, sdcard, strlen(sdcard));
+    info.handle = hFile;
+    return true;
+
+}
+
+int remove_sdcard_lock_os(char *sdcard)
+{
+    char *lock_file = g_strdup_printf("%s.lck", sdcard);
+    HANDLE hFile2;
+    BOOL fSuccess;
+    hFile2 = CreateFile(lock_file, GENERIC_READ,
+            0,
+            NULL,
+            OPEN_EXISTING,
+            FILE_ATTRIBUTE_NORMAL,
+            NULL);
+
+    if (hFile2 == INVALID_HANDLE_VALUE) {
+        ERR("CreateFile() error : (%d)\n", GetLastError());
+        if (GetLastError() == 32) {
+            if (strncmp(g_sdcard, sdcard, strlen(sdcard)) != 0) {
+                INFO("not same sdcard!!!\n");
+                return ERR_UNLCK;
+            }
+
+            INFO("return ERR_SUCCESS\n");
+            g_sdcard[0] = '\0';
+            fSuccess = DeleteFile(lock_file);
+            if (!fSuccess) {
+                // Handle the error.
+                ERR("DeleteFile failed (%d)\n", GetLastError());
+                return ERR_UNLCK;
+            }
+            return ERR_SUCCESS;
+        }
+        return ERR_NOENT;
+    }
+
+    hFile2 = CreateFile(lock_file, GENERIC_READ,
+            0,
+            NULL,
+            CREATE_ALWAYS,
+            FILE_ATTRIBUTE_NORMAL,
+            NULL);
+
+    if (hFile2 == INVALID_HANDLE_VALUE) {
+        ERR("CreateFile() error : (%d)\n", GetLastError());
+        return ERR_UNLCK;
+    }
+    CloseHandle(hFile2);
+    fSuccess = DeleteFile(lock_file);
+    if (!fSuccess) {
+        // Handle the error.
+        ERR("DeleteFile failed (%d)\n", GetLastError());
+        return ERR_UNLCK;
+    }
+    INFO("unlock success: %s\n", lock_file);
+    CloseHandle(info.handle);
+
+    return ERR_SUCCESS;
+
+}
index 3bcaf20..9e6f9ba 100644 (file)
@@ -43,6 +43,7 @@
 MULTI_DEBUG_CHANNEL(emulator, osutil);
 
 
+sdcard_info info;
 const char *pac_tempfile = ".autoproxy";
 
 inline size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
@@ -96,3 +97,83 @@ inline void remove_string(char *src, char *dst, const char *toremove)
 
     dst[j] = '\0';
 }
+
+#ifndef CONFIG_WIN32
+static int fd_lock(int fd)
+{
+    struct flock lock;
+
+    lock.l_type = F_WRLCK;
+    lock.l_start = 0;
+    lock.l_whence = SEEK_SET;
+    lock.l_len = 0;
+    lock.l_pid = getpid();
+
+    return fcntl(fd, F_SETLK, &lock);
+}
+
+static int fd_unlock(int fd)
+{
+    struct flock lock;
+
+    lock.l_type = F_UNLCK;
+    lock.l_start = 0;
+    lock.l_whence = SEEK_SET;
+    lock.l_len = 0;
+
+    return fcntl(fd, F_SETLK, &lock);
+}
+
+bool make_sdcard_lock_posix(char *sdcard)
+{
+    char *lock_file = g_strdup_printf("%s.lck", sdcard);
+    int fd = open(lock_file, O_CREAT|O_RDWR, 0666);
+    if (fd == -1)
+    {
+        perror("file open error : ");
+        return false;
+    }
+    if (fd_lock(fd) == -1)
+    {
+        perror("file is lock ");
+        close(fd);
+        return false;
+    }
+    info.fd = fd;
+    INFO("Get file lock: %s\n", lock_file);
+    return true;
+}
+
+int remove_sdcard_lock_posix(char *sdcard)
+{
+    errno = 0;
+    char *lock_file = g_strdup_printf("%s.lck", sdcard);
+    int fd = open(lock_file, O_RDWR, 0666);
+    if (fd == -1)
+    {
+        perror("file open error : ");
+        if(errno == ENOENT) {
+            return ERR_NOENT;
+        }
+        return ERR_UNLCK;
+    }
+
+    if (fd_unlock(fd) == -1)
+    {
+        perror("file unlock error ");
+        close(fd);
+        return ERR_UNLCK;
+    }
+
+    if (unlink(lock_file) < 0) {
+        perror("unlink error ");
+        close(fd);
+        return ERR_UNLCK;
+    }
+
+    INFO("unlock success: %s\n", lock_file);
+    close(fd);
+    close(info.fd);
+    return ERR_SUCCESS;
+}
+#endif
index f885823..75982d4 100644 (file)
 #define GCONFTOOL 0
 #define GSETTINGS 1
 
+#define ERR_SUCCESS 0
+#define ERR_UNLCK 4
+#define ERR_LCK   5
+#define ERR_NOENT 6
+
 extern const char *pac_tempfile;
 
 void check_vm_lock_os(void);
 void make_vm_lock_os(void);
 void remove_vm_lock_os(void);
+bool make_sdcard_lock_os(char *sdcard);
+int remove_sdcard_lock_os(char *sdcard);
 
 void set_bin_path_os(char const *const);
+typedef struct sdcard_info
+{
+#ifndef CONFIG_WIN32
+    int fd;
+#else
+    HANDLE handle;
+#endif
+    char* lock_file; /* reserved for future use */
+} sdcard_info;
+extern sdcard_info info;
+
+#ifndef CONFIG_WIN32
+bool make_sdcard_lock_posix(char *sdcard);
+int remove_sdcard_lock_posix(char *sdcard);
+#endif
 
 void print_system_info_os(void);
 
@@ -74,6 +96,16 @@ void download_url(char *);
 size_t write_data(void *, size_t, size_t, FILE *);
 void remove_string(char *, char *, const char *);
 
+#if defined(CONFIG_SPICE) && defined(CONFIG_LINUX)
+void get_process_id(char const *process_name, char *first_param, int *pid, int *pscount);
+void execute_websocket(int port);
+void execute_nodejs(void);
+void clean_websocket_port(int signal);
+void nodejs_init(void);
+void websocket_init(void);
+void spice_pkg_install(void);
+#endif
+
 static inline int get_timeofday(char *buf, size_t size)
 {
     qemu_timeval tv;
@@ -88,7 +120,7 @@ static inline int get_timeofday(char *buf, size_t size)
     ptm = localtime(&ti);
     ret = strftime(buf, size, "%H:%M:%S", ptm);
 
-    return ret + g_snprintf(buf + ret, size - ret, ".%06ld", (long)tv.tv_usec);
+    return ret + g_snprintf(buf + ret, size - ret, ".%03ld", (long)tv.tv_usec/1000);
 }
 
 int get_number_of_processors(void);
index 0d1c20b..44a7b31 100644 (file)
@@ -202,7 +202,7 @@ void sdb_setup(void)
     number = get_device_serial_number();
 
     for ( ; tries > 0; tries--, number += 10 ) {
-        sprintf(buf, "tcp:%d::26101", number);
+        sprintf(buf, "tcp:%d::%d", number, number);
         if(net_slirp_redir((char*)buf) < 0)
             continue;
 
index 4cce3b3..b7d869b 100644 (file)
 #include "hw/hw.h"
 #include "ui/spice-display.h"
 
+#ifdef CONFIG_MARU
+extern int get_emul_spice_port(void);
+#endif
+
 /* core bits */
 
 static SpiceServer *spice_server;
@@ -648,7 +652,12 @@ void qemu_spice_init(void)
     if (!opts) {
         return;
     }
+
+#ifdef CONFIG_MARU
+    port = get_emul_spice_port();
+#else
     port = qemu_opt_get_number(opts, "port", 0);
+#endif
     tls_port = qemu_opt_get_number(opts, "tls-port", 0);
     if (!port && !tls_port) {
         error_report("neither port nor tls-port specified for spice");
index ce6b220..33a0cea 100644 (file)
 
 #include "ui/spice-display.h"
 
+#ifdef CONFIG_MARU
+#define RATIO_SCALE 2
+#endif
+
 static int debug = 0;
 
 static void GCC_FMT_ATTR(2, 3) dprint(int level, const char *fmt, ...)
@@ -196,12 +200,14 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd,
 
 static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
 {
+#ifndef CONFIG_MARU
     static const int blksize = 32;
     int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize;
     int dirty_top[blocks];
     int y, yoff, x, xoff, blk, bw;
     int bpp = surface_bytes_per_pixel(ssd->ds);
     uint8_t *guest, *mirror;
+#endif
 
     if (qemu_spice_rect_is_empty(&ssd->dirty)) {
         return;
@@ -213,6 +219,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
                                                  ssd->ds->image);
     }
 
+#ifndef CONFIG_MARU
     for (blk = 0; blk < blocks; blk++) {
         dirty_top[blk] = -1;
     }
@@ -260,6 +267,27 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
             dirty_top[blk] = -1;
         }
     }
+#endif
+
+#ifdef CONFIG_MARU
+    pixman_transform_t matrix;
+    struct pixman_f_transform matrix_f;
+
+    pixman_f_transform_init_identity(&matrix_f);
+    pixman_f_transform_scale(&matrix_f, NULL, RATIO_SCALE, RATIO_SCALE);
+    pixman_transform_from_pixman_f_transform(&matrix, &matrix_f);
+    pixman_image_set_transform(ssd->ds->image, &matrix);
+    pixman_image_set_filter(ssd->ds->image, PIXMAN_FILTER_BEST, NULL, 0);
+
+    QXLRect update = {
+        .top    = 0,
+        .bottom = surface_height(ssd->ds),
+        .left   = 0,
+        .right  = surface_width(ssd->ds),
+    };
+
+    qemu_spice_create_one_update(ssd, &update);
+#endif
 
     memset(&ssd->dirty, 0, sizeof(ssd->dirty));
 }
@@ -307,6 +335,11 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
     surface.mem        = (uintptr_t)ssd->buf;
     surface.group_id   = MEMSLOT_GROUP_HOST;
 
+#ifdef CONFIG_MARU
+    surface.width /= RATIO_SCALE;
+    surface.height /= RATIO_SCALE;
+#endif
+
     qemu_spice_create_primary_surface(ssd, 0, &surface, QXL_SYNC);
 }
 
index 43e48ca..18991c1 100644 (file)
@@ -30,8 +30,6 @@
 # define AI_ADDRCONFIG 0
 #endif
 
-static const int on=1, off=0;
-
 /* used temporarily until all users are converted to QemuOpts */
 QemuOptsList socket_optslist = {
     .name = "socket",
@@ -159,6 +157,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
 #ifdef IPV6_V6ONLY
         if (e->ai_family == PF_INET6) {
             /* listen on both ipv4 and ipv6 */
+            const int off = 0;
             qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &off,
                             sizeof(off));
         }
index d42ef62..1560ab1 100644 (file)
@@ -27,4 +27,8 @@ FILESUBTYPE VFT2_UNKNOWN
   }
 }
 
+#ifdef CONFIG_MARU
+IDI_ICON1 ICON "tizen/src/skin/client/resource/icons/emulator_icon.ico"
+#else
 IDI_ICON1 ICON "pc-bios/qemu-nsis.ico"
+#endif
diff --git a/vl.c b/vl.c
index 702ff1b..44da833 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -143,13 +143,30 @@ int qemu_main(int argc, char **argv, char **envp);
 #define MAX_VIRTIO_CONSOLES 1
 #define MAX_SCLP_CONSOLES 1
 
-#ifdef CONFIG_MARU
-int skin_disabled = 0;
-static int enable_yagl= 0;
-extern int enable_spice;
+#ifdef CONFIG_YAGL
+static int enable_yagl = 0;
 static const char *yagl_backend = NULL;
+
+bool yagl_enabled(void); /* prototype to make gcc happy */
+bool yagl_enabled(void)
+{
+    return enable_yagl;
+}
+#endif /* CONFIG_YAGL */
+
+#ifdef CONFIG_VIGS
 static int enable_vigs = 0;
 static char *vigs_backend = NULL;
+#endif /* CONFIG_VIGS */
+
+#ifdef CONFIG_MARU
+int skin_disabled = 0;
+extern int enable_spice;
+#if defined(CONFIG_SPICE) && defined(CONFIG_LINUX)
+extern void websocket_init(void);
+extern void nodejs_init(void);
+extern void spice_pkg_install(void);
+#endif
 #endif
 
 static const char *data_dir[16];
@@ -241,9 +258,6 @@ static NotifierList machine_init_done_notifiers =
 
 static bool tcg_allowed = true;
 bool xen_allowed;
-// FIXME: ??
-int hax_allowed = 0;
-//
 uint32_t xen_domid;
 enum xen_mode xen_mode = XEN_EMULATE;
 static int tcg_tb_size;
@@ -2352,6 +2366,16 @@ static DisplayType select_display(const char *p)
         fprintf(stderr, "GTK support is disabled\n");
         exit(1);
 #endif
+#ifdef CONFIG_MARU
+# ifdef CONFIG_SDL
+    } else if (strstart(p, "maru_sdl", &opts)) {
+        display = DT_MARU_SDL;
+# endif
+# ifdef CONFIG_USE_SHM
+    } else if (strstart(p, "maru_shm", &opts)) {
+        display = DT_MARU_SHM;
+# endif
+#endif /* CONFIG_MARU */
     } else if (strstart(p, "none", &opts)) {
         display = DT_NONE;
     } else {
@@ -2745,9 +2769,18 @@ static MachineClass *machine_parse(const char *name)
 
 static int tcg_init(QEMUMachine *machine)
 {
-    int ret = 0;
     tcg_exec_init(tcg_tb_size * 1024 * 1024);
-    ret = hax_accel_init();
+    return 0;
+}
+
+static int hax_init(QEMUMachine *machine)
+{
+    int ret = hax_accel_init(ram_size);
+    if (!ret && !hax_ug_platform()) {
+        // TCG is used for very limited purpose under HAX.
+        // so we can allocate small TB buffer.
+        tcg_exec_init(16 * 1024 * 1024);
+    }
     return ret;
 }
 
@@ -2762,6 +2795,7 @@ static struct {
     { "xen", "Xen", xen_available, xen_init, &xen_allowed },
     { "kvm", "KVM", kvm_available, kvm_init, &kvm_allowed },
     { "qtest", "QTest", qtest_available, qtest_init_accel, &qtest_allowed },
+    { "hax", "HAX", hax_available, hax_init, &hax_allowed },
 };
 
 static int configure_accelerator(QEMUMachine *machine)
@@ -2985,8 +3019,6 @@ out:
 }
 
 #ifdef CONFIG_MARU
-int use_qemu_display = 0; //0:use tizen qemu sdl, 1:use original qemu sdl
-
 // W/A for preserve larger continuous heap for RAM.
 extern void *preallocated_ram_ptr;
 extern int preallocated_ram_size;
@@ -3971,15 +4003,8 @@ int main(int argc, char **argv, char **envp)
                 }
                 break;
             case QEMU_OPTION_enable_hax:
-#ifdef CONFIG_HAX_BACKEND
                 olist = qemu_find_opts("machine");
-                //qemu_opts_reset(olist);
-                hax_disable(0);
-                //qemu_opts_parse(olist, "accel=hax", 0);
-#else
-                fprintf(stderr,
-                        "HAX support is disabled, ignoring -enable-hax\n");
-#endif
+                qemu_opts_parse(olist, "accel=hax", 0);
                 break;
             case QEMU_OPTION_add_fd:
 #ifndef _WIN32
@@ -4242,7 +4267,15 @@ int main(int argc, char **argv, char **envp)
 
     if (display_type == DT_DEFAULT && !display_remote) {
 #if defined(CONFIG_MARU)
-        display_type = DT_MARU;
+        // FIXME: for compatibility...
+        // If no display_type is specified,
+        // we use DT_MARU_SDL on Linux, Windows and
+        // use DT_MARU_SHM on MacOS.
+#if defined(CONFIG_SDL)
+        display_type = DT_MARU_SDL;
+#elif defined(CONFIG_USE_SHM)
+        display_type = DT_MARU_SHM;
+#endif
 #elif defined(CONFIG_GTK)
         display_type = DT_GTK;
 #elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
@@ -4294,8 +4327,6 @@ int main(int argc, char **argv, char **envp)
         ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
     }
 
-    hax_pre_init(ram_size);
-
     if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0)
         != 0) {
         exit(0);
@@ -4370,6 +4401,10 @@ int main(int argc, char **argv, char **envp)
     qemu_mutex_lock_iothread();
 
 #ifdef CONFIG_SPICE
+#if defined(CONFIG_MARU) && defined(CONFIG_LINUX)
+    nodejs_init();
+#endif
+
     /* spice needs the timers to be initialized by this point */
     qemu_spice_init();
 #endif
@@ -4556,7 +4591,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 #ifdef CONFIG_YAGL
     // To support legacy YaGL options
-    if (enable_yagl) {
+    if (yagl_enabled()) {
         PCIBus *pci_bus = (PCIBus *) object_resolve_path_type("", TYPE_PCI_BUS, NULL);
         PCIDevice *pci_dev = pci_create(pci_bus, -1, "yagl");
         if (enable_vigs) {
@@ -4580,20 +4615,6 @@ int main(int argc, char **argv, char **envp)
         curses_display_init(ds, full_screen);
         break;
 #endif
-#if defined(CONFIG_MARU)
-#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM)
-    case DT_MARU:
-        maru_display_init(ds);
-        if (skin_disabled == 1) {
-            /* do not start skin client process */
-            set_emul_skin_enable(false);
-        } else {
-            set_emul_skin_enable(true);
-        }
-        start_skin();
-        break;
-#endif
-#endif
 #if defined(CONFIG_SDL)
     case DT_SDL:
         sdl_display_init(ds, full_screen, no_frame);
@@ -4608,6 +4629,21 @@ int main(int argc, char **argv, char **envp)
         gtk_display_init(ds, full_screen, grab_on_hover);
         break;
 #endif
+#if defined(CONFIG_MARU)
+#if defined(CONFIG_SDL) || defined(CONFIG_USE_SHM)
+    case DT_MARU_SDL:
+    case DT_MARU_SHM:
+        maru_display_init(ds, display_type, full_screen);
+        if (skin_disabled == 1) {
+            /* do not start skin client process */
+            set_emul_skin_enable(false);
+        } else {
+            set_emul_skin_enable(true);
+        }
+        start_skin();
+        break;
+#endif
+#endif
     default:
         break;
     }
@@ -4636,6 +4672,10 @@ int main(int argc, char **argv, char **envp)
 #ifdef CONFIG_SPICE
     if (using_spice) {
         qemu_spice_display_init();
+#if defined(CONFIG_MARU) && defined(CONFIG_LINUX)
+        spice_pkg_install();
+        websocket_init();
+#endif
     }
 #endif