Add sub functions to remove duplicated code
[platform/core/api/camera.git] / src / camera.c
index 2d9b6a7..f061b94 100644 (file)
@@ -25,7 +25,6 @@
 #include <muse_camera_msg.h>
 #include <camera_private.h>
 #include <muse_client.h>
-#include <dlog.h>
 #include <gio/gio.h>
 #include <dlfcn.h>
 
 #endif
 #define LOG_TAG         "TIZEN_N_CAMERA"
 #define MODULE_NAME     "camera"
-#define LIB_CAMERA_DEVICE_MANAGER PATH_LIBDIR"/libcamera_device_manager.so"
-#define CAMERA_CHECK_DEVICE_MANAGER \
-       do {\
-               if (access(LIB_CAMERA_DEVICE_MANAGER, F_OK) != 0) {\
-                       CAM_LOG_ERROR("no camera device maanger[errno:%d]", errno);\
-                       return CAMERA_ERROR_NOT_SUPPORTED;\
-               }\
-       } while (0)
-#define CAMERA_CHECK_HANDLE_RETURN(pc) \
-       do {\
-               if (!pc || !pc->cb_info) {\
-                       CAM_LOG_ERROR("NULL handle[%p]", pc);\
-                       return;\
-               }\
-       } while (0)
-#define CAMERA_CHECK_HANDLE_RETURN_VAL(pc, val) \
-       do {\
-               if (!pc || !pc->cb_info) {\
-                       CAM_LOG_ERROR("NULL handle[%p]", pc);\
-                       return (val);\
-               }\
-       } while (0)
-
-/* for camera device manager */
-typedef struct _cdm_symbol_table {
-       void **func_ptr;
-       const char *func_name;
-} cdm_symbol_table;
+
 
 /* for device changed callback */
 static GMutex g_cam_dev_state_changed_cb_lock;
@@ -287,6 +259,88 @@ _DONE:
 }
 
 
+static void __camera_preview_cb_monitoring_info_sub_reset(monitoring_info_sub_s *info_sub)
+{
+       if (!info_sub) {
+               CAM_LOG_ERROR("NULL info_sub");
+               return;
+       }
+
+       info_sub->frame_count = 0;
+       info_sub->elapsed_sec_accum = 0.0;
+       info_sub->elapsed_sec_peak = 0.0;
+}
+
+
+static void __camera_preview_cb_monitoring_info_reset(camera_preview_cb_monitoring_info_s *info)
+{
+       if (!info) {
+               CAM_LOG_ERROR("NULL info");
+               return;
+       }
+
+       __camera_preview_cb_monitoring_info_sub_reset(info->total);
+       __camera_preview_cb_monitoring_info_sub_reset(info->interval);
+}
+
+
+static void __camera_preview_cb_monitoring_info_start(camera_preview_cb_monitoring_info_s *info)
+{
+       if (!info) {
+               CAM_LOG_ERROR("NULL info");
+               return;
+       }
+
+       g_timer_start(info->timer_calling);
+
+       if (info->interval->frame_count == 0)
+               g_timer_start(info->timer_interval);
+}
+
+
+static void __camera_preview_cb_monitoring_info_sub_update(monitoring_info_sub_s *info_sub, gdouble elapsed_sec)
+{
+       if (!info_sub) {
+               CAM_LOG_ERROR("NULL info_sub");
+               return;
+       }
+
+       info_sub->frame_count++;
+       info_sub->elapsed_sec_accum += elapsed_sec;
+
+       if (info_sub->elapsed_sec_peak < elapsed_sec)
+               info_sub->elapsed_sec_peak = elapsed_sec;
+}
+
+
+static void __camera_preview_cb_monitoring_info_end(camera_preview_cb_monitoring_info_s *info)
+{
+       gdouble elapsed_sec = 0.0;
+       gdouble elapsed_sec_interval = 0.0;
+
+       if (!info) {
+               CAM_LOG_ERROR("NULL info");
+               return;
+       }
+
+       elapsed_sec = g_timer_elapsed(info->timer_calling, NULL);
+       elapsed_sec_interval = g_timer_elapsed(info->timer_interval, NULL);
+
+       __camera_preview_cb_monitoring_info_sub_update(info->total, elapsed_sec);
+       __camera_preview_cb_monitoring_info_sub_update(info->interval, elapsed_sec);
+
+       if (elapsed_sec_interval >= 1.0) {
+               CAM_LOG_INFO("id[%d], frame count[t:%llu,i:%llu], elapsed - avg[t:%dms,i:%dms], peak[t:%dms,i:%dms]",
+                       info->stream_id, info->total->frame_count, info->interval->frame_count,
+                       (int)((info->total->elapsed_sec_accum / (gdouble)info->total->frame_count) * 1000),
+                       (int)((info->interval->elapsed_sec_accum / (gdouble)info->interval->frame_count) * 1000),
+                       (int)(info->total->elapsed_sec_peak * 1000), (int)(info->interval->elapsed_sec_peak * 1000));
+
+               __camera_preview_cb_monitoring_info_sub_reset(info->interval);
+       }
+}
+
+
 static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv_msg, int *tfd)
 {
        int i = 0;
@@ -308,6 +362,7 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
        MMCamcorderVideoStreamDataType *stream = NULL;
        camera_media_packet_data *mp_data = NULL;
        media_packet_h pkt = NULL;
+       camera_preview_cb_monitoring_info_s *monitoring_info = NULL;
 
        /* tfd[0]: MMCamcorderVideoStreamDataType
           tfd[1]: data_bo or zero copy bo[0]
@@ -334,6 +389,11 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
        ret_fd = preview_fd;
        CAMERA_MSG_PARAM_SET(param, INT, ret_fd);
 
+       if (cb_info->invoke_preview_cb == FALSE) {
+               CAM_LOG_WARNING("Skip preview callback for fd[%d] due to preview stop.", ret_fd);
+               goto _PREVIEW_CB_HANDLER_DONE;
+       }
+
        if (num_buffer_fd < 0 || num_buffer_fd > BUFFER_MAX_PLANE_NUM) {
                CAM_LOG_ERROR("invalid num buffer fd %d", num_buffer_fd);
                goto _PREVIEW_CB_HANDLER_DONE;
@@ -350,6 +410,14 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
        /* get stream info */
        stream = (MMCamcorderVideoStreamDataType *)buf_pos;
 
+       CAM_LOG_VERBOSE("meta [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu] [%llu]",
+               stream->frame_meta.ts_soe, stream->frame_meta.ts_eoe,
+               stream->frame_meta.ts_sof, stream->frame_meta.ts_eof,
+               stream->frame_meta.ts_hal, stream->frame_meta.ts_qmf,
+               stream->frame_meta.ts_gst, stream->frame_meta.td_exp,
+               stream->frame_meta.ts_aux, stream->frame_meta.td_aux,
+               stream->frame_meta.seqnum, stream->frame_meta.flags);
+
        if (num_buffer_fd == 0 && CAMERA_IS_FD_VALID(tfd[1])) {
                /* import tbm data_bo and get virtual address */
                if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[1], &data_bo, &data_bo_handle)) {
@@ -381,15 +449,23 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
                cb_info->stream_data = stream;
 
                if (stream->extra_stream_id < 0) {
+                       monitoring_info = cb_info->monitoring_info_preview;
+                       __camera_preview_cb_monitoring_info_start(monitoring_info);
+
                        if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])
                                ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
                                        cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
                } else {
+                       monitoring_info = cb_info->monitoring_info_preview_ex[stream->extra_stream_id];
+                       __camera_preview_cb_monitoring_info_start(monitoring_info);
+
                        if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW])
                                ((camera_extra_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW])(&frame,
                                        stream->extra_stream_id, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_EXTRA_PREVIEW]);
                }
 
