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