Get the module index using muse configure 87/198187/4 accepted/tizen/unified/20190218.063821 submit/tizen/20190129.225447 submit/tizen/20190130.080354 submit/tizen/20190214.113838
authorYoungHun Kim <yh8004.kim@samsung.com>
Tue, 22 Jan 2019 07:21:39 +0000 (16:21 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Tue, 22 Jan 2019 10:18:19 +0000 (19:18 +0900)
[Version] 0.4.20
[Profile] Common
[Issue Type] Update
[Dependency module] N/A

Change-Id: I609f9e8fe7b8d243202aa12705151b880ad5d318

packaging/capi-media-camera.spec
src/camera.c

index 3cc5fe2..875c42e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.19
+Version:    0.4.20
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 9e1dada..4237161 100644 (file)
@@ -34,6 +34,7 @@
 #undef LOG_TAG
 #endif
 #define LOG_TAG "TIZEN_N_CAMERA"
+#define MODULE_NAME "camera"
 
 /* for device changed callback */
 static GMutex g_cam_dev_state_changed_cb_lock;
@@ -2279,6 +2280,7 @@ int _camera_independent_request(int api, int device_type, const char *key, int *
 {
        int ret = CAMERA_ERROR_NONE;
        int sock_fd = -1;
+       int module_index = -1;
        char *msg = NULL;
        char recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH] = {'\0',};
 
@@ -2294,8 +2296,14 @@ int _camera_independent_request(int api, int device_type, const char *key, int *
                return CAMERA_ERROR_INVALID_OPERATION;
        }
 
+       if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+               LOGE("muse client get module index failed");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto _REQUEST_EXIT;
+       }
+
        msg = muse_core_msg_new(api,
-               MUSE_TYPE_INT, "module", MUSE_CAMERA,
+               MUSE_TYPE_INT, "module", module_index,
                MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
                0);
        if (!msg) {
@@ -2354,7 +2362,7 @@ int camera_create(camera_device_e device, camera_h *camera)
        tbm_bufmgr bufmgr = NULL;
 
        muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
-       muse_core_api_module_e muse_module = MUSE_CAMERA;
+       int module_index = -1;
        int device_type = (int)device;
 
        if (!camera) {
@@ -2371,8 +2379,14 @@ int camera_create(camera_device_e device, camera_h *camera)
 
        pid = getpid();
 
+       if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+               LOGE("muse client get module index failed");
+               ret = CAMERA_ERROR_INVALID_OPERATION;
+               goto ErrorExit;
+       }
+
        send_msg = muse_core_msg_new(api,
-               MUSE_TYPE_INT, "module", muse_module,
+               MUSE_TYPE_INT, "module", module_index,
                MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
                MUSE_TYPE_INT, "pid", pid,
                0);