+               __camera_preview_cb_monitoring_info_end(monitoring_info);
+
                cb_info->stream_data = NULL;
        }
 
@@ -422,8 +498,14 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv
        /* 1. media packet preview callback */
        if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
                media_packet_ref(pkt);
+
+               monitoring_info = cb_info->monitoring_info_preview_mp;
+               __camera_preview_cb_monitoring_info_start(monitoring_info);
+
                ((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]);
+
+               __camera_preview_cb_monitoring_info_end(monitoring_info);
        }
 
        /* 2. call evas renderer */
@@ -664,16 +746,14 @@ static bool __camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo
                return false;
        }
 
-       tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
+       tmp_bo_handle = tbm_bo_get_handle(tmp_bo, TBM_DEVICE_CPU);
        if (tmp_bo_handle.ptr == NULL) {
-               CAM_LOG_ERROR("map failed %p", tmp_bo);
+               CAM_LOG_ERROR("tbm_bo_get_handle() failed %p", tmp_bo);
                tbm_bo_unref(tmp_bo);
                tmp_bo = NULL;
                return false;
        }
 
-       tbm_bo_unmap(tmp_bo);
-
        /* set bo and bo_handle */
        *bo = tmp_bo;
        *bo_handle = tmp_bo_handle;
@@ -762,7 +842,7 @@ static int __set_enable(camera_h camera, muse_camera_api_e api, int set_enable)
 }
 
 
