Release version 0.2.12
[platform/core/api/camera.git] / src / camera.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <mm.h>
22 #include <mm_types.h>
23 #include <camera.h>
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <camera_private.h>
28 #include <muse_core.h>
29 //#include <glib.h>
30 #include <dlog.h>
31 #include <Elementary.h>
32 #include <mm_camcorder_client.h>
33 #include <Evas.h>
34 #ifdef HAVE_WAYLAND
35 #include <Ecore_Wayland.h>
36 #else
37 #include <Ecore.h>
38 #endif
39
40 #ifdef LOG_TAG
41 #undef LOG_TAG
42 #endif
43 #define LOG_TAG "TIZEN_N_CAMERA_CLIENT"
44
45
46 static int client_wait_for_cb_return(muse_camera_api_e api, callback_cb_info_s *cb_info, int time_out)
47 {
48         int ret = CAMERA_ERROR_NONE;
49         gint64 end_time;
50
51         LOGD("Enter api : %d", api);
52         g_mutex_lock(&(cb_info->pMutex[api]));
53
54         if (cb_info->activating[api] == 0) {
55                 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
56                 if (g_cond_wait_until(&(cb_info->pCond[api]), &(cb_info->pMutex[api]), end_time)) {
57                         LOGD("cb_info->recvApiMsg : %s", cb_info->recvApiMsg);
58                         if (!muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
59                                 LOGE("Get cb msg failed.");
60                                 ret = CAMERA_ERROR_INVALID_OPERATION;
61                         } else {
62                                 LOGD("Wait passed, ret : 0x%x", ret);
63                         }
64                         if (cb_info->activating[api])
65                                 cb_info->activating[api] = 0;
66                 } else {
67                         LOGD("api %d was TIMED OUT!", api);
68                         ret = CAMERA_ERROR_INVALID_OPERATION;
69                 }
70         } else {
71                 LOGE("condition is already checked for the api : %d.", api);
72                 if (!muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
73                         LOGE("Get cb msg failed.");
74                         ret = CAMERA_ERROR_INVALID_OPERATION;
75                 } else {
76                         LOGD("Already checked condition, Wait passed, ret : 0x%x", ret);
77                 }
78         }
79         g_mutex_unlock(&(cb_info->pMutex[api]));
80         LOGD("ret : 0x%x", ret);
81         return ret;
82 }
83
84 static void _client_user_callback(callback_cb_info_s * cb_info, muse_camera_event_e event )
85 {
86         char *recvMsg = cb_info->recvMsg;
87         int param, param1, param2;
88         LOGD("get event %d", event);
89
90         switch (event) {
91                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
92                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
93                         muse_camera_msg_get(param1, recvMsg);
94                         muse_camera_msg_get(param2, recvMsg);
95                         break;
96                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
97                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
98                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
99                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
100                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
101                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
102                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
103                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
104                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
105                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
106                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
107                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
108                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
109                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
110                         muse_camera_msg_get(param, recvMsg);
111                         break;
112                 default:
113                         break;
114         }
115
116         switch(event) {
117                 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
118                 {
119                         int cb_previous, cb_current, cb_by_policy;
120                         muse_camera_msg_get(cb_previous, recvMsg);
121                         muse_camera_msg_get(cb_current, recvMsg);
122                         muse_camera_msg_get(cb_by_policy, recvMsg);
123                         ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)cb_previous,
124                                                                                                         (camera_state_e)cb_current,
125                                                                                                         (bool)cb_by_policy,
126                                                                                                         cb_info->user_data[event]);
127                         break;
128                 }
129                 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
130                 {
131                         int cb_state;
132                         muse_camera_msg_get(cb_state, recvMsg);
133                         ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)cb_state,
134                                                                                                         cb_info->user_data[event]);
135                         break;
136                 }
137                 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
138                         ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
139                         break;
140                 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
141                         ((camera_preview_cb)cb_info->user_cb[event])(NULL,
142                                                                                                         cb_info->user_data[event]);
143                         break;
144                 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
145                         ((camera_media_packet_preview_cb)cb_info->user_cb[event])(NULL,
146                                                                                                                         cb_info->user_data[event]);
147                         break;
148                 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
149                 {
150                         int progress;
151                         muse_camera_msg_get(progress, recvMsg);
152                         ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(progress,
153                                                                                                                         cb_info->user_data[event]);
154                         break;
155                 }
156                 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
157                 {
158                         int cb_policy, cb_previous, cb_current;
159                         muse_camera_msg_get(cb_policy, recvMsg);
160                         muse_camera_msg_get(cb_previous, recvMsg);
161                         muse_camera_msg_get(cb_current, recvMsg);
162                         ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)cb_policy,
163                                                                                                                 (camera_state_e)cb_previous,
164                                                                                                                 (camera_state_e)cb_current,
165                                                                                                                 cb_info->user_data[event]);
166                         break;
167                 }
168                 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
169                 {
170                         int count;
171                         muse_camera_msg_get(count, recvMsg);
172                         ((camera_face_detected_cb)cb_info->user_cb[event])(NULL,
173                                                                                                         count,
174                                                                                                         cb_info->user_data[event]);
175                         break;
176                 }
177                 case MUSE_CAMERA_EVENT_TYPE_ERROR:
178                 {
179                         int cb_error, cb_current_state;
180                         muse_camera_msg_get(cb_error, recvMsg);
181                         muse_camera_msg_get(cb_current_state, recvMsg);
182                         ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)cb_error,
183                                                                                                         (camera_state_e)cb_current_state,
184                                                                                                         cb_info->user_data[event]);
185                         break;
186                 }
187                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
188                         ((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2,
189                                                                                                                                         cb_info->user_data[event]);
190                         break;
191                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
192                         ((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2,
193                                                                                                                                         cb_info->user_data[event]);
194                         break;
195                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
196                         ((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param,
197                                                                                                                                         cb_info->user_data[event]);
198                         break;
199                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
200                         ((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param,
201                                                                                                                                         cb_info->user_data[event]);
202                         break;
203                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
204                         ((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param,
205                                                                                                                                         cb_info->user_data[event]);
206                         break;
207                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
208                         ((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param,
209                                                                                                                                         cb_info->user_data[event]);
210                         break;
211                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
212                         ((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param,
213                                                                                                                         cb_info->user_data[event]);
214                         break;
215                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
216                         ((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param,
217                                                                                                                                                 cb_info->user_data[event]);
218                         break;
219                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
220                         ((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param,
221                                                                                                                                 cb_info->user_data[event]);
222                         break;
223                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
224                         ((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param,
225                                                                                                                                         cb_info->user_data[event]);
226                         break;
227                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
228                         ((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param,
229                                                                                                                                         cb_info->user_data[event]);
230                         break;
231                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
232                         ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param,
233                                                                                                                         cb_info->user_data[event]);
234                         break;
235                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
236                         ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param,
237                                                                                                                         cb_info->user_data[event]);
238                         break;
239                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
240                         ((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param,
241                                                                                                                                         cb_info->user_data[event]);
242                         break;
243                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
244                         ((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param,
245                                                                                                                                         cb_info->user_data[event]);
246                         break;
247                 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
248                         ((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param,
249                                                                                                                                         cb_info->user_data[event]);
250                         break;
251                 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
252                 {
253                         int ret = CAMERA_ERROR_NONE;
254                         camera_image_data_s *rImage = NULL;
255                         camera_image_data_s *rPostview = NULL;
256                         camera_image_data_s *rThumbnail = NULL;
257                         unsigned char *buf_pos = NULL;
258                         tbm_bo bo;
259                         tbm_bo_handle bo_handle;
260                         int tbm_key = 0;
261                         int is_postview = 0;
262                         int is_thumbnail = 0;
263
264                         muse_camera_msg_get(tbm_key, recvMsg);
265                         muse_camera_msg_get(is_postview, recvMsg);
266                         muse_camera_msg_get(is_thumbnail, recvMsg);
267
268                         LOGD("camera capture callback came in. key %d, postview %d, thumbnail %d",
269                              tbm_key, is_postview, is_thumbnail);
270
271                         if (tbm_key <= 0) {
272                                 LOGE("invalid key %d", tbm_key);
273                                 break;
274                         }
275
276                         /* import tbm bo and get virtual address */
277                         bo = tbm_bo_import(cb_info->bufmgr, tbm_key);
278                         if (bo == NULL) {
279                                 LOGE("bo import failed - bufmgr %p, key %d", cb_info->bufmgr, tbm_key);
280                                 break;
281                         }
282
283                         bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
284                         if (bo_handle.ptr == NULL) {
285                                 LOGE("bo map failed %p", bo);
286                                 tbm_bo_unref(bo);
287                                 bo = NULL;
288                                 break;
289                         }
290
291                         buf_pos = (unsigned char *)bo_handle.ptr;
292                         rImage = (camera_image_data_s *)buf_pos;
293                         rImage->data = buf_pos + sizeof(camera_image_data_s);
294                         buf_pos += sizeof(camera_image_data_s) + rImage->size;
295
296                         if (is_postview) {
297                                 rPostview = (camera_image_data_s *)buf_pos;
298                                 LOGD("rPostview->size : %d", rPostview->size);
299                                 rPostview->data = buf_pos + sizeof(camera_image_data_s);
300                                 buf_pos += sizeof(camera_image_data_s) + rPostview->size;
301                         }
302
303                         if (is_thumbnail) {
304                                 rThumbnail = (camera_image_data_s *)buf_pos;
305                                 LOGD("rThumbnail->size : %d", rThumbnail->size);
306                                 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
307                                 buf_pos += sizeof(camera_image_data_s) + rThumbnail->size;
308                         }
309
310                         LOGD("read image info height: %d, width : %d, size : %d", rImage->height, rImage->width, rImage->size);
311
312                         if (cb_info->user_cb[event]) {
313                                 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
314                         } else {
315                                 LOGW("capture cb is NULL");
316                         }
317
318                         /* return buffer */
319                         muse_camera_msg_send1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info->fd, cb_info, ret, INT, tbm_key);
320
321                         LOGD("return buffer result : 0x%x", ret);
322
323                         /* unmap and unref tbm bo */
324                         tbm_bo_unmap(bo);
325                         tbm_bo_unref(bo);
326                         bo = NULL;
327
328                         break;
329                 }
330                 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
331                         break;
332
333                 default:
334                         LOGE("Unknonw event : %d", event);
335                         break;
336         }
337 }
338
339 static void *client_cb_handler(gpointer data)
340 {
341         int ret;
342         int api;
343         int num_token = 0;
344         int i = 0;
345         int str_pos = 0;
346         int prev_pos = 0;
347         callback_cb_info_s *cb_info = data;
348         char *recvMsg = cb_info->recvMsg;
349         char parseStr[CAMERA_PARSE_STRING_SIZE][MUSE_CAMERA_MSG_MAX_LENGTH] = {{0,0},};
350
351         while (g_atomic_int_get(&cb_info->running)) {
352                 ret = muse_core_ipc_recv_msg(cb_info->fd, recvMsg);
353                 if (ret <= 0)
354                         break;
355                 recvMsg[ret] = '\0';
356
357                 str_pos = 0;
358                 prev_pos = 0;
359                 num_token = 0;
360                 memset(parseStr, 0, CAMERA_PARSE_STRING_SIZE * MUSE_CAMERA_MSG_MAX_LENGTH);
361
362                 LOGD("recvMSg : %s, length : %d", recvMsg, ret);
363
364                 /* Need to split the combined entering msgs.
365                     This module supports up to 200 combined msgs. */
366                 for (str_pos = 0; str_pos < ret; str_pos++) {
367                         if(recvMsg[str_pos] == '}') {
368                                 strncpy(&(parseStr[num_token][0]), recvMsg + prev_pos, str_pos - prev_pos + 1);
369                                 LOGD("splitted msg : %s, Index : %d", &(parseStr[num_token][0]), num_token);
370                                 prev_pos = str_pos+1;
371                                 num_token++;
372                         }
373                 }
374                 LOGD("num_token : %d", num_token);
375
376                 /* Re-construct to the useful single msg. */
377                 for (i = 0; i < num_token; i++) {
378
379                         if (i >= CAMERA_PARSE_STRING_SIZE)
380                                 break;
381
382                         if (muse_camera_msg_get(api, &(parseStr[i][0]))) {
383                                 if(api < MUSE_CAMERA_API_MAX){
384                                         LOGD("Set Condition");
385                                         g_mutex_lock(&(cb_info->pMutex[api]));
386
387                                         /* The api msgs should be distinguished from the event msg. */
388                                         memset(cb_info->recvApiMsg, 0, strlen(cb_info->recvApiMsg));
389                                         strcpy(cb_info->recvApiMsg, &(parseStr[i][0]));
390                                         LOGD("cb_info->recvApiMsg : %s", cb_info->recvApiMsg);
391                                         cb_info->activating[api] = 1;
392                                         g_cond_signal(&(cb_info->pCond[api]));
393                                         g_mutex_unlock(&(cb_info->pMutex[api]));
394
395                                         if (api == MUSE_CAMERA_API_CREATE) {
396                                                 if (muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
397                                                         if (ret != CAMERA_ERROR_NONE) {
398                                                                 g_atomic_int_set(&cb_info->running, 0);
399                                                                 LOGE("camera create error. close client cb handler");
400                                                         }
401                                                 } else {
402                                                         LOGE("failed to get api return");
403                                                 }
404                                         } else if (api == MUSE_CAMERA_API_DESTROY) {
405                                                 if (muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
406                                                         if (ret == CAMERA_ERROR_NONE) {
407                                                                 g_atomic_int_set(&cb_info->running, 0);
408                                                                 LOGD("camera destroy done. close client cb handler");
409                                                         }
410                                                 } else {
411                                                         LOGE("failed to get api return");
412                                                 }
413                                         }
414                                 } else if(api == MUSE_CAMERA_CB_EVENT) {
415                                         int event;
416                                         if (muse_camera_msg_get(event, &(parseStr[i][0]))) {
417                                                 LOGD("go callback : %d", event);
418                                                 _client_user_callback(cb_info, event);
419                                         }
420                                 } else {
421                                         LOGW("unknown api : %d", api);
422                                 }
423                         }else{
424                                 LOGE("Get Msg Failed");
425                         }
426                 }
427
428         }
429         LOGD("client cb exit");
430
431         return NULL;
432 }
433
434 static callback_cb_info_s *client_callback_new(gint sockfd)
435 {
436         callback_cb_info_s *cb_info;
437         GCond *camera_cond;
438         GMutex *camera_mutex;
439         gint *camera_activ;
440         g_return_val_if_fail(sockfd > 0, NULL);
441
442         cb_info = g_new0(callback_cb_info_s, 1);
443         camera_cond = g_new0(GCond, MUSE_CAMERA_API_MAX);
444         camera_mutex = g_new0(GMutex, MUSE_CAMERA_API_MAX);
445         camera_activ = g_new0(gint, MUSE_CAMERA_API_MAX);
446
447         g_atomic_int_set(&cb_info->running, 1);
448         cb_info->fd = sockfd;
449         cb_info->pCond = camera_cond;
450         cb_info->pMutex = camera_mutex;
451         cb_info->activating = camera_activ;
452         cb_info->thread =
453                 g_thread_new("callback_thread", client_cb_handler,
454                              (gpointer) cb_info);
455
456         return cb_info;
457 }
458
459 static void client_callback_destroy(callback_cb_info_s * cb_info)
460 {
461         g_return_if_fail(cb_info != NULL);
462
463         LOGI("%p Callback destroyed", cb_info->thread);
464
465         g_thread_join(cb_info->thread);
466         g_thread_unref(cb_info->thread);
467
468         if (cb_info->bufmgr) {
469                 tbm_bufmgr_deinit(cb_info->bufmgr);
470                 cb_info->bufmgr = NULL;
471         }
472
473         if (cb_info->pCond) {
474                 g_free(cb_info->pCond);
475         }
476         if (cb_info->pMutex) {
477                 g_free(cb_info->pMutex);
478         }
479         if (cb_info->activating) {
480                 g_free(cb_info->activating);
481         }
482         g_free(cb_info);
483 }
484
485 int camera_create(camera_device_e device, camera_h* camera)
486 {
487         int sock_fd = -1;
488         char *sndMsg;
489         int ret = CAMERA_ERROR_NONE;
490         camera_cli_s *pc = NULL;
491         tbm_bufmgr bufmgr = NULL;
492
493         muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
494         muse_core_api_module_e muse_module = MUSE_CAMERA;
495         int device_type = (int)device;
496
497         if (camera == NULL){
498                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
499                 return CAMERA_ERROR_INVALID_PARAMETER;
500         }
501
502         bufmgr = tbm_bufmgr_init(-1);
503         if (bufmgr == NULL) {
504                 LOGE("get tbm bufmgr failed");
505                 return CAMERA_ERROR_INVALID_OPERATION;
506         }
507
508         sock_fd = muse_core_client_new();
509
510         sndMsg = muse_core_msg_json_factory_new(api,
511                                                                         MUSE_TYPE_INT, "module", muse_module,
512                                                                         MUSE_TYPE_INT, PARAM_DEVICE_TYPE, (int)device_type,
513                                                                         0);
514
515         muse_core_ipc_send_msg(sock_fd, sndMsg);
516         muse_core_msg_json_factory_free(sndMsg);
517
518         pc = g_new0(camera_cli_s, 1);
519         if (pc == NULL) {
520                 ret = CAMERA_ERROR_OUT_OF_MEMORY;
521                 goto ErrorExit;
522         }
523
524         pc->cb_info = client_callback_new(sock_fd);
525
526         LOGD("cb info : %d", pc->cb_info->fd);
527
528         ret = client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
529         if (ret == CAMERA_ERROR_NONE) {
530                 intptr_t handle = 0;
531                 muse_camera_msg_get_pointer(handle, pc->cb_info->recvMsg);
532                 if (handle == 0) {
533                         LOGE("Receiving Handle Failed!!");
534                         ret = CAMERA_ERROR_INVALID_OPERATION;
535                         goto ErrorExit;
536                 } else {
537                         pc->remote_handle = handle;
538                         pc->cb_info->bufmgr = bufmgr;
539                 }
540
541                 LOGD("camera create 0x%x", pc->remote_handle);
542
543                 *camera = (camera_h) pc;
544         } else {
545                 goto ErrorExit;
546         }
547
548         return ret;
549
550 ErrorExit:
551         tbm_bufmgr_deinit(bufmgr);
552         bufmgr = NULL;
553
554         if (pc) {
555                 client_callback_destroy(pc->cb_info);
556                 pc->cb_info = NULL;
557                 g_free(pc);
558                 pc = NULL;
559         }
560
561         LOGE("camera create error : 0x%x", ret);
562
563         return ret;
564 }
565
566  int camera_destroy(camera_h camera)
567 {
568         if (camera == NULL) {
569                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
570                 return CAMERA_ERROR_INVALID_PARAMETER;
571         }
572
573         int ret = CAMERA_ERROR_NONE;
574         muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
575         camera_cli_s *pc = (camera_cli_s *)camera;
576         int sock_fd = pc->cb_info->fd;
577         LOGD("ENTER");
578
579         if (pc == NULL) {
580                 LOGE("pc is already nul!!");
581                 return CAMERA_ERROR_INVALID_PARAMETER;
582         } else if (pc->cb_info == NULL) {
583                 return CAMERA_ERROR_INVALID_PARAMETER;
584         }
585
586         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
587         if (ret == CAMERA_ERROR_NONE) {
588                 client_callback_destroy(pc->cb_info);
589                 g_free(pc);
590                 pc = NULL;
591         } else {
592                 LOGE("camera destroy error : 0x%x", ret);
593         }
594
595         return ret;
596 }
597
598 int camera_start_preview(camera_h camera)
599 {
600         LOGD("start");
601         if (camera == NULL) {
602                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
603                 return CAMERA_ERROR_INVALID_PARAMETER;
604         }
605
606         int ret = CAMERA_ERROR_NONE;
607         muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
608         camera_cli_s *pc = (camera_cli_s *)camera;
609         int sock_fd;
610         char caps[MUSE_CAMERA_MSG_MAX_LENGTH] = {0};
611
612         if (pc->cb_info == NULL) {
613                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
614                 return CAMERA_ERROR_INVALID_PARAMETER;
615         }
616
617         sock_fd = pc->cb_info->fd;
618
619         muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
620         LOGD("Enter,  ret :0x%x", ret);
621         if(ret == CAMERA_ERROR_NONE) {
622                 muse_camera_msg_get_string(caps, pc->cb_info->recvMsg);
623                 LOGD("caps : %s", caps);
624                 if (pc->cli_display_handle != 0) {
625                         LOGD("client's display handle is : 0x%x", pc->cli_display_handle);
626                         if(strlen(caps) > 0 &&
627                                         mm_camcorder_client_realize(pc->client_handle, caps) != MM_ERROR_NONE)
628                                 ret = CAMERA_ERROR_INVALID_OPERATION;
629                 } else {
630                         LOGD("display handle is NULL");
631                 }
632         }
633         LOGD("ret : 0x%x", ret);
634         return ret;
635 }
636
637 int camera_stop_preview(camera_h camera)
638 {
639         if (camera == NULL) {
640                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
641                 return CAMERA_ERROR_INVALID_PARAMETER;
642         }
643         int ret = CAMERA_ERROR_NONE;
644         camera_cli_s *pc = (camera_cli_s *)camera;
645         int sock_fd;
646         muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
647
648         if (pc->cb_info == NULL) {
649                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
650                 return CAMERA_ERROR_INVALID_PARAMETER;
651         }
652
653         sock_fd = pc->cb_info->fd;
654         LOGD("Enter");
655         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
656
657         if(ret == CAMERA_ERROR_NONE) {
658                 if (pc->cli_display_handle != 0) {
659                         LOGD("Unrealize client");
660                         if (pc->client_handle != NULL) {
661                                 ret = mm_camcorder_client_unrealize(pc->client_handle);
662                                 mm_camcorder_client_destroy(pc->client_handle);
663                         }
664                 } else {
665                         LOGD("Client did not realized : Display handle is NULL");
666                 }
667         }
668         LOGD("ret : 0x%x", ret);
669         return ret;
670 }
671
672 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data)
673 {
674         if (camera == NULL) {
675                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
676                 return CAMERA_ERROR_INVALID_PARAMETER;
677         }
678         int ret = CAMERA_ERROR_NONE;
679
680         camera_cli_s *pc = (camera_cli_s *)camera;
681         muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
682         int sock_fd;
683         int is_capturing_cb = 0;
684         int is_completed_cb = 0;
685         LOGD("Enter, handle :%x", pc->remote_handle);
686
687         if (pc->cb_info == NULL) {
688                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
689                 return CAMERA_ERROR_INVALID_PARAMETER;
690         }
691
692         sock_fd = pc->cb_info->fd;
693
694         if (capturing_cb != NULL) {
695                 is_capturing_cb = 1;
696                 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
697                 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
698         }
699
700         if(completed_cb != NULL) {
701                 is_completed_cb = 1;
702                 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
703                 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
704         }
705
706         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
707         LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
708         LOGD("ret : 0x%x", ret);
709         return ret;
710 }
711
712 bool camera_is_supported_continuous_capture(camera_h camera)
713 {
714         if (camera == NULL) {
715                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
716                 return false;
717         }
718
719         int ret = CAMERA_ERROR_NONE;
720         camera_cli_s *pc = (camera_cli_s *)camera;
721         muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
722         int sock_fd;
723
724         if (pc->cb_info == NULL) {
725                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
726                 return CAMERA_ERROR_INVALID_PARAMETER;
727         }
728
729         sock_fd = pc->cb_info->fd;
730
731         LOGD("Enter, remote_handle : %x", pc->remote_handle);
732         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
733         LOGD("ret : 0x%x", ret);
734         return (bool)ret;
735 }
736
737 int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data)
738 {
739         if (camera == NULL) {
740                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
741                 return CAMERA_ERROR_INVALID_PARAMETER;
742         }
743
744         int ret = CAMERA_ERROR_NONE;
745
746         camera_cli_s *pc = (camera_cli_s *)camera;
747         muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
748
749         LOGD("Enter, handle :%x", pc->remote_handle);
750
751         int sock_fd;
752         if (pc->cb_info == NULL) {
753                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
754                 return CAMERA_ERROR_INVALID_PARAMETER;
755         }
756         sock_fd = pc->cb_info->fd;
757
758         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
759         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
760         pc->cb_info->user_cb_completed[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = completed_cb;
761
762         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
763         LOGD("ret : 0x%x", ret);
764         return ret;
765 }
766
767 int camera_stop_continuous_capture(camera_h camera)
768 {
769         if (camera == NULL) {
770                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
771                 return CAMERA_ERROR_INVALID_PARAMETER;
772         }
773
774
775         int ret = CAMERA_ERROR_NONE;
776
777         camera_cli_s *pc = (camera_cli_s *)camera;
778         muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
779         LOGD("Enter,  handle :%x", pc->remote_handle);
780         int sock_fd;
781         if (pc->cb_info == NULL) {
782                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
783                 return CAMERA_ERROR_INVALID_PARAMETER;
784         }
785         sock_fd = pc->cb_info->fd;
786         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
787         LOGD("ret : 0x%x", ret);
788         return ret;
789 }
790
791 bool camera_is_supported_face_detection(camera_h camera)
792 {
793         if (camera == NULL) {
794                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
795                 return false;
796         }
797         int ret = CAMERA_ERROR_NONE;
798
799         camera_cli_s *pc = (camera_cli_s *)camera;
800         muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
801         int sock_fd;
802         if (pc->cb_info == NULL) {
803                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
804                 return CAMERA_ERROR_INVALID_PARAMETER;
805         }
806         sock_fd = pc->cb_info->fd;
807
808         LOGD("Enter, remote_handle : %x", pc->remote_handle);
809         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
810         LOGD("ret : 0x%x", ret);
811         return (bool)ret;
812 }
813
814 bool camera_is_supported_zero_shutter_lag(camera_h camera)
815 {
816         if (camera == NULL) {
817                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
818                 return false;
819         }
820         int ret = CAMERA_ERROR_NONE;
821
822         camera_cli_s *pc = (camera_cli_s *)camera;
823         muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
824         int sock_fd;
825         if (pc->cb_info == NULL) {
826                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
827                 return CAMERA_ERROR_INVALID_PARAMETER;
828         }
829         sock_fd = pc->cb_info->fd;
830
831         LOGD("Enter, remote_handle : %x", pc->remote_handle);
832         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
833         LOGD("ret : 0x%x", ret);
834         return (bool)ret;
835 }
836
837 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
838 {
839         if (camera == NULL) {
840                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
841                 return false;
842         }
843
844         int ret = CAMERA_ERROR_NONE;
845
846         camera_cli_s *pc = (camera_cli_s *)camera;
847         muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
848         int sock_fd;
849         if (pc->cb_info == NULL) {
850                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
851                 return CAMERA_ERROR_INVALID_PARAMETER;
852         }
853         sock_fd = pc->cb_info->fd;
854
855         LOGD("Enter, remote_handle : %x", pc->remote_handle);
856         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
857         LOGD("ret : 0x%x", ret);
858         return (bool)ret;
859 }
860
861 int camera_get_device_count(camera_h camera, int *device_count)
862 {
863         if (camera == NULL || device_count == NULL) {
864                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
865                 return CAMERA_ERROR_INVALID_PARAMETER;
866         }
867         int ret = CAMERA_ERROR_NONE;
868
869         camera_cli_s *pc = (camera_cli_s *)camera;
870         muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
871         int sock_fd;
872         if (pc->cb_info == NULL) {
873                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
874                 return CAMERA_ERROR_INVALID_PARAMETER;
875         }
876         sock_fd = pc->cb_info->fd;
877         int get_device_count;
878
879         LOGD("Enter, remote_handle : %x", pc->remote_handle);
880         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
881
882         if (ret == CAMERA_ERROR_NONE) {
883                 muse_camera_msg_get(get_device_count, pc->cb_info->recvMsg);
884                 *device_count = get_device_count;
885         }
886         LOGD("ret : 0x%x", ret);
887         return ret;
888 }
889
890 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data)
891 {
892         if (camera == NULL) {
893                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
894                 return CAMERA_ERROR_INVALID_PARAMETER;
895         }
896
897         int ret = CAMERA_ERROR_NONE;
898
899         camera_cli_s *pc = (camera_cli_s *)camera;
900         muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
901
902         LOGD("Enter, handle :%x", pc->remote_handle);
903         int sock_fd;
904         if (pc->cb_info == NULL) {
905                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
906                 return CAMERA_ERROR_INVALID_PARAMETER;
907         }
908         sock_fd = pc->cb_info->fd;
909         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
910         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
911
912         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
913         LOGD("ret : 0x%x", ret);
914         return ret;
915 }
916
917 int camera_stop_face_detection(camera_h camera)
918 {
919         if (camera == NULL) {
920                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
921                 return CAMERA_ERROR_INVALID_PARAMETER;
922         }
923
924         int ret = CAMERA_ERROR_NONE;
925
926         camera_cli_s *pc = (camera_cli_s *)camera;
927         muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
928         LOGD("Enter,  handle :%x", pc->remote_handle);
929         int sock_fd;
930         if (pc->cb_info == NULL) {
931                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
932                 return CAMERA_ERROR_INVALID_PARAMETER;
933         }
934         sock_fd = pc->cb_info->fd;
935         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
936         LOGD("ret : 0x%x", ret);
937         return ret;
938 }
939
940 int camera_get_state(camera_h camera, camera_state_e * state)
941 {
942         if (camera == NULL || state == NULL) {
943                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
944                 return CAMERA_ERROR_INVALID_PARAMETER;
945         }
946         int ret = CAMERA_ERROR_NONE;
947
948         camera_cli_s *pc = (camera_cli_s *)camera;
949         muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
950         int sock_fd;
951         if (pc->cb_info == NULL) {
952                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
953                 return CAMERA_ERROR_INVALID_PARAMETER;
954         }
955         sock_fd = pc->cb_info->fd;
956         int get_state;
957
958         LOGD("Enter, remote_handle : %x", pc->remote_handle);
959         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
960
961         if (ret == CAMERA_ERROR_NONE) {
962                 muse_camera_msg_get(get_state, pc->cb_info->recvMsg);
963                 *state = (camera_state_e)get_state;
964         }
965         LOGD("ret : 0x%x", ret);
966         return ret;
967 }
968
969 int camera_start_focusing(camera_h camera, bool continuous)
970 {
971         if( camera == NULL){
972                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
973                 return CAMERA_ERROR_INVALID_PARAMETER;
974         }
975
976         int ret = CAMERA_ERROR_NONE;
977
978         camera_cli_s *pc = (camera_cli_s *)camera;
979         muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
980         int sock_fd;
981         if (pc->cb_info == NULL) {
982                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
983                 return CAMERA_ERROR_INVALID_PARAMETER;
984         }
985         sock_fd = pc->cb_info->fd;
986         int is_continuous = (int)continuous;
987
988         LOGD("Enter, remote_handle : %x", pc->remote_handle);
989         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
990         LOGD("ret : 0x%x", ret);
991         return ret;
992 }
993
994 int camera_cancel_focusing(camera_h camera)
995 {
996         if (camera == NULL) {
997                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
998                 return CAMERA_ERROR_INVALID_PARAMETER;
999         }
1000
1001         int ret = CAMERA_ERROR_NONE;
1002
1003         camera_cli_s *pc = (camera_cli_s *)camera;
1004         muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1005         int sock_fd;
1006         if (pc->cb_info == NULL) {
1007                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1008                 return CAMERA_ERROR_INVALID_PARAMETER;
1009         }
1010         sock_fd = pc->cb_info->fd;
1011
1012         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1013         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1014         LOGD("ret : 0x%x", ret);
1015         return ret;
1016 }
1017
1018 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
1019 {
1020         int ret = CAMERA_ERROR_NONE;
1021         int display_surface;
1022         void *set_display_handle = NULL;
1023         int set_surface = MM_DISPLAY_SURFACE_X;
1024         Evas_Object *obj = NULL;
1025         const char *object_type = NULL;
1026         char socket_path[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
1027
1028         if (camera == NULL) {
1029                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1030                 return CAMERA_ERROR_INVALID_PARAMETER;
1031         }
1032
1033         if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
1034                 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
1035                 return CAMERA_ERROR_INVALID_PARAMETER;
1036         }
1037
1038         int display_type = (int)type;
1039         camera_cli_s *pc = (camera_cli_s *)camera;
1040         muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1041         int sock_fd;
1042         if (pc->cb_info == NULL) {
1043                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1044                 return CAMERA_ERROR_INVALID_PARAMETER;
1045         }
1046         sock_fd = pc->cb_info->fd;
1047
1048         LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
1049
1050         if (type == CAMERA_DISPLAY_TYPE_NONE) {
1051                 set_display_handle = 0;
1052                 set_surface = MM_DISPLAY_SURFACE_NULL;
1053                 LOGD("display type NONE");
1054         } else {
1055                 obj = (Evas_Object *)display;
1056                 object_type = evas_object_type_get(obj);
1057                 if (object_type) {
1058                         if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
1059 #ifdef HAVE_WAYLAND
1060                                 MMCamWaylandInfo *wl_info = g_new0(MMCamWaylandInfo, 1);
1061
1062                                 if (wl_info == NULL) {
1063                                         LOGE("wl_info alloc failed : %d", sizeof(MMCamWaylandInfo));
1064                                         return CAMERA_ERROR_OUT_OF_MEMORY;
1065                                 }
1066
1067                                 wl_info->evas_obj = (void *)obj;
1068                                 wl_info->window = (void *)elm_win_wl_window_get(obj);
1069                                 wl_info->surface = (void *)ecore_wl_window_surface_get(wl_info->window);
1070                                 wl_info->display = (void *)ecore_wl_display_get();
1071
1072                                 if (wl_info->window == NULL || wl_info->surface == NULL || wl_info->display == NULL) {
1073                                         LOGE("something is NULL %p, %p, %p", wl_info->window, wl_info->surface, wl_info->display);
1074                                         return CAMERA_ERROR_INVALID_OPERATION;
1075                                 }
1076
1077                                 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
1078                                                               &wl_info->window_width, &wl_info->window_height);
1079
1080                                 /* set wayland info */
1081                                 pc->wl_info = wl_info;
1082                                 set_surface = MM_DISPLAY_SURFACE_X;
1083                                 set_display_handle = (void *)wl_info;
1084
1085                                 LOGD("wayland obj %p, window %p, surface %p, display %p, size %d,%d,%dx%d",
1086                                      wl_info->evas_obj, wl_info->window, wl_info->surface, wl_info->display,
1087                                      wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
1088 #else /* HAVE_WAYLAND */
1089                                 /* x window overlay surface */
1090                                 set_display_handle = (void *)elm_win_xwindow_get(obj);
1091                                 set_surface = MM_DISPLAY_SURFACE_X;
1092                                 LOGD("display type OVERLAY : handle %p", set_display_handle);
1093 #endif
1094                         } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
1095                                 /* evas object surface */
1096                                 set_display_handle = (void *)display;
1097                                 set_surface = MM_DISPLAY_SURFACE_EVAS;
1098                                 LOGD("display type EVAS : handle %p", set_display_handle);
1099                         } else {
1100                                 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
1101                                 return CAMERA_ERROR_INVALID_PARAMETER;
1102                         }
1103                 } else {
1104                         LOGE("failed to get evas object type from %p", obj);
1105                         return CAMERA_ERROR_INVALID_PARAMETER;
1106                 }
1107         }
1108
1109         pc->cli_display_handle = (intptr_t)set_display_handle;
1110         display_surface = (int)set_surface;
1111         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret,
1112                                                             INT, display_type,
1113                                                             INT, display_surface);
1114
1115         if (ret == CAMERA_ERROR_NONE && type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
1116                 if (mm_camcorder_client_create(&(pc->client_handle))) {
1117                         LOGE("camera client create Failed");
1118                         return CAMERA_ERROR_INVALID_OPERATION;
1119                 }
1120                 muse_camera_msg_get_string(socket_path, pc->cb_info->recvMsg);
1121                 LOGD("shmsrc stream path : %s", socket_path);
1122                 if(mm_camcorder_client_set_shm_socket_path(pc->client_handle, socket_path)
1123                                 != MM_ERROR_NONE)
1124                         return CAMERA_ERROR_INVALID_OPERATION;
1125                 ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
1126                                                   MMCAM_DISPLAY_SURFACE, set_surface,
1127                                                   NULL);
1128                 if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) {
1129                         ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
1130                                                           MMCAM_DISPLAY_HANDLE, pc->cli_display_handle, sizeof(void *),
1131                                                           NULL);
1132                         LOGD("ret : 0x%x", ret);
1133                 }
1134         }
1135         LOGD("ret : 0x%x", ret);
1136         return ret;
1137 }
1138
1139 int camera_set_preview_resolution(camera_h camera,  int width, int height)
1140 {
1141         if( camera == NULL){
1142                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1143                 return CAMERA_ERROR_INVALID_PARAMETER;
1144         }
1145         int ret = CAMERA_ERROR_NONE;
1146
1147         camera_cli_s *pc = (camera_cli_s *)camera;
1148         muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
1149         int sock_fd;
1150         if (pc->cb_info == NULL) {
1151                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1152                 return CAMERA_ERROR_INVALID_PARAMETER;
1153         }
1154         sock_fd = pc->cb_info->fd;
1155
1156         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1157         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
1158         LOGD("ret : 0x%x", ret);
1159         return ret;
1160 }
1161
1162
1163 int camera_set_capture_resolution(camera_h camera,  int width, int height)
1164 {
1165         if (camera == NULL) {
1166                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1167                 return CAMERA_ERROR_INVALID_PARAMETER;
1168         }
1169
1170         int ret = CAMERA_ERROR_NONE;
1171
1172         camera_cli_s *pc = (camera_cli_s *)camera;
1173         muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
1174         int sock_fd;
1175         if (pc->cb_info == NULL) {
1176                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1177                 return CAMERA_ERROR_INVALID_PARAMETER;
1178         }
1179         sock_fd = pc->cb_info->fd;
1180
1181         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1182         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
1183         LOGD("ret : 0x%x", ret);
1184         return ret;
1185 }
1186
1187 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
1188 {
1189         if (camera == NULL) {
1190                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1191                 return CAMERA_ERROR_INVALID_PARAMETER;
1192         }
1193
1194         int ret = CAMERA_ERROR_NONE;
1195         int set_format = (int)format;
1196
1197         camera_cli_s *pc = (camera_cli_s *)camera;
1198         muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
1199         int sock_fd;
1200         if (pc->cb_info == NULL) {
1201                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1202                 return CAMERA_ERROR_INVALID_PARAMETER;
1203         }
1204         sock_fd = pc->cb_info->fd;
1205
1206         LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
1207         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
1208         LOGD("ret : 0x%x", ret);
1209         return ret;
1210 }
1211
1212 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
1213 {
1214         if (camera == NULL) {
1215                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1216                 return CAMERA_ERROR_INVALID_PARAMETER;
1217         }
1218
1219         int ret = CAMERA_ERROR_NONE;
1220         int set_format = (int)format;
1221
1222         camera_cli_s *pc = (camera_cli_s *)camera;
1223         muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
1224         int sock_fd;
1225         if (pc->cb_info == NULL) {
1226                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1227                 return CAMERA_ERROR_INVALID_PARAMETER;
1228         }
1229         sock_fd = pc->cb_info->fd;
1230
1231         LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
1232         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
1233         LOGD("ret : 0x%x", ret);
1234         return ret;
1235 }
1236
1237 int camera_get_preview_resolution(camera_h camera,  int *width, int *height)
1238 {
1239         if (camera == NULL || width == NULL || height == NULL) {
1240                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1241                 return CAMERA_ERROR_INVALID_PARAMETER;
1242         }
1243
1244
1245         int ret = CAMERA_ERROR_NONE;
1246
1247         camera_cli_s *pc = (camera_cli_s *)camera;
1248         muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
1249         int sock_fd;
1250         if (pc->cb_info == NULL) {
1251                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1252                 return CAMERA_ERROR_INVALID_PARAMETER;
1253         }
1254         sock_fd = pc->cb_info->fd;
1255         int get_width;
1256         int get_height;
1257
1258         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1259         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1260
1261         if (ret == CAMERA_ERROR_NONE) {
1262                 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
1263                 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
1264                 *width = get_width;
1265                 *height = get_height;
1266         }
1267         LOGD("ret : 0x%x", ret);
1268         return ret;
1269 }
1270
1271 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
1272 {
1273         if( camera == NULL){
1274                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1275                 return CAMERA_ERROR_INVALID_PARAMETER;
1276         }
1277
1278         int ret = CAMERA_ERROR_NONE;
1279         camera_cli_s *pc = (camera_cli_s *)camera;
1280         muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
1281         int sock_fd;
1282         if (pc->cb_info == NULL) {
1283                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1284                 return CAMERA_ERROR_INVALID_PARAMETER;
1285         }
1286         sock_fd = pc->cb_info->fd;
1287         int set_rotation = (int)rotation;
1288
1289         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1290         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
1291         LOGD("ret : 0x%x", ret);
1292         return ret;
1293 }
1294
1295 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
1296 {
1297         if( camera == NULL || rotation == NULL ){
1298                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1299                 return CAMERA_ERROR_INVALID_PARAMETER;
1300         }
1301
1302         int ret = CAMERA_ERROR_NONE;
1303
1304         camera_cli_s *pc = (camera_cli_s *)camera;
1305         muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
1306         int sock_fd;
1307         if (pc->cb_info == NULL) {
1308                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1309                 return CAMERA_ERROR_INVALID_PARAMETER;
1310         }
1311         sock_fd = pc->cb_info->fd;
1312         int get_rotation;
1313
1314         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1315         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1316
1317         if (ret == CAMERA_ERROR_NONE) {
1318                 muse_camera_msg_get(get_rotation, pc->cb_info->recvMsg);
1319                 *rotation = (camera_rotation_e)get_rotation;
1320         }
1321         LOGD("ret : 0x%x", ret);
1322         return ret;
1323 }
1324
1325 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
1326 {
1327         if( camera == NULL){
1328                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1329                 return CAMERA_ERROR_INVALID_PARAMETER;
1330         }
1331
1332         int ret = CAMERA_ERROR_NONE;
1333
1334         camera_cli_s *pc = (camera_cli_s *)camera;
1335         muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
1336         int sock_fd;
1337         if (pc->cb_info == NULL) {
1338                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1339                 return CAMERA_ERROR_INVALID_PARAMETER;
1340         }
1341         sock_fd = pc->cb_info->fd;
1342         int set_flip = (int)flip;
1343
1344         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1345         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
1346         LOGD("ret : 0x%x", ret);
1347         return ret;
1348 }
1349
1350 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
1351 {
1352         if( camera == NULL || flip == NULL ){
1353                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1354                 return CAMERA_ERROR_INVALID_PARAMETER;
1355         }
1356
1357         int ret = CAMERA_ERROR_NONE;
1358
1359         camera_cli_s *pc = (camera_cli_s *)camera;
1360         muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
1361         int sock_fd;
1362         if (pc->cb_info == NULL) {
1363                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1364                 return CAMERA_ERROR_INVALID_PARAMETER;
1365         }
1366         sock_fd = pc->cb_info->fd;
1367         int get_flip;
1368
1369         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1370         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1371
1372         if (ret == CAMERA_ERROR_NONE) {
1373                 muse_camera_msg_get(get_flip, pc->cb_info->recvMsg);
1374                 *flip = (camera_flip_e)get_flip;
1375         }
1376         LOGD("ret : 0x%x", ret);
1377         return ret;
1378 }
1379
1380 int camera_set_display_visible(camera_h camera, bool visible)
1381 {
1382         if( camera == NULL){
1383                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1384                 return CAMERA_ERROR_INVALID_PARAMETER;
1385         }
1386
1387         int ret = CAMERA_ERROR_NONE;
1388
1389         camera_cli_s *pc = (camera_cli_s *)camera;
1390         muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
1391         int set_visible = (int)visible;
1392         int sock_fd;
1393         if (pc->cb_info == NULL) {
1394                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1395                 return CAMERA_ERROR_INVALID_PARAMETER;
1396         }
1397         sock_fd = pc->cb_info->fd;
1398
1399         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1400         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_visible);
1401         LOGD("ret : 0x%x", ret);
1402         return ret;
1403 }
1404
1405 int camera_is_display_visible(camera_h camera, bool* visible)
1406 {
1407         if( camera == NULL || visible == NULL){
1408                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1409                 return CAMERA_ERROR_INVALID_PARAMETER;
1410         }
1411
1412         int ret = CAMERA_ERROR_NONE;
1413
1414         camera_cli_s *pc = (camera_cli_s *)camera;
1415         muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
1416         int sock_fd;
1417         if (pc->cb_info == NULL) {
1418                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1419                 return CAMERA_ERROR_INVALID_PARAMETER;
1420         }
1421         sock_fd = pc->cb_info->fd;
1422         int get_visible;
1423
1424         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1425         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1426
1427         if (ret == CAMERA_ERROR_NONE) {
1428                 muse_camera_msg_get(get_visible, pc->cb_info->recvMsg);
1429                 *visible = (bool)get_visible;
1430         }
1431         LOGD("ret : 0x%x", ret);
1432         return ret;
1433 }
1434
1435 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
1436 {
1437         if (camera == NULL) {
1438                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1439                 return CAMERA_ERROR_INVALID_PARAMETER;
1440         }
1441
1442         int ret = CAMERA_ERROR_NONE;
1443         int set_mode = (int)mode;
1444
1445         camera_cli_s *pc = (camera_cli_s *)camera;
1446         muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
1447         int sock_fd;
1448         if (pc->cb_info == NULL) {
1449                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1450                 return CAMERA_ERROR_INVALID_PARAMETER;
1451         }
1452         sock_fd = pc->cb_info->fd;
1453
1454         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1455         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
1456         LOGD("ret : 0x%x", ret);
1457         return ret;
1458 }
1459
1460 int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode)
1461 {
1462         if( camera == NULL || mode == NULL){
1463                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1464                 return CAMERA_ERROR_INVALID_PARAMETER;
1465         }
1466
1467         int ret = CAMERA_ERROR_NONE;
1468
1469         camera_cli_s *pc = (camera_cli_s *)camera;
1470         muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
1471         int sock_fd;
1472         if (pc->cb_info == NULL) {
1473                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1474                 return CAMERA_ERROR_INVALID_PARAMETER;
1475         }
1476         sock_fd = pc->cb_info->fd;
1477         int get_mode;
1478
1479         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1480         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1481
1482         if (ret == CAMERA_ERROR_NONE) {
1483                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
1484                 *mode = (camera_display_mode_e)get_mode;
1485         }
1486         LOGD("ret : 0x%x", ret);
1487         return ret;
1488 }
1489
1490 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
1491 {
1492         if( camera == NULL || width== NULL || height == NULL){
1493                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1494                 return CAMERA_ERROR_INVALID_PARAMETER;
1495         }
1496         int ret = CAMERA_ERROR_NONE;
1497
1498         camera_cli_s *pc = (camera_cli_s *)camera;
1499         muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
1500         int sock_fd;
1501         if (pc->cb_info == NULL) {
1502                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1503                 return CAMERA_ERROR_INVALID_PARAMETER;
1504         }
1505         sock_fd = pc->cb_info->fd;
1506         int get_width;
1507         int get_height;
1508
1509         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1510         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1511
1512         if (ret == CAMERA_ERROR_NONE) {
1513                 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
1514                 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
1515                 *width = get_width;
1516                 *height = get_height;
1517         }
1518         LOGD("ret : 0x%x", ret);
1519         return ret;
1520 }
1521
1522 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
1523 {
1524         if( camera == NULL || format == NULL){
1525                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1526                 return CAMERA_ERROR_INVALID_PARAMETER;
1527         }
1528         int ret = CAMERA_ERROR_NONE;
1529
1530         camera_cli_s *pc = (camera_cli_s *)camera;
1531         muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
1532         int get_format;
1533         int sock_fd;
1534         if (pc->cb_info == NULL) {
1535                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1536                 return CAMERA_ERROR_INVALID_PARAMETER;
1537         }
1538         sock_fd = pc->cb_info->fd;
1539
1540         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1541         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1542
1543         if (ret == CAMERA_ERROR_NONE) {
1544                 muse_camera_msg_get(get_format, pc->cb_info->recvMsg);
1545                 *format = (camera_pixel_format_e)get_format;
1546         }
1547         LOGD("ret : 0x%x", ret);
1548         return ret;
1549 }
1550
1551 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
1552 {
1553         if( camera == NULL || format == NULL){
1554                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1555                 return CAMERA_ERROR_INVALID_PARAMETER;
1556         }
1557
1558         int ret = CAMERA_ERROR_NONE;
1559
1560         camera_cli_s *pc = (camera_cli_s *)camera;
1561         muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
1562         int get_format;
1563         int sock_fd;
1564         if (pc->cb_info == NULL) {
1565                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1566                 return CAMERA_ERROR_INVALID_PARAMETER;
1567         }
1568         sock_fd = pc->cb_info->fd;
1569
1570         LOGD("Enter, remote_handle : %x", pc->remote_handle);
1571         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1572
1573         if (ret == CAMERA_ERROR_NONE) {
1574                 muse_camera_msg_get(get_format, pc->cb_info->recvMsg);
1575                 *format = (camera_pixel_format_e)get_format;
1576         }
1577         LOGD("ret : 0x%x", ret);
1578         return ret;
1579 }
1580
1581 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data)
1582 {
1583         if (camera == NULL || callback == NULL) {
1584                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1585                 return CAMERA_ERROR_INVALID_PARAMETER;
1586         }
1587         int ret = CAMERA_ERROR_NONE;
1588
1589         camera_cli_s *pc = (camera_cli_s *)camera;
1590         int sock_fd;
1591         if (pc->cb_info == NULL) {
1592                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1593                 return CAMERA_ERROR_INVALID_PARAMETER;
1594         }
1595         sock_fd = pc->cb_info->fd;
1596         muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
1597
1598         LOGD("Enter, handle :%x", pc->remote_handle);
1599
1600         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
1601         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
1602
1603         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1604         LOGD("ret : 0x%x", ret);
1605         return ret;
1606 }
1607
1608 int camera_unset_preview_cb(camera_h camera)
1609 {
1610         if (camera == NULL) {
1611                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1612                 return CAMERA_ERROR_INVALID_PARAMETER;
1613         }
1614
1615         int ret = CAMERA_ERROR_NONE;
1616
1617         camera_cli_s *pc = (camera_cli_s *)camera;
1618         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
1619
1620         LOGD("Enter, handle :%x", pc->remote_handle);
1621
1622         int sock_fd;
1623         if (pc->cb_info == NULL) {
1624                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1625                 return CAMERA_ERROR_INVALID_PARAMETER;
1626         }
1627         sock_fd = pc->cb_info->fd;
1628         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
1629         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
1630
1631         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1632         LOGD("ret : 0x%x", ret);
1633         return ret;
1634 }
1635
1636 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void* user_data)
1637 {
1638         if (camera == NULL) {
1639                 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
1640                 return CAMERA_ERROR_INVALID_PARAMETER;
1641         }
1642
1643         if (callback == NULL) {
1644                 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
1645                 return CAMERA_ERROR_NOT_SUPPORTED;
1646         }
1647
1648         int ret = CAMERA_ERROR_NONE;
1649
1650         camera_cli_s *pc = (camera_cli_s *)camera;
1651         muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
1652
1653         LOGD("Enter, handle :%x", pc->remote_handle);
1654
1655         int sock_fd;
1656         if (pc->cb_info == NULL) {
1657                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1658                 return CAMERA_ERROR_INVALID_PARAMETER;
1659         }
1660         sock_fd = pc->cb_info->fd;
1661         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
1662         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
1663
1664         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1665         LOGD("ret : 0x%x", ret);
1666         return ret;
1667 }
1668
1669 int camera_unset_media_packet_preview_cb(camera_h camera)
1670 {
1671         if (camera == NULL) {
1672                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1673                 return CAMERA_ERROR_INVALID_PARAMETER;
1674         }
1675
1676         int ret = CAMERA_ERROR_NONE;
1677
1678         camera_cli_s *pc = (camera_cli_s *)camera;
1679         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
1680
1681         LOGD("Enter, handle :%x", pc->remote_handle);
1682
1683         int sock_fd;
1684         if (pc->cb_info == NULL) {
1685                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1686                 return CAMERA_ERROR_INVALID_PARAMETER;
1687         }
1688         sock_fd = pc->cb_info->fd;
1689         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
1690         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
1691
1692         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1693         LOGD("ret : 0x%x", ret);
1694         return ret;
1695 }
1696
1697 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data)
1698 {
1699         if( camera == NULL || callback == NULL){
1700                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1701                 return CAMERA_ERROR_INVALID_PARAMETER;
1702         }
1703         int ret = CAMERA_ERROR_NONE;
1704
1705         camera_cli_s *pc = (camera_cli_s *)camera;
1706         muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
1707
1708         LOGD("Enter, handle :%x", pc->remote_handle);
1709
1710         int sock_fd;
1711         if (pc->cb_info == NULL) {
1712                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1713                 return CAMERA_ERROR_INVALID_PARAMETER;
1714         }
1715         sock_fd = pc->cb_info->fd;
1716         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
1717         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
1718
1719         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1720         LOGD("ret : 0x%x", ret);
1721         return ret;
1722 }
1723 int camera_unset_state_changed_cb(camera_h camera)
1724 {
1725         if( camera == NULL){
1726                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1727                 return CAMERA_ERROR_INVALID_PARAMETER;
1728         }
1729         int ret = CAMERA_ERROR_NONE;
1730
1731         camera_cli_s *pc = (camera_cli_s *)camera;
1732         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
1733
1734         LOGD("Enter, handle :%x", pc->remote_handle);
1735
1736         int sock_fd;
1737         if (pc->cb_info == NULL) {
1738                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1739                 return CAMERA_ERROR_INVALID_PARAMETER;
1740         }
1741         sock_fd = pc->cb_info->fd;
1742         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
1743         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
1744
1745         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1746         LOGD("ret : 0x%x", ret);
1747         return ret;
1748 }
1749
1750 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
1751 {
1752         if( camera == NULL || callback == NULL){
1753                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1754                 return CAMERA_ERROR_INVALID_PARAMETER;
1755         }
1756         int ret = CAMERA_ERROR_NONE;
1757
1758         camera_cli_s *pc = (camera_cli_s *)camera;
1759         muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
1760
1761         LOGD("Enter, handle :%x", pc->remote_handle);
1762
1763         int sock_fd;
1764         if (pc->cb_info == NULL) {
1765                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1766                 return CAMERA_ERROR_INVALID_PARAMETER;
1767         }
1768         sock_fd = pc->cb_info->fd;
1769         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
1770         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
1771
1772         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1773         LOGD("ret : 0x%x", ret);
1774         return ret;
1775 }
1776
1777 int camera_unset_interrupted_cb(camera_h camera)
1778 {
1779         if( camera == NULL){
1780                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1781                 return CAMERA_ERROR_INVALID_PARAMETER;
1782         }
1783         int ret = CAMERA_ERROR_NONE;
1784
1785         camera_cli_s *pc = (camera_cli_s *)camera;
1786         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
1787
1788         LOGD("Enter, handle :%x", pc->remote_handle);
1789
1790         int sock_fd;
1791         if (pc->cb_info == NULL) {
1792                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1793                 return CAMERA_ERROR_INVALID_PARAMETER;
1794         }
1795         sock_fd = pc->cb_info->fd;
1796         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
1797         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
1798
1799         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1800         LOGD("ret : 0x%x", ret);
1801         return ret;
1802 }
1803
1804 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data)
1805 {
1806         if( camera == NULL || callback == NULL){
1807                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1808                 return CAMERA_ERROR_INVALID_PARAMETER;
1809         }
1810         int ret = CAMERA_ERROR_NONE;
1811
1812         camera_cli_s *pc = (camera_cli_s *)camera;
1813         muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
1814
1815         LOGD("Enter, handle :%x", pc->remote_handle);
1816
1817         int sock_fd;
1818         if (pc->cb_info == NULL) {
1819                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1820                 return CAMERA_ERROR_INVALID_PARAMETER;
1821         }
1822         sock_fd = pc->cb_info->fd;
1823         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
1824         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
1825
1826         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1827         LOGD("ret : 0x%x", ret);
1828         return ret;
1829 }
1830
1831 int camera_unset_focus_changed_cb(camera_h camera)
1832 {
1833         if( camera == NULL){
1834                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1835                 return CAMERA_ERROR_INVALID_PARAMETER;
1836         }
1837         int ret = CAMERA_ERROR_NONE;
1838
1839         camera_cli_s *pc = (camera_cli_s *)camera;
1840         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
1841
1842         LOGD("Enter, handle :%x", pc->remote_handle);
1843
1844         int sock_fd;
1845         if (pc->cb_info == NULL) {
1846                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1847                 return CAMERA_ERROR_INVALID_PARAMETER;
1848         }
1849         sock_fd = pc->cb_info->fd;
1850         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
1851         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
1852
1853         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1854         LOGD("ret : 0x%x", ret);
1855         return ret;
1856 }
1857
1858 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
1859 {
1860         if( camera == NULL || callback == NULL){
1861                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1862                 return CAMERA_ERROR_INVALID_PARAMETER;
1863         }
1864         int ret = CAMERA_ERROR_NONE;
1865
1866         camera_cli_s *pc = (camera_cli_s *)camera;
1867         muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
1868
1869         LOGD("Enter, handle :%x", pc->remote_handle);
1870
1871         int sock_fd;
1872         if (pc->cb_info == NULL) {
1873                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1874                 return CAMERA_ERROR_INVALID_PARAMETER;
1875         }
1876         sock_fd = pc->cb_info->fd;
1877         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
1878         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
1879
1880         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1881         LOGD("ret : 0x%x", ret);
1882         return ret;
1883 }
1884
1885 int camera_unset_error_cb(camera_h camera)
1886 {
1887         if( camera == NULL){
1888                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1889                 return CAMERA_ERROR_INVALID_PARAMETER;
1890         }
1891         int ret = CAMERA_ERROR_NONE;
1892
1893         camera_cli_s *pc = (camera_cli_s *)camera;
1894         muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
1895
1896         LOGD("Enter, handle :%x", pc->remote_handle);
1897
1898         int sock_fd;
1899         if (pc->cb_info == NULL) {
1900                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1901                 return CAMERA_ERROR_INVALID_PARAMETER;
1902         }
1903         sock_fd = pc->cb_info->fd;
1904         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
1905         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
1906
1907         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1908         LOGD("ret : 0x%x", ret);
1909         return ret;
1910 }
1911
1912 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
1913 {
1914         if( camera == NULL || foreach_cb == NULL){
1915                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1916                 return CAMERA_ERROR_INVALID_PARAMETER;
1917         }
1918         int ret = CAMERA_ERROR_NONE;
1919
1920         camera_cli_s *pc = (camera_cli_s *)camera;
1921         muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
1922
1923         LOGD("Enter, handle :%x", pc->remote_handle);
1924
1925         int sock_fd;
1926         if (pc->cb_info == NULL) {
1927                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1928                 return CAMERA_ERROR_INVALID_PARAMETER;
1929         }
1930         sock_fd = pc->cb_info->fd;
1931         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
1932         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
1933
1934         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1935         LOGD("ret : 0x%x", ret);
1936         return ret;
1937 }
1938
1939 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
1940 {
1941         if( camera == NULL || foreach_cb == NULL){
1942                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1943                 return CAMERA_ERROR_INVALID_PARAMETER;
1944         }
1945         int ret = CAMERA_ERROR_NONE;
1946
1947         camera_cli_s *pc = (camera_cli_s *)camera;
1948         muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
1949
1950         LOGD("Enter, handle :%x", pc->remote_handle);
1951
1952         int sock_fd;
1953         if (pc->cb_info == NULL) {
1954                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1955                 return CAMERA_ERROR_INVALID_PARAMETER;
1956         }
1957         sock_fd = pc->cb_info->fd;
1958         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
1959         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
1960
1961         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1962         LOGD("ret : 0x%x", ret);
1963         return ret;
1964 }
1965
1966 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
1967 {
1968         if( camera == NULL || foreach_cb == NULL){
1969                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1970                 return CAMERA_ERROR_INVALID_PARAMETER;
1971         }
1972         int ret = CAMERA_ERROR_NONE;
1973
1974         camera_cli_s *pc = (camera_cli_s *)camera;
1975         muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
1976
1977         LOGD("Enter, handle :%x", pc->remote_handle);
1978
1979         int sock_fd;
1980         if (pc->cb_info == NULL) {
1981                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1982                 return CAMERA_ERROR_INVALID_PARAMETER;
1983         }
1984         sock_fd = pc->cb_info->fd;
1985         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
1986         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
1987
1988         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1989         LOGD("ret : 0x%x", ret);
1990         return ret;
1991 }
1992
1993
1994 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
1995 {
1996         if( camera == NULL || foreach_cb == NULL){
1997                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1998                 return CAMERA_ERROR_INVALID_PARAMETER;
1999         }
2000         int ret = CAMERA_ERROR_NONE;
2001
2002         camera_cli_s *pc = (camera_cli_s *)camera;
2003         muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2004
2005         LOGD("Enter, handle :%x", pc->remote_handle);
2006
2007         int sock_fd;
2008         if (pc->cb_info == NULL) {
2009                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2010                 return CAMERA_ERROR_INVALID_PARAMETER;
2011         }
2012         sock_fd = pc->cb_info->fd;
2013         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
2014         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
2015
2016         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2017         LOGD("ret : 0x%x", ret);
2018         return ret;
2019 }
2020
2021
2022 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
2023 {
2024         if (camera == NULL || width == NULL || height == NULL) {
2025                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2026                 return CAMERA_ERROR_INVALID_PARAMETER;
2027         }
2028         int ret = CAMERA_ERROR_NONE;
2029
2030         camera_cli_s *pc = (camera_cli_s *)camera;
2031         muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2032         int sock_fd;
2033         if (pc->cb_info == NULL) {
2034                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2035                 return CAMERA_ERROR_INVALID_PARAMETER;
2036         }
2037         sock_fd = pc->cb_info->fd;
2038         int get_width;
2039         int get_height;
2040
2041         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2042         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2043
2044         if (ret == CAMERA_ERROR_NONE) {
2045                 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
2046                 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
2047                 *width = get_width;
2048                 *height = get_height;
2049         }
2050         LOGD("ret : 0x%x", ret);
2051         return ret;
2052 }
2053
2054
2055 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
2056 {
2057         if( camera == NULL || angle == NULL){
2058                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2059                 return CAMERA_ERROR_INVALID_PARAMETER;
2060         }
2061         int ret = CAMERA_ERROR_NONE;
2062
2063         camera_cli_s *pc = (camera_cli_s *)camera;
2064         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2065         int sock_fd;
2066         if (pc->cb_info == NULL) {
2067                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2068                 return CAMERA_ERROR_INVALID_PARAMETER;
2069         }
2070         sock_fd = pc->cb_info->fd;
2071         int get_angle;
2072
2073         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2074         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2075
2076         if (ret == CAMERA_ERROR_NONE) {
2077                 muse_camera_msg_get(get_angle, pc->cb_info->recvMsg);
2078                 *angle = get_angle;
2079         }
2080         LOGD("ret : 0x%x", ret);
2081         return ret;
2082 }
2083
2084 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
2085 {
2086         if (camera == NULL) {
2087                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2088                 return CAMERA_ERROR_INVALID_PARAMETER;
2089         }
2090         int ret = CAMERA_ERROR_NONE;
2091         camera_cli_s *pc = (camera_cli_s *)camera;
2092         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2093         int sock_fd;
2094         if (pc->cb_info == NULL) {
2095                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2096                 return CAMERA_ERROR_INVALID_PARAMETER;
2097         }
2098         sock_fd = pc->cb_info->fd;
2099         int set_mode = (int)mode;
2100         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2101         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2102         LOGD("ret : 0x%x", ret);
2103         return ret;
2104 }
2105
2106 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
2107 {
2108         if (camera == NULL || mode == NULL) {
2109                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2110                 return CAMERA_ERROR_INVALID_PARAMETER;
2111         }
2112
2113         int ret = CAMERA_ERROR_NONE;
2114         camera_cli_s *pc = (camera_cli_s *)camera;
2115         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2116         int sock_fd;
2117         if (pc->cb_info == NULL) {
2118                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2119                 return CAMERA_ERROR_INVALID_PARAMETER;
2120         }
2121         sock_fd = pc->cb_info->fd;
2122         int get_mode;
2123         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2124         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2125
2126         if (ret == CAMERA_ERROR_NONE) {
2127                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
2128                 *mode = (camera_attr_theater_mode_e)get_mode;
2129         }
2130         LOGD("ret : 0x%x", ret);
2131         return ret;
2132 }
2133
2134 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
2135 {
2136         if (camera == NULL || foreach_cb == NULL) {
2137                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2138                 return CAMERA_ERROR_INVALID_PARAMETER;
2139         }
2140         int ret = CAMERA_ERROR_NONE;
2141
2142         camera_cli_s *pc = (camera_cli_s *)camera;
2143         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2144
2145         LOGD("Enter, handle :%x", pc->remote_handle);
2146
2147         int sock_fd;
2148         if (pc->cb_info == NULL) {
2149                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2150                 return CAMERA_ERROR_INVALID_PARAMETER;
2151         }
2152         sock_fd = pc->cb_info->fd;
2153         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
2154         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
2155
2156         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2157
2158         LOGD("Finish, return :%x", ret);
2159
2160         return ret;
2161 }
2162
2163 int camera_attr_set_preview_fps(camera_h camera,  camera_attr_fps_e fps)
2164 {
2165         if( camera == NULL){
2166                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2167                 return CAMERA_ERROR_INVALID_PARAMETER;
2168         }
2169         int ret = CAMERA_ERROR_NONE;
2170         camera_cli_s *pc = (camera_cli_s *)camera;
2171         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2172         int sock_fd;
2173         if (pc->cb_info == NULL) {
2174                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2175                 return CAMERA_ERROR_INVALID_PARAMETER;
2176         }
2177         sock_fd = pc->cb_info->fd;
2178         int set_fps = (int)fps;
2179         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2180         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
2181         LOGD("ret : 0x%x", ret);
2182         return ret;
2183 }
2184
2185
2186 int camera_attr_set_image_quality(camera_h camera,  int quality)
2187 {
2188         if( camera == NULL){
2189                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2190                 return CAMERA_ERROR_INVALID_PARAMETER;
2191         }
2192         int ret = CAMERA_ERROR_NONE;
2193
2194         camera_cli_s *pc = (camera_cli_s *)camera;
2195         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2196         int sock_fd;
2197         if (pc->cb_info == NULL) {
2198                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2199                 return CAMERA_ERROR_INVALID_PARAMETER;
2200         }
2201         sock_fd = pc->cb_info->fd;
2202         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2203         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
2204         LOGD("ret : 0x%x", ret);
2205         return ret;
2206 }
2207
2208 int camera_attr_get_preview_fps(camera_h camera,  camera_attr_fps_e *fps)
2209 {
2210         if( camera == NULL || fps == NULL){
2211                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2212                 return CAMERA_ERROR_INVALID_PARAMETER;
2213         }
2214         int ret = CAMERA_ERROR_NONE;
2215
2216         camera_cli_s *pc = (camera_cli_s *)camera;
2217         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2218         int get_fps;
2219         int sock_fd;
2220         if (pc->cb_info == NULL) {
2221                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2222                 return CAMERA_ERROR_INVALID_PARAMETER;
2223         }
2224         sock_fd = pc->cb_info->fd;
2225
2226         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2227         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2228
2229         if (ret == CAMERA_ERROR_NONE) {
2230                 muse_camera_msg_get(get_fps, pc->cb_info->recvMsg);
2231                 *fps = (camera_attr_fps_e)get_fps;
2232         }
2233         LOGD("ret : 0x%x", ret);
2234         return ret;
2235 }
2236
2237
2238 int camera_attr_get_image_quality(camera_h camera, int *quality)
2239 {
2240         if( camera == NULL || quality == NULL){
2241                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2242                 return CAMERA_ERROR_INVALID_PARAMETER;
2243         }
2244         int ret = CAMERA_ERROR_NONE;
2245
2246         camera_cli_s *pc = (camera_cli_s *)camera;
2247         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
2248         int sock_fd;
2249         if (pc->cb_info == NULL) {
2250                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2251                 return CAMERA_ERROR_INVALID_PARAMETER;
2252         }
2253         sock_fd = pc->cb_info->fd;
2254         int get_quality;
2255         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2256         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2257
2258         if (ret == CAMERA_ERROR_NONE) {
2259                 muse_camera_msg_get(get_quality, pc->cb_info->recvMsg);
2260                 *quality = get_quality;
2261         }
2262         LOGD("ret : 0x%x", ret);
2263         return ret;
2264 }
2265
2266
2267 int camera_attr_set_zoom(camera_h camera, int zoom)
2268 {
2269         if( camera == NULL){
2270                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2271                 return CAMERA_ERROR_INVALID_PARAMETER;
2272         }
2273         int ret = CAMERA_ERROR_NONE;
2274
2275         camera_cli_s *pc = (camera_cli_s *)camera;
2276         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
2277         int sock_fd;
2278         if (pc->cb_info == NULL) {
2279                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2280                 return CAMERA_ERROR_INVALID_PARAMETER;
2281         }
2282         sock_fd = pc->cb_info->fd;
2283
2284         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2285         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
2286         LOGD("ret : 0x%x", ret);
2287         return ret;
2288 }
2289
2290 int camera_attr_set_af_mode(camera_h camera,  camera_attr_af_mode_e mode)
2291 {
2292         if( camera == NULL){
2293                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2294                 return CAMERA_ERROR_INVALID_PARAMETER;
2295         }
2296         int ret = CAMERA_ERROR_NONE;
2297
2298         camera_cli_s *pc = (camera_cli_s *)camera;
2299         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
2300         int sock_fd;
2301         if (pc->cb_info == NULL) {
2302                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2303                 return CAMERA_ERROR_INVALID_PARAMETER;
2304         }
2305         sock_fd = pc->cb_info->fd;
2306         int set_mode = (int)mode;
2307         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2308         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2309         LOGD("ret : 0x%x", ret);
2310         return ret;
2311 }
2312
2313 int camera_attr_set_af_area(camera_h camera, int x, int y)
2314 {
2315         if( camera == NULL){
2316                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2317                 return CAMERA_ERROR_INVALID_PARAMETER;
2318         }
2319         int ret = CAMERA_ERROR_NONE;
2320         camera_cli_s *pc = (camera_cli_s *)camera;
2321         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
2322         int sock_fd = pc->cb_info->fd;
2323         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2324         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
2325         LOGD("ret : 0x%x", ret);
2326         return ret;
2327 }
2328
2329
2330 int camera_attr_clear_af_area(camera_h camera)
2331 {
2332         if( camera == NULL){
2333                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2334                 return CAMERA_ERROR_INVALID_PARAMETER;
2335         }
2336         int ret = CAMERA_ERROR_NONE;
2337
2338         camera_cli_s *pc = (camera_cli_s *)camera;
2339         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
2340         int sock_fd;
2341         if (pc->cb_info == NULL) {
2342                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2343                 return CAMERA_ERROR_INVALID_PARAMETER;
2344         }
2345         sock_fd = pc->cb_info->fd;
2346         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2347         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2348         LOGD("ret : 0x%x", ret);
2349         return ret;
2350 }
2351
2352
2353 int camera_attr_set_exposure_mode(camera_h camera,  camera_attr_exposure_mode_e mode)
2354 {
2355         if( camera == NULL){
2356                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2357                 return CAMERA_ERROR_INVALID_PARAMETER;
2358         }
2359
2360         if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
2361                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
2362                 return CAMERA_ERROR_NOT_SUPPORTED;
2363         }
2364
2365         int ret = CAMERA_ERROR_NONE;
2366         camera_cli_s *pc = (camera_cli_s *)camera;
2367         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
2368         int set_mode = (int)mode;
2369         int sock_fd;
2370         if (pc->cb_info == NULL) {
2371                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2372                 return CAMERA_ERROR_INVALID_PARAMETER;
2373         }
2374         sock_fd = pc->cb_info->fd;
2375         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2376         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2377         LOGD("ret : 0x%x", ret);
2378         return ret;
2379 }
2380
2381
2382 int camera_attr_set_exposure(camera_h camera, int value)
2383 {
2384         if( camera == NULL){
2385                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2386                 return CAMERA_ERROR_INVALID_PARAMETER;
2387         }
2388         int ret = CAMERA_ERROR_NONE;
2389
2390         camera_cli_s *pc = (camera_cli_s *)camera;
2391         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
2392         int sock_fd;
2393         if (pc->cb_info == NULL) {
2394                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2395                 return CAMERA_ERROR_INVALID_PARAMETER;
2396         }
2397         sock_fd = pc->cb_info->fd;
2398
2399         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2400         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
2401         LOGD("ret : 0x%x", ret);
2402         return ret;
2403 }
2404
2405
2406 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
2407 {
2408         if( camera == NULL){
2409                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2410                 return CAMERA_ERROR_INVALID_PARAMETER;
2411         }
2412         int ret = CAMERA_ERROR_NONE;
2413
2414         camera_cli_s *pc = (camera_cli_s *)camera;
2415         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
2416         int sock_fd;
2417         if (pc->cb_info == NULL) {
2418                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2419                 return CAMERA_ERROR_INVALID_PARAMETER;
2420         }
2421         sock_fd = pc->cb_info->fd;
2422         int set_iso = (int)iso;
2423         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2424         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
2425         LOGD("ret : 0x%x", ret);
2426         return ret;
2427 }
2428
2429
2430 int camera_attr_set_brightness(camera_h camera, int level)
2431 {
2432         if( camera == NULL){
2433                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2434                 return CAMERA_ERROR_INVALID_PARAMETER;
2435         }
2436         int ret = CAMERA_ERROR_NONE;
2437
2438         camera_cli_s *pc = (camera_cli_s *)camera;
2439         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
2440         int sock_fd;
2441         if (pc->cb_info == NULL) {
2442                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2443                 return CAMERA_ERROR_INVALID_PARAMETER;
2444         }
2445         sock_fd = pc->cb_info->fd;
2446
2447         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2448         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
2449         LOGD("ret : 0x%x", ret);
2450         return ret;
2451 }
2452
2453
2454 int camera_attr_set_contrast(camera_h camera, int level)
2455 {
2456         if( camera == NULL){
2457                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2458                 return CAMERA_ERROR_INVALID_PARAMETER;
2459         }
2460         int ret = CAMERA_ERROR_NONE;
2461
2462         camera_cli_s *pc = (camera_cli_s *)camera;
2463         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
2464         int sock_fd;
2465         if (pc->cb_info == NULL) {
2466                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2467                 return CAMERA_ERROR_INVALID_PARAMETER;
2468         }
2469         sock_fd = pc->cb_info->fd;
2470
2471         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2472         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
2473         LOGD("ret : 0x%x", ret);
2474         return ret;
2475 }
2476
2477
2478 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
2479 {
2480         if (camera == NULL) {
2481                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2482                 return CAMERA_ERROR_INVALID_PARAMETER;
2483         }
2484
2485         if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
2486                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_NOT_SUPPORTED);
2487                 return CAMERA_ERROR_NOT_SUPPORTED;
2488         }
2489
2490         int ret = CAMERA_ERROR_NONE;
2491
2492         camera_cli_s *pc = (camera_cli_s *)camera;
2493         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
2494         int sock_fd;
2495         if (pc->cb_info == NULL) {
2496                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2497                 return CAMERA_ERROR_INVALID_PARAMETER;
2498         }
2499         sock_fd = pc->cb_info->fd;
2500         int set_whitebalance = (int)wb;
2501         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2502         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
2503         LOGD("ret : 0x%x", ret);
2504         return ret;
2505 }
2506
2507
2508 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
2509 {
2510         if( camera == NULL){
2511                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2512                 return CAMERA_ERROR_INVALID_PARAMETER;
2513         }
2514         int ret = CAMERA_ERROR_NONE;
2515
2516         camera_cli_s *pc = (camera_cli_s *)camera;
2517         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
2518         int sock_fd;
2519         if (pc->cb_info == NULL) {
2520                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2521                 return CAMERA_ERROR_INVALID_PARAMETER;
2522         }
2523         sock_fd = pc->cb_info->fd;
2524         int set_effect = (int)effect;
2525         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2526         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
2527         LOGD("ret : 0x%x", ret);
2528         return ret;
2529 }
2530
2531
2532 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
2533 {
2534         if( camera == NULL){
2535                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2536                 return CAMERA_ERROR_INVALID_PARAMETER;
2537         }
2538         int ret = CAMERA_ERROR_NONE;
2539
2540         camera_cli_s *pc = (camera_cli_s *)camera;
2541         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
2542         int sock_fd;
2543         if (pc->cb_info == NULL) {
2544                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2545                 return CAMERA_ERROR_INVALID_PARAMETER;
2546         }
2547         sock_fd = pc->cb_info->fd;
2548         int set_mode = (int)mode;
2549         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2550         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2551         LOGD("ret : 0x%x", ret);
2552         return ret;
2553 }
2554
2555
2556 int camera_attr_enable_tag(camera_h camera, bool enable)
2557 {
2558         if( camera == NULL){
2559                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2560                 return CAMERA_ERROR_INVALID_PARAMETER;
2561         }
2562         int ret = CAMERA_ERROR_NONE;
2563         camera_cli_s *pc = (camera_cli_s *)camera;
2564         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
2565         int sock_fd;
2566         if (pc->cb_info == NULL) {
2567                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2568                 return CAMERA_ERROR_INVALID_PARAMETER;
2569         }
2570         sock_fd = pc->cb_info->fd;
2571         int set_enable = (int)enable;
2572
2573         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2574         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
2575         LOGD("ret : 0x%x", ret);
2576         return ret;
2577 }
2578
2579
2580 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
2581 {
2582         if( camera == NULL){
2583                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2584                 return CAMERA_ERROR_INVALID_PARAMETER;
2585         }
2586         if( description == NULL){
2587                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2588                 return CAMERA_ERROR_INVALID_PARAMETER;
2589         }
2590         int ret = CAMERA_ERROR_NONE;
2591         camera_cli_s *pc = (camera_cli_s *)camera;
2592         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
2593         int sock_fd;
2594         if (pc->cb_info == NULL) {
2595                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2596                 return CAMERA_ERROR_INVALID_PARAMETER;
2597         }
2598         sock_fd = pc->cb_info->fd;
2599         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2600         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
2601         LOGD("ret : 0x%x", ret);
2602         return ret;
2603 }
2604
2605
2606 int camera_attr_set_tag_orientation(camera_h camera,  camera_attr_tag_orientation_e orientation)
2607 {
2608         if( camera == NULL){
2609                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2610                 return CAMERA_ERROR_INVALID_PARAMETER;
2611         }
2612         int ret = CAMERA_ERROR_NONE;
2613         camera_cli_s *pc = (camera_cli_s *)camera;
2614         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
2615         int sock_fd;
2616         if (pc->cb_info == NULL) {
2617                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2618                 return CAMERA_ERROR_INVALID_PARAMETER;
2619         }
2620         sock_fd = pc->cb_info->fd;
2621         int set_orientation = (int)orientation;
2622
2623         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2624         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
2625         LOGD("ret : 0x%x", ret);
2626         return ret;
2627 }
2628
2629
2630 int camera_attr_set_tag_software(camera_h camera,  const char *software)
2631 {
2632         if( camera == NULL){
2633                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2634                 return CAMERA_ERROR_INVALID_PARAMETER;
2635         }
2636         if( software == NULL){
2637                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2638                 return CAMERA_ERROR_INVALID_PARAMETER;
2639         }
2640         int ret = CAMERA_ERROR_NONE;
2641         camera_cli_s *pc = (camera_cli_s *)camera;
2642         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
2643         int sock_fd;
2644         if (pc->cb_info == NULL) {
2645                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2646                 return CAMERA_ERROR_INVALID_PARAMETER;
2647         }
2648         sock_fd = pc->cb_info->fd;
2649         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2650         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
2651         LOGD("ret : 0x%x", ret);
2652         return ret;
2653 }
2654
2655
2656 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
2657 {
2658         if( camera == NULL){
2659                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2660                 return CAMERA_ERROR_INVALID_PARAMETER;
2661         }
2662         int ret = CAMERA_ERROR_NONE;
2663         camera_cli_s *pc = (camera_cli_s *)camera;
2664         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
2665         int sock_fd;
2666         if (pc->cb_info == NULL) {
2667                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2668                 return CAMERA_ERROR_INVALID_PARAMETER;
2669         }
2670         sock_fd = pc->cb_info->fd;
2671         double set_geotag[3] = { latitude, longitude, altitude };
2672
2673         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2674         muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
2675                                                                         set_geotag, sizeof(set_geotag), sizeof(double));
2676         LOGD("ret : 0x%x", ret);
2677         return ret;
2678 }
2679
2680
2681 int camera_attr_remove_geotag(camera_h camera)
2682 {
2683         if( camera == NULL){
2684                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2685                 return CAMERA_ERROR_INVALID_PARAMETER;
2686         }
2687         int ret = CAMERA_ERROR_NONE;
2688         camera_cli_s *pc = (camera_cli_s *)camera;
2689         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
2690         int sock_fd;
2691         if (pc->cb_info == NULL) {
2692                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2693                 return CAMERA_ERROR_INVALID_PARAMETER;
2694         }
2695         sock_fd = pc->cb_info->fd;
2696         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2697         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2698         LOGD("ret : 0x%x", ret);
2699         return ret;
2700 }
2701
2702
2703 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
2704 {
2705         if( camera == NULL){
2706                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2707                 return CAMERA_ERROR_INVALID_PARAMETER;
2708         }
2709         int ret = CAMERA_ERROR_NONE;
2710         camera_cli_s *pc = (camera_cli_s *)camera;
2711         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
2712         int sock_fd;
2713         if (pc->cb_info == NULL) {
2714                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2715                 return CAMERA_ERROR_INVALID_PARAMETER;
2716         }
2717         sock_fd = pc->cb_info->fd;
2718         int set_mode = (int)mode;
2719
2720         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2721         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2722         LOGD("ret : 0x%x", ret);
2723         return ret;
2724 }
2725
2726
2727 int camera_attr_get_zoom(camera_h camera, int *zoom)
2728 {
2729         if( camera == NULL || zoom == NULL){
2730                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2731                 return CAMERA_ERROR_INVALID_PARAMETER;
2732         }
2733         int ret = CAMERA_ERROR_NONE;
2734
2735         camera_cli_s *pc = (camera_cli_s *)camera;
2736         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
2737         int get_zoom;
2738         int sock_fd;
2739         if (pc->cb_info == NULL) {
2740                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2741                 return CAMERA_ERROR_INVALID_PARAMETER;
2742         }
2743         sock_fd = pc->cb_info->fd;
2744
2745         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2746         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2747
2748         if (ret == CAMERA_ERROR_NONE) {
2749                 muse_camera_msg_get(get_zoom, pc->cb_info->recvMsg);
2750                 *zoom = get_zoom;
2751         }
2752         LOGD("ret : 0x%x", ret);
2753         return ret;
2754 }
2755
2756
2757 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
2758 {
2759         if( camera == NULL || min == NULL || max == NULL ){
2760                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2761                 return CAMERA_ERROR_INVALID_PARAMETER;
2762         }
2763         int ret = CAMERA_ERROR_NONE;
2764         camera_cli_s *pc = (camera_cli_s *)camera;
2765         int sock_fd;
2766         if (pc->cb_info == NULL) {
2767                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2768                 return CAMERA_ERROR_INVALID_PARAMETER;
2769         }
2770         sock_fd = pc->cb_info->fd;
2771         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
2772         int get_min;
2773         int get_max;
2774
2775         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2776         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2777
2778         if (ret == CAMERA_ERROR_NONE) {
2779                 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
2780                 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
2781                 *min = get_min;
2782                 *max = get_max;
2783         }
2784         LOGD("ret : 0x%x", ret);
2785         return ret;
2786 }
2787
2788
2789 int camera_attr_get_af_mode( camera_h camera,  camera_attr_af_mode_e *mode)
2790 {
2791         if( camera == NULL || mode == NULL){
2792                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2793                 return CAMERA_ERROR_INVALID_PARAMETER;
2794         }
2795         int ret = CAMERA_ERROR_NONE;
2796         camera_cli_s *pc = (camera_cli_s *)camera;
2797         int sock_fd;
2798         if (pc->cb_info == NULL) {
2799                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2800                 return CAMERA_ERROR_INVALID_PARAMETER;
2801         }
2802         sock_fd = pc->cb_info->fd;
2803         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
2804         int get_mode;
2805
2806         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2807         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2808
2809         if (ret == CAMERA_ERROR_NONE) {
2810                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
2811                 *mode = (camera_attr_af_mode_e)get_mode;
2812         }
2813         LOGD("ret : 0x%x", ret);
2814         return ret;
2815 }
2816
2817
2818 int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e *mode)
2819 {
2820         if( camera == NULL|| mode == NULL){
2821                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2822                 return CAMERA_ERROR_INVALID_PARAMETER;
2823         }
2824         int ret = CAMERA_ERROR_NONE;
2825         camera_cli_s *pc = (camera_cli_s *)camera;
2826         int sock_fd;
2827         if (pc->cb_info == NULL) {
2828                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2829                 return CAMERA_ERROR_INVALID_PARAMETER;
2830         }
2831         sock_fd = pc->cb_info->fd;
2832         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
2833         int get_mode;
2834
2835         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2836         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2837
2838         if (ret == CAMERA_ERROR_NONE) {
2839                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
2840                 *mode = (camera_attr_exposure_mode_e)get_mode;
2841         }
2842         LOGD("ret : 0x%x", ret);
2843         return ret;
2844 }
2845
2846 int camera_attr_get_exposure(camera_h camera, int *value)
2847 {
2848         if( camera == NULL || value == NULL){
2849                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2850                 return CAMERA_ERROR_INVALID_PARAMETER;
2851         }
2852         int ret = CAMERA_ERROR_NONE;
2853         camera_cli_s *pc = (camera_cli_s *)camera;
2854         int sock_fd;
2855         if (pc->cb_info == NULL) {
2856                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2857                 return CAMERA_ERROR_INVALID_PARAMETER;
2858         }
2859         sock_fd = pc->cb_info->fd;
2860         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
2861         int get_value;
2862
2863         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2864         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2865
2866         if (ret == CAMERA_ERROR_NONE) {
2867                 muse_camera_msg_get(get_value, pc->cb_info->recvMsg);
2868                 *value = get_value;
2869         }
2870         LOGD("ret : 0x%x", ret);
2871         return ret;
2872 }
2873
2874
2875 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
2876 {
2877         if( camera == NULL || min == NULL || max == NULL ){
2878                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2879                 return CAMERA_ERROR_INVALID_PARAMETER;
2880         }
2881         int ret = CAMERA_ERROR_NONE;
2882         camera_cli_s *pc = (camera_cli_s *)camera;
2883         int sock_fd;
2884         if (pc->cb_info == NULL) {
2885                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2886                 return CAMERA_ERROR_INVALID_PARAMETER;
2887         }
2888         sock_fd = pc->cb_info->fd;
2889         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
2890         int get_min;
2891         int get_max;
2892
2893         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2894         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2895
2896         if (ret == CAMERA_ERROR_NONE) {
2897                 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
2898                 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
2899                 *min = get_min;
2900                 *max = get_max;
2901         }
2902         LOGD("ret : 0x%x", ret);
2903         return ret;
2904 }
2905
2906
2907 int camera_attr_get_iso( camera_h camera,  camera_attr_iso_e *iso)
2908 {
2909         if( camera == NULL || iso == NULL){
2910                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2911                 return CAMERA_ERROR_INVALID_PARAMETER;
2912         }
2913         int ret = CAMERA_ERROR_NONE;
2914         camera_cli_s *pc = (camera_cli_s *)camera;
2915         int sock_fd;
2916         if (pc->cb_info == NULL) {
2917                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2918                 return CAMERA_ERROR_INVALID_PARAMETER;
2919         }
2920         sock_fd = pc->cb_info->fd;
2921         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
2922         int get_iso;
2923
2924         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2925         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2926
2927         if (ret == CAMERA_ERROR_NONE) {
2928                 muse_camera_msg_get(get_iso, pc->cb_info->recvMsg);
2929                 *iso = (camera_attr_iso_e)get_iso;
2930         }
2931         LOGD("ret : 0x%x", ret);
2932         return ret;
2933 }
2934
2935
2936 int camera_attr_get_brightness(camera_h camera,  int *level)
2937 {
2938         if( camera == NULL || level == NULL){
2939                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2940                 return CAMERA_ERROR_INVALID_PARAMETER;
2941         }
2942         int ret = CAMERA_ERROR_NONE;
2943         camera_cli_s *pc = (camera_cli_s *)camera;
2944         int sock_fd;
2945         if (pc->cb_info == NULL) {
2946                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2947                 return CAMERA_ERROR_INVALID_PARAMETER;
2948         }
2949         sock_fd = pc->cb_info->fd;
2950         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
2951         int get_level;
2952
2953         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2954         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2955
2956         if (ret == CAMERA_ERROR_NONE) {
2957                 muse_camera_msg_get(get_level, pc->cb_info->recvMsg);
2958                 *level = get_level;
2959         }
2960         LOGD("ret : 0x%x", ret);
2961         return ret;
2962 }
2963
2964
2965 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
2966 {
2967         if( camera == NULL || min == NULL || max == NULL ){
2968                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2969                 return CAMERA_ERROR_INVALID_PARAMETER;
2970         }
2971         int ret = CAMERA_ERROR_NONE;
2972         camera_cli_s *pc = (camera_cli_s *)camera;
2973         int sock_fd;
2974         if (pc->cb_info == NULL) {
2975                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2976                 return CAMERA_ERROR_INVALID_PARAMETER;
2977         }
2978         sock_fd = pc->cb_info->fd;
2979         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
2980         int get_min;
2981         int get_max;
2982
2983         LOGD("Enter, remote_handle : %x", pc->remote_handle);
2984         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2985
2986         if (ret == CAMERA_ERROR_NONE) {
2987                 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
2988                 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
2989                 *min = get_min;
2990                 *max = get_max;
2991         }
2992         LOGD("ret : 0x%x", ret);
2993         return ret;
2994 }
2995
2996
2997 int camera_attr_get_contrast(camera_h camera,  int *level)
2998 {
2999         if( camera == NULL || level == NULL){
3000                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3001                 return CAMERA_ERROR_INVALID_PARAMETER;
3002         }
3003         int ret = CAMERA_ERROR_NONE;
3004         camera_cli_s *pc = (camera_cli_s *)camera;
3005         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3006         int sock_fd;
3007         if (pc->cb_info == NULL) {
3008                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3009                 return CAMERA_ERROR_INVALID_PARAMETER;
3010         }
3011         sock_fd = pc->cb_info->fd;
3012         int get_level;
3013
3014         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3015         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3016
3017         if (ret == CAMERA_ERROR_NONE) {
3018                 muse_camera_msg_get(get_level, pc->cb_info->recvMsg);
3019                 *level = get_level;
3020         }
3021         LOGD("ret : 0x%x", ret);
3022         return ret;
3023 }
3024
3025
3026 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
3027 {
3028         if( camera == NULL || min == NULL || max == NULL ){
3029                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3030                 return CAMERA_ERROR_INVALID_PARAMETER;
3031         }
3032         int ret = CAMERA_ERROR_NONE;
3033         camera_cli_s *pc = (camera_cli_s *)camera;
3034         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3035         int sock_fd;
3036         if (pc->cb_info == NULL) {
3037                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3038                 return CAMERA_ERROR_INVALID_PARAMETER;
3039         }
3040         sock_fd = pc->cb_info->fd;
3041         int get_min;
3042         int get_max;
3043
3044         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3045         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3046
3047         if (ret == CAMERA_ERROR_NONE) {
3048                 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
3049                 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
3050                 *min = get_min;
3051                 *max = get_max;
3052         }
3053         LOGD("ret : 0x%x", ret);
3054         return ret;
3055 }
3056
3057
3058 int camera_attr_get_whitebalance(camera_h camera,  camera_attr_whitebalance_e *wb)
3059 {
3060         if( camera == NULL || wb == NULL){
3061                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3062                 return CAMERA_ERROR_INVALID_PARAMETER;
3063         }
3064         int ret = CAMERA_ERROR_NONE;
3065         camera_cli_s *pc = (camera_cli_s *)camera;
3066         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3067         int sock_fd;
3068         if (pc->cb_info == NULL) {
3069                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3070                 return CAMERA_ERROR_INVALID_PARAMETER;
3071         }
3072         sock_fd = pc->cb_info->fd;
3073         int get_wb;
3074
3075         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3076         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3077
3078         if (ret == CAMERA_ERROR_NONE) {
3079                 muse_camera_msg_get(get_wb, pc->cb_info->recvMsg);
3080                 *wb = (camera_attr_whitebalance_e)get_wb;
3081         }
3082         LOGD("ret : 0x%x", ret);
3083         return ret;
3084 }
3085
3086
3087 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
3088 {
3089         if( camera == NULL || effect == NULL ){
3090                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3091                 return CAMERA_ERROR_INVALID_PARAMETER;
3092         }
3093
3094         int ret = CAMERA_ERROR_NONE;
3095         camera_cli_s *pc = (camera_cli_s *)camera;
3096         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3097         int sock_fd;
3098         if (pc->cb_info == NULL) {
3099                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3100                 return CAMERA_ERROR_INVALID_PARAMETER;
3101         }
3102         sock_fd = pc->cb_info->fd;
3103         int get_effect;
3104
3105         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3106         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3107
3108         if (ret == CAMERA_ERROR_NONE) {
3109                 muse_camera_msg_get(get_effect, pc->cb_info->recvMsg);
3110                 *effect = (camera_attr_effect_mode_e)get_effect;
3111         }
3112         LOGD("ret : 0x%x", ret);
3113         return ret;
3114 }
3115
3116
3117 int camera_attr_get_scene_mode(camera_h camera,  camera_attr_scene_mode_e *mode)
3118 {
3119         if( camera == NULL || mode == NULL){
3120                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3121                 return CAMERA_ERROR_INVALID_PARAMETER;
3122         }
3123
3124         int ret = CAMERA_ERROR_NONE;
3125         camera_cli_s *pc = (camera_cli_s *)camera;
3126         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3127         int sock_fd;
3128         if (pc->cb_info == NULL) {
3129                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3130                 return CAMERA_ERROR_INVALID_PARAMETER;
3131         }
3132         sock_fd = pc->cb_info->fd;
3133         int get_mode;
3134
3135         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3136         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3137
3138         if (ret == CAMERA_ERROR_NONE) {
3139                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3140                 *mode = (camera_attr_scene_mode_e)get_mode;
3141         }
3142         LOGD("ret : 0x%x", ret);
3143         return ret;
3144 }
3145
3146
3147 int camera_attr_is_enabled_tag(camera_h camera,  bool *enable)
3148 {
3149         if( camera == NULL || enable == NULL){
3150                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3151                 return CAMERA_ERROR_INVALID_PARAMETER;
3152         }
3153
3154         int ret = CAMERA_ERROR_NONE;
3155         camera_cli_s *pc = (camera_cli_s *)camera;
3156         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3157         int sock_fd;
3158         if (pc->cb_info == NULL) {
3159                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3160                 return CAMERA_ERROR_INVALID_PARAMETER;
3161         }
3162         sock_fd = pc->cb_info->fd;
3163         int get_enable;
3164
3165         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3166         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3167
3168         if (ret == CAMERA_ERROR_NONE) {
3169                 muse_camera_msg_get(get_enable, pc->cb_info->recvMsg);
3170                 *enable = (bool)get_enable;
3171         }
3172         LOGD("ret : 0x%x", ret);
3173         return ret;
3174 }
3175
3176
3177 int camera_attr_get_tag_image_description(camera_h camera,  char **description)
3178 {
3179         if( camera == NULL || description == NULL){
3180                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3181                 return CAMERA_ERROR_INVALID_PARAMETER;
3182         }
3183
3184         int ret = CAMERA_ERROR_NONE;
3185         camera_cli_s *pc = (camera_cli_s *)camera;
3186         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3187         int sock_fd;
3188         if (pc->cb_info == NULL) {
3189                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3190                 return CAMERA_ERROR_INVALID_PARAMETER;
3191         }
3192         sock_fd = pc->cb_info->fd;
3193         char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3194
3195         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3196         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3197
3198         if (ret == CAMERA_ERROR_NONE) {
3199                 muse_camera_msg_get_string(get_description, pc->cb_info->recvMsg);
3200                 *description = strdup(get_description);
3201         }
3202         LOGD("ret : 0x%x", ret);
3203         return ret;
3204 }
3205
3206
3207 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
3208 {
3209         if( camera == NULL || orientation == NULL){
3210                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3211                 return CAMERA_ERROR_INVALID_PARAMETER;
3212         }
3213
3214         int ret = CAMERA_ERROR_NONE;
3215         camera_cli_s *pc = (camera_cli_s *)camera;
3216         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3217         int sock_fd;
3218         if (pc->cb_info == NULL) {
3219                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3220                 return CAMERA_ERROR_INVALID_PARAMETER;
3221         }
3222         sock_fd = pc->cb_info->fd;
3223         int get_orientation;
3224
3225         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3226         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3227
3228         if (ret == CAMERA_ERROR_NONE) {
3229                 muse_camera_msg_get(get_orientation, pc->cb_info->recvMsg);
3230                 *orientation = (camera_attr_tag_orientation_e)get_orientation;
3231                 LOGD("success, orientation : %d", *orientation);
3232         }
3233         LOGD("ret : 0x%x", ret);
3234         return ret;
3235 }
3236
3237
3238 int camera_attr_get_tag_software(camera_h camera, char **software)
3239 {
3240         if( camera == NULL || software == NULL ){
3241                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3242                 return CAMERA_ERROR_INVALID_PARAMETER;
3243         }
3244
3245         int ret = CAMERA_ERROR_NONE;
3246         camera_cli_s *pc = (camera_cli_s *)camera;
3247         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3248         int sock_fd;
3249         if (pc->cb_info == NULL) {
3250                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3251                 return CAMERA_ERROR_INVALID_PARAMETER;
3252         }
3253         sock_fd = pc->cb_info->fd;
3254         char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3255
3256         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3257         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3258
3259         if (ret == CAMERA_ERROR_NONE) {
3260                 muse_camera_msg_get_string(get_software, pc->cb_info->recvMsg);
3261                 *software = strdup(get_software);
3262         }
3263         LOGD("ret : 0x%x", ret);
3264         return ret;
3265 }
3266
3267
3268 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
3269 {
3270         if( camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL){
3271                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3272                 return CAMERA_ERROR_INVALID_PARAMETER;
3273         }
3274
3275         int ret = CAMERA_ERROR_NONE;
3276         camera_cli_s *pc = (camera_cli_s *)camera;
3277         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3278         double get_geotag[3] = {0,};
3279         int sock_fd;
3280         if (pc->cb_info == NULL) {
3281                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3282                 return CAMERA_ERROR_INVALID_PARAMETER;
3283         }
3284         sock_fd = pc->cb_info->fd;
3285         int valid = 0;
3286         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3287         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3288
3289         if (ret == CAMERA_ERROR_NONE) {
3290                 muse_camera_msg_get_array(get_geotag, pc->cb_info->recvMsg);
3291                 *latitude = get_geotag[0];
3292                 *longitude = get_geotag[1];
3293                 *altitude = get_geotag[2];
3294         } else {
3295                 LOGE("Returned value is not valid : 0x%x", valid);
3296                 *latitude = 0;
3297                 *longitude = 0;
3298                 *altitude = 0;
3299         }
3300         LOGD("ret : 0x%x", ret);
3301         return ret;
3302 }
3303
3304
3305 int camera_attr_get_flash_mode(camera_h camera,  camera_attr_flash_mode_e *mode)
3306 {
3307         if( camera == NULL || mode == NULL){
3308                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3309                 return CAMERA_ERROR_INVALID_PARAMETER;
3310         }
3311
3312         int ret = CAMERA_ERROR_NONE;
3313         camera_cli_s *pc = (camera_cli_s *)camera;
3314         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3315         int sock_fd;
3316         if (pc->cb_info == NULL) {
3317                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3318                 return CAMERA_ERROR_INVALID_PARAMETER;
3319         }
3320         sock_fd = pc->cb_info->fd;
3321         int get_mode;
3322
3323         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3324         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3325
3326         if (ret == CAMERA_ERROR_NONE) {
3327                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3328                 *mode = (camera_attr_flash_mode_e)get_mode;
3329         }
3330         LOGD("ret : 0x%x", ret);
3331         return ret;
3332 }
3333
3334
3335 int camera_attr_foreach_supported_af_mode( camera_h camera, camera_attr_supported_af_mode_cb foreach_cb , void *user_data)
3336 {
3337         if( camera == NULL || foreach_cb == NULL){
3338                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3339                 return CAMERA_ERROR_INVALID_PARAMETER;
3340         }
3341         int ret = CAMERA_ERROR_NONE;
3342
3343         camera_cli_s *pc = (camera_cli_s *)camera;
3344         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3345
3346         LOGD("Enter, handle :%x", pc->remote_handle);
3347
3348         int sock_fd;
3349         if (pc->cb_info == NULL) {
3350                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3351                 return CAMERA_ERROR_INVALID_PARAMETER;
3352         }
3353         sock_fd = pc->cb_info->fd;
3354         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
3355         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
3356
3357         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3358         LOGD("ret : 0x%x", ret);
3359         return ret;
3360 }
3361
3362
3363 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
3364 {
3365         if( camera == NULL || foreach_cb == NULL){
3366                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3367                 return CAMERA_ERROR_INVALID_PARAMETER;
3368         }
3369         int ret = CAMERA_ERROR_NONE;
3370
3371         camera_cli_s *pc = (camera_cli_s *)camera;
3372         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3373
3374         LOGD("Enter, handle :%x", pc->remote_handle);
3375
3376         int sock_fd;
3377         if (pc->cb_info == NULL) {
3378                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3379                 return CAMERA_ERROR_INVALID_PARAMETER;
3380         }
3381         sock_fd = pc->cb_info->fd;
3382         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
3383         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
3384
3385         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3386         LOGD("ret : 0x%x", ret);
3387         return ret;
3388 }
3389
3390
3391 int camera_attr_foreach_supported_iso( camera_h camera, camera_attr_supported_iso_cb foreach_cb , void *user_data)
3392 {
3393         if( camera == NULL || foreach_cb == NULL){
3394                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3395                 return CAMERA_ERROR_INVALID_PARAMETER;
3396         }
3397         int ret = CAMERA_ERROR_NONE;
3398
3399         camera_cli_s *pc = (camera_cli_s *)camera;
3400         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
3401
3402         LOGD("Enter, handle :%x", pc->remote_handle);
3403
3404         int sock_fd;
3405         if (pc->cb_info == NULL) {
3406                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3407                 return CAMERA_ERROR_INVALID_PARAMETER;
3408         }
3409         sock_fd = pc->cb_info->fd;
3410         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
3411         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
3412
3413         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3414         LOGD("ret : 0x%x", ret);
3415         return ret;
3416 }
3417
3418
3419 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
3420 {
3421         if( camera == NULL || foreach_cb == NULL){
3422                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3423                 return CAMERA_ERROR_INVALID_PARAMETER;
3424         }
3425         int ret = CAMERA_ERROR_NONE;
3426
3427         camera_cli_s *pc = (camera_cli_s *)camera;
3428         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
3429
3430         LOGD("Enter, handle :%x", pc->remote_handle);
3431
3432         int sock_fd;
3433         if (pc->cb_info == NULL) {
3434                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3435                 return CAMERA_ERROR_INVALID_PARAMETER;
3436         }
3437         sock_fd = pc->cb_info->fd;
3438         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
3439         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
3440
3441         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3442         LOGD("ret : 0x%x", ret);
3443         return ret;
3444 }
3445
3446
3447 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
3448 {
3449         if( camera == NULL || foreach_cb == NULL){
3450                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3451                 return CAMERA_ERROR_INVALID_PARAMETER;
3452         }
3453         int ret = CAMERA_ERROR_NONE;
3454
3455         camera_cli_s *pc = (camera_cli_s *)camera;
3456         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
3457
3458         LOGD("Enter, handle :%x", pc->remote_handle);
3459
3460         int sock_fd;
3461         if (pc->cb_info == NULL) {
3462                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3463                 return CAMERA_ERROR_INVALID_PARAMETER;
3464         }
3465         sock_fd = pc->cb_info->fd;
3466         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
3467         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
3468
3469         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3470         LOGD("ret : 0x%x", ret);
3471         return ret;
3472 }
3473
3474
3475 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
3476 {
3477         if( camera == NULL || foreach_cb == NULL){
3478                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3479                 return CAMERA_ERROR_INVALID_PARAMETER;
3480         }
3481         int ret = CAMERA_ERROR_NONE;
3482
3483         camera_cli_s *pc = (camera_cli_s *)camera;
3484         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
3485
3486         LOGD("Enter, handle :%x", pc->remote_handle);
3487
3488         int sock_fd;
3489         if (pc->cb_info == NULL) {
3490                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3491                 return CAMERA_ERROR_INVALID_PARAMETER;
3492         }
3493         sock_fd = pc->cb_info->fd;
3494         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
3495         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
3496
3497         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3498         LOGD("ret : 0x%x", ret);
3499         return ret;
3500 }
3501
3502
3503 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
3504 {
3505         if( camera == NULL || foreach_cb == NULL){
3506                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3507                 return CAMERA_ERROR_INVALID_PARAMETER;
3508         }
3509         int ret = CAMERA_ERROR_NONE;
3510
3511         camera_cli_s *pc = (camera_cli_s *)camera;
3512         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
3513
3514         LOGD("Enter, handle :%x", pc->remote_handle);
3515
3516         int sock_fd;
3517         if (pc->cb_info == NULL) {
3518                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3519                 return CAMERA_ERROR_INVALID_PARAMETER;
3520         }
3521         sock_fd = pc->cb_info->fd;
3522         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
3523         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
3524
3525         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3526         LOGD("ret : 0x%x", ret);
3527         return ret;
3528 }
3529
3530
3531 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
3532 {
3533         if( camera == NULL || foreach_cb == NULL){
3534                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3535                 return CAMERA_ERROR_INVALID_PARAMETER;
3536         }
3537         int ret = CAMERA_ERROR_NONE;
3538
3539         camera_cli_s *pc = (camera_cli_s *)camera;
3540         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
3541         int sock_fd;
3542         if (pc->cb_info == NULL) {
3543                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3544                 return CAMERA_ERROR_INVALID_PARAMETER;
3545         }
3546         sock_fd = pc->cb_info->fd;
3547         LOGD("Enter, handle :%x", pc->remote_handle);
3548         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
3549         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
3550
3551         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3552         LOGD("Enter, handle :%x", pc->remote_handle);
3553         return ret;
3554 }
3555
3556 int camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb foreach_cb, void *user_data)
3557 {
3558         if( camera == NULL || foreach_cb == NULL){
3559                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3560                 return CAMERA_ERROR_INVALID_PARAMETER;
3561         }
3562         int ret = CAMERA_ERROR_NONE;
3563
3564         camera_cli_s *pc = (camera_cli_s *)camera;
3565         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
3566         int sock_fd;
3567         if (pc->cb_info == NULL) {
3568                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3569                 return CAMERA_ERROR_INVALID_PARAMETER;
3570         }
3571         sock_fd = pc->cb_info->fd;
3572         LOGD("Enter, handle :%x", pc->remote_handle);
3573         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
3574         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
3575
3576         muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
3577         LOGD("ret : 0x%x", ret);
3578         return ret;
3579 }
3580
3581 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
3582 {
3583         if( camera == NULL || foreach_cb == NULL){
3584                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3585                 return CAMERA_ERROR_INVALID_PARAMETER;
3586         }
3587         int ret = CAMERA_ERROR_NONE;
3588
3589         camera_cli_s *pc = (camera_cli_s *)camera;
3590         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
3591         int sock_fd;
3592         if (pc->cb_info == NULL) {
3593                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3594                 return CAMERA_ERROR_INVALID_PARAMETER;
3595         }
3596         sock_fd = pc->cb_info->fd;
3597         LOGD("Enter, handle :%x", pc->remote_handle);
3598         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
3599         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
3600
3601         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3602         LOGD("ret : 0x%x", ret);
3603         return ret;
3604 }
3605
3606
3607 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
3608 {
3609         if( camera == NULL || foreach_cb == NULL){
3610                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3611                 return CAMERA_ERROR_INVALID_PARAMETER;
3612         }
3613         int ret = CAMERA_ERROR_NONE;
3614
3615         camera_cli_s *pc = (camera_cli_s *)camera;
3616         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
3617         int sock_fd;
3618         if (pc->cb_info == NULL) {
3619                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3620                 return CAMERA_ERROR_INVALID_PARAMETER;
3621         }
3622         sock_fd = pc->cb_info->fd;
3623         LOGD("Enter, handle :%x", pc->remote_handle);
3624         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
3625         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
3626
3627         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3628         LOGD("ret : 0x%x", ret);
3629         return ret;
3630 }
3631
3632
3633 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
3634 {
3635         if( camera == NULL){
3636                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3637                 return CAMERA_ERROR_INVALID_PARAMETER;
3638         }
3639
3640         int ret = CAMERA_ERROR_NONE;
3641         camera_cli_s *pc = (camera_cli_s *)camera;
3642         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
3643         int sock_fd;
3644         if (pc->cb_info == NULL) {
3645                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3646                 return CAMERA_ERROR_INVALID_PARAMETER;
3647         }
3648         sock_fd = pc->cb_info->fd;
3649         int set_rotation = (int)rotation;
3650
3651         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3652         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
3653         LOGD("ret : 0x%x", ret);
3654         return ret;
3655 }
3656
3657
3658 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
3659 {
3660         if( camera == NULL || rotation == NULL ){
3661                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3662                 return CAMERA_ERROR_INVALID_PARAMETER;
3663         }
3664
3665         int ret = CAMERA_ERROR_NONE;
3666         camera_cli_s *pc = (camera_cli_s *)camera;
3667         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
3668         int sock_fd;
3669         if (pc->cb_info == NULL) {
3670                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3671                 return CAMERA_ERROR_INVALID_PARAMETER;
3672         }
3673         sock_fd = pc->cb_info->fd;
3674         int get_rotation;
3675
3676         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3677         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3678
3679         if (ret == CAMERA_ERROR_NONE) {
3680                 muse_camera_msg_get(get_rotation, pc->cb_info->recvMsg);
3681                 *rotation = (camera_rotation_e)get_rotation;
3682         }
3683         LOGD("ret : 0x%x", ret);
3684         return ret;
3685 }
3686
3687
3688 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
3689 {
3690         if( camera == NULL){
3691                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3692                 return CAMERA_ERROR_INVALID_PARAMETER;
3693         }
3694
3695         int ret = CAMERA_ERROR_NONE;
3696         camera_cli_s *pc = (camera_cli_s *)camera;
3697         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
3698         int sock_fd;
3699         if (pc->cb_info == NULL) {
3700                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3701                 return CAMERA_ERROR_INVALID_PARAMETER;
3702         }
3703         sock_fd = pc->cb_info->fd;
3704         int set_flip = (int)flip;
3705
3706         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3707         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
3708         LOGD("ret : 0x%x", ret);
3709         return ret;
3710 }
3711
3712
3713 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
3714 {
3715         if( camera == NULL || flip == NULL ){
3716                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3717                 return CAMERA_ERROR_INVALID_PARAMETER;
3718         }
3719
3720         int ret = CAMERA_ERROR_NONE;
3721         camera_cli_s *pc = (camera_cli_s *)camera;
3722         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
3723         int sock_fd;
3724         if (pc->cb_info == NULL) {
3725                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3726                 return CAMERA_ERROR_INVALID_PARAMETER;
3727         }
3728         sock_fd = pc->cb_info->fd;
3729         int get_flip;
3730
3731         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3732         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3733
3734         if (ret == CAMERA_ERROR_NONE) {
3735                 muse_camera_msg_get(get_flip, pc->cb_info->recvMsg);
3736                 *flip = (camera_flip_e)get_flip;
3737         }
3738         LOGD("ret : 0x%x", ret);
3739         return ret;
3740 }
3741
3742 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
3743 {
3744         if( camera == NULL){
3745                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3746                 return CAMERA_ERROR_INVALID_PARAMETER;
3747         }
3748
3749         int ret = CAMERA_ERROR_NONE;
3750         camera_cli_s *pc = (camera_cli_s *)camera;
3751         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
3752         int sock_fd;
3753         if (pc->cb_info == NULL) {
3754                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3755                 return CAMERA_ERROR_INVALID_PARAMETER;
3756         }
3757         sock_fd = pc->cb_info->fd;
3758         int set_mode = (int)mode;
3759
3760         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3761         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3762         LOGD("ret : 0x%x", ret);
3763         return ret;
3764 }
3765
3766
3767 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
3768 {
3769         if (camera == NULL) {
3770                 LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER);
3771                 return CAMERA_ERROR_INVALID_PARAMETER;
3772         }
3773         if (mode == NULL) {
3774                 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode",CAMERA_ERROR_NOT_SUPPORTED);
3775                 return CAMERA_ERROR_NOT_SUPPORTED;
3776         }
3777         int ret = CAMERA_ERROR_NONE;
3778         camera_cli_s *pc = (camera_cli_s *)camera;
3779         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
3780         int sock_fd;
3781         if (pc->cb_info == NULL) {
3782                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3783                 return CAMERA_ERROR_INVALID_PARAMETER;
3784         }
3785         sock_fd = pc->cb_info->fd;
3786         int get_mode;
3787
3788         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3789         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3790
3791         if (ret == CAMERA_ERROR_NONE) {
3792                 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3793                 *mode = (camera_attr_hdr_mode_e)get_mode;
3794         }
3795         LOGD("ret : 0x%x", ret);
3796         return ret;
3797 }
3798
3799
3800 bool camera_attr_is_supported_hdr_capture(camera_h camera)
3801 {
3802         if( camera == NULL){
3803                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3804                 return false;
3805         }
3806
3807         int ret = CAMERA_ERROR_NONE;
3808         camera_cli_s *pc = (camera_cli_s *)camera;
3809         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
3810         int sock_fd;
3811         if (pc->cb_info == NULL) {
3812                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3813                 return CAMERA_ERROR_INVALID_PARAMETER;
3814         }
3815         sock_fd = pc->cb_info->fd;
3816         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3817         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3818         LOGD("ret : 0x%x", ret);
3819         return (bool)ret;
3820 }
3821
3822
3823 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data)
3824 {
3825         if (camera == NULL) {
3826                 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3827                 return CAMERA_ERROR_INVALID_PARAMETER;
3828         }
3829         if (callback == NULL) {
3830                 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
3831                 return CAMERA_ERROR_NOT_SUPPORTED;
3832         }
3833         int ret = CAMERA_ERROR_NONE;
3834
3835         camera_cli_s *pc = (camera_cli_s *)camera;
3836         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
3837         int sock_fd;
3838         if (pc->cb_info == NULL) {
3839                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3840                 return CAMERA_ERROR_INVALID_PARAMETER;
3841         }
3842         sock_fd = pc->cb_info->fd;
3843         LOGD("Enter, handle :%x", pc->remote_handle);
3844
3845         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
3846         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
3847
3848         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3849         LOGD("ret : 0x%x", ret);
3850         return ret;
3851 }
3852
3853
3854 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
3855 {
3856         if( camera == NULL){
3857                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3858                 return CAMERA_ERROR_INVALID_PARAMETER;
3859         }
3860
3861         int ret = CAMERA_ERROR_NONE;
3862
3863         camera_cli_s *pc = (camera_cli_s *)camera;
3864         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
3865         int sock_fd;
3866         if (pc->cb_info == NULL) {
3867                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3868                 return CAMERA_ERROR_INVALID_PARAMETER;
3869         }
3870         sock_fd = pc->cb_info->fd;
3871         LOGD("Enter, handle :%x", pc->remote_handle);
3872
3873         pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
3874         pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
3875
3876         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3877         LOGD("ret : 0x%x", ret);
3878         return ret;
3879 }
3880
3881
3882 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
3883 {
3884         if (camera == NULL) {
3885                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3886                 return CAMERA_ERROR_INVALID_PARAMETER;
3887         }
3888
3889         int ret = CAMERA_ERROR_NONE;
3890         camera_cli_s *pc = (camera_cli_s *)camera;
3891         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
3892         int sock_fd;
3893         if (pc->cb_info == NULL) {
3894                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3895                 return CAMERA_ERROR_INVALID_PARAMETER;
3896         }
3897         sock_fd = pc->cb_info->fd;
3898         int set_enable = (int)enable;
3899
3900         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3901         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
3902         LOGD("ret : 0x%x", ret);
3903         return ret;
3904 }
3905
3906
3907 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
3908 {
3909         if (camera == NULL) {
3910                 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3911                 return CAMERA_ERROR_INVALID_PARAMETER;
3912         }
3913         if (enabled == NULL) {
3914                 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
3915                 return CAMERA_ERROR_NOT_SUPPORTED;
3916         }
3917         int ret = CAMERA_ERROR_NONE;
3918         camera_cli_s *pc = (camera_cli_s *)camera;
3919         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
3920         int sock_fd;
3921         if (pc->cb_info == NULL) {
3922                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3923                 return CAMERA_ERROR_INVALID_PARAMETER;
3924         }
3925         sock_fd = pc->cb_info->fd;
3926         int get_enabled;
3927
3928         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3929         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3930
3931         if (ret == CAMERA_ERROR_NONE) {
3932                 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
3933                 *enabled = (bool)get_enabled;
3934         }
3935         LOGD("ret : 0x%x", ret);
3936         return ret;
3937 }
3938
3939
3940 bool camera_attr_is_supported_anti_shake(camera_h camera)
3941 {
3942
3943         if( camera == NULL){
3944                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3945                 return false;
3946         }
3947
3948         int ret = CAMERA_ERROR_NONE;
3949         camera_cli_s *pc = (camera_cli_s *)camera;
3950         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
3951         int sock_fd;
3952         if (pc->cb_info == NULL) {
3953                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3954                 return CAMERA_ERROR_INVALID_PARAMETER;
3955         }
3956         sock_fd = pc->cb_info->fd;
3957         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3958         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3959         LOGD("ret : 0x%x", ret);
3960         return ret;
3961 }
3962
3963
3964 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
3965 {
3966         if (camera == NULL) {
3967                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3968                 return CAMERA_ERROR_INVALID_PARAMETER;
3969         }
3970
3971         int ret = CAMERA_ERROR_NONE;
3972         camera_cli_s *pc = (camera_cli_s *)camera;
3973         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
3974         int sock_fd;
3975         if (pc->cb_info == NULL) {
3976                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3977                 return CAMERA_ERROR_INVALID_PARAMETER;
3978         }
3979         sock_fd = pc->cb_info->fd;
3980         int set_enable = (int)enable;
3981
3982         LOGD("Enter, remote_handle : %x", pc->remote_handle);
3983         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
3984         LOGD("ret : 0x%x", ret);
3985         return ret;
3986 }
3987
3988
3989 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
3990 {
3991         if (camera == NULL) {
3992                 LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER);
3993                 return CAMERA_ERROR_INVALID_PARAMETER;
3994         }
3995         if (enabled == NULL) {
3996                 LOGE("INVALID_PARAMETER(0x%08x) - enabled",CAMERA_ERROR_INVALID_PARAMETER);
3997                 return CAMERA_ERROR_NOT_SUPPORTED;
3998         }
3999         int ret = CAMERA_ERROR_NONE;
4000         camera_cli_s *pc = (camera_cli_s *)camera;
4001         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4002         int sock_fd;
4003         if (pc->cb_info == NULL) {
4004                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4005                 return CAMERA_ERROR_INVALID_PARAMETER;
4006         }
4007         sock_fd = pc->cb_info->fd;
4008         int get_enabled;
4009
4010         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4011         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4012
4013         if (ret == CAMERA_ERROR_NONE) {
4014                 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
4015                 *enabled = (bool)get_enabled;
4016         }
4017         LOGD("ret : 0x%x", ret);
4018         return ret;
4019 }
4020
4021
4022 bool camera_attr_is_supported_video_stabilization(camera_h camera)
4023 {
4024         if( camera == NULL){
4025                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4026                 return false;
4027         }
4028
4029         int ret = CAMERA_ERROR_NONE;
4030         camera_cli_s *pc = (camera_cli_s *)camera;
4031         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4032         int sock_fd;
4033         if (pc->cb_info == NULL) {
4034                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4035                 return CAMERA_ERROR_INVALID_PARAMETER;
4036         }
4037         sock_fd = pc->cb_info->fd;
4038         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4039         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4040         LOGD("ret : 0x%x", ret);
4041         return ret;
4042 }
4043
4044
4045 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
4046 {
4047         if( camera == NULL){
4048                 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4049                 return CAMERA_ERROR_INVALID_PARAMETER;
4050         }
4051
4052         int ret = CAMERA_ERROR_NONE;
4053         camera_cli_s *pc = (camera_cli_s *)camera;
4054         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4055         int sock_fd;
4056         if (pc->cb_info == NULL) {
4057                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4058                 return CAMERA_ERROR_INVALID_PARAMETER;
4059         }
4060         sock_fd = pc->cb_info->fd;
4061         int set_enable = (int)enable;
4062
4063         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4064         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4065         LOGD("ret : 0x%x", ret);
4066         return ret;
4067 }
4068
4069
4070 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
4071 {
4072         if (camera == NULL) {
4073                 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
4074                 return CAMERA_ERROR_INVALID_PARAMETER;
4075         }
4076         if (enabled == NULL) {
4077                 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
4078                 return CAMERA_ERROR_INVALID_PARAMETER;
4079         }
4080         int ret = CAMERA_ERROR_NONE;
4081         camera_cli_s *pc = (camera_cli_s *)camera;
4082         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4083         int sock_fd;
4084         if (pc->cb_info == NULL) {
4085                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4086                 return CAMERA_ERROR_INVALID_PARAMETER;
4087         }
4088         sock_fd = pc->cb_info->fd;
4089         int get_enabled;
4090
4091         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4092         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4093
4094         if (ret == CAMERA_ERROR_NONE) {
4095                 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
4096                 *enabled = (bool)get_enabled;
4097         }
4098         LOGD("ret : 0x%x", ret);
4099         return ret;
4100 }
4101
4102
4103 bool camera_attr_is_supported_auto_contrast(camera_h camera)
4104 {
4105         if( camera == NULL){
4106                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4107                 return false;
4108         }
4109
4110         int ret = CAMERA_ERROR_NONE;
4111         camera_cli_s *pc = (camera_cli_s *)camera;
4112         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4113         int sock_fd;
4114         if (pc->cb_info == NULL) {
4115                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4116                 return CAMERA_ERROR_INVALID_PARAMETER;
4117         }
4118         sock_fd = pc->cb_info->fd;
4119         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4120         muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4121         LOGD("ret : 0x%x", ret);
4122         return ret;
4123 }
4124
4125
4126 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
4127 {
4128         if (camera == NULL) {
4129                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4130                 return CAMERA_ERROR_INVALID_PARAMETER;
4131         }
4132
4133         int ret = CAMERA_ERROR_NONE;
4134         camera_cli_s *pc = (camera_cli_s *)camera;
4135         muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4136         int sock_fd;
4137         if (pc->cb_info == NULL) {
4138                 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4139                 return CAMERA_ERROR_INVALID_PARAMETER;
4140         }
4141         sock_fd = pc->cb_info->fd;
4142         int set_disable = (int)disable;
4143
4144         LOGD("Enter, remote_handle : %x", pc->remote_handle);
4145         muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
4146         LOGD("ret : 0x%x", ret);
4147         return ret;
4148 }