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