Remove unused variable
[platform/core/api/camera.git] / src / camera.c
index 6fcde32..e5c2403 100644 (file)
 #include <camera.h>
 #include <muse_camera.h>
 #include <muse_camera_msg.h>
-#include <muse_core_ipc.h>
-#include <muse_core_module.h>
 #include <camera_private.h>
 #include <muse_core.h>
+#include <muse_client.h>
 #include <dlog.h>
 #include <Elementary.h>
 #include <tbm_surface_internal.h>
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
 #include <mm_evas_renderer.h>
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
+#include <gio/gio.h>
 
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
 #define LOG_TAG "TIZEN_N_CAMERA"
 
+/* for device changed callback */
+static GMutex g_cam_dev_state_changed_cb_lock;
+static GList *g_cam_dev_state_changed_cb_list;
+static int g_cam_dev_state_changed_cb_id;
+static GDBusConnection *g_cam_dev_state_changed_cb_conn;
+static guint g_cam_dev_state_changed_cb_subscribe_id;
+
+static void _camera_msg_send(int api, camera_cb_info_s *cb_info,
+       int *ret, int timeout);
+static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
+       int *ret, camera_msg_param *param, int timeout);
+static int _camera_import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle);
+static void _camera_release_imported_bo(tbm_bo *bo);
+static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
+       tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
+static int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
+       camera_media_packet_data *mp_data, media_packet_h *packet);
+static int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
+       tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data);
+static void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info);
+
 
 static void __global(void *data, struct wl_registry *registry,
        uint32_t name, const char *interface, uint32_t version)
@@ -110,8 +131,10 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
        int ret = CAMERA_ERROR_NONE;
        Ecore_Wl_Window *window = NULL;
        struct wl_display *display = NULL;
+       struct wl_display *display_wrapper = NULL;
        struct wl_surface *surface = NULL;
        struct wl_registry *registry = NULL;
+       struct wl_event_queue *queue = NULL;
        struct tizen_surface *tz_surface = NULL;
        struct tizen_resource *tz_resource = NULL;
 
@@ -127,6 +150,8 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
                goto _DONE;
        }
 
+       ecore_wl_window_video_has(window, EINA_TRUE);
+
        surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
        if (!surface) {
                LOGE("failed to get wayland surface");
@@ -141,7 +166,23 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
                goto _DONE;
        }
 
-       registry = wl_display_get_registry(display);
+       display_wrapper = wl_proxy_create_wrapper(display);
+       if (!display_wrapper) {
+               LOGE("failed to create wl display wrapper");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _DONE;
+       }
+
+       queue = wl_display_create_queue(display);
+       if (!queue) {
+               LOGE("failed to create wl display queue");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _DONE;
+       }
+
+       wl_proxy_set_queue((struct wl_proxy *)display_wrapper, queue);
+
+       registry = wl_display_get_registry(display_wrapper);
        if (!registry) {
                LOGE("failed to get wayland registry");
                ret = CAMERA_ERROR_INVALID_OPERATION;
@@ -150,8 +191,8 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
 
        wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
 
-       wl_display_dispatch(display);
-       wl_display_roundtrip(display);
+       wl_display_dispatch_queue(display, queue);
+       wl_display_roundtrip_queue(display, queue);
 
        if (!tz_surface) {
                LOGE("failed to get tizen surface");
@@ -171,15 +212,13 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
 
        tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
 
-       wl_display_roundtrip(display);
+       wl_display_roundtrip_queue(display, queue);
 
        if (wl_info->parent_id > 0) {
                int rotation = 0;
                Ecore_Evas *ecore_evas = NULL;
                ret = CAMERA_ERROR_NONE;
 
-               wl_info->evas_obj = obj;
-
                evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
                        &wl_info->window_width, &wl_info->window_height);
 
@@ -199,7 +238,7 @@ int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
                }
 
                LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
-                       wl_info->evas_obj, rotation, wl_info->parent_id,
+                       obj, rotation, wl_info->parent_id,
                        wl_info->window_x, wl_info->window_y,
                        wl_info->window_width, wl_info->window_height);
        } else {
@@ -223,10 +262,422 @@ _DONE:
                registry = NULL;
        }
 
+       if (queue) {
+               wl_event_queue_destroy(queue);
+               queue = NULL;
+       }
+
+       if (display_wrapper) {
+               wl_proxy_wrapper_destroy(display_wrapper);
+               display_wrapper = NULL;
+       }
+
        return ret;
 }
 
 
+static void __camera_update_api_waiting(camera_cb_info_s *cb_info, int api, int value)
+{
+       if (!cb_info ||
+               api < 0 || api >= MUSE_CAMERA_API_MAX) {
+               LOGE("invalid param %p %d", cb_info, api);
+               return;
+       }
+
+       g_mutex_lock(&(cb_info->api_mutex[api]));
+       cb_info->api_waiting[api] += value;
+       g_mutex_unlock(&(cb_info->api_mutex[api]));
+
+       /*LOGD("api %d, value %d, waiting %d",
+               api, value, cb_info->api_waiting[api]);*/
+
+       return;
+}
+
+
+static void __camera_device_state_changed_cb(GDBusConnection *connection,
+       const gchar *sender_name, const gchar *object_path, const gchar *interface_name,
+       const gchar *signal_name, GVariant *param, gpointer user_data)
+{
+       int value = 0;
+       camera_device_e device = CAMERA_DEVICE_CAMERA0;
+       camera_device_state_e state = CAMERA_DEVICE_STATE_NULL;
+       GList *tmp_list = NULL;
+       camera_cb_info *info = NULL;
+
+       g_mutex_lock(&g_cam_dev_state_changed_cb_lock);
+
+       if (!g_cam_dev_state_changed_cb_list || !param) {
+               LOGW("no callback or NULL param %p", param);
+               goto _DONE;
+       }
+
+       /* get device and state */
+       g_variant_get(param, "(i)", &value);
+
+       device = value >> 16;
+       state = 0x0000ffff & value;
+
+       LOGD("device %d, state %d", device, state);
+
+       tmp_list = g_cam_dev_state_changed_cb_list;
+
+       do {
+               info = (camera_cb_info *)tmp_list->data;
+
+               if (info) {
+                       if (info->callback) {
+                               LOGD("start id[%d] callback", info->id);
+                               ((camera_device_state_changed_cb)info->callback)(device, state, info->user_data);
+                               LOGD("returned id[%d] callback", info->id);
+                       } else {
+                               LOGW("NULL callback for id %d", info->id);
+                       }
+               }
+
+               tmp_list = tmp_list->next;
+       } while (tmp_list);
+
+_DONE:
+       g_mutex_unlock(&g_cam_dev_state_changed_cb_lock);
+
+       return;
+}
+
+
+static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv_msg)
+{
+       int i = 0;
+       int ret = 0;
+       int num_buffer_key = 0;
+       int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
+       int tbm_key = 0;
+       int data_key = 0;
+       unsigned char *buf_pos = NULL;
+       camera_msg_param param;
+
+       tbm_bo bo = NULL;
+       tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
+       tbm_bo_handle bo_handle = {.ptr = NULL};
+       tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
+       tbm_bo data_bo = NULL;
+       tbm_bo_handle data_bo_handle = {.ptr = NULL};
+
+       camera_preview_data_s frame;
+       camera_stream_data_s *stream = NULL;
+       camera_media_packet_data *mp_data = NULL;
+       media_packet_h pkt = NULL;
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       media_packet_h pkt_evas = NULL;
+#endif /* TIZEN_FEATURE_EVAS_RENDERER */
+
+       if (!cb_info || !recv_msg) {
+               LOGE("invalid param %p %p", cb_info, recv_msg);
+               return;
+       }
+
+       muse_camera_msg_get(tbm_key, recv_msg);
+       muse_camera_msg_get(num_buffer_key, recv_msg);
+       muse_camera_msg_get_array(buffer_key, recv_msg);
+       muse_camera_msg_get(data_key, recv_msg);
+
+       memset(&frame, 0x0, sizeof(camera_preview_data_s));
+
+       if (tbm_key <= 0) {
+               LOGE("invalid key %d", tbm_key);
+               return;
+       }
+
+       CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+
+       if (num_buffer_key < 0 || num_buffer_key > BUFFER_MAX_PLANE_NUM) {
+               LOGE("invalid num buffer key %d", num_buffer_key);
+               goto _PREVIEW_CB_HANDLER_DONE;
+       }
+
+       if (data_key > 0) {
+               /* import tbm data_bo and get virtual address */
+               if (!_camera_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
+                       LOGE("failed to import data key %d", data_key);
+                       goto _PREVIEW_CB_HANDLER_DONE;
+               }
+       }
+
+       /* import tbm bo and get virtual address */
+       if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
+               LOGE("failed to import key %d", tbm_key);
+               goto _PREVIEW_CB_HANDLER_DONE;
+       }
+
+       buf_pos = (unsigned char *)bo_handle.ptr;
+
+       /* get stream info */
+       stream = (camera_stream_data_s *)buf_pos;
+
+       for (i = 0 ; i < num_buffer_key ; i++) {
+               /* import buffer bo and get virtual address */
+               if (!_camera_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
+                       LOGE("failed to import buffer key %d", buffer_key[i]);
+                       goto _PREVIEW_CB_HANDLER_DONE;
+               }
+       }
+
+       /* call preview callback */
+       if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
+               _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
+
+               ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
+                       cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
+       }
+
+       if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+               ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
+
+               if (ret == CAMERA_ERROR_NONE) {
+                       ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt_evas);
+                       if (ret != CAMERA_ERROR_NONE) {
+                               LOGE("create pkt for evas failed");
+                               _camera_media_packet_data_release(mp_data, cb_info);
+                               mp_data = NULL;
+                       }
+               }
+#else /* TIZEN_FEATURE_EVAS_RENDERER */
+               LOGW("evas renderer is not supported");
+#endif /* TIZEN_FEATURE_EVAS_RENDERER */
+       }
+
+       /* call media packet callback */
+       if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
+               ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
+
+               if (ret == CAMERA_ERROR_NONE) {
+                       ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
+
+                       if (ret == CAMERA_ERROR_NONE) {
+                               ((camera_media_packet_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(pkt,
+                                       cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+                       } else {
+                               _camera_media_packet_data_release(mp_data, cb_info);
+                               mp_data = NULL;
+                       }
+               }
+       }
+
+#ifdef TIZEN_FEATURE_EVAS_RENDERER
+       /* call evas renderer */
+       if (pkt_evas) {
+               g_mutex_lock(&cb_info->evas_mutex);
+               if (cb_info->run_evas_render) {
+                       mm_evas_renderer_write(pkt_evas, cb_info->evas_info);
+               } else {
+                       LOGW("evas renderer is stopped, skip this buffer...");
+                       media_packet_destroy(pkt_evas);
+               }
+               pkt_evas = NULL;
+               g_mutex_unlock(&cb_info->evas_mutex);
+       }
+#endif /* TIZEN_FEATURE_EVAS_RENDERER */
+
+       /* send message for preview callback return */
+       if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
+               _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info, NULL, 0);
+
+_PREVIEW_CB_HANDLER_DONE:
+       if (mp_data == NULL) {
+               /* release imported bo */
+               for (i = 0 ; i < num_buffer_key ; i++)
+                       _camera_release_imported_bo(&buffer_bo[i]);
+
+               /* unmap and unref tbm bo */
+               _camera_release_imported_bo(&data_bo);
+               _camera_release_imported_bo(&bo);
+
+               /* return buffer */
+               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+
+               /*LOGD("return buffer Done");*/
+       }
+
+       return;
+}
+
+
+static void __camera_event_handler_capture(camera_cb_info_s *cb_info, char *recv_msg)
+{
+       int tbm_key = 0;
+       int tbm_key_main = 0;
+       int tbm_key_post = 0;
+       int tbm_key_thumb = 0;
+       unsigned char *buf_pos = NULL;
+
+       camera_msg_param param;
+       camera_image_data_s *rImage = NULL;
+       camera_image_data_s *rPostview = NULL;
+       camera_image_data_s *rThumbnail = NULL;
+
+       tbm_bo bo_main = NULL;
+       tbm_bo bo_post = NULL;
+       tbm_bo bo_thumb = NULL;
+       tbm_bo_handle bo_main_handle = {.ptr = NULL};
+       tbm_bo_handle bo_post_handle = {.ptr = NULL};
+       tbm_bo_handle bo_thumb_handle = {.ptr = NULL};
+
+       if (!cb_info || !recv_msg) {
+               LOGE("invalid param %p %p", cb_info, recv_msg);
+               return;
+       }
+
+       muse_camera_msg_get(tbm_key_main, recv_msg);
+       muse_camera_msg_get(tbm_key_post, recv_msg);
+       muse_camera_msg_get(tbm_key_thumb, recv_msg);
+
+       /*
+       LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
+               tbm_key_main, tbm_key_post, tbm_key_thumb);
+       */
+
+       if (tbm_key_main <= 0) {
+               LOGE("invalid key %d", tbm_key_main);
+               goto _CAPTURE_CB_HANDLER_DONE;
+       }
+
+       if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] == NULL) {
+               LOGW("NULL callback");
+               goto _CAPTURE_CB_HANDLER_DONE;
+       }
+
+       /* import tbm bo and get virtual address */
+       if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle)) {
+               LOGE("failed to import key [%d] for main", tbm_key_main);
+               goto _CAPTURE_CB_HANDLER_DONE;
+       }
+
+       buf_pos = (unsigned char *)bo_main_handle.ptr;
+       rImage = (camera_image_data_s *)buf_pos;
+       rImage->data = buf_pos + sizeof(camera_image_data_s);
+       if (rImage->exif && rImage->exif_size > 0) {
+               rImage->exif = rImage->data + rImage->size;
+       } else {
+               rImage->exif = NULL;
+               rImage->exif_size = 0;
+       }
+
+       LOGD("image info %dx%d, size %d, EXIF info %p, size %d",
+               rImage->width, rImage->height, rImage->size, rImage->exif, rImage->exif_size);
+
+       if (tbm_key_post > 0) {
+               /* import tbm bo and get virtual address */
+               if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle)) {
+                       buf_pos = (unsigned char *)bo_post_handle.ptr;
+                       rPostview = (camera_image_data_s *)buf_pos;
+                       LOGD("rPostview->size : %d", rPostview->size);
+                       rPostview->data = buf_pos + sizeof(camera_image_data_s);
+               } else {
+                       LOGE("failed to import key [%d] for postview", tbm_key_post);
+               }
+       }
+
+       if (tbm_key_thumb > 0) {
+               /* import tbm bo and get virtual address */
+               if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle)) {
+                       buf_pos = (unsigned char *)bo_thumb_handle.ptr;
+                       rThumbnail = (camera_image_data_s *)buf_pos;
+                       LOGD("rThumbnail->size : %d", rThumbnail->size);
+                       rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
+               } else {
+                       LOGE("failed to import key [%d] for thumbnail", tbm_key_thumb);
+               }
+       }
+
+       ((camera_capturing_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE])(rImage,
+               rPostview, rThumbnail, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE]);
+
+_CAPTURE_CB_HANDLER_DONE:
+       /* return buffer */
+       if (tbm_key_main > 0) {
+               _camera_release_imported_bo(&bo_main);
+
+               tbm_key = tbm_key_main;
+               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+
+               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+       }
+
+       if (tbm_key_post > 0) {
+               _camera_release_imported_bo(&bo_post);
+
+               tbm_key = tbm_key_post;
+               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+
+               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+       }
+
+       if (tbm_key_thumb > 0) {
+               _camera_release_imported_bo(&bo_thumb);
+
+               tbm_key = tbm_key_thumb;
+               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+
+               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+       }
+
+       LOGD("return buffer done");
+
+       return;
+}
+
+
+static void __camera_event_handler_face_detection(camera_cb_info_s *cb_info, char *recv_msg)
+{
+       int count = 0;
+       int tbm_key = 0;
+       camera_detected_face_s *faces = NULL;
+       camera_msg_param param;
+
+       tbm_bo bo = NULL;
+       tbm_bo_handle bo_handle = {.ptr = NULL};
+
+       if (!cb_info || !recv_msg) {
+               LOGE("invalid param %p %p", cb_info, recv_msg);
+               return;
+       }
+
+       muse_camera_msg_get(count, recv_msg);
+       muse_camera_msg_get(tbm_key, recv_msg);
+
+       if (count >= 0 && cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]) {
+               LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
+
+               if (tbm_key > 0) {
+
+                       if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
+                               /* set face info */
+                               faces = bo_handle.ptr;
+                       }
+               }
+
+               ((camera_face_detected_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION])(faces,
+                       count, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+
+               /* release bo */
+               _camera_release_imported_bo(&bo);
+       } else {
+               LOGW("skip face detection message [count %d, key %d, cb %p",
+                       count, tbm_key, cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+       }
+
+       /* return buffer */
+       if (tbm_key > 0) {
+               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+               /*LOGD("return buffer done");*/
+       }
+
+       return;
+}
+
+
 static int _camera_import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
 {
        tbm_bo tmp_bo = NULL;
@@ -264,7 +715,7 @@ static int _camera_import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_b
 static void _camera_release_imported_bo(tbm_bo *bo)
 {
        if (!bo || !(*bo)) {
-               LOGW("NULL bo");
+               /*LOGW("NULL bo");*/
                return;
        }
 
@@ -289,15 +740,22 @@ static int _camera_client_wait_for_cb_return(muse_camera_api_e api, camera_cb_in
        g_mutex_lock(&(cb_info->api_mutex[api]));
 
        if (cb_info->api_activating[api] == 0) {
-               end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
-               if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
+               if (time_out == CAMERA_CB_NO_TIMEOUT) {
+                       LOGW("wait for api %d", api);
+                       g_cond_wait(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]));
                        ret = cb_info->api_ret[api];
                        cb_info->api_activating[api] = 0;
-
-                       /*LOGD("return value : 0x%x", ret);*/
+                       LOGW("api %d returned 0x%x", api, ret);
                } else {
-                       ret = CAMERA_ERROR_INVALID_OPERATION;
-                       LOGE("api %d was TIMED OUT!", api);
+                       end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
+                       if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
+                               ret = cb_info->api_ret[api];
+                               cb_info->api_activating[api] = 0;
+                               /*LOGD("return value : 0x%x", ret);*/
+                       } else {
+                               ret = CAMERA_ERROR_INVALID_OPERATION;
+                               LOGE("api %d was TIMED OUT!", api);
+                       }
                }
        } else {
                ret = cb_info->api_ret[api];
@@ -338,7 +796,7 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info,
                return;
        }
 