-static void __send_message_get_return(camera_cb_info_s *cb_info, muse_camera_api_e api, char *msg, int time_out, int *ret)
+void _camera_send_message_get_return(camera_cb_info_s *cb_info, muse_camera_api_e api, char *msg, int time_out, int *ret)
 {
        int send_ret = 0;
 
@@ -774,7 +854,10 @@ static void __send_message_get_return(camera_cb_info_s *cb_info, muse_camera_api
                return;
        }
 
-       CAM_LOG_INFO("api[%d], message[%s]", api, msg);
+       if (api != MUSE_CAMERA_API_RETURN_BUFFER && api != MUSE_CAMERA_API_PREVIEW_CB_RETURN)
+               CAM_LOG_INFO("api[%d], message[%s]", api, msg);
+       else
+               CAM_LOG_DEBUG("api[%d], message[%s]", api, msg);
 
        if (cb_info->is_server_connected) {
                _camera_update_api_waiting(cb_info, api, 1);
@@ -797,7 +880,10 @@ static void __send_message_get_return(camera_cb_info_s *cb_info, muse_camera_api
 
        muse_core_msg_free(msg);
 
-       CAM_LOG_INFO("api[%d] ret[0x%x]", api, ret ? *ret : 0x0);
+       if (api != MUSE_CAMERA_API_RETURN_BUFFER && api != MUSE_CAMERA_API_PREVIEW_CB_RETURN)
+               CAM_LOG_INFO("api[%d] ret[0x%x]", api, ret ? *ret : 0x0);
+       else
+               CAM_LOG_DEBUG("api[%d] ret[0x%x]", api, ret ? *ret : 0x0);
 }
 
 
@@ -865,7 +951,7 @@ void _camera_msg_send(int api, int *fds, camera_cb_info_s *cb_info,
 
        msg = muse_core_msg_new(api, NULL);
 
-       __send_message_get_return(cb_info, api, msg, timeout, ret);
+       _camera_send_message_get_return(cb_info, api, msg, timeout, ret);
 }
 
 
@@ -910,7 +996,7 @@ void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
                break;
        }
 
-       __send_message_get_return(cb_info, api, msg, timeout, ret);
+       _camera_send_message_get_return(cb_info, api, msg, timeout, ret);
 }
 
 
@@ -939,7 +1025,7 @@ void _camera_msg_send_param2_int(int api, camera_cb_info_s *cb_info,
                param1->type, param1->name, param1->value.value_INT,
                NULL);
 
-       __send_message_get_return(cb_info, api, msg, timeout, ret);
+       _camera_send_message_get_return(cb_info, api, msg, timeout, ret);
 }
 
 
