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