-       msg = muse_core_msg_json_factory_new(api, NULL);
+       msg = muse_core_msg_new(api, NULL);
        if (!msg) {
                LOGE("msg failed: api %d", api);
 
@@ -350,8 +808,13 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info,
 
        /*LOGD("send msg %s", msg);*/
 
-       if (cb_info->is_server_connected)
-               send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+       if (cb_info->is_server_connected) {
+               __camera_update_api_waiting(cb_info, api, 1);
+
+               g_mutex_lock(&cb_info->fd_lock);
+               send_ret = muse_core_msg_send(cb_info->fd, msg);
+               g_mutex_unlock(&cb_info->fd_lock);
+       }
 
        if (send_ret < 0) {
                LOGE("msg send failed");
@@ -362,7 +825,9 @@ static void _camera_msg_send(int api, camera_cb_info_s *cb_info,
                        *ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
        }
 
-       muse_core_msg_json_factory_free(msg);
+       __camera_update_api_waiting(cb_info, api, -1);
+
+       muse_core_msg_free(msg);
 
        return;
 }
@@ -387,12 +852,12 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
 
        switch (param->type) {
        case MUSE_TYPE_INT:
-               msg = muse_core_msg_json_factory_new(api,
+               msg = muse_core_msg_new(api,
                        param->type, param->name, param->value.value_INT,
                        NULL);
                break;
        case MUSE_TYPE_STRING:
-               msg = muse_core_msg_json_factory_new(api,
+               msg = muse_core_msg_new(api,
                        param->type, param->name, param->value.value_STRING,
                        NULL);
                break;
@@ -412,8 +877,13 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
 
        /*LOGD("send msg %s", msg);*/
 
-       if (cb_info->is_server_connected)
-               send_ret = muse_core_ipc_send_msg(cb_info->fd, msg);
+       if (cb_info->is_server_connected) {
+               __camera_update_api_waiting(cb_info, api, 1);
+
+               g_mutex_lock(&cb_info->fd_lock);
+               send_ret = muse_core_msg_send(cb_info->fd, msg);
+               g_mutex_unlock(&cb_info->fd_lock);
+       }
 
        if (send_ret < 0) {
                LOGE("msg send failed");
@@ -425,7 +895,9 @@ static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
                        *ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
        }
 
-       muse_core_msg_json_factory_free(msg);
+       __camera_update_api_waiting(cb_info, api, -1);
+
+       muse_core_msg_free(msg);
 
        return;
 }
@@ -544,7 +1016,7 @@ int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mi
        return CAMERA_ERROR_NONE;
 }
 
-void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
+static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
        tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
 {
        int total_size = 0;
@@ -660,7 +1132,7 @@ void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_k
        return;
 }
 
-int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
+static int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
        tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
 {
        int i = 0;
@@ -692,7 +1164,7 @@ int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
        return ret;
 }
 
-void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
+static void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
 {
        int i = 0;
        int tbm_key = 0;
@@ -731,7 +1203,7 @@ void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera
        return;
 }
 
-int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
+static int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
        camera_media_packet_data *mp_data, media_packet_h *packet)
 {
        media_packet_h pkt = NULL;
@@ -955,10 +1427,6 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
 {
        int param1 = 0;
        int param2 = 0;
-       int tbm_key = 0;
-       tbm_bo bo = NULL;
-       tbm_bo_handle bo_handle = {NULL, };
-       camera_msg_param param;
 
        if (!recv_msg || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
                LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
@@ -967,16 +1435,24 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
 
        /*LOGD("get camera msg %s, event %d", recv_msg, event);*/
 
-       if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
-               if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
-                       cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
-                       cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
-                       LOGW("all preview callback from user are NULL");
+       g_mutex_lock(&cb_info->user_cb_mutex[event]);
+
+       if (cb_info->user_cb[event] == NULL) {
+               if (event != MUSE_CAMERA_EVENT_TYPE_PREVIEW &&
+                       event != MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW &&
+                       event != MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION &&
+                       event != MUSE_CAMERA_EVENT_TYPE_CAPTURE) {
+                       g_mutex_unlock(&cb_info->user_cb_mutex[event]);
+                       LOGW("NULL callback for event %d, return here", event);
                        return;
                }
-       } else if (cb_info->user_cb[event] == NULL) {
-               LOGW("user callback for event %d is not set", event);
-               return;
+
+               /* return buffer message should be sent for some events.
+                - MUSE_CAMERA_EVENT_TYPE_PREVIEW
+                - MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW
+                - MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION
+                - MUSE_CAMERA_EVENT_TYPE_CAPTURE
+               */
        }
 
        switch (event) {
@@ -1014,154 +1490,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                break;
        case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
        case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
-               {
-                       int i = 0;
-                       int ret = 0;
-                       int num_buffer_key = 0;
-                       int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
-                       int data_key = 0;
-                       unsigned char *buf_pos = NULL;
-
-                       tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
-                       tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
-                       tbm_bo data_bo = NULL;
-                       tbm_bo_handle data_bo_handle = {.ptr = NULL};
-
-                       camera_preview_data_s frame;
-                       camera_stream_data_s *stream = NULL;
-                       camera_media_packet_data *mp_data = NULL;
-                       media_packet_h pkt = NULL;
-
-                       muse_camera_msg_get(tbm_key, recv_msg);
-                       muse_camera_msg_get(num_buffer_key, recv_msg);
-                       muse_camera_msg_get_array(buffer_key, recv_msg);
-                       muse_camera_msg_get(data_key, recv_msg);
-
-                       memset(&frame, 0x0, sizeof(camera_preview_data_s));
-
-                       if (tbm_key <= 0) {
-                               LOGE("invalid key %d", tbm_key);
-                               break;
-                       }
-
-                       CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-
-                       if (data_key > 0) {
-                               /* import tbm data_bo and get virtual address */
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
-                                       LOGE("failed to import data key %d", data_key);
-                                       _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-                                       break;
-                               }
-                       }
-
-                       /* import tbm bo and get virtual address */
-                       if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
-                               LOGE("failed to import key %d", tbm_key);
-                               _camera_release_imported_bo(&data_bo);
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-                               break;
-                       }
-
-                       buf_pos = (unsigned char *)bo_handle.ptr;
-
-                       /* get stream info */
-                       stream = (camera_stream_data_s *)buf_pos;
-
-                       for (i = 0 ; i < num_buffer_key ; i++) {
-                               /* import buffer bo and get virtual address */
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
-                                       LOGE("failed to import buffer key %d", buffer_key[i]);
-
-                                       /* release imported bo */
-                                       _camera_release_imported_bo(&data_bo);
-                                       _camera_release_imported_bo(&bo);
-
-                                       for (i -= 1 ; i >= 0 ; i--)
-                                               _camera_release_imported_bo(&buffer_bo[i]);
-
-                                       /* send return buffer */
-                                       _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-
-                                       return;
-                               }
-                       }
-
-                       /* call preview callback */
-                       if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
-                               _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
-
-                               ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
-                                       cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
-                       }
-
-                       /* call media packet callback */
-                       if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
-                               ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
-
-                               if (ret == CAMERA_ERROR_NONE) {
-                                       ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
-
-                                       if (ret == CAMERA_ERROR_NONE) {
-                                               ((camera_media_packet_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(pkt,
-                                                       cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
-                                       } else {
-                                               _camera_media_packet_data_release(mp_data, cb_info);
-                                               mp_data = NULL;
-                                       }
-                               }
-                       }
-
-                       /* call evas renderer */
-                       if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-                               ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
-
-                               if (ret == CAMERA_ERROR_NONE) {
-                                       ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
-
-                                       if (ret == CAMERA_ERROR_NONE) {
-                                               g_mutex_lock(&cb_info->evas_mutex);
-
-                                               if (cb_info->run_evas_render) {
-                                                       mm_evas_renderer_write(pkt, cb_info->evas_info);
-                                               } else {
-                                                       LOGW("evas renderer is stopped, skip this buffer...");
-                                                       media_packet_destroy(pkt);
-                                               }
-
-                                               pkt = NULL;
-
-                                               g_mutex_unlock(&cb_info->evas_mutex);
-                                       } else {
-                                               _camera_media_packet_data_release(mp_data, cb_info);
-                                               mp_data = NULL;
-                                       }
-                               }
-#else /* TIZEN_FEATURE_EVAS_RENDERER */
-                               LOGW("evas renderer is not supported");
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
-                       }
-
-                       /* send message for preview callback return */
-                       if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
-                               _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info, NULL, 0);
-
-                       if (mp_data == NULL) {
-                               /* release imported bo */
-                               for (i = 0 ; i < num_buffer_key ; i++)
-                                       _camera_release_imported_bo(&buffer_bo[i]);
-
-                               /* unmap and unref tbm bo */
-                               _camera_release_imported_bo(&data_bo);
-                               _camera_release_imported_bo(&bo);
-
-                               /* return buffer */
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-
-                               /*LOGD("return buffer Done");*/
-                       }
-               }
+               __camera_event_handler_preview(cb_info, recv_msg);
                break;
        case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
                {
@@ -1169,7 +1498,7 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
 
                        muse_camera_msg_get(percent, recv_msg);
 
-                       LOGD("HDR progress - %d \%", percent);
+                       LOGD("HDR progress - %d %%", percent);
 
                        ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
                }
@@ -1198,49 +1527,30 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                                (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
                }
                break;
-       case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
+       case MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED:
                {
-                       int count = 0;
-                       camera_detected_face_s *faces = NULL;
-
-                       muse_camera_msg_get(count, recv_msg);
-                       muse_camera_msg_get(tbm_key, recv_msg);
-
-                       if (count > 0 && tbm_key > 0) {
-                               LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
-
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
-                                       break;
-
-                               /* set face info */
-                               faces = bo_handle.ptr;
-
-                               ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
-
-#if 0
-                               {
-                                       int i = 0;
+                       int policy = 0;
+                       int state = 0;
 
-                                       for (i = 0 ; i < count ; i++) {
-                                               LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
-                                                    i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
-                                       }
-                               }
-#endif
+                       muse_camera_msg_get(policy, recv_msg);
+                       muse_camera_msg_get(state, recv_msg);
 
-                               /* release bo */
-                               _camera_release_imported_bo(&bo);
+                       LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state);
 
-                               /* return buffer */
-                               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+                       if (policy == CAMERA_POLICY_SOUND)
+                               LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release.");
+                       else if (policy == CAMERA_POLICY_SOUND_BY_CALL)
+                               LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
+                       else if (policy == CAMERA_POLICY_SOUND_BY_ALARM)
+                               LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
 
-                               /*LOGD("return buffer done");*/
-                       } else {
-                               LOGE("invalid message - count %d, key %d", count, tbm_key);
-                       }
+                       ((camera_interrupt_started_cb)cb_info->user_cb[event])((camera_policy_e)policy,
+                               (camera_state_e)state, cb_info->user_data[event]);
                }
                break;