@@ -1290,7 +1376,7 @@ static int __camera_update_media_packet_format(camera_cb_info_s *cb_info, MMCamc
                media_format_get_video_info(cb_info->pkt_fmt,
                        &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
 
-               CAM_LOG_INFO("pkt_fmt %dx%d - stream %dx%d",
+               CAM_LOG_DEBUG("pkt_fmt %dx%d - stream %dx%d",
                        pkt_fmt_width, pkt_fmt_height, stream->width, stream->height);
 
                if (pkt_fmt_mimetype != mimetype ||
@@ -1353,6 +1439,16 @@ static int __camera_create_media_packet(camera_cb_info_s *cb_info, MMCamcorderVi
                        stream->data.encoded.data, stream->data.encoded.length_data,
                        (media_packet_dispose_cb)_camera_media_packet_dispose, (void *)cb_info,
                        &pkt);
+
+               if (pkt) {
+                       if (!stream->data.encoded.is_delta_frame)
+                               media_packet_set_flags(pkt, MEDIA_PACKET_SYNC_FRAME);
+
+                       if (stream->data.encoded.is_header_included) {
+                               media_packet_set_flags(pkt, MEDIA_PACKET_CODEC_CONFIG);
+                               CAM_LOG_INFO("Codec config in buffer");
+                       }
+               }
        } else {
                tsurf = __camera_get_tbm_surface(stream, mp_data);
                if (!tsurf) {
@@ -1377,8 +1473,7 @@ static int __camera_create_media_packet(camera_cb_info_s *cb_info, MMCamcorderVi
                goto _PACKET_CREATE_FAILED;
        }
 
-       /* set timestamp : msec -> nsec */
-       if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
+       if (media_packet_set_pts(pkt, stream->timestamp_nsec) != MEDIA_PACKET_ERROR_NONE)
                CAM_LOG_WARNING("media_packet_set_pts failed");
 
        if (media_packet_set_rotate_method(pkt, (media_packet_rotate_method_e)stream->rotation) != MEDIA_PACKET_ERROR_NONE)
@@ -1774,7 +1869,6 @@ static gpointer __camera_msg_handler_func(gpointer data)
                }
 
                g_free(cam_msg);
-               cam_msg = NULL;
 
                g_mutex_lock(&handler_info->mutex);
        }
@@ -1834,7 +1928,6 @@ static void __camera_deactivate_idle_event_all(camera_cb_info_s *cb_info)
                        cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
 
                        g_free(cam_idle_event);
-                       cam_idle_event = NULL;
 
                        continue;
                }
@@ -2279,10 +2372,42 @@ static void __camera_mutex_cond_clear(camera_cb_info_s *cb_info)
 }
 
 
+static camera_preview_cb_monitoring_info_s *__camera_preview_cb_monitoring_info_create(int stream_id)
+{
+       camera_preview_cb_monitoring_info_s *new_info = g_new0(camera_preview_cb_monitoring_info_s, 1);
+
+       new_info->stream_id = stream_id;
+       new_info->total = g_new0(monitoring_info_sub_s, 1);
+       new_info->interval = g_new0(monitoring_info_sub_s, 1);
+       new_info->timer_calling = g_timer_new();
+       new_info->timer_interval = g_timer_new();
+
+       CAM_LOG_INFO("create preview cb monitoring info[%p]", new_info);
+
+       return new_info;
+}
+
+
+static void __camera_preview_cb_monitoring_info_destroy(camera_preview_cb_monitoring_info_s *info)
+{
+       if (!info)
+               return;
+
+       g_timer_destroy(info->timer_calling);
+       g_timer_destroy(info->timer_interval);
+       g_free(info->total);
+       g_free(info->interval);
+
+       CAM_LOG_INFO("destroy preview cb monitoring info[%p]", info);
+
+       g_free(info);
+}
+
+
 static camera_cb_info_s *__camera_client_callback_new(gint sockfd)
 {
+       int i = 0;
        camera_cb_info_s *cb_info = NULL;
-       gint i = 0;
 
        g_return_val_if_fail(sockfd > 0, NULL);
 
@@ -2327,6 +2452,11 @@ static camera_cb_info_s *__camera_client_callback_new(gint sockfd)
 
        cb_info->is_server_connected = TRUE;
 
+       cb_info->monitoring_info_preview = __camera_preview_cb_monitoring_info_create(CAMERA_MONITORING_INFO_STREAM_ID_PREVIEW);
+       cb_info->monitoring_info_preview_mp = __camera_preview_cb_monitoring_info_create(CAMERA_MONITORING_INFO_STREAM_ID_PREVIEW_MP);
+       for (i = 0 ; i < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX ; i++)
+               cb_info->monitoring_info_preview_ex[i] = __camera_preview_cb_monitoring_info_create(i);
+
        return cb_info;
 //LCOV_EXCL_START
 ErrorExit:
@@ -2347,6 +2477,8 @@ ErrorExit:
 
 static void __camera_client_callback_destroy(camera_cb_info_s *cb_info)
 {
+       int i = 0;
+
        if (!cb_info) {
                CAM_LOG_ERROR("NULL cb_info");
                return;
@@ -2385,6 +2517,11 @@ static void __camera_client_callback_destroy(camera_cb_info_s *cb_info)
                cb_info->dp_interface = NULL;
        }
 
+       __camera_preview_cb_monitoring_info_destroy(cb_info->monitoring_info_preview);
+       __camera_preview_cb_monitoring_info_destroy(cb_info->monitoring_info_preview_mp);
+       for (i = 0 ; i < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX ; i++)
+               __camera_preview_cb_monitoring_info_destroy(cb_info->monitoring_info_preview_ex[i]);
+
        g_free(cb_info);
 }
 
@@ -2738,6 +2875,7 @@ int camera_destroy(camera_h camera)
 
 int camera_start_preview(camera_h camera)
 {
+       int i = 0;
        int ret = CAMERA_ERROR_NONE;
        int *fds = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
@@ -2763,6 +2901,11 @@ int camera_start_preview(camera_h camera)
        }
 
        if (current_state == CAMERA_STATE_CREATED) {
+               __camera_preview_cb_monitoring_info_reset(pc->cb_info->monitoring_info_preview);
+               __camera_preview_cb_monitoring_info_reset(pc->cb_info->monitoring_info_preview_mp);
+               for (i = 0 ; i < MM_CAMCORDER_EXTRA_PREVIEW_STREAM_MAX ; i++)
+                       __camera_preview_cb_monitoring_info_reset(pc->cb_info->monitoring_info_preview_ex[i]);
+
                if (!__create_msg_handler_thread(&pc->cb_info->preview_cb_info,
                                CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "cam:preview_cb", pc->cb_info)) {
                        CAM_LOG_ERROR("preview_cb_info failed");
@@ -2779,11 +2922,13 @@ int camera_start_preview(camera_h camera)
                }
        }
 
+       pc->cb_info->invoke_preview_cb = TRUE;
+
        _camera_msg_send(api, fds, pc->cb_info, &ret,
 #ifdef TIZEN_FEATURE_NO_TIMEOUT_FOR_PREVIEW
                CAMERA_CB_NO_TIMEOUT);
 #else
-               (pc->cb_info->is_network ? CAMERA_CB_NETWORK_PREVIEW_TIMEOUT : CAMERA_CB_TIMEOUT));
+               CAMERA_CB_TIMEOUT_FOR_PREVIEW);
 #endif
        if (ret != CAMERA_ERROR_NONE)
                goto _START_FAILED;
@@ -2841,7 +2986,9 @@ int camera_stop_preview(camera_h camera)
                }
        }
 //LCOV_EXCL_STOP
-       /* send stop preview message */
+
+       pc->cb_info->invoke_preview_cb = FALSE;
+
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
@@ -4579,60 +4726,55 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
 }
 
 
-int camera_attr_set_brightness(camera_h camera, int level)
+int camera_attr_set_gain(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_SET_BRIGHTNESS;
-       camera_msg_param param;
-
-       CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER);
-
-       CAM_LOG_INFO("Enter");
-
-       CAMERA_MSG_PARAM_SET(param, INT, level);
-
-       _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_GAIN, level);
+}
 
-       CAM_LOG_INFO("ret : 0x%x", ret);
 
