4 * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef __TIZEN_SOCIAL_CALENDAR_VCALENDAR_H__
20 #define __TIZEN_SOCIAL_CALENDAR_VCALENDAR_H__
22 #include <calendar_view.h>
29 * @file calendar_vcalendar.h
33 * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_VCALENDAR_MODULE
38 * @brief Retrieves a vcalendar stream from a calendar list.
40 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
42 * @param[in] calendar_list The calendar list handle
43 * @param[out] vcalendar_stream The vcalendar stream
45 * @return @c 0 on success,
46 * otherwise a negative error value
47 * @retval #CALENDAR_ERROR_NONE Successful
48 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
49 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
50 * @retval #CALENDAR_ERROR_NO_DATA Requested data does not exist
52 int calendar_vcalendar_make_from_records(calendar_list_h calendar_list, char **vcalendar_stream);
55 * @brief Retrieves all calendars from a vcalendar stream.
57 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
59 * @param[in] vcalendar_stream The vcalendar stream
60 * @param[out] calendar_list The calendar list handle
62 * @return @c 0 on success,
63 * otherwise a negative error value
64 * @retval #CALENDAR_ERROR_NONE Successful
65 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
66 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
67 * @retval #CALENDAR_ERROR_NO_DATA Requested data does not exist
69 * @pre calendar_connect() should be called to initialize.
72 int calendar_vcalendar_parse_to_calendar(const char* vcalendar_stream, calendar_list_h *calendar_list);
75 * @brief Called to get a record handle of
76 * \ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_event or \ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_todo.
78 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
80 * @param[in] record The record handle (\ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_event or \ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_todo)
81 * @param[in] user_data The user data passed from the foreach function
83 * @return @c true to continue with the next iteration of the loop,
84 * otherwise @c false to break out of the loop
86 * @pre calendar_vcalendar_parse_to_calendar_foreach() will invoke this callback.
88 * @see calendar_vcalendar_parse_to_calendar_foreach()
89 * @see calendar_record_get_uri_p()
91 typedef bool (*calendar_vcalendar_parse_cb)(calendar_record_h record, void *user_data);
94 * @brief Retrieves all events or to-dos
95 * (\ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_event or \ref CAPI_SOCIAL_CALENDAR_SVC_VIEW_MODULE_calendar_todo) from a vCalendar file.
97 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
99 * @param[in] vcalendar_file_path The file path of the vCalendar stream file
100 * @param[in] callback The callback function to be invoked
101 * @param[in] user_data The user data to be passed to the callback function
103 * @return @c 0 on success,
104 * otherwise a negative error value
105 * @retval #CALENDAR_ERROR_NONE Successful
106 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
107 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
109 * @pre calendar_connect() should be called to initialize.
111 * @post This function invokes calendar_vcalendar_parse_cb().
113 * @see calendar_vcalendar_parse_cb()
114 * @see calendar_record_get_uri_p()
116 int calendar_vcalendar_parse_to_calendar_foreach(const char *vcalendar_file_path, calendar_vcalendar_parse_cb callback, void *user_data);
126 #endif /* __TIZEN_SOCIAL_CALENDAR_VCALENDAR_H__ */