+       case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
+               __camera_event_handler_face_detection(cb_info, recv_msg);
+               break;
        case MUSE_CAMERA_EVENT_TYPE_ERROR:
                {
                        int error = 0;
@@ -1316,108 +1626,15 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                }
                break;
        case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
-               {
-                       camera_image_data_s *rImage = NULL;
-                       camera_image_data_s *rPostview = NULL;
-                       camera_image_data_s *rThumbnail = NULL;
-                       unsigned char *buf_pos = NULL;
-                       int tbm_key_main = 0;
-                       int tbm_key_post = 0;
-                       int tbm_key_thumb = 0;
-                       tbm_bo bo_main = NULL;
-                       tbm_bo bo_post = NULL;
-                       tbm_bo bo_thumb = NULL;
-                       tbm_bo_handle bo_main_handle = {NULL, };
-                       tbm_bo_handle bo_post_handle = {NULL, };
-                       tbm_bo_handle bo_thumb_handle = {NULL, };
-
-                       muse_camera_msg_get(tbm_key_main, recv_msg);
-                       muse_camera_msg_get(tbm_key_post, recv_msg);
-                       muse_camera_msg_get(tbm_key_thumb, recv_msg);
-
-                       /*
-                       LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
-                               tbm_key_main, tbm_key_post, tbm_key_thumb);
-                       */
-
-                       if (tbm_key_main <= 0) {
-                               LOGE("invalid key %d", tbm_key_main);
-                               break;
-                       }
-
-                       /* import tbm bo and get virtual address */
-                       if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
-                               break;
-
-                       buf_pos = (unsigned char *)bo_main_handle.ptr;
-                       rImage = (camera_image_data_s *)buf_pos;
-                       rImage->data = buf_pos + sizeof(camera_image_data_s);
-
-                       LOGD("image info %dx%d, size : %d", rImage->width, rImage->height, rImage->size);
-
-                       if (tbm_key_post > 0) {
-                               /* import tbm bo and get virtual address */
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
-                                       break;
-
-                               buf_pos = (unsigned char *)bo_post_handle.ptr;
-                               rPostview = (camera_image_data_s *)buf_pos;
-                               LOGD("rPostview->size : %d", rPostview->size);
-                               rPostview->data = buf_pos + sizeof(camera_image_data_s);
-                       }
-
-                       if (tbm_key_thumb > 0) {
-                               /* import tbm bo and get virtual address */
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
-                                       break;
-
-                               buf_pos = (unsigned char *)bo_thumb_handle.ptr;
-
-                               rThumbnail = (camera_image_data_s *)buf_pos;
-                               LOGD("rThumbnail->size : %d", rThumbnail->size);
-                               rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
-                       }
-
-                       ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
-
-                       /* unmap and unref tbm bo */
-                       _camera_release_imported_bo(&bo_main);
-
-                       /* return buffer */
-                       tbm_key = tbm_key_main;
-
-                       CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-
-                       _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-
-                       if (tbm_key_post > 0) {
-                               /* unmap and unref tbm bo */
-                               _camera_release_imported_bo(&bo_post);
-
-                               /* return buffer */
-                               param.value.value_INT = tbm_key_post;
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-                       }
-
-                       if (tbm_key_thumb > 0) {
-                               /* unmap and unref tbm bo */
-                               _camera_release_imported_bo(&bo_thumb);
-
-                               /* return buffer */
-                               param.value.value_INT = tbm_key_thumb;
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-                       }
-
-                       LOGD("return buffer done");
-               }
-               break;
-       case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
+               __camera_event_handler_capture(cb_info, recv_msg);
                break;
        default:
-               LOGW("Unknown event : %d", event);
+               LOGW("unhandled event %d", event);
                break;
        }
 
+       g_mutex_unlock(&cb_info->user_cb_mutex[event]);
+
        return;
 }
 
@@ -1436,7 +1653,7 @@ static bool _camera_idle_event_callback(void *data)
 
        cb_info = cam_idle_event->cb_info;
        if (cb_info == NULL) {
-               LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
+               LOGW("camera cb_info is NULL. event %p %d", cam_idle_event, cam_idle_event->event);
                goto IDLE_EVENT_CALLBACK_DONE;
        }
 
@@ -1450,7 +1667,7 @@ static bool _camera_idle_event_callback(void *data)
        g_mutex_unlock(&cb_info->idle_event_mutex);
 
        /* user callback */
-       _camera_client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
+       _camera_client_user_callback(cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
 
        /* send signal for waiting thread */
        g_cond_signal(&cb_info->idle_event_cond);
@@ -1476,7 +1693,7 @@ static void *_camera_msg_handler_func(gpointer data)
        camera_cb_info_s *cb_info = NULL;
 
        if (!handler_info || !handler_info->cb_info) {
-               LOGE("t:%d NULL handler %p", type, handler_info);
+               LOGE("NULL handler %p", handler_info);
                return NULL;
        }
 
@@ -1517,12 +1734,16 @@ static void *_camera_msg_handler_func(gpointer data)
                        g_mutex_lock(&cb_info->api_mutex[api]);
 
                        if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
-                               cb_info->api_ret[api] = ret;
-                               cb_info->api_activating[api] = 1;
+                               if (cb_info->api_waiting[api] > 0) {
+                                       cb_info->api_ret[api] = ret;
+                                       cb_info->api_activating[api] = 1;
 
-                               /*LOGD("t:%d camera api %d - return 0x%x", type, ret);*/
+                                       /*LOGD("t:%d camera api %d - return 0x%x", type, ret);*/
 
-                               g_cond_signal(&cb_info->api_cond[api]);
+                                       g_cond_signal(&cb_info->api_cond[api]);
+                               } else {
+                                       LOGW("no waiting for this api [%d]", api);
+                               }
                        } else {
                                LOGE("t:%d failed to get camera ret for api %d, msg %s", type, api, cam_msg->recv_msg);
                        }
@@ -1543,9 +1764,9 @@ static void *_camera_msg_handler_func(gpointer data)
                                cam_idle_event->event = cam_msg->event;
                                cam_idle_event->cb_info = cb_info;
                                g_mutex_init(&cam_idle_event->event_mutex);
-                               memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
+                               strncpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg) - 1);
 
-                               /*LOGD("t:%d add camera event[%d, %p] to IDLE", type, event, cam_idle_event);*/
+                               /*LOGD("t:%d add camera event[%d, %p] to IDLE", type, cam_msg->event, cam_idle_event);*/
 
                                g_mutex_lock(&cb_info->idle_event_mutex);
                                cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
@@ -1590,10 +1811,9 @@ static void *_camera_msg_handler_func(gpointer data)
 }
 
 
-static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
+static void _camera_deactivate_idle_event_all(camera_cb_info_s *cb_info)
 {
        camera_idle_event_s *cam_idle_event = NULL;
-       gboolean ret = TRUE;
        GList *list = NULL;
        gint64 end_time = 0;
 
@@ -1621,40 +1841,27 @@ static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
                        continue;
                }
 
-               if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
-                       ret = g_idle_remove_by_data(cam_idle_event);
+               if (!g_mutex_trylock(&cam_idle_event->event_mutex)) {
+                       LOGW("lock failed, %p event is calling now", cam_idle_event);
 
-                       LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
+                       end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
 
-                       if (!ret) {
-                               cam_idle_event->cb_info = NULL;
-                               LOGW("idle event %p will be called later", cam_idle_event);
-                       }
-
-                       cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
-
-                       g_mutex_unlock(&cam_idle_event->event_mutex);
-
-                       if (ret) {
-                               g_mutex_clear(&cam_idle_event->event_mutex);
-
-                               g_free(cam_idle_event);
-                               cam_idle_event = NULL;
-
-                               LOGD("remove idle event done");
-                       }
+                       if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
+                               LOGW("signal received");
+                       else
+                               LOGW("timeout");
 
                        continue;
                }
 
-               LOGW("event lock failed. it's being called...");
+               LOGW("set NULL cb_info for event %p %d, it will be freed on idle callback",
+                       cam_idle_event, cam_idle_event->event);
+
+               cam_idle_event->cb_info = NULL;
 