-       return ret;
+int camera_attr_set_brightness(camera_h camera, int level)
+{
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, level);
 }
 
 
 int camera_attr_set_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_SET_CONTRAST;
-       camera_msg_param param;
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_CONTRAST, level);
+}
 
-       CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER);
 
-       CAM_LOG_INFO("Enter");
+int camera_attr_set_hue(camera_h camera, int level)
+{
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_HUE, level);
+}
 
-       CAMERA_MSG_PARAM_SET(param, INT, level);
 
-       _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
+int camera_attr_set_saturation(camera_h camera, int level)
+{
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_SATURATION, level);
+}
 
-       CAM_LOG_INFO("ret : 0x%x", ret);
 
-       return ret;
+int camera_attr_set_sharpness(camera_h camera, int level)
+{
+       return _camera_attr_set_level(camera, MUSE_CAMERA_API_ATTR_SET_SHARPNESS, level);
 }
 
 
-int camera_attr_set_hue(camera_h camera, int level)
+int camera_attr_set_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_SET_HUE;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
        camera_msg_param param;
+       int set_whitebalance = (int)wb;
 
        CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER);
 
        CAM_LOG_INFO("Enter");
 
-       CAMERA_MSG_PARAM_SET(param, INT, level);
+       CAMERA_MSG_PARAM_SET(param, INT, set_whitebalance);
 
        _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
 
@@ -4642,19 +4784,18 @@ int camera_attr_set_hue(camera_h camera, int level)
 }
 
 
-int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
+int camera_attr_set_whitebalance_temperature(camera_h camera, int temperature)
 {
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
-       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE_TEMPERATURE;
        camera_msg_param param;
-       int set_whitebalance = (int)wb;
 
        CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER);
 
        CAM_LOG_INFO("Enter");
 
-       CAMERA_MSG_PARAM_SET(param, INT, set_whitebalance);
+       CAMERA_MSG_PARAM_SET(param, INT, temperature);
 
        _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
 
@@ -4788,7 +4929,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude, double longitude, d
                MUSE_TYPE_ARRAY, "set_geotag", length, (int *)set_geotag,
                NULL);
 
-       __send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
+       _camera_send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
 
        return ret;
 }
@@ -4844,27 +4985,10 @@ int camera_attr_get_zoom(camera_h camera, int *zoom)
 
 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;
-
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("Enter");
-
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
-
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-       }
-
-       CAM_LOG_INFO("ret : 0x%x", ret);
-
-       return ret;
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE,
+               min, max);
 }
 
 
@@ -4942,27 +5066,10 @@ int camera_attr_get_exposure(camera_h camera, int *value)
 
 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;
-
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("Enter");
-
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
-
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-       }
-
-       CAM_LOG_INFO("ret : 0x%x", ret);
-
-       return ret;
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE,
+               min, max);
 }
 
 
@@ -4990,14 +5097,32 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
 }
 
 
-int camera_attr_get_brightness(camera_h camera, int *level)
+int camera_attr_get_gain(camera_h camera, int *level)
+{
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_GAIN,
+               MUSE_CAMERA_GET_INT_GAIN,
+               level);
+}
+
+
+int camera_attr_get_gain_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_GAIN_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_GAIN_RANGE,
+               min, max);
+}
+
+
+int camera_attr_get_gain_step(camera_h camera, int *step)
 {
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
-       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GAIN_STEP;
 
-       if (!pc || !pc->cb_info || !level) {
-               CAM_LOG_ERROR("NULL pointer %p %p", pc, level);
+       if (!pc || !pc->cb_info || !step) {
+               CAM_LOG_ERROR("NULL pointer %p %p", pc, step);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
@@ -5006,7 +5131,7 @@ int camera_attr_get_brightness(camera_h camera, int *level)
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE)
-               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_BRIGHTNESS];
+               *step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_GAIN_STEP];
 
        CAM_LOG_INFO("ret : 0x%x", ret);
 
@@ -5014,91 +5139,104 @@ int camera_attr_get_brightness(camera_h camera, int *level)
 }
 
 
-int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
+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_RANGE;
-
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("Enter");
-
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
-
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-       }
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS,
+               MUSE_CAMERA_GET_INT_BRIGHTNESS,
+               level);
+}
 
-       CAM_LOG_INFO("ret : 0x%x", ret);
 
-       return ret;
+int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE,
+               min, max);
 }
 
 
 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;
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_CONTRAST,
+               MUSE_CAMERA_GET_INT_CONTRAST,
+               level);
+}
 
-       if (!pc || !pc->cb_info || !level) {
-               CAM_LOG_ERROR("NULL pointer %p %p", pc, level);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
 
-       CAM_LOG_INFO("Enter");
+int camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE,
+               min, max);
+}
 
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE)
-               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CONTRAST];
+int camera_attr_get_hue(camera_h camera, int *level)
+{
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_HUE,
+               MUSE_CAMERA_GET_INT_HUE,
+               level);
+}
 
-       CAM_LOG_INFO("ret : 0x%x", ret);
 
-       return ret;
+int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_HUE_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE,
+               min, max);
 }
 
 
-int camera_attr_get_contrast_range(camera_h camera, int *min, int *max)
+int camera_attr_get_saturation(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_RANGE;
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_SATURATION,
+               MUSE_CAMERA_GET_INT_SATURATION,
+               level);
+}
 
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
 
-       CAM_LOG_INFO("Enter");
+int camera_attr_get_saturation_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_SATURATION_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_SATURATION_RANGE,
+               min, max);
+}
 
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-               CAM_LOG_INFO("min %d, max %d", *min, *max);
-       }
+int camera_attr_get_sharpness(camera_h camera, int *level)
+{
+       return _camera_attr_get_level(camera,
+               MUSE_CAMERA_API_ATTR_GET_SHARPNESS,
+               MUSE_CAMERA_GET_INT_SHARPNESS,
+               level);
+}
 
-       CAM_LOG_INFO("ret : 0x%x", ret);
 
-       return ret;
+int camera_attr_get_sharpness_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_SHARPNESS_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_SHARPNESS_RANGE,
+               min, max);
 }
 
 
-int camera_attr_get_hue(camera_h camera, int *level)
+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_HUE;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
 
-       if (!pc || !pc->cb_info || !level) {
-               CAM_LOG_ERROR("NULL pointer %p %p", pc, level);
+       if (!pc || !pc->cb_info || !wb) {
+               CAM_LOG_ERROR("NULL pointer %p %p", pc, wb);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
@@ -5107,7 +5245,7 @@ int camera_attr_get_hue(camera_h camera, int *level)
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE)
-               *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_HUE];
+               *wb = (camera_attr_whitebalance_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE];
 
        CAM_LOG_INFO("ret : 0x%x", ret);
 
@@ -5115,14 +5253,14 @@ int camera_attr_get_hue(camera_h camera, int *level)
 }
 
 
-int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
+int camera_attr_get_whitebalance_temperature(camera_h camera, int *temperature)
 {
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
-       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HUE_RANGE;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE;
 
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
+       if (!pc || !pc->cb_info || !temperature) {
+               CAM_LOG_ERROR("NULL pointer %p %p", pc, temperature);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
@@ -5130,11 +5268,8 @@ int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
 
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
-       if (ret == CAMERA_ERROR_NONE) {
-               *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][0];
-               *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][1];
-               CAM_LOG_INFO("min %d, max %d", *min, *max);
-       }
+       if (ret == CAMERA_ERROR_NONE)
+               *temperature = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE_TEMPERATURE];
 
        CAM_LOG_INFO("ret : 0x%x", ret);
 
@@ -5142,14 +5277,23 @@ int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
 }
 
 
-int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
+int camera_attr_get_whitebalance_temperature_range(camera_h camera, int *min, int *max)
+{
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_WHITE_BALANCE_TEMPERATURE_RANGE,
+               min, max);
+}
+
+
+int camera_attr_get_whitebalance_temperature_step(camera_h camera, int *step)
 {
        int ret = CAMERA_ERROR_NONE;
        camera_cli_s *pc = (camera_cli_s *)camera;
-       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
+       muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE_STEP;
 
-       if (!pc || !pc->cb_info || !wb) {
-               CAM_LOG_ERROR("NULL pointer %p %p", pc, wb);
+       if (!pc || !pc->cb_info || !step) {
+               CAM_LOG_ERROR("NULL pointer %p %p", pc, step);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
@@ -5158,7 +5302,7 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb
        _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE)
-               *wb = (camera_attr_whitebalance_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE];
+               *step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE_TEMPERATURE_STEP];
 
        CAM_LOG_INFO("ret : 0x%x", ret);
 
@@ -6025,27 +6169,10 @@ int camera_attr_get_pan(camera_h camera, int *pan_step)
 
 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;
-
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("Enter");
-
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
-
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-       }
-
-       CAM_LOG_INFO("ret : 0x%x", ret);
-
-       return ret;
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_PAN_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE,
+               min, max);
 }
 
 
@@ -6099,27 +6226,10 @@ int camera_attr_get_tilt(camera_h camera, int *tilt_step)
 
 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;
-
-       if (!pc || !pc->cb_info || !min || !max) {
-               CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("Enter");
-
-       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
-
-       if (ret == CAMERA_ERROR_NONE) {
-               *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];
-       }
-
-       CAM_LOG_INFO("ret : 0x%x", ret);
-
-       return ret;
+       return _camera_attr_get_range(camera,
+               MUSE_CAMERA_API_ATTR_GET_TILT_RANGE,
+               MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE,
+               min, max);
 }
 
 
@@ -6197,7 +6307,7 @@ int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, i
                MUSE_TYPE_ARRAY, "set_display_roi_area", length, (int *)set_display_roi_area,
                NULL);
 
-       __send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
+       _camera_send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
 
        return ret;
 }
@@ -6480,200 +6590,6 @@ int camera_create_network(camera_device_e device, camera_h *camera)
 }
 
 
-int camera_device_manager_initialize(camera_device_manager_h *manager)
-{
-       unsigned int i = 0;
-       int ret = CAMERA_ERROR_NONE;
-       void *dl_handle = NULL;
-       camera_device_manager *new_manager = NULL;
-       cdm_symbol_table sym_table[] = {
-               {(void **)&new_manager->initialize, "cdm_initialize"},
-               {(void **)&new_manager->deinitialize, "cdm_deinitialize"},
-               {(void **)&new_manager->get_device_list, "cdm_get_device_list"},
-               {(void **)&new_manager->add_device_connection_changed_cb, "cdm_add_device_connection_changed_cb"},
-               {(void **)&new_manager->remove_device_connection_changed_cb, "cdm_remove_device_connection_changed_cb"},
-       };
-
-       CAMERA_CHECK_DEVICE_MANAGER;
-
-       new_manager = g_new0(camera_device_manager, 1);
-
-       if (!manager) {
-               CAM_LOG_ERROR("NULL manager");
-               ret = CAMERA_ERROR_INVALID_PARAMETER;
-               goto _INITIALIZE_FAILED;
-       }
-
-       dl_handle = dlopen(LIB_CAMERA_DEVICE_MANAGER, RTLD_NOW);
-       if (!dl_handle) {
-               CAM_LOG_ERROR("dlopen[%s] failed[%s]", LIB_CAMERA_DEVICE_MANAGER, dlerror());
-               ret = CAMERA_ERROR_INVALID_OPERATION;
-               goto _INITIALIZE_FAILED;
-       }
-
-       /* get symbols */
-       for (i = 0 ; i < G_N_ELEMENTS(sym_table) ; i++) {
-               *sym_table[i].func_ptr = dlsym(dl_handle, sym_table[i].func_name);
-               if (*sym_table[i].func_ptr == NULL) {
-                       CAM_LOG_ERROR("symbol failed[%s]", sym_table[i].func_name);
-                       ret = CAMERA_ERROR_INVALID_OPERATION;
-                       goto _INITIALIZE_FAILED;
-               }
-       }
-
-       ret = new_manager->initialize();
-       if (ret != CAMERA_ERROR_NONE) {
-               CAM_LOG_ERROR("failed[0x%x]", ret);
-               goto _INITIALIZE_FAILED;
-       }
-
-       new_manager->dl_handle = dl_handle;
-       *manager = (camera_device_manager_h)new_manager;
-
-       CAM_LOG_INFO("camera device manager[%p](dl handle[%p]) initialized",
-               new_manager, dl_handle);
-
-       return CAMERA_ERROR_NONE;
-
-_INITIALIZE_FAILED:
-       if (dl_handle)
-               dlclose(dl_handle);
-       g_free(new_manager);
-       return ret;
-}
-
-
-//LCOV_EXCL_START
-int camera_device_manager_deinitialize(camera_device_manager_h manager)
-{
-       int ret = CAMERA_ERROR_NONE;
-       camera_device_manager *m = (camera_device_manager *)manager;
-
-       CAMERA_CHECK_DEVICE_MANAGER;
-
-       if (!m) {
-               CAM_LOG_ERROR("NULL manager");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("deinitialize camera device manager[%p]", m);
-
-       ret = m->deinitialize();
-       if (ret != CAMERA_ERROR_NONE) {
-               CAM_LOG_ERROR("failed[0x%x]", ret);
-               return ret;
-       }
-
-       CAM_LOG_INFO("close dl handle[%p]", m->dl_handle);
-
-       dlclose(m->dl_handle);
-
-       memset(m, 0x0, sizeof(camera_device_manager));
-       g_free(m);
-
-       return CAMERA_ERROR_NONE;
-}
-
-
-int camera_device_manager_foreach_supported_device(camera_device_manager_h manager, camera_supported_device_cb callback, void *user_data)
-{
-       int ret = CAMERA_ERROR_NONE;
-       unsigned int i = 0;
-       camera_device_list_s device_list;
-       camera_device_s *device = NULL;
-       camera_device_manager *m = (camera_device_manager *)manager;
-
-       CAMERA_CHECK_DEVICE_MANAGER;
-
-       if (!m || !callback) {
-               CAM_LOG_ERROR("NULL parameter[%p,%p]", m, callback);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("enter");
-
-       memset(&device_list, 0x0, sizeof(camera_device_list_s));
-
-       ret = m->get_device_list(&device_list);
-       if (ret != CAMERA_ERROR_NONE) {
-               CAM_LOG_ERROR("failed[0x%x]", ret);
-               return ret;
-       }
-
-       CAM_LOG_INFO("device count[%d]", device_list.count);
-
-       for (i = 0 ; i < device_list.count ; i++) {
-               device = &device_list.device[i];
-
-               CAM_LOG_INFO("    [%d] : type[%d], index[%d], name[%s], id[%s], ex-stream[%d]",
-                       i, device->type, device->index,
-                       device->name, device->id, device->extra_stream_num);
-
-               if (!callback(device, user_data)) {
-                       CAM_LOG_WARNING("callback is stopped[called:%u,total:%u]",
-                               i + 1, device_list.count);
-                       break;
-               }
-       }
-
-       return CAMERA_ERROR_NONE;
-}
-
-
-int camera_device_manager_add_device_connection_changed_cb(camera_device_manager_h manager,
-       camera_device_connection_changed_cb callback, void *user_data, int *cb_id)
-{
-       int ret = CAMERA_ERROR_NONE;
-       camera_device_manager *m = (camera_device_manager *)manager;
-
-       CAMERA_CHECK_DEVICE_MANAGER;
-
-       if (!m || !callback || !cb_id) {
-               CAM_LOG_ERROR("NULL parameter[%p,%p,%p]", m, callback, cb_id);
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("enter");
-
-       ret = m->add_device_connection_changed_cb(callback, user_data, cb_id);
-       if (ret != CAMERA_ERROR_NONE) {
-               CAM_LOG_ERROR("failed[0x%x]", ret);
-               return ret;
-       }
-
-       CAM_LOG_INFO("cb_id[%d] added", *cb_id);
-
-       return CAMERA_ERROR_NONE;
-}
-
-
-int camera_device_manager_remove_device_connection_changed_cb(camera_device_manager_h manager, int cb_id)
-{
-       int ret = CAMERA_ERROR_NONE;
-       camera_device_manager *m = (camera_device_manager *)manager;
-
-       CAMERA_CHECK_DEVICE_MANAGER;
-
-       if (!m) {
-               CAM_LOG_ERROR("NULL manager");
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
-       CAM_LOG_INFO("enter - cb_id[%d]", cb_id);
-
-       ret = m->remove_device_connection_changed_cb(cb_id);
-       if (ret != CAMERA_ERROR_NONE) {
-               CAM_LOG_ERROR("failed[0x%x]", ret);
-               return ret;
-       }
-
-       CAM_LOG_INFO("cb_id[%d] removed", cb_id);
-
-       return CAMERA_ERROR_NONE;
-}
-//LCOV_EXCL_STOP
-
-
 int camera_set_extra_preview_cb(camera_h camera, camera_extra_preview_cb callback, void *user_data)
 {
        int ret = CAMERA_ERROR_NONE;
@@ -6761,7 +6677,7 @@ int camera_set_extra_preview_stream_format(camera_h camera, int stream_id, camer
                MUSE_TYPE_ARRAY, "stream_format", 4, stream_format,
                NULL);
 
-       __send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
+       _camera_send_message_get_return(pc->cb_info, api, msg, CAMERA_CB_TIMEOUT, &ret);
 
        return ret;
 }
@@ -6931,3 +6847,86 @@ int _camera_get_log_level(void)
        return g_camera_log_level;
 }
 
+
+int _camera_attr_set_level(camera_h camera, muse_camera_api_e api, int level)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+       camera_msg_param param;
+
+       if (!pc || !pc->cb_info) {
+               CAM_LOG_ERROR("api[%d] NULL handle", api);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       CAM_LOG_INFO("api[%d] Enter - level[%d]", api, level);
+
+       CAMERA_MSG_PARAM_SET(param, INT, level);
+
+       _camera_msg_send_param1(api, pc->cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
+
+       CAM_LOG_INFO("api[%d] ret[0x%x]", api, ret);
+
+       return ret;
+}
+
+
+int _camera_attr_get_level(camera_h camera, muse_camera_api_e api, muse_camera_get_int_e get_index, int *level)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+
+       if (!pc || !pc->cb_info || !level) {
+               CAM_LOG_ERROR("api[%d] NULL param[%p,%p]", api, pc, level);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (get_index >= MUSE_CAMERA_GET_INT_NUM) {
+               CAM_LOG_ERROR("api[%d] INVALID index[%d]", api, get_index);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       CAM_LOG_INFO("api[%d] Enter", api);
+
+       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               *level = pc->cb_info->get_int[get_index];
+               CAM_LOG_INFO("api[%d] level[%d]", api, *level);
+       }
+
+       CAM_LOG_INFO("api[%d] ret[0x%x]", api, ret);
+
+       return ret;
+}
+
+
+int _camera_attr_get_range(camera_h camera, muse_camera_api_e api, muse_camera_get_int_pair_e get_index, int *min, int *max)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_cli_s *pc = (camera_cli_s *)camera;
+
+       if (!pc || !pc->cb_info || !min || !max) {
+               CAM_LOG_ERROR("api[%d] NULL param[%p,%p,%p]", api, pc, min, max);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (get_index >= MUSE_CAMERA_GET_INT_PAIR_NUM) {
+               CAM_LOG_ERROR("api[%d] INVALID index[%d]", api, get_index);
+               return CAMERA_ERROR_INVALID_OPERATION;
+       }
+
+       CAM_LOG_INFO("api[%d] Enter", api);
+
+       _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+       if (ret == CAMERA_ERROR_NONE) {
+               *min = pc->cb_info->get_int_pair[get_index][0];
+               *max = pc->cb_info->get_int_pair[get_index][1];
+               CAM_LOG_INFO("api[%d] min[%d], max[%d]", api, *min, *max);
+       }
+
+       CAM_LOG_INFO("api[%d] ret[0x%x]", api, ret);
+
+       return ret;
+}