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