[Non-ACR][calendar-service][TFIVE-14035] 69/190169/9 accepted/tizen/5.0/unified/20181102.015812 accepted/tizen/unified/20181005.012342 submit/tizen/20181004.081758 submit/tizen_5.0/20181101.000003
authorSameer Prakash Pradhan <sp.pradhan@samsung.com>
Thu, 27 Sep 2018 15:13:24 +0000 (20:43 +0530)
committerSameer Prakash Pradhan <sp.pradhan@samsung.com>
Wed, 3 Oct 2018 13:44:19 +0000 (19:14 +0530)
Signed-off-by: Sameer Prakash Pradhan <sp.pradhan@samsung.com>
Change-Id: I7aa63d99c26e4254a06d9eb880e93f41cd499bd5

common/cal_record.c
include/calendar_record.h

index 05ab54c1705122bdd89d31b52431cfea10ae95ca..605c49f07e8160331bc688cf1c0540e5eb5edb1c 100644 (file)
@@ -349,6 +349,207 @@ EXPORT_API int calendar_record_get_lli(calendar_record_h record, unsigned int pr
        return ret;
 }
 
+//Getters & Setters of local caltime
+EXPORT_API calendar_time_s *cal_caltime_create(void)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       calendar_time_s *caltime = NULL;
+       caltime = calloc(1, sizeof(calendar_time_s));
+       WARN_IF(NULL == caltime, "calloc() Fail");
+
+       return caltime;
+}
+
+EXPORT_API void cal_caltime_destroy(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       free(caltime);
+}
+
+
+EXPORT_API calendar_time_type_e cal_caltime_get_local_type(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       return caltime->type;
+}
+
+
+EXPORT_API int cal_caltime_set_local_type(calendar_time_s *caltime, calendar_time_type_e type)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       caltime->type = type;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API long long int cal_caltime_get_local_utime(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_UTIME != caltime->type, 0);
+
+       return caltime->time.utime;
+}
+
+EXPORT_API int cal_caltime_set_local_utime(calendar_time_s *caltime, long long int utime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_UTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.utime = utime;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API int cal_caltime_get_local_year(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.year;
+}
+
+EXPORT_API int cal_caltime_set_local_year(calendar_time_s *caltime, int year)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.year = year;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+
+EXPORT_API int cal_caltime_get_local_month(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.month;
+}
+
+EXPORT_API int cal_caltime_set_local_month(calendar_time_s *caltime, int month)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.year = month;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API int cal_caltime_get_local_mday(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.mday;
+}
+
+EXPORT_API int cal_caltime_set_local_mday(calendar_time_s *caltime, int mday)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.mday = mday;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API int cal_caltime_get_local_hour(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.hour;
+}
+
+EXPORT_API int cal_caltime_set_local_hour(calendar_time_s *caltime, int hour)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.hour = hour;
+
+       return CALENDAR_ERROR_NONE;
+}
+EXPORT_API int cal_caltime_get_local_minute(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.minute;
+}
+
+EXPORT_API int cal_caltime_set_local_minute(calendar_time_s *caltime, int minute)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.minute = minute;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API int cal_caltime_get_local_second(calendar_time_s *caltime)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, 0);
+
+       return caltime->time.date.second;
+}
+
+EXPORT_API int cal_caltime_set_local_second(calendar_time_s *caltime, int second)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+       RETV_IF(NULL == caltime, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(CALENDAR_TIME_LOCALTIME != caltime->type, CALENDAR_ERROR_INVALID_PARAMETER);
+
+       caltime->time.date.second = second;
+
+       return CALENDAR_ERROR_NONE;
+}
+
+EXPORT_API int cal_caltime_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s *value)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+
+       RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+       __CHECK_READ_ONLY_PROPERTY();
+
+       int ret = cal_record_set_caltime(record, property_id, *value);
+
+       return ret;
+}
+
+
+
+EXPORT_API int cal_caltime_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s **out_value)
+{
+       CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
+
+       int ret = CALENDAR_ERROR_NONE;
+
+       cal_record_s *temp = (cal_record_s*)(record);
+
+       RETV_IF(NULL == record, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == temp->plugin_cb, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == out_value, CALENDAR_ERROR_INVALID_PARAMETER);
+       RETVM_IF(NULL == temp->plugin_cb->get_caltime, CALENDAR_ERROR_NOT_PERMITTED, "Not permitted(%x) in [%s]", property_id, temp->view_uri);
+       RETVM_IF(false == cal_record_check_property_flag(record, property_id, CAL_PROPERTY_FLAG_PROJECTION), CALENDAR_ERROR_NOT_PERMITTED, "Not permitted");
+
+       *out_value = cal_caltime_create();
+       ret = temp->plugin_cb->get_caltime(record, property_id, *out_value);
+
+       return ret;
+}
+
 EXPORT_API int calendar_record_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s *out_value)
 {
        CHECK_CALENDAR_SUPPORTED(CALENDAR_FEATURE);
index 29bf7c65a678c7d0d43356886ef1d68eb1a98548..aaa0e2485f3081a5ec21ef0bf48f1168b666aec4 100644 (file)
@@ -405,7 +405,46 @@ int calendar_record_get_child_record_at_p(calendar_record_h record, unsigned int
  */
 int calendar_record_clone_child_record_list(calendar_record_h record, unsigned int property_id, calendar_list_h* out_list);
 
+/**
+ * @brief
+ *
+ *
+ */
+calendar_time_s*  cal_caltime_create(void);
+
+void cal_caltime_destroy(calendar_time_s *caltime);
+
+calendar_time_type_e cal_caltime_get_local_type(calendar_time_s *caltime);
+
+int cal_caltime_set_local_type(calendar_time_s *caltime, calendar_time_type_e type);
+
+long long int cal_caltime_get_local_utime(calendar_time_s *caltime);
+
+int cal_caltime_set_local_utime(calendar_time_s *caltime, long long int utime);
+
+int cal_caltime_get_local_year(calendar_time_s *caltime);
+
+int cal_caltime_set_local_year(calendar_time_s *caltime, int year);
+
+int cal_caltime_get_local_month(calendar_time_s *caltime);
+
+int cal_caltime_set_local_month(calendar_time_s *caltime, int month);
+
+int cal_caltime_get_local_mday(calendar_time_s *caltime);
+
+int cal_caltime_set_local_mday(calendar_time_s *caltime, int mday);
+
+int cal_caltime_get_local_hour(calendar_time_s *caltime);
+
+int cal_caltime_set_local_hour(calendar_time_s *caltime, int hour);
+
+int cal_caltime_get_local_minute(calendar_time_s *caltime);
+
+int cal_caltime_set_local_minute(calendar_time_s *caltime, int minute);
+
+int cal_caltime_get_local_second(calendar_time_s *caltime);
 
+int cal_caltime_set_local_second(calendar_time_s *caltime, int second);
 /**
  * @}
  */