diff options
-rwxr-xr-x | debian/changelog | 8 | ||||
-rwxr-xr-x | include/calllog.h | 38 | ||||
-rwxr-xr-x | include/calllog_private.h | 2 | ||||
-rwxr-xr-x | include/calllog_types.h | 10 | ||||
-rwxr-xr-x | packaging/capi-social-call-log.spec | 4 | ||||
-rwxr-xr-x | src/calllog.c | 21 |
6 files changed, 76 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index 4b36462..71457a9 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +capi-social-call-log (0.1.2-1) unstable; urgency=low + + * Release Tizen 2.0 beta + * Git: framework/api/call-log + * Tag: capi-social-call-log_0.1.2-1 + + -- DongHee Ye <donghee.ye@samsung.com> Tue, 24 Jul 2012 10:11:36 +0900 + capi-social-call-log (0.1.1-25) unstable; urgency=low * package build dependecy updated diff --git a/include/calllog.h b/include/calllog.h index 8f4d58c..bca1b8c 100755 --- a/include/calllog.h +++ b/include/calllog.h @@ -50,7 +50,6 @@ int calllog_connect(void); /** * @brief Closes the connection to call log service. * - * * @return 0 on success, otherwise a negative error value. * @retval #CALLLOG_ERROR_NONE Successful * @retval #CALLLOG_ERROR_DB_FAILED Database failed @@ -60,6 +59,41 @@ int calllog_connect(void); int calllog_disconnect(void); /** + * @brief Registers a callback function to be invoked when the call log changes. + * + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value. + * @retval #CALLLOG_ERROR_NONE Successful + * @retval #CALLLOG_ERROR_INVALID_PARAMETER Invalid parameter + * + * @pre This function requires an open connection to the call log service by calllog_connect(). + * @post calllog_db_changed_cb() will be invoked when the call log changes. + * + * @see calllog_connect() + * @see calllog_db_changed_cb() + * @see calllog_insert_to_db() + * @see calllog_update_missed_unchecked_to_checked_to_db() + * @see calllog_delete_from_db() + */ +int calllog_add_calllog_db_changed_cb(calllog_db_changed_cb callback, void *user_data); + +/** + * @brief Unregisters the callback function. + * + * @param[in] callback The callback function to unregister + * + * @return 0 on success, otherwise a negative error value. + * @retval #CALLLOG_ERROR_NONE Successful + * @retval #CALLLOG_ERROR_INVALID_PARAMETER Invalid parameter + * + * @see calllog_db_changed_cb() + * @see calllog_add_calllog_db_changed_cb() + */ +int calllog_remove_calllog_db_changed_cb(calllog_db_changed_cb callback); + +/** * @brief Creates a new call log handle. * @remarks The call log handle must be released with calllog_destroy() by you. * @remarks The created handle is not added to call log database until calllog_insert_to_db() is called. @@ -338,5 +372,5 @@ int calllog_query_calllog_by_number(calllog_foreach_cb callback, const char *num } #endif -#endif /* __CONTACTS_LOG_H__ */ +#endif /* __TIZEN_CALLLOG_H__ */ diff --git a/include/calllog_private.h b/include/calllog_private.h index 970c9f0..40ee582 100755 --- a/include/calllog_private.h +++ b/include/calllog_private.h @@ -122,5 +122,5 @@ int _calllog_set_shortmsg(calllog_h log, const char *shortmsg); } #endif -#endif /* __CALLLOG_H__ */ +#endif /* __TIZEN_CALLLOG_PRIVATE_H__ */ diff --git a/include/calllog_types.h b/include/calllog_types.h index c919107..06c2f81 100755 --- a/include/calllog_types.h +++ b/include/calllog_types.h @@ -75,6 +75,14 @@ typedef enum } calllog_type_e; /** + * @brief Called when call log changes. + * + * @param[in] user_data The user data passed from the callback registration function + * @see calllog_add_calllog_db_changed_cb() + */ +typedef void (*calllog_db_changed_cb)(void *user_data); + +/** * @brief The call log handle. */ typedef struct _calllog_s* calllog_h; @@ -126,5 +134,5 @@ typedef bool (*calllog_foreach_cb)(calllog_query_detail_s *query_log, void *user } #endif -#endif /* __CALLLOG_H__ */ +#endif /* __TIZEN_CALLLOG_TYPE_H__ */ diff --git a/packaging/capi-social-call-log.spec b/packaging/capi-social-call-log.spec index ace3bee..ee2f64c 100755 --- a/packaging/capi-social-call-log.spec +++ b/packaging/capi-social-call-log.spec @@ -1,7 +1,7 @@ Name: capi-social-call-log Summary: Call log library in Tizen Native API -Version: 0.1.1 -Release: 25 +Version: 0.1.3 +Release: 1 Group: TO_BE/FILLED_IN License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/calllog.c b/src/calllog.c index 7ca5855..943c1f1 100755 --- a/src/calllog.c +++ b/src/calllog.c @@ -191,7 +191,7 @@ int calllog_update_missed_unchecked_to_checked_to_db(int calllog_db_id) int calllog_get_time(calllog_h log, time_t* log_time) { - if(log == NULL || time == NULL) { + if(log == NULL || log_time == NULL) { LOGE("[%s] CALLLOG_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALLLOG_ERROR_INVALID_PARAMETER); return CALLLOG_ERROR_INVALID_PARAMETER; } @@ -384,11 +384,30 @@ int calllog_query_calllog_by_number(calllog_foreach_cb cb, const char* number_to _calllog_safe_free(query_data.contact_image_path); _calllog_safe_free(query_data.phone_number); _calllog_safe_free(query_data.short_message); + if (!func_ret) { + break; + } } contacts_svc_iter_remove(iter); return CALLLOG_ERROR_NONE; } +int calllog_add_calllog_db_changed_cb(calllog_db_changed_cb callback, void *user_data) +{ + if(contacts_svc_subscribe_change(CTS_SUBSCRIBE_PLOG_CHANGE, callback, user_data) == CTS_SUCCESS) + return CALLLOG_ERROR_NONE; + + LOGE("[%s] CALLLOG_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALLLOG_ERROR_INVALID_PARAMETER); + return CALLLOG_ERROR_INVALID_PARAMETER; +} +int calllog_remove_calllog_db_changed_cb(calllog_db_changed_cb callback) +{ + if(contacts_svc_unsubscribe_change(CTS_SUBSCRIBE_PLOG_CHANGE, callback) == CTS_SUCCESS) + return CALLLOG_ERROR_NONE; + + LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CALLLOG_ERROR_INVALID_PARAMETER); + return CALLLOG_ERROR_INVALID_PARAMETER; +} |