diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2017-06-09 18:39:30 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2017-06-14 18:10:06 +0900 |
commit | c64db312088425fd6ac87c1e32f83fe027a36b16 (patch) | |
tree | 10874941714020fdad1a871bcba51183920bccd7 /src | |
parent | 2543d8cbaa4dcfd802b410b9f5345fc8e3b957e2 (diff) | |
download | camera-c64db312088425fd6ac87c1e32f83fe027a36b16.tar.gz camera-c64db312088425fd6ac87c1e32f83fe027a36b16.tar.bz2 camera-c64db312088425fd6ac87c1e32f83fe027a36b16.zip |
[ACR-987] Add interrupt started callback related APIssubmit/tizen_4.0_unified/20170814.115522submit/tizen_4.0/20170814.115522submit/tizen_4.0/20170811.094300submit/tizen/20170619.053621submit/tizen/20170614.052326accepted/tizen/unified/20170630.083115accepted/tizen/4.0/unified/20170816.014933accepted/tizen/4.0/unified/20170816.011807
The application can only get callback after interrupt is completed,
it means that there is no way to know the internal interrupt handling status for application.
This patch provides the APIs to get callback when interrupt is started.
[Version] 0.3.2
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20170608.1]
Change-Id: I3af3dedec3f1c195c0206e32b7509a368d84ee5e
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/camera.c | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/camera.c b/src/camera.c index 6b999f6..39d7d6c 100644 --- a/src/camera.c +++ b/src/camera.c @@ -1343,6 +1343,27 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]); } break; + case MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED: + { + int policy = 0; + int state = 0; + + muse_camera_msg_get(policy, recv_msg); + muse_camera_msg_get(state, recv_msg); + + LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state); + + if (policy == CAMERA_POLICY_SOUND) + LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release."); + else if (policy == CAMERA_POLICY_SOUND_BY_CALL) + LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release."); + else if (policy == CAMERA_POLICY_SOUND_BY_ALARM) + LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release."); + + ((camera_interrupt_started_cb)cb_info->user_cb[event])((camera_policy_e)policy, + (camera_state_e)state, cb_info->user_data[event]); + } + break; case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION: { int count = 0; @@ -1555,8 +1576,8 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m LOGD("return buffer done"); } break; - default: /* MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */ - LOGE("render error"); + default: + LOGW("unhandled event %d", event); break; } @@ -3971,6 +3992,58 @@ int camera_unset_interrupted_cb(camera_h camera) } +int camera_set_interrupt_started_cb(camera_h camera, camera_interrupt_started_cb callback, void *user_data) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPT_STARTED_CB; + + if (!pc || !pc->cb_info || !callback) { + LOGE("NULL pointer %p %p", pc, callback); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + LOGD("Enter"); + + _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = callback; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = user_data; + } + + LOGD("ret : 0x%x", ret); + + return ret; +} + + +int camera_unset_interrupt_started_cb(camera_h camera) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPT_STARTED_CB; + + if (!pc || !pc->cb_info) { + LOGE("NULL handle"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + LOGD("Enter"); + + _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL; + } + + LOGD("ret : 0x%x", ret); + + return ret; +} + + int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data) { int ret = CAMERA_ERROR_NONE; |