From fb920d6dcc2040a52404bb9b795a2bbc72c70579 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Fri, 2 Sep 2016 17:40:54 +0900 Subject: [PATCH] [UTC][Smartcard][ACR-712][Add UTC for additional smartcard apis] - get omapi version - set / unset reader event callback Signed-off-by: Jihoon Jung Change-Id: I801f7ca22918e9b45bf8969cdb76df0c68553a31 --- src/utc/smartcard/tct-smartcard-core_mobile.h | 8 ++++ src/utc/smartcard/tct-smartcard-core_wearable.h | 8 ++++ src/utc/smartcard/utc-smartcard-reader.c | 53 +++++++++++++++++++++++++ src/utc/smartcard/utc-smartcard-service.c | 41 +++++++++++++++++++ 4 files changed, 110 insertions(+) diff --git a/src/utc/smartcard/tct-smartcard-core_mobile.h b/src/utc/smartcard/tct-smartcard-core_mobile.h index 45fe0ac..1eb6249 100755 --- a/src/utc/smartcard/tct-smartcard-core_mobile.h +++ b/src/utc/smartcard/tct-smartcard-core_mobile.h @@ -31,6 +31,8 @@ extern void utc_smartcard_channel_cleanup(void); extern int utc_smartcard_smartcard_initialize_p(void); extern int utc_smartcard_smartcard_deinitialize_p(void); extern int utc_smartcard_smartcard_deinitialize_n(void); +extern int utc_smartcard_smartcard_get_version_p(void); +extern int utc_smartcard_smartcard_get_version_n(void); extern int utc_smartcard_smartcard_get_readers_p(void); extern int utc_smartcard_smartcard_get_readers_n(void); extern int utc_smartcard_smartcard_reader_get_name_p(void); @@ -41,6 +43,8 @@ extern int utc_smartcard_smartcard_reader_open_session_p(void); extern int utc_smartcard_smartcard_reader_open_session_n(void); extern int utc_smartcard_smartcard_reader_close_sessions_p(void); extern int utc_smartcard_smartcard_reader_close_sessions_n(void); +extern int utc_smartcard_smartcard_reader_set_event_cb_p(void); +extern int utc_smartcard_smartcard_reader_set_event_cb_n(void); extern int utc_smartcard_smartcard_session_get_reader_p(void); extern int utc_smartcard_smartcard_session_get_reader_n(void); extern int utc_smartcard_smartcard_session_get_atr_p(void); @@ -66,6 +70,8 @@ testcase tc_array[] = { {"utc_smartcard_smartcard_initialize_p", utc_smartcard_smartcard_initialize_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_deinitialize_p", utc_smartcard_smartcard_deinitialize_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_deinitialize_n", utc_smartcard_smartcard_deinitialize_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, + {"utc_smartcard_smartcard_get_version_p", utc_smartcard_smartcard_get_version_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, + {"utc_smartcard_smartcard_get_version_n", utc_smartcard_smartcard_get_version_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_get_readers_p", utc_smartcard_smartcard_get_readers_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_get_readers_n", utc_smartcard_smartcard_get_readers_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_reader_get_name_p", utc_smartcard_smartcard_reader_get_name_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, @@ -76,6 +82,8 @@ testcase tc_array[] = { {"utc_smartcard_smartcard_reader_open_session_n", utc_smartcard_smartcard_reader_open_session_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_reader_close_sessions_p", utc_smartcard_smartcard_reader_close_sessions_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_reader_close_sessions_n", utc_smartcard_smartcard_reader_close_sessions_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, + {"utc_smartcard_smartcard_reader_set_event_cb_p", utc_smartcard_smartcard_reader_set_event_cb_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, + {"utc_smartcard_smartcard_reader_set_event_cb_n", utc_smartcard_smartcard_reader_set_event_cb_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_session_get_reader_p", utc_smartcard_smartcard_session_get_reader_p, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, {"utc_smartcard_smartcard_session_get_reader_n", utc_smartcard_smartcard_session_get_reader_n, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, {"utc_smartcard_smartcard_session_get_atr_p", utc_smartcard_smartcard_session_get_atr_p, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, diff --git a/src/utc/smartcard/tct-smartcard-core_wearable.h b/src/utc/smartcard/tct-smartcard-core_wearable.h index 45fe0ac..1eb6249 100755 --- a/src/utc/smartcard/tct-smartcard-core_wearable.h +++ b/src/utc/smartcard/tct-smartcard-core_wearable.h @@ -31,6 +31,8 @@ extern void utc_smartcard_channel_cleanup(void); extern int utc_smartcard_smartcard_initialize_p(void); extern int utc_smartcard_smartcard_deinitialize_p(void); extern int utc_smartcard_smartcard_deinitialize_n(void); +extern int utc_smartcard_smartcard_get_version_p(void); +extern int utc_smartcard_smartcard_get_version_n(void); extern int utc_smartcard_smartcard_get_readers_p(void); extern int utc_smartcard_smartcard_get_readers_n(void); extern int utc_smartcard_smartcard_reader_get_name_p(void); @@ -41,6 +43,8 @@ extern int utc_smartcard_smartcard_reader_open_session_p(void); extern int utc_smartcard_smartcard_reader_open_session_n(void); extern int utc_smartcard_smartcard_reader_close_sessions_p(void); extern int utc_smartcard_smartcard_reader_close_sessions_n(void); +extern int utc_smartcard_smartcard_reader_set_event_cb_p(void); +extern int utc_smartcard_smartcard_reader_set_event_cb_n(void); extern int utc_smartcard_smartcard_session_get_reader_p(void); extern int utc_smartcard_smartcard_session_get_reader_n(void); extern int utc_smartcard_smartcard_session_get_atr_p(void); @@ -66,6 +70,8 @@ testcase tc_array[] = { {"utc_smartcard_smartcard_initialize_p", utc_smartcard_smartcard_initialize_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_deinitialize_p", utc_smartcard_smartcard_deinitialize_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_deinitialize_n", utc_smartcard_smartcard_deinitialize_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, + {"utc_smartcard_smartcard_get_version_p", utc_smartcard_smartcard_get_version_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, + {"utc_smartcard_smartcard_get_version_n", utc_smartcard_smartcard_get_version_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_get_readers_p", utc_smartcard_smartcard_get_readers_p, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_get_readers_n", utc_smartcard_smartcard_get_readers_n, utc_smartcard_service_startup, utc_smartcard_service_cleanup}, {"utc_smartcard_smartcard_reader_get_name_p", utc_smartcard_smartcard_reader_get_name_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, @@ -76,6 +82,8 @@ testcase tc_array[] = { {"utc_smartcard_smartcard_reader_open_session_n", utc_smartcard_smartcard_reader_open_session_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_reader_close_sessions_p", utc_smartcard_smartcard_reader_close_sessions_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_reader_close_sessions_n", utc_smartcard_smartcard_reader_close_sessions_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, + {"utc_smartcard_smartcard_reader_set_event_cb_p", utc_smartcard_smartcard_reader_set_event_cb_p, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, + {"utc_smartcard_smartcard_reader_set_event_cb_n", utc_smartcard_smartcard_reader_set_event_cb_n, utc_smartcard_reader_startup, utc_smartcard_reader_cleanup}, {"utc_smartcard_smartcard_session_get_reader_p", utc_smartcard_smartcard_session_get_reader_p, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, {"utc_smartcard_smartcard_session_get_reader_n", utc_smartcard_smartcard_session_get_reader_n, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, {"utc_smartcard_smartcard_session_get_atr_p", utc_smartcard_smartcard_session_get_atr_p, utc_smartcard_session_startup, utc_smartcard_session_cleanup}, diff --git a/src/utc/smartcard/utc-smartcard-reader.c b/src/utc/smartcard/utc-smartcard-reader.c index a3aeb52..2a5445b 100755 --- a/src/utc/smartcard/utc-smartcard-reader.c +++ b/src/utc/smartcard/utc-smartcard-reader.c @@ -202,3 +202,56 @@ int utc_smartcard_smartcard_reader_close_sessions_n(void) SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_INVALID_PARAMETER); return 0; } + +static void __reader_event_cb(int reader_id, smartcard_reader_event_type_e event_type, void *user_data) +{ + return; +} + +/** + * @testcase utc_smartcard_smartcard_reader_close_sessions_p + * @since_tizen 3.0 + * @description + */ +int utc_smartcard_smartcard_reader_set_event_cb_p(void) +{ + int ret = SMARTCARD_ERROR_NONE; + SMARTCARD_ASSERT(_init_state, SMARTCARD_ERROR_NONE); + + // process start + ret = smartcard_reader_set_event_cb(__reader_event_cb, NULL); + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_NONE); + + ret = smartcard_reader_unset_event_cb(); + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_NONE); + // process end + + return 0; + +} + +/** + * @testcase utc_smartcard_smartcard_reader_close_sessions_n + * @since_tizen 3.0 + * @description + */ +int utc_smartcard_smartcard_reader_set_event_cb_n(void) +{ + int ret = SMARTCARD_ERROR_NONE; + SMARTCARD_ASSERT(_init_state, SMARTCARD_ERROR_NONE); + + // process start + ret = smartcard_reader_set_event_cb(NULL, NULL); + + if (ret == SMARTCARD_ERROR_INVALID_PARAMETER) { + smartcard_deinitialize(); + ret = smartcard_reader_unset_event_cb(); + + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_NOT_INITIALIZED); + } else { + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_INVALID_PARAMETER); + } + // process end + + return 0; +} diff --git a/src/utc/smartcard/utc-smartcard-service.c b/src/utc/smartcard/utc-smartcard-service.c index f20c6f6..988f0ba 100755 --- a/src/utc/smartcard/utc-smartcard-service.c +++ b/src/utc/smartcard/utc-smartcard-service.c @@ -96,6 +96,47 @@ int utc_smartcard_smartcard_deinitialize_n(void) } /** + * @testcase utc_smartcard_smartcard_get_version_p + * @since_tizen 3.0 + * @description + */ +int utc_smartcard_smartcard_get_version_p(void) +{ + int ret = SMARTCARD_ERROR_NONE; + char *version = NULL; + + SMARTCARD_ASSERT(_init_state, SMARTCARD_ERROR_NONE); + + // process start + ret = smartcard_get_version(&version); + + if (version != NULL) + free(version); + // process end + + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_NONE); + return 0; +} + +/** + * @testcase utc_smartcard_smartcard_get_version_n + * @since_tizen 3.0 + * @description + */ +int utc_smartcard_smartcard_get_version_n(void) +{ + int ret = SMARTCARD_ERROR_NONE; + SMARTCARD_ASSERT(_init_state, SMARTCARD_ERROR_NONE); + + // process start + ret = smartcard_get_version(NULL); + // process end + + SMARTCARD_ASSERT(ret, SMARTCARD_ERROR_INVALID_PARAMETER); + return 0; +} + +/** * @testcase utc_smartcard_smartcard_get_readers_p * @since_tizen 2.3 * @description -- 2.7.4