-               end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
+               cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
 
-               if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
-                       LOGW("signal received");
-               else
-                       LOGW("timeout");
+               g_mutex_unlock(&cam_idle_event->event_mutex);
        }
 
        g_list_free(cb_info->idle_event_list);
@@ -1685,7 +1892,7 @@ static void __camera_add_msg_to_queue(camera_cb_info_s *cb_info, int api, int ev
        cam_msg->event = event;
        cam_msg->event_class = event_class;
 
-       memcpy(cam_msg->recv_msg, msg, sizeof(cam_msg->recv_msg));
+       strncpy(cam_msg->recv_msg, msg, sizeof(cam_msg->recv_msg) - 1);
 
        /*LOGD("add camera message to queue : api %d, event %d, event_class %d", api, event, event_class);*/
 
@@ -1712,20 +1919,139 @@ static void __camera_add_msg_to_queue(camera_cb_info_s *cb_info, int api, int ev
 }
 
 
+static void __camera_process_msg(camera_cb_info_s *cb_info, char *msg)
+{
+       int ret = CAMERA_ERROR_NONE;
+       int api = -1;
+       int api_class = -1;
+       int event = -1;
+       int event_class = -1;
+       int get_type = -1;
+       int get_index = -1;
+
+       if (!cb_info || !msg) {
+               LOGE("invalid ptr %p %p", cb_info, msg);
+               return;
+       }
+
+       /*LOGD("msg [%s]", msg);*/
+
+       if (!muse_camera_msg_get(api, msg)) {
+               LOGE("failed to get camera api");
+               return;
+       }
+
+       if (api == MUSE_CAMERA_CB_EVENT) {
+               if (!muse_camera_msg_get(event, msg) ||
+                       !muse_camera_msg_get(event_class, msg)) {
+                       LOGE("failed to get camera event or event_class [%s]", msg);
+                       return;
+               }
+       } else {
+               if (!muse_camera_msg_get(api_class, msg)) {
+                       LOGE("failed to get camera api_class [%s]", msg);
+                       return;
+               }
+       }
+
+       if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
+               if (api >= MUSE_CAMERA_API_MAX) {
+                       LOGE("invalid api %d", api);
+                       return;
+               }
+
+               if (!muse_camera_msg_get(ret, msg)) {
+                       LOGE("failed to get camera ret");
+                       return;
+               }
+
+               g_mutex_lock(&cb_info->api_mutex[api]);
+
+               switch (api) {
+               case MUSE_CAMERA_API_CREATE:
+                       if (ret != CAMERA_ERROR_NONE) {
+                               g_atomic_int_set(&cb_info->msg_recv_running, 0);
+                               LOGE("camera create error 0x%x. close client cb handler", ret);
+                       }
+                       break;
+               case MUSE_CAMERA_API_DESTROY:
+                       if (ret == CAMERA_ERROR_NONE) {
+                               g_atomic_int_set(&cb_info->msg_recv_running, 0);
+                               LOGD("camera destroy done. close client cb handler");
+                       }
+                       break;
+               default:
+                       muse_camera_msg_get(get_type, msg);
+                       if (get_type != MUSE_CAMERA_GET_TYPE_NONE) {
+                               if (get_type != MUSE_CAMERA_GET_TYPE_ARRAY)
+                                       muse_camera_msg_get(get_index, msg);
+
+                               switch (get_type) {
+                               case MUSE_CAMERA_GET_TYPE_INT:
+                                       muse_core_msg_deserialize("get_value", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int[get_index]);
+                                       break;
+                               case MUSE_CAMERA_GET_TYPE_INT_PAIR:
+                                       muse_core_msg_deserialize("get_value0", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int_pair[get_index][0]);
+                                       muse_core_msg_deserialize("get_value1", msg, NULL, NULL, MUSE_TYPE_INT, &cb_info->get_int_pair[get_index][1]);
+                                       break;
+                               case MUSE_CAMERA_GET_TYPE_ARRAY:
+                                       if (api == MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA) {
+                                               muse_core_msg_deserialize("get_value",
+                                                       msg, NULL, NULL, MUSE_TYPE_ARRAY, cb_info->get_display_roi_area);
+                                               LOGD("get display roi %d,%d,%dx%d",
+                                                       cb_info->get_display_roi_area[0],
+                                                       cb_info->get_display_roi_area[1],
+                                                       cb_info->get_display_roi_area[2],
+                                                       cb_info->get_display_roi_area[3]);
+                                       } else {
+                                               muse_core_msg_deserialize("get_value",
+                                                       msg, NULL, NULL, MUSE_TYPE_ARRAY, cb_info->get_geotag);
+                                               LOGD("get geotag %lf, %lf, %lf",
+                                                       cb_info->get_geotag[0], cb_info->get_geotag[1], cb_info->get_geotag[2]);
+                                       }
+                                       break;
+                               case MUSE_CAMERA_GET_TYPE_STRING:
+                                       muse_core_msg_deserialize("get_value", msg, NULL, NULL, MUSE_TYPE_STRING, cb_info->get_string[get_index]);
+                                       break;
+                               default:
+                                       LOGW("unknown type %d", get_type);
+                                       break;
+                               }
+                       }
+                       break;
+               }
+
+               if (cb_info->api_waiting[api] > 0) {
+                       cb_info->api_ret[api] = ret;
+                       cb_info->api_activating[api] = 1;
+
+                       g_cond_signal(&cb_info->api_cond[api]);
+               } else {
+                       LOGW("no waiting for this api [%d]", api);
+               }
+
+               g_mutex_unlock(&cb_info->api_mutex[api]);
+       } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
+               __camera_add_msg_to_queue(cb_info, api, event, event_class, msg);
+       } else {
+               LOGW("unknown camera api %d, class %d", api, api_class);
+       }
+
+       return;
+}
+
+
 static void *_camera_msg_recv_func(gpointer data)
 {
-       int i = 0;
-       int ret = 0;
-       int api = 0;
-       int api_class = 0;
-       int event = 0;
-       int event_class = 0;
-       int num_token = 0;
-       int str_pos = 0;
-       int prev_pos = 0;
-       char *error_msg = NULL;
+       int recv_length = 0;
+       int single_length = 0;
+       int remained_length = 0;
        char *recv_msg = NULL;
-       char **parse_str = NULL;
+       char *single_msg = NULL;
+       char *remained_msg = NULL;
+       int num_msg = 0;
+       int cur_pos = 0;
+       int prev_pos = 0;
        camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
 
        if (!cb_info) {
@@ -1735,132 +2061,103 @@ static void *_camera_msg_recv_func(gpointer data)
 
        LOGD("start");
 
-       parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
-       if (parse_str == NULL) {
-               LOGE("parse_str malloc failed");
+       single_msg = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
+       if (!single_msg) {
+               LOGE("single_msg malloc failed");
                return NULL;
        }
 
-       for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
-               parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
-               if (parse_str[i] == NULL) {
-                       LOGE("parse_str[%d] malloc failed", i);
-                       goto CB_HANDLER_EXIT;
-               }
-       }
-
        recv_msg = cb_info->recv_msg;
 
        while (g_atomic_int_get(&cb_info->msg_recv_running)) {
-               ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
-               if (ret <= 0) {
+               recv_length = muse_core_msg_recv(cb_info->fd, recv_msg);
+               if (recv_length <= 0) {
                        cb_info->is_server_connected = FALSE;
                        LOGE("receive msg failed - server disconnected");
                        break;
                }
 
-               recv_msg[ret] = '\0';
-
-               str_pos = 0;
+               cur_pos = 0;
                prev_pos = 0;
-               num_token = 0;
-
-               /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
-
-               /* Need to split the combined entering msgs.
-                   This module supports up to 200 combined msgs. */
-               for (str_pos = 0; str_pos < ret; str_pos++) {
-                       if (recv_msg[str_pos] == '}') {
-                               strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
-                               /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
-                               prev_pos = str_pos + 1;
-                               num_token++;
-                       }
-               }
+               num_msg = 0;
 
-               /*LOGD("num_token : %d", num_token);*/
+               /*LOGD("recv msg : %s, length : %d", recv_msg, recv_length);*/
 
-               /* Re-construct to the useful single msg. */
-               for (i = 0; i < num_token; i++) {
-                       if (i >= CAMERA_PARSE_STRING_SIZE) {
-                               LOGE("invalid token index %d", i);
-                               break;
-                       }
+               /* Need to split the combined entering msgs */
+               for (cur_pos = 0 ; cur_pos < recv_length ; cur_pos++) {
+                       if (recv_msg[cur_pos] == '}') {
+                               single_length = cur_pos - prev_pos + 1;
 
-                       api = -1;
-                       api_class = -1;
-                       event = -1;
-                       event_class = -1;
+                               if (single_length < MUSE_CAMERA_MSG_MAX_LENGTH) {
+                                       /* check remained msg */
+                                       if (remained_length > 0) {
+                                               if (remained_msg) {
+                                                       strncpy(single_msg, remained_msg, remained_length);
+                                                       strncpy(single_msg + remained_length, recv_msg + prev_pos, single_length);
+                                                       single_msg[remained_length + single_length] = '\0';
 
-                       if (!muse_camera_msg_get(api, parse_str[i])) {
-                               LOGE("failed to get camera api");
-                               continue;
-                       }
+                                                       free(remained_msg);
+                                                       remained_msg = NULL;
+                                               } else {
+                                                       strncpy(single_msg, recv_msg + prev_pos, single_length);
+                                                       single_msg[single_length] = '\0';
+                                                       LOGE("lost msg [%s], skip...", single_msg);
+                                               }
 
-                       if (api == MUSE_CAMERA_CB_EVENT) {
-                               if (!muse_camera_msg_get(event, parse_str[i]) ||
-                                       !muse_camera_msg_get(event_class, parse_str[i])) {
-                                       LOGE("failed to get camera event or event_class [%s]", parse_str[i]);
-                                       continue;
-                               }
-                       } else {
-                               if (!muse_camera_msg_get(api_class, parse_str[i])) {
-                                       LOGE("failed to get camera api_class [%s]", parse_str[i]);
-                                       continue;
-                               }
-                       }
+                                               remained_length = 0;
+                                       } else {
+                                               strncpy(single_msg, recv_msg + prev_pos, single_length);
+                                               single_msg[single_length] = '\0';
+                                       }
 
-                       if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
-                               if (api >= MUSE_CAMERA_API_MAX) {
-                                       LOGE("invalid api %d", api);
-                                       continue;
+                                       if (single_msg[0] == '{') {
+                                               num_msg++;
+                                               /*LOGD("splitted msg : [%s], Index : %d", single_msg, num_msg);*/
+                                               /* process each message */
+                                               __camera_process_msg(cb_info, single_msg);
+                                       } else {
+                                               LOGE("invalid msg [%s]", single_msg);
+                                       }
+                               } else {
+                                       LOGE("too long message [len %d] skip...", single_length);
                                }
 
-                               g_mutex_lock(&cb_info->api_mutex[api]);
+                               prev_pos = cur_pos + 1;
+                       }
+               }
 
-                               if (!muse_camera_msg_get(ret, parse_str[i])) {
-                                       LOGE("failed to get camera ret");
-                                       g_mutex_unlock(&cb_info->api_mutex[api]);
-                                       continue;
-                               }
+               /* check incompleted message */
+               if (recv_msg[recv_length - 1] != '}') {
+                       remained_length = recv_length - prev_pos;
 
-                               cb_info->api_ret[api] = ret;
-                               cb_info->api_activating[api] = 1;
+                       LOGW("incompleted message [len %d]", remained_length);
 
-                               if (api == MUSE_CAMERA_API_CREATE) {
-                                       if (ret != CAMERA_ERROR_NONE) {
-                                               g_atomic_int_set(&cb_info->msg_recv_running, 0);
-                                               LOGE("camera create error 0x%x. close client cb handler", ret);
-                                       }
-                               } else if (api == MUSE_CAMERA_API_DESTROY) {
-                                       if (ret == CAMERA_ERROR_NONE) {
-                                               g_atomic_int_set(&cb_info->msg_recv_running, 0);
-                                               LOGD("camera destroy done. close client cb handler");
-                                       }
-                               } else if (api == MUSE_CAMERA_API_GET_FLASH_STATE) {
-                                       g_atomic_int_set(&cb_info->msg_recv_running, 0);
-                                       LOGD("get flash state done. close client cb handler");
-                               }
+                       if (remained_msg) {
+                               free(remained_msg);
+                               remained_msg = NULL;
+                       }
 
-                               g_cond_signal(&cb_info->api_cond[api]);
-                               g_mutex_unlock(&cb_info->api_mutex[api]);
-                       } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
-                               __camera_add_msg_to_queue(cb_info, api, event, event_class, parse_str[i]);
+                       remained_msg = (char *)malloc(remained_length + 1);
+                       if (remained_msg) {
+                               strncpy(remained_msg, recv_msg + prev_pos, remained_length);
+                               remained_msg[remained_length] = '\0';
                        } else {
-                               LOGW("unknown camera api %d, class %d", api, api_class);
+                               LOGE("failed to alloc for remained msg");
                        }
+               } else {
+                       remained_length = 0;
                }
-
        }
 
        LOGD("client cb exit - server connected %d", cb_info->is_server_connected);
 
        if (!cb_info->is_server_connected) {
                /* send error msg for server disconnection */
-               error_msg = muse_core_msg_json_factory_new(MUSE_CAMERA_CB_EVENT,
+               char *error_msg = muse_core_msg_new(MUSE_CAMERA_CB_EVENT,
                        MUSE_TYPE_INT, "error", CAMERA_ERROR_SERVICE_DISCONNECTED,
                        MUSE_TYPE_INT, "current_state", CAMERA_STATE_NONE,
                        NULL);
+
                if (!error_msg) {
                        LOGE("error_msg failed");
                        goto CB_HANDLER_EXIT;
@@ -1872,23 +2169,21 @@ static void *_camera_msg_recv_func(gpointer data)
                        MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
                        error_msg);
 
-               muse_core_msg_json_factory_free(error_msg);
+               muse_core_msg_free(error_msg);
                error_msg = NULL;
 
                LOGE("add error msg for service disconnection done");
        }
 
 CB_HANDLER_EXIT:
-       if (parse_str) {
-               for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
-                       if (parse_str[i]) {
-                               free(parse_str[i]);
-                               parse_str[i] = NULL;
-                       }
-               }
+       if (single_msg) {
+               free(single_msg);
+               single_msg = NULL;
+       }
 
-               free(parse_str);
-               parse_str = NULL;
+       if (remained_msg) {
+               free(remained_msg);
+               remained_msg = NULL;
        }
 
        return NULL;
@@ -1962,7 +2257,6 @@ static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info
        g_mutex_unlock(&handler_info->mutex);
 
        g_thread_join(handler_info->thread);
-       g_thread_unref(handler_info->thread);
        handler_info->thread = NULL;
 
        g_mutex_clear(&handler_info->mutex);
@@ -1976,7 +2270,7 @@ static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info
 }
 
 
-static camera_cb_info_s *_camera_client_callback_new(gint sockfd, bool need_msg_handler_thread)
+static camera_cb_info_s *_camera_client_callback_new(gint sockfd)
 {
        camera_cb_info_s *cb_info = NULL;
        gint i = 0;
@@ -1989,11 +2283,14 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd, bool need_msg_
                goto ErrorExit;
        }
 
+       cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 1;
+
        for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
                g_mutex_init(&cb_info->api_mutex[i]);
                g_cond_init(&cb_info->api_cond[i]);
        }
 
+       g_mutex_init(&cb_info->fd_lock);
        g_mutex_init(&cb_info->idle_event_mutex);
        g_cond_init(&cb_info->idle_event_cond);
        g_mutex_init(&cb_info->mp_data_mutex);
@@ -2001,27 +2298,28 @@ static camera_cb_info_s *_camera_client_callback_new(gint sockfd, bool need_msg_
        g_mutex_init(&cb_info->evas_mutex);
 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
 
-       if (need_msg_handler_thread) {
-               /* message handler thread */
-               if (!__create_msg_handler_thread(&cb_info->msg_handler_info,
-                       CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "camera_msg_handler", cb_info)) {
-                       LOGE("msg_handler_info failed");
-                       goto ErrorExit;
-               }
+       for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
+               g_mutex_init(&cb_info->user_cb_mutex[i]);
 
-               /* message handler thread for preview callback */
-               if (!__create_msg_handler_thread(&cb_info->preview_cb_info,
-                       CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "camera_msg_handler:preview_cb", cb_info)) {
-                       LOGE("preview_cb_info failed");
-                       goto ErrorExit;
-               }
+       /* message handler thread */
+       if (!__create_msg_handler_thread(&cb_info->msg_handler_info,
+               CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "camera_msg_handler", cb_info)) {
+               LOGE("msg_handler_info failed");
+               goto ErrorExit;
+       }
 
-               /* message handler thread for capture callback */
-               if (!__create_msg_handler_thread(&cb_info->capture_cb_info,
-                       CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "camera_msg_handler:capture_cb", cb_info)) {
-                       LOGE("capture_cb_info failed");
-                       goto ErrorExit;
-               }
+       /* message handler thread for preview callback */
+       if (!__create_msg_handler_thread(&cb_info->preview_cb_info,
+               CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "camera_msg_handler:preview_cb", cb_info)) {
+               LOGE("preview_cb_info failed");
+               goto ErrorExit;
+       }
+
+       /* message handler thread for capture callback */
+       if (!__create_msg_handler_thread(&cb_info->capture_cb_info,
+               CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "camera_msg_handler:capture_cb", cb_info)) {
+               LOGE("capture_cb_info failed");
+               goto ErrorExit;
        }
 
        cb_info->fd = sockfd;
@@ -2049,6 +2347,10 @@ ErrorExit:
                __destroy_msg_handler_thread(&cb_info->preview_cb_info);
                __destroy_msg_handler_thread(&cb_info->capture_cb_info);
 
+               for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
+                       g_mutex_clear(&cb_info->user_cb_mutex[i]);
+
+               g_mutex_clear(&cb_info->fd_lock);
                g_mutex_clear(&cb_info->idle_event_mutex);
                g_cond_clear(&cb_info->idle_event_cond);
                g_mutex_clear(&cb_info->mp_data_mutex);
@@ -2077,7 +2379,6 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
        LOGD("msg_recv thread[%p] destroy", cb_info->msg_recv_thread);
 
        g_thread_join(cb_info->msg_recv_thread);
-       g_thread_unref(cb_info->msg_recv_thread);
        cb_info->msg_recv_thread = NULL;
 
        LOGD("msg_recv thread removed");
@@ -2087,6 +2388,10 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
        __destroy_msg_handler_thread(&cb_info->preview_cb_info);
        __destroy_msg_handler_thread(&cb_info->capture_cb_info);
 
+       for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
+               g_mutex_clear(&cb_info->user_cb_mutex[i]);
+
+       g_mutex_clear(&cb_info->fd_lock);
        g_mutex_clear(&cb_info->idle_event_mutex);
        g_cond_clear(&cb_info->idle_event_cond);
        g_mutex_clear(&cb_info->mp_data_mutex);
@@ -2100,7 +2405,7 @@ static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
        }
 
        if (cb_info->fd > -1) {
-               muse_core_connection_close(cb_info->fd);
+               muse_client_close(cb_info->fd);
                cb_info->fd = -1;
        }
 
@@ -2200,6 +2505,74 @@ int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
 }
 
 
+int _camera_independent_request(int api, int device_type, const char *key, int *value)
+{
+       int ret = CAMERA_ERROR_NONE;
+       int sock_fd = -1;
+       char *msg = NULL;
+       char recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH] = {'\0',};
+
+       /* create muse connection */
+       if (!key || !value) {
+               LOGE("NULL pointer");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       sock_fd = muse_client_new();
+       if (sock_fd < 0) {
+               LOGE("muse_client_new failed");
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       msg = muse_core_msg_new(api,
+               MUSE_TYPE_INT, "module", MUSE_CAMERA,
+               MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
+               0);
+       if (!msg) {
+               LOGE("msg failed");
+               ret = CAMERA_ERROR_OUT_OF_MEMORY;
+               goto _REQUEST_EXIT;
+       }
+
+       ret = muse_core_msg_send(sock_fd, msg);
+
+       muse_core_msg_free(msg);
+       msg = NULL;
+
+       if (ret < 0) {
+               LOGE("send msg failed");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _REQUEST_EXIT;
+       }
+
+       ret = muse_core_msg_recv(sock_fd, recv_msg);
+       if (ret <= 0) {
+               LOGE("recv msg failed %d", errno);
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _REQUEST_EXIT;
+       }
+
+       if (!muse_camera_msg_get(ret, recv_msg)) {
+               LOGE("failed to get return value from msg [%s]", recv_msg);
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _REQUEST_EXIT;
+       }
+
+       if (ret == CAMERA_ERROR_NONE)
+               muse_core_msg_deserialize(key, recv_msg, NULL, NULL, MUSE_TYPE_ANY, value);
+
+       LOGD("api %d - value %d", api, *value);
+
+_REQUEST_EXIT:
+       if (sock_fd > -1) {
+               muse_client_close(sock_fd);
+               sock_fd = -1;
+       }
+
+       return ret;
+}
+
+
 int camera_create(camera_device_e device, camera_h *camera)
 {
        int sock_fd = -1;
@@ -2219,16 +2592,16 @@ int camera_create(camera_device_e device, camera_h *camera)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       sock_fd = muse_core_client_new();
+       sock_fd = muse_client_new();
        if (sock_fd < 0) {
-               LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
+               LOGE("muse_client_new failed - returned fd %d", sock_fd);
                ret = CAMERA_ERROR_INVALID_OPERATION;
                goto ErrorExit;
        }
 
        pid = getpid();
 
-       send_msg = muse_core_msg_json_factory_new(api,
+       send_msg = muse_core_msg_new(api,
                MUSE_TYPE_INT, "module", muse_module,
                MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
                MUSE_TYPE_INT, "pid", pid,
@@ -2240,9 +2613,9 @@ int camera_create(camera_device_e device, camera_h *camera)
                goto ErrorExit;
        }
 
-       send_ret = muse_core_ipc_send_msg(sock_fd, send_msg);
+       send_ret = muse_core_msg_send(sock_fd, send_msg);
 
-       muse_core_msg_json_factory_free(send_msg);
+       muse_core_msg_free(send_msg);
        send_msg = NULL;
 
        if (send_ret < 0) {
@@ -2265,7 +2638,7 @@ int camera_create(camera_device_e device, camera_h *camera)
                goto ErrorExit;
        }
 
-       pc->cb_info = _camera_client_callback_new(sock_fd, true);
+       pc->cb_info = _camera_client_callback_new(sock_fd);
        if (pc->cb_info == NULL) {
                LOGE("cb_info alloc failed");
                ret = CAMERA_ERROR_OUT_OF_MEMORY;
@@ -2277,6 +2650,9 @@ int camera_create(camera_device_e device, camera_h *camera)
        LOGD("cb info : %d", pc->cb_info->fd);
 
        ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
+
+       pc->cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 0;
+
        if (ret == CAMERA_ERROR_NONE) {
                intptr_t handle = 0;
                muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
@@ -2310,7 +2686,7 @@ ErrorExit:
        }
 
        if (sock_fd > -1) {
-               muse_core_connection_close(sock_fd);
+               muse_client_close(sock_fd);
                sock_fd = -1;
        }
 
@@ -2331,6 +2707,7 @@ ErrorExit:
 
 int camera_change_device(camera_h camera, camera_device_e device)
 {
+       int i = 0;
        int ret = CAMERA_ERROR_NONE;
        muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
        camera_cli_s *pc = (camera_cli_s *)camera;
@@ -2345,6 +2722,15 @@ int camera_change_device(camera_h camera, camera_device_e device)
 
        _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               /* reset callback and user data */
+               for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++) {
+                       pc->cb_info->user_cb[i] = NULL;
+                       pc->cb_info->user_data[i] = NULL;
+               }
+               UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER);
+       }
+
        return ret;
 }
 
@@ -2368,7 +2754,7 @@ int camera_destroy(camera_h camera)
                LOGW("server disconnected. release resource without send message.");
 
        if (ret == CAMERA_ERROR_NONE) {
-               _camera_remove_idle_event_all(pc->cb_info);
+               _camera_deactivate_idle_event_all(pc->cb_info);
                _camera_client_callback_destroy(pc->cb_info);
                pc->cb_info = NULL;
 
@@ -2392,7 +2778,7 @@ int camera_start_preview(camera_h camera)
 
        LOGD("Enter");
 
-       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT_LONG);
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT);
        if (ret == CAMERA_ERROR_NONE && CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
                ret = _camera_start_evas_rendering(camera);
                if (ret != CAMERA_ERROR_NONE) {
@@ -2492,8 +2878,10 @@ bool camera_is_supported_continuous_capture(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -2518,7 +2906,9 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca
 
        pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
        pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
+
        pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
+       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
 
        value = (count << 16) | interval;
        CAMERA_MSG_PARAM_SET(param, INT, value);
@@ -2567,8 +2957,10 @@ bool camera_is_supported_face_detection(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -2591,8 +2983,10 @@ bool camera_is_supported_zero_shutter_lag(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -2615,8 +3009,10 @@ bool camera_is_supported_media_packet_preview_cb(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -2628,7 +3024,6 @@ int camera_get_device_count(camera_h camera, int *device_count)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
-       int get_device_count = 0;
 
        if (!pc || !pc->cb_info) {
                LOGE("NULL handle");
@@ -2639,10 +3034,8 @@ int camera_get_device_count(camera_h camera, int *device_count)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
-               *device_count = get_device_count;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *device_count = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DEVICE_COUNT];
 
        LOGD("ret : 0x%x", ret);
 
@@ -2662,11 +3055,17 @@ int camera_start_face_detection(camera_h camera, camera_face_detected_cb callbac
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -2687,6 +3086,15 @@ int camera_stop_face_detection(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -2697,7 +3105,6 @@ int camera_get_state(camera_h camera, camera_state_e *state)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
-       int get_state = CAMERA_STATE_NONE;
 
        if (!pc || !pc->cb_info || !state) {
                LOGE("NULL pointer %p %p", pc, state);
@@ -2708,10 +3115,8 @@ int camera_get_state(camera_h camera, camera_state_e *state)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
-               *state = (camera_state_e)get_state;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *state = (camera_state_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STATE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -2898,7 +3303,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                length = sizeof(camera_wl_info_s) / sizeof(int) + \
                        (sizeof(camera_wl_info_s) % sizeof(int) ? 1 : 0);
 
-               msg = muse_core_msg_json_factory_new(api,
+               msg = muse_core_msg_new(api,
                        MUSE_TYPE_INT, "type", type,
                        MUSE_TYPE_ARRAY, "wl_info", length, (int *)&pc->wl_info,
                        NULL);
@@ -2907,8 +3312,13 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                        return CAMERA_ERROR_OUT_OF_MEMORY;
                }
 
-               if (pc->cb_info->is_server_connected)
-                       send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+               if (pc->cb_info->is_server_connected) {
+                       __camera_update_api_waiting(pc->cb_info, api, 1);
+
+                       g_mutex_lock(&pc->cb_info->fd_lock);
+                       send_ret = muse_core_msg_send(pc->cb_info->fd, msg);
+                       g_mutex_unlock(&pc->cb_info->fd_lock);
+               }
 
                if (send_ret < 0) {
                        LOGE("message send failed");
@@ -2917,7 +3327,9 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                        ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
                }
 
-               muse_core_msg_json_factory_free(msg);
+               __camera_update_api_waiting(pc->cb_info, api, -1);
+
+               muse_core_msg_free(msg);
 
                LOGD("wayland parent id : %d, window %d,%d,%dx%d",
                        pc->wl_info.parent_id, pc->wl_info.window_x, pc->wl_info.window_y,
@@ -2940,6 +3352,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
 int camera_set_preview_resolution(camera_h camera, int width, int height)
 {
        int ret = CAMERA_ERROR_NONE;
+       camera_state_e current_state = CAMERA_STATE_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
        camera_msg_param param;
@@ -2950,6 +3363,20 @@ int camera_set_preview_resolution(camera_h camera, int width, int height)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
+       if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
+               ret = camera_get_state(camera, &current_state);
+               if (ret != CAMERA_ERROR_NONE) {
+                       LOGE("failed to get current state 0x%x", ret);
+                       return ret;
+               }
+
+               if (current_state == CAMERA_STATE_PREVIEW) {
+                       ret = _camera_stop_evas_rendering(camera, true);
+                       if (ret != CAMERA_ERROR_NONE)
+                               return ret;
+               }
+       }
+
        value = (width << 16) | height;
        CAMERA_MSG_PARAM_SET(param, INT, value);
 
@@ -2959,6 +3386,11 @@ int camera_set_preview_resolution(camera_h camera, int width, int height)
 
        LOGD("ret : 0x%x", ret);
 
+       if (current_state == CAMERA_STATE_PREVIEW) {
+               LOGW("restart evas rendering");
+               _camera_start_evas_rendering(camera);
+       }
+
        return ret;
 }
 
@@ -3044,8 +3476,6 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
-       int get_width = 0;
-       int get_height = 0;
 
        if (!pc || !pc->cb_info || !width || !height) {
                LOGE("NULL pointer %p %p %p", pc, width, height);
@@ -3057,10 +3487,8 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
-               *width = get_width;
-               *height = get_height;
+               *width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION] >> 16;
+               *height = 0x0000ffff & pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -3107,7 +3535,6 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
 {
        int ret = CAMERA_ERROR_NONE;
-       int get_rotation = CAMERA_ROTATION_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
 
        if (!pc || !pc->cb_info || !rotation) {
@@ -3117,10 +3544,8 @@ int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
 
        _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
-               *rotation = (camera_rotation_e)get_rotation;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *rotation = (camera_rotation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_ROTATION];
 
        return ret;
 }
@@ -3164,7 +3589,6 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip)
 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
 {
        int ret = CAMERA_ERROR_NONE;
-       int get_flip = CAMERA_FLIP_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
 
        if (!pc || !pc->cb_info || !flip) {
@@ -3174,10 +3598,8 @@ int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
 
        _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
-               *flip = (camera_flip_e)get_flip;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *flip = (camera_flip_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_FLIP];
 
        return ret;
 }
@@ -3221,7 +3643,6 @@ int camera_set_display_visible(camera_h camera, bool visible)
 int camera_is_display_visible(camera_h camera, bool *visible)
 {
        int ret = CAMERA_ERROR_NONE;
-       int get_visible = true;
        camera_cli_s *pc = (camera_cli_s *)camera;
 
        if (!pc || !pc->cb_info || !visible) {
@@ -3231,10 +3652,8 @@ int camera_is_display_visible(camera_h camera, bool *visible)
 
        _camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
-               *visible = (bool)get_visible;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *visible = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE];
 
        return ret;
 }
@@ -3278,7 +3697,6 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
 {
        int ret = CAMERA_ERROR_NONE;
-       int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
        camera_cli_s *pc = (camera_cli_s *)camera;
 
        if (!pc || !pc->cb_info || !mode) {
@@ -3288,10 +3706,8 @@ int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
 
        _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_display_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_display_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_MODE];
 
        return ret;
 }
@@ -3322,7 +3738,6 @@ int camera_set_display_reuse_hint(camera_h camera, bool hint)
 int camera_get_display_reuse_hint(camera_h camera, bool *hint)
 {
        int ret = CAMERA_ERROR_NONE;
-       int get_hint = 0;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
 
@@ -3334,9 +3749,7 @@ int camera_get_display_reuse_hint(camera_h camera, bool *hint)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_hint, pc->cb_info->recv_msg);
-               *hint = (bool)get_hint;
-
+               *hint = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT];
                LOGD("display reuse hint %d", *hint);
        }
 
@@ -3349,8 +3762,6 @@ int camera_get_capture_resolution(camera_h camera, int *width, int *height)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
-       int get_width = 0;
-       int get_height = 0;
 
        if (!pc || !pc->cb_info || !width || !height) {
                LOGE("NULL pointer %p %p %p", pc, width, height);
@@ -3362,10 +3773,8 @@ int camera_get_capture_resolution(camera_h camera, int *width, int *height)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
-               *width = get_width;
-               *height = get_height;
+               *width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION] >> 16;
+               *height = 0x0000ffff & pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -3379,7 +3788,6 @@ int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
-       int get_format = 0;
 
        if (!pc || !pc->cb_info || !format) {
                LOGE("NULL pointer %p %p", pc, format);
@@ -3390,10 +3798,8 @@ int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
-               *format = (camera_pixel_format_e)get_format;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *format = (camera_pixel_format_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CAPTURE_FORMAT];
 
        LOGD("ret : 0x%x", ret);
 
@@ -3406,7 +3812,6 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
-       int get_format = 0;
 
        if (!pc || !pc->cb_info || !format) {
                LOGE("NULL pointer %p %p", pc, format);
@@ -3417,10 +3822,8 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
-               *format = (camera_pixel_format_e)get_format;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *format = (camera_pixel_format_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_FORMAT];
 
        LOGD("ret : 0x%x", ret);
 
@@ -3433,7 +3836,6 @@ int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *faci
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
-       int get_facing_direction = 0;
 
        if (!pc || !pc->cb_info || !facing_direction) {
                LOGE("NULL pointer %p %p", pc, facing_direction);
@@ -3444,10 +3846,8 @@ int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *faci
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
-               *facing_direction = (camera_facing_direction_e)get_facing_direction;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *facing_direction = (camera_facing_direction_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FACING_DIRECTION];
 
        LOGD("ret : 0x%x", ret);
 
@@ -3468,12 +3868,18 @@ int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *use
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
 
-       SET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER);
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
 
-       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
+
+               SET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER);
+       }
 
        LOGD("ret : 0x%x", ret);
 
@@ -3494,12 +3900,18 @@ int camera_unset_preview_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL;
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
 
-       UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER);
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL;
 
-       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
+
+               UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER);
+       }
 
        LOGD("ret : 0x%x", ret);
 
@@ -3530,11 +3942,17 @@ int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_prev
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3554,11 +3972,17 @@ int camera_unset_media_packet_preview_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3578,11 +4002,17 @@ int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callbac
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3602,11 +4032,17 @@ int camera_unset_state_changed_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3626,11 +4062,17 @@ int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, v
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3648,12 +4090,78 @@ int camera_unset_interrupted_cb(camera_h camera)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       LOGD("Enter");
+       LOGD("Enter");
+
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
+       }
+
+       LOGD("ret : 0x%x", ret);
+
+       return ret;
+}
+
+
+int camera_set_interrupt_started_cb(camera_h camera, camera_interrupt_started_cb callback, void *user_data)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPT_STARTED_CB;
+
+       if (!pc || !pc->cb_info || !callback) {
+               LOGE("NULL pointer %p %p", pc, callback);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("Enter");
+
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
+       }
+
+       LOGD("ret : 0x%x", ret);
+
+       return ret;
+}
+
+
+int camera_unset_interrupt_started_cb(camera_h camera)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPT_STARTED_CB;
+
+       if (!pc || !pc->cb_info) {
+               LOGE("NULL handle");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       LOGD("Enter");
+
+       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL;
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
 
-       _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
+       }
 
        LOGD("ret : 0x%x", ret);
 
@@ -3674,11 +4182,17 @@ int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callbac
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3698,11 +4212,17 @@ int camera_unset_focus_changed_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3722,11 +4242,17 @@ int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_da
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3746,11 +4272,17 @@ int camera_unset_error_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -3858,8 +4390,6 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
-       int get_width = 0;
-       int get_height = 0;
 
        if (!pc || !pc->cb_info || !width || !height) {
                LOGE("NULL pointer %p %p %p", pc, width, height);
@@ -3870,10 +4400,8 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
-               *width = get_width;
-               *height = get_height;
+               *width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION] >> 16;
+               *height = 0x0000ffff & pc->cb_info->get_int[MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -3887,7 +4415,6 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
-       int get_angle = 0;
 
        if (!pc || !pc->cb_info || !angle) {
                LOGE("NULL pointer %p %p", pc, angle);
@@ -3898,10 +4425,8 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
-               *angle = get_angle;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *angle = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_LENS_ORIENTATION];
 
        LOGD("ret : 0x%x", ret);
 
@@ -3939,7 +4464,6 @@ int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mo
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -3950,10 +4474,8 @@ int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mo
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_theater_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_theater_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_THEATER_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4039,7 +4561,6 @@ int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
-       int get_fps = 0;
 
        if (!pc || !pc->cb_info || !fps) {
                LOGE("NULL pointer %p %p", pc, fps);
@@ -4050,10 +4571,8 @@ int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
-               *fps = (camera_attr_fps_e)get_fps;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *fps = (camera_attr_fps_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_FPS];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4066,7 +4585,6 @@ int camera_attr_get_image_quality(camera_h camera, int *quality)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
-       int get_quality = 0;
 
        if (!pc || !pc->cb_info || !quality) {
                LOGE("NULL pointer %p %p", pc, quality);
@@ -4077,10 +4595,8 @@ int camera_attr_get_image_quality(camera_h camera, int *quality)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
-               *quality = get_quality;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *quality = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_IMAGE_QUALITY];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4093,7 +4609,6 @@ int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
-       int get_bitrate = 0;
 
        if (!pc || !pc->cb_info || !bitrate) {
                LOGE("NULL pointer %p %p", pc, bitrate);
@@ -4104,10 +4619,8 @@ int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
-               *bitrate = get_bitrate;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *bitrate = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4145,7 +4658,6 @@ int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
-       int get_gop_interval = 0;
 
        if (!pc || !pc->cb_info || !interval) {
                LOGE("NULL pointer %p %p", pc, interval);
@@ -4156,10 +4668,8 @@ int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
-               *interval = get_gop_interval;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *interval = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4601,7 +5111,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d
        length = sizeof(set_geotag) / sizeof(int) + \
                (sizeof(set_geotag) % sizeof(int) ? 1 : 0);
 
-       msg = muse_core_msg_json_factory_new(api,
+       msg = muse_core_msg_new(api,
                MUSE_TYPE_ARRAY, "set_geotag", length, (int *)set_geotag,
                NULL);
        if (!msg) {
@@ -4609,8 +5119,13 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d
                return CAMERA_ERROR_OUT_OF_MEMORY;
        }
 
-       if (pc->cb_info->is_server_connected)
-               send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+       if (pc->cb_info->is_server_connected) {
+               __camera_update_api_waiting(pc->cb_info, api, 1);
+
+               g_mutex_lock(&pc->cb_info->fd_lock);
+               send_ret = muse_core_msg_send(pc->cb_info->fd, msg);
+               g_mutex_unlock(&pc->cb_info->fd_lock);
+       }
 
        if (send_ret < 0) {
                LOGE("message send failed");
@@ -4619,7 +5134,9 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d
                ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
        }
 
-       muse_core_msg_json_factory_free(msg);
+       __camera_update_api_waiting(pc->cb_info, api, -1);
+
+       muse_core_msg_free(msg);
 
        LOGD("ret : 0x%x", ret);
 
@@ -4678,7 +5195,6 @@ int camera_attr_get_zoom(camera_h camera, int *zoom)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
-       int get_zoom = 0;
 
        if (!pc || !pc->cb_info || !zoom) {
                LOGE("NULL pointer %p %p", pc, zoom);
@@ -4689,10 +5205,8 @@ int camera_attr_get_zoom(camera_h camera, int *zoom)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
-               *zoom = get_zoom;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *zoom = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ZOOM];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4705,8 +5219,6 @@ int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
                LOGE("NULL pointer %p %p %p", pc, min, max);
@@ -4718,10 +5230,8 @@ int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE][1];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -4735,7 +5245,6 @@ int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -4746,10 +5255,8 @@ int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_af_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_af_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_AF_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4762,7 +5269,6 @@ int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -4773,10 +5279,8 @@ int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_exposure_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_exposure_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXPOSURE_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4789,7 +5293,6 @@ int camera_attr_get_exposure(camera_h camera, int *value)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
-       int get_value = 0;
 
        if (!pc || !pc->cb_info || !value) {
                LOGE("NULL pointer %p %p", pc, value);
@@ -4800,10 +5303,8 @@ int camera_attr_get_exposure(camera_h camera, int *value)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
-               *value = get_value;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *value = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXPOSURE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4816,8 +5317,6 @@ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
                LOGE("NULL pointer %p %p %p", pc, min, max);
@@ -4829,10 +5328,8 @@ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE][1];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -4846,7 +5343,6 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
-       int get_iso = 0;
 
        if (!pc || !pc->cb_info || !iso) {
                LOGE("NULL pointer %p %p", pc, iso);
@@ -4857,10 +5353,8 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
-               *iso = (camera_attr_iso_e)get_iso;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *iso = (camera_attr_iso_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ISO];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4873,7 +5367,6 @@ int camera_attr_get_brightness(camera_h camera, int *level)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
-       int get_level = 0;
 
        if (!pc || !pc->cb_info || !level) {
                LOGE("NULL pointer %p %p", pc, level);
@@ -4884,10 +5377,8 @@ int camera_attr_get_brightness(camera_h camera, int *level)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
-               *level = get_level;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_BRIGHTNESS];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4900,8 +5391,6 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
                LOGE("NULL pointer %p %p %p", pc, min, max);
@@ -4913,10 +5402,8 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE][1];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -4930,7 +5417,6 @@ int camera_attr_get_contrast(camera_h camera, int *level)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
-       int get_level = 0;
 
        if (!pc || !pc->cb_info || !level) {
                LOGE("NULL pointer %p %p", pc, level);
@@ -4941,10 +5427,8 @@ int camera_attr_get_contrast(camera_h camera, int *level)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
-               *level = get_level;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CONTRAST];
 
        LOGD("ret : 0x%x", ret);
 
@@ -4957,8 +5441,6 @@ int camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
                LOGE("NULL pointer %p %p %p", pc, min, max);
@@ -4970,10 +5452,9 @@ int camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE][1];
+               LOGD("min %d, max %d", *min, *max);
        }
 
        LOGD("ret : 0x%x", ret);
@@ -4987,7 +5468,6 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
-       int get_wb = 0;
 
        if (!pc || !pc->cb_info || !wb) {
                LOGE("NULL pointer %p %p", pc, wb);
@@ -4998,10 +5478,8 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
-               *wb = (camera_attr_whitebalance_e)get_wb;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *wb = (camera_attr_whitebalance_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5014,7 +5492,6 @@ int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
-       int get_effect = 0;
 
        if (!pc || !pc->cb_info || !effect) {
                LOGE("NULL pointer %p %p", pc, effect);
@@ -5025,10 +5502,8 @@ int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
-               *effect = (camera_attr_effect_mode_e)get_effect;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *effect = (camera_attr_effect_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EFFECT];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5041,7 +5516,6 @@ int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -5052,10 +5526,8 @@ int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_scene_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_scene_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_SCENE_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5068,7 +5540,6 @@ int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
-       int get_enabled = 0;
 
        if (!pc || !pc->cb_info || !enable) {
                LOGE("NULL pointer %p %p", pc, enable);
@@ -5079,10 +5550,8 @@ int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
-               *enable = (bool)get_enabled;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *enable = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_TAG];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5095,7 +5564,6 @@ int camera_attr_get_tag_image_description(camera_h camera, char **description)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
-       char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0, };
 
        if (!pc || !pc->cb_info || !description) {
                LOGE("NULL pointer %p %p", pc, description);
@@ -5106,10 +5574,8 @@ int camera_attr_get_tag_image_description(camera_h camera, char **description)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
-               *description = strdup(get_description);
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *description = strdup(pc->cb_info->get_string[MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION]);
 
        LOGD("ret : 0x%x", ret);
 
@@ -5122,7 +5588,6 @@ int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
-       int get_orientation = 0;
 
        if (!pc || !pc->cb_info || !orientation) {
                LOGE("NULL pointer %p %p", pc, orientation);
@@ -5133,10 +5598,8 @@ int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
-               *orientation = (camera_attr_tag_orientation_e)get_orientation;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *orientation = (camera_attr_tag_orientation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_TAG_ORIENTATION];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5149,7 +5612,6 @@ int camera_attr_get_tag_software(camera_h camera, char **software)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
-       char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0, };
 
        if (!pc || !pc->cb_info || !software) {
                LOGE("NULL pointer %p %p", pc, software);
@@ -5160,10 +5622,8 @@ int camera_attr_get_tag_software(camera_h camera, char **software)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
-               *software = strdup(get_software);
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *software = strdup(pc->cb_info->get_string[MUSE_CAMERA_GET_STRING_TAG_SOFTWARE]);
 
        LOGD("ret : 0x%x", ret);
 
@@ -5176,7 +5636,6 @@ int camera_attr_get_geotag(camera_h camera, double *latitude, double *longitude,
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
-       double get_geotag[3] = {0.0, };
 
        if (!pc || !pc->cb_info || !latitude || !longitude || !altitude) {
                LOGE("NULL pointer %p %p %p %p", pc, latitude, longitude, altitude);
@@ -5188,10 +5647,9 @@ int camera_attr_get_geotag(camera_h camera, double *latitude, double *longitude,
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
-               *latitude = get_geotag[0];
-               *longitude = get_geotag[1];
-               *altitude = get_geotag[2];
+               *latitude = pc->cb_info->get_geotag[0];
+               *longitude = pc->cb_info->get_geotag[1];
+               *altitude = pc->cb_info->get_geotag[2];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -5205,7 +5663,6 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -5216,10 +5673,8 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_flash_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_flash_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FLASH_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5229,90 +5684,22 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
 
 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
 {
-       int sock_fd = -1;
-       char *msg = NULL;
        int ret = CAMERA_ERROR_NONE;
-       int send_ret = 0;
-       camera_cli_s *pc = NULL;
        int get_flash_state = 0;
 
-       /* create muse connection */
-       muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
-       muse_core_api_module_e muse_module = MUSE_CAMERA;
-       int device_type = (int)device;
-
        if (!state) {
                LOGE("NULL pointer");
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       sock_fd = muse_core_client_new();
-       if (sock_fd < 0) {
-               LOGE("muse_core_client_new failed");
-               return CAMERA_ERROR_INVALID_OPERATION;
-       }
-
-       msg = muse_core_msg_json_factory_new(api,
-               MUSE_TYPE_INT, "module", muse_module,
-               MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
-               0);
-       if (!msg) {
-               LOGE("msg failed");
-               ret = CAMERA_ERROR_OUT_OF_MEMORY;
-               goto Exit;
-       }
-
-       send_ret = muse_core_ipc_send_msg(sock_fd, msg);
-
-       muse_core_msg_json_factory_free(msg);
-       msg = NULL;
-
-       if (send_ret < 0) {
-               LOGE("send msg failed");
-               ret = CAMERA_ERROR_INVALID_OPERATION;
-               goto Exit;
-       }
-
-       pc = g_new0(camera_cli_s, 1);
-       if (!pc) {
-               LOGE("handle alloc failed");
-               ret = CAMERA_ERROR_OUT_OF_MEMORY;
-               goto Exit;
-       }
-
-       pc->cb_info = _camera_client_callback_new(sock_fd, false);
-       if (!pc->cb_info) {
-               LOGE("cb_info alloc failed");
-               ret = CAMERA_ERROR_OUT_OF_MEMORY;
-               goto Exit;
-       }
-
-       sock_fd = -1;
-
-       ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
+       ret = _camera_independent_request(MUSE_CAMERA_API_GET_FLASH_STATE,
+               (int)device, "get_flash_state", &get_flash_state);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
                *state = (camera_flash_state_e)get_flash_state;
-       }
-
-       LOGD("Flash state : %d", *state);
-
-Exit:
-       /* release resources */
-       if (pc) {
-               if (pc->cb_info) {
-                       _camera_client_callback_destroy(pc->cb_info);
-                       pc->cb_info = NULL;
-               }
-
-               g_free(pc);
-               pc = NULL;
-       }
-
-       if (sock_fd > -1) {
-               muse_core_connection_close(sock_fd);
-               sock_fd = -1;
+               LOGD("flash state %d", *state);
+       } else {
+               LOGE("failed 0x%x", ret);
        }
 
        return ret;
@@ -5618,7 +6005,6 @@ int camera_attr_get_stream_rotation(camera_h camera, camera_rotation_e *rotation
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
-       int get_rotation = 0;
 
        if (!pc || !pc->cb_info || !rotation) {
                LOGE("NULL pointer %p %p", pc, rotation);
@@ -5629,10 +6015,8 @@ int camera_attr_get_stream_rotation(camera_h camera, camera_rotation_e *rotation
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
-               *rotation = (camera_rotation_e)get_rotation;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *rotation = (camera_rotation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STREAM_ROTATION];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5670,7 +6054,6 @@ int camera_attr_get_stream_flip(camera_h camera, camera_flip_e *flip)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
-       int get_flip = 0;
 
        if (!pc || !pc->cb_info || !flip) {
                LOGE("NULL pointer %p %p", pc, flip);
@@ -5681,10 +6064,8 @@ int camera_attr_get_stream_flip(camera_h camera, camera_flip_e *flip)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
-               *flip = (camera_flip_e)get_flip;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *flip = (camera_flip_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STREAM_FLIP];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5721,7 +6102,6 @@ int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
-       int get_mode = 0;
 
        if (!pc || !pc->cb_info || !mode) {
                LOGE("NULL pointer %p %p", pc, mode);
@@ -5732,10 +6112,8 @@ int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
-               *mode = (camera_attr_hdr_mode_e)get_mode;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *mode = (camera_attr_hdr_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_HDR_MODE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5758,8 +6136,10 @@ bool camera_attr_is_supported_hdr_capture(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -5790,11 +6170,17 @@ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_pro
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -5814,11 +6200,17 @@ int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
 
        LOGD("Enter");
 
-       pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL;
-       pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL;
-
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
+       if (ret == CAMERA_ERROR_NONE) {
+               g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
+
+               pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL;
+               pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL;
+
+               g_mutex_unlock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
+       }
+
        LOGD("ret : 0x%x", ret);
 
        return ret;
@@ -5855,7 +6247,6 @@ int camera_attr_is_enabled_anti_shake(camera_h camera, bool *enabled)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
-       int get_enabled = 0;
 
        if (!pc || !pc->cb_info || !enabled) {
                LOGE("NULL pointer %p %p", pc, enabled);
@@ -5866,10 +6257,8 @@ int camera_attr_is_enabled_anti_shake(camera_h camera, bool *enabled)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
-               *enabled = (bool)get_enabled;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5892,8 +6281,10 @@ bool camera_attr_is_supported_anti_shake(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -5931,7 +6322,6 @@ int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
-       int get_enabled = 0;
 
        if (!pc || !pc->cb_info || !enabled) {
                LOGE("NULL pointer %p %p", pc, enabled);
@@ -5942,10 +6332,8 @@ int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
-               *enabled = (bool)get_enabled;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION];
 
        LOGD("ret : 0x%x", ret);
 
@@ -5968,8 +6356,10 @@ bool camera_attr_is_supported_video_stabilization(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -6007,7 +6397,6 @@ int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
-       int get_enabled = 0;
 
        if (!pc || !pc->cb_info || !enabled) {
                LOGE("NULL pointer %p %p", pc, enabled);
@@ -6018,10 +6407,8 @@ int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
-               *enabled = (bool)get_enabled;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST];
 
        LOGD("ret : 0x%x", ret);
 
@@ -6044,8 +6431,10 @@ bool camera_attr_is_supported_auto_contrast(camera_h camera)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_SERVICE_DISCONNECTED)
+       if (ret < 0) {
+               LOGE("error is occurred 0x%x", ret);
                ret = false;
+       }
 
        LOGD("ret : %d", ret);
 
@@ -6110,7 +6499,6 @@ int camera_attr_get_pan(camera_h camera, int *pan_step)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
-       int get_pan_step = 0;
 
        if (!pc || !pc->cb_info || !pan_step) {
                LOGE("NULL pointer %p %p", pc, pan_step);
@@ -6121,10 +6509,8 @@ int camera_attr_get_pan(camera_h camera, int *pan_step)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
-               *pan_step = get_pan_step;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *pan_step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PAN];
 
        LOGD("ret : 0x%x", ret);
 
@@ -6137,11 +6523,9 @@ int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
-               LOGE("NULL pointer %p %p", pc, min, max);
+               LOGE("NULL pointer %p %p %p", pc, min, max);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
@@ -6150,10 +6534,8 @@ int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE][1];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -6194,7 +6576,6 @@ int camera_attr_get_tilt(camera_h camera, int *tilt_step)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
-       int get_tilt_step = 0;
 
        if (!pc || !pc->cb_info || !tilt_step) {
                LOGE("NULL pointer %p %p", pc, tilt_step);
@@ -6205,10 +6586,8 @@ int camera_attr_get_tilt(camera_h camera, int *tilt_step)
 
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
-               *tilt_step = get_tilt_step;
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *tilt_step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_TILT];
 
        LOGD("ret : 0x%x", ret);
 
@@ -6221,8 +6600,6 @@ int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
        muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
-       int get_min = 0;
-       int get_max = 0;
 
        if (!pc || !pc->cb_info || !min || !max) {
                LOGE("NULL pointer %p %p %p", pc, min, max);
@@ -6234,10 +6611,8 @@ int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
-               muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
-               *min = get_min;
-               *max = get_max;
+               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE][0];
+               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE][1];
        }
 
        LOGD("ret : 0x%x", ret);
@@ -6330,7 +6705,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
        length = sizeof(set_display_roi_area) / sizeof(int) + \
                (sizeof(set_display_roi_area) % sizeof(int) ? 1 : 0);
 
-       msg = muse_core_msg_json_factory_new(api,
+       msg = muse_core_msg_new(api,
                MUSE_TYPE_ARRAY, "set_display_roi_area", length, (int *)set_display_roi_area,
                NULL);
        if (!msg) {
@@ -6338,8 +6713,13 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
                return CAMERA_ERROR_OUT_OF_MEMORY;
        }
 
-       if (pc->cb_info->is_server_connected)
-               send_ret = muse_core_ipc_send_msg(pc->cb_info->fd, msg);
+       if (pc->cb_info->is_server_connected) {
+               __camera_update_api_waiting(pc->cb_info, api, 1);
+
+               g_mutex_lock(&pc->cb_info->fd_lock);
+               send_ret = muse_core_msg_send(pc->cb_info->fd, msg);
+               g_mutex_unlock(&pc->cb_info->fd_lock);
+       }
 
        if (send_ret < 0) {
                LOGE("message send failed");
@@ -6348,7 +6728,9 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
                ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
        }
 
-       muse_core_msg_json_factory_free(msg);
+       __camera_update_api_waiting(pc->cb_info, api, -1);
+
+       muse_core_msg_free(msg);
 
        LOGD("ret : 0x%x", ret);
 
@@ -6360,7 +6742,6 @@ int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width
 {
        camera_cli_s *pc = (camera_cli_s *)camera;
        int ret = CAMERA_ERROR_NONE;
-       int get_display_roi_area[4] = {0,};
        muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
 
        if (!pc || !pc->cb_info || !x || !y || !width || !height) {
@@ -6373,14 +6754,188 @@ int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width
        _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
-               *x = get_display_roi_area[0];
-               *y = get_display_roi_area[1];
-               *width = get_display_roi_area[2];
-               *height = get_display_roi_area[3];
+               *x = pc->cb_info->get_display_roi_area[0];
+               *y = pc->cb_info->get_display_roi_area[1];
+               *width = pc->cb_info->get_display_roi_area[2];
+               *height = pc->cb_info->get_display_roi_area[3];
        }
 
        LOGD("ret : 0x%x", ret);
 
        return ret;
 }
+
+
+int camera_get_device_state(camera_device_e device, camera_device_state_e *state)
+{
+       int ret = CAMERA_ERROR_NONE;
+       int get_device_state = 0;
+
+       if (!state) {
+               LOGE("NULL pointer");
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = _camera_independent_request(MUSE_CAMERA_API_GET_DEVICE_STATE,
+               (int)device, "get_device_state", &get_device_state);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               *state = (camera_device_state_e)get_device_state;
+               LOGD("device state %d", *state);
+       } else {
+               LOGE("failed 0x%x", ret);
+       }
+
+       return ret;
+}
+
+
+int camera_add_device_state_changed_cb(camera_device_state_changed_cb callback, void *user_data, int *cb_id)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_device_state_e state = CAMERA_DEVICE_STATE_NULL;
+       camera_cb_info *info = NULL;
+
+       if (!callback || !cb_id) {
+               LOGE("invalid pointer %p %p", callback, cb_id);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       /* check camera support */
+       ret = camera_get_device_state(CAMERA_DEVICE_CAMERA0, &state);
+       if (ret != CAMERA_ERROR_NONE) {
+               LOGE("get device state failed");
+               return ret;
+       }
+
+       g_mutex_lock(&g_cam_dev_state_changed_cb_lock);
+
+       info = g_new0(camera_cb_info, 1);
+       if (!info) {
+               LOGE("info failed");
+               ret = CAMERA_ERROR_OUT_OF_MEMORY;
+               goto _DONE;
+       }
+
+       info->id = ++g_cam_dev_state_changed_cb_id;
+       info->callback = (void *)callback;
+       info->user_data = user_data;
+
+       *cb_id = info->id;
+
+       /* subscribe dbus signal for camera state change */
+       if (!g_cam_dev_state_changed_cb_conn) {
+               g_cam_dev_state_changed_cb_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
+               if (!g_cam_dev_state_changed_cb_conn) {
+                       LOGE("failed to get gdbus connection");
+                       ret = CAMERA_ERROR_INVALID_OPERATION;
+                       goto _DONE;
+               }
+
+               LOGD("subscribe signal %s - %s - %s",
+                       MM_CAMCORDER_DBUS_OBJECT,
+                       MM_CAMCORDER_DBUS_INTERFACE_CAMERA,
+                       MM_CAMCORDER_DBUS_SIGNAL_STATE_CHANGED);
+
+               g_cam_dev_state_changed_cb_subscribe_id = g_dbus_connection_signal_subscribe(g_cam_dev_state_changed_cb_conn,
+                       NULL, MM_CAMCORDER_DBUS_INTERFACE_CAMERA, MM_CAMCORDER_DBUS_SIGNAL_STATE_CHANGED, MM_CAMCORDER_DBUS_OBJECT, NULL,
+                       G_DBUS_SIGNAL_FLAGS_NONE, (GDBusSignalCallback)__camera_device_state_changed_cb, NULL, NULL);
+               if (!g_cam_dev_state_changed_cb_subscribe_id) {
+                       LOGE("failed to get gdbus connection");
+                       ret = CAMERA_ERROR_INVALID_OPERATION;
+                       goto _DONE;
+               }
+
+               LOGD("signal subscribe id %u", g_cam_dev_state_changed_cb_subscribe_id);
+       }
+
+       g_cam_dev_state_changed_cb_list = g_list_prepend(g_cam_dev_state_changed_cb_list, (gpointer)info);
+
+       LOGD("callback id %d", info->id);
+
+_DONE:
+       if (ret != CAMERA_ERROR_NONE) {
+               if (info) {
+                       g_free(info);
+                       info = NULL;
+               }
+
+               if (g_cam_dev_state_changed_cb_conn) {
+                       g_object_unref(g_cam_dev_state_changed_cb_conn);
+                       g_cam_dev_state_changed_cb_conn = NULL;
+               }
+       }
+
+       g_mutex_unlock(&g_cam_dev_state_changed_cb_lock);
+
+       return ret;
+}
+
+
+int camera_remove_device_state_changed_cb(int cb_id)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_device_state_e state = CAMERA_DEVICE_STATE_NULL;
+       GList *tmp_list = NULL;
+       camera_cb_info *info = NULL;
+
+       /* check camera support */
+       ret = camera_get_device_state(CAMERA_DEVICE_CAMERA0, &state);
+       if (ret != CAMERA_ERROR_NONE) {
+               LOGE("get device state failed");
+               return ret;
+       }
+
+       g_mutex_lock(&g_cam_dev_state_changed_cb_lock);
+
+       if (!g_cam_dev_state_changed_cb_list) {
+               LOGE("there is no callback info");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _DONE;
+       }
+
+       tmp_list = g_cam_dev_state_changed_cb_list;
+
+       do {
+               info = tmp_list->data;
+               tmp_list = tmp_list->next;
+
+               if (!info) {
+                       LOGW("NULL info");
+                       continue;
+               }
+
+               if (info->id == cb_id) {
+                       g_cam_dev_state_changed_cb_list = g_list_remove(g_cam_dev_state_changed_cb_list, info);
+
+                       g_free(info);
+                       info = NULL;
+
+                       if (!g_cam_dev_state_changed_cb_list) {
+                               /* no remained callback */
+                               if (g_cam_dev_state_changed_cb_conn) {
+                                       /* unsubscribe signal */
+                                       g_dbus_connection_signal_unsubscribe(g_cam_dev_state_changed_cb_conn, g_cam_dev_state_changed_cb_subscribe_id);
+                                       g_cam_dev_state_changed_cb_subscribe_id = 0;
+
+                                       /* unref connection */
+                                       g_object_unref(g_cam_dev_state_changed_cb_conn);
+                                       g_cam_dev_state_changed_cb_conn = NULL;
+                               }
+                       }
+
+                       LOGD("id %d callback removed", cb_id);
+                       ret = CAMERA_ERROR_NONE;
+
+                       goto _DONE;
+               }
+       } while (tmp_list);
+
+       LOGE("id %d callback not found", cb_id);
+       ret = CAMERA_ERROR_INVALID_PARAMETER;
+
+_DONE:
+       g_mutex_unlock(&g_cam_dev_state_changed_cb_lock);
+
+       return ret;
+}