4 * Copyright (c) 2000 - 2012 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 __CALENDAR_SVC_H__
20 #define __CALENDAR_SVC_H__
23 #define DEPRECATED __attribute__ ((deprecated))
28 * @defgroup CALENDAR_SVC Calendar Service
32 * @defgroup common common
33 * @ingroup CALENDAR_SVC
35 * common struct for calendar service
40 * cal_struct is an opaque type, it must be
41 * used via accessor functions.
43 * @see calendar_svc_struct_new(), calendar_svc_struct_free()
44 * @see calendar_svc_struct_get_value(), calendar_svc_struct_get_list(),
45 * @see calendar_svc_struct_store_value(), calendar_svc_struct_store_list()
56 #include <calendar-svc-errors.h>
57 #include <calendar-svc-struct.h>
66 * This enumeration date type, sun or lunar.
70 CAL_DATE_SUN = 0, /**< date is sun type*/
71 CAL_DATE_LUNAR, /**< date is lunar type */
75 * This enumeration defines Remind Tick Unit for schedule.
76 * Ex. remindTick = 1, remindTickUnit = CAL_SCH_TIME_UNIT_MIN, Organizer alarms
77 * 1 minute before schedule starting time.
79 typedef enum /* use with *60 */
81 CAL_SCH_TIME_UNIT_OFF = -1, /**< off */
82 CAL_SCH_TIME_UNIT_MIN = 1, /**< Minute */
83 CAL_SCH_TIME_UNIT_HOUR = 60, /**< Hour 60 * 60 */
84 CAL_SCH_TIME_UNIT_DAY = 1440, /**< Day 60 * 60 *24 */
85 CAL_SCH_TIME_UNIT_WEEK = 10080, /**< Week DAY * 7 */
86 CAL_SCH_TIME_UNIT_MONTH, /**< Month - will be removed*/
87 CAL_SCH_TIME_UNIT_SPECIFIC /**< using alarm time */
88 } cal_sch_remind_tick_unit_t;
91 * This enumeration defines Repeat term.
95 CAL_REPEAT_NONE = 0, /**< never Repeat */
96 CAL_REPEAT_EVERY_DAY, /**< Repeats every day */
97 CAL_REPEAT_EVERY_WEEK, /**< Repeats every week */
98 CAL_REPEAT_EVERY_MONTH, /**< Repeats every month */
99 CAL_REPEAT_EVERY_YEAR, /**< Repeats every year */
100 CAL_REPEAT_EVERY_WEEKDAYS, /**< Repeats every weekdays *//* same with CAL_REPEAT_EVERY_WEEK, but week_flag="0111110", day_date=1, sun_moon=0, week_start=0 */
101 CAL_REPEAT_EVERY_MONTH_DAY, /**< Repeats every month's week days *//* same with CAL_REPEAT_EVERY_MONTH, but week_flag="1000000"~"0000001", day_date=0, sun_moon=0, week_start=0 */
102 CAL_REPEAT_EVERY_YEAR_DAY, /**< Repeats every year's month week days *//* same with CAL_REPEAT_EVERY_YEAR, but week_flag="1000000"~"0000001", day_date=0, sun_moon=0, week_start=0 */
106 * This enumeration defines Repeat term.
110 CALS_REPEAT_UNTIL_TYPE_NONE = 0, /**< Repeat endlessly */
111 CALS_REPEAT_UNTIL_TYPE_COUNT, /**< Repeat number of times, which the CAL_VALUE_INT_REPEAT_OCCURRENCES indicates */
112 CALS_REPEAT_UNTIL_TYPE_DATETIME, /**< Repeat until the date-time which the CAL_VALUE_GMT_REPEAT_END_DATE indicates */
113 } cal_repeat_until_type_t;
116 * This enumeration defines sync status.
120 CAL_SYNC_STATUS_NEW = 0, /**< newly added. */
121 CAL_SYNC_STATUS_UPDATED, /**< updated. */
122 CAL_SYNC_STATUS_DELETED, /**< deleted. */
123 CAL_SYNC_STATUS_SYNCED, /**< synced */
127 * This enumeration defines Expiration for schedule data.
131 CAL_SCH_EXPIRATION_NONE = 0, /**< never expirate */
132 CAL_SCH_EXPIRATION_AFTER_1_MONTH, /**< After 1 month */
133 CAL_SCH_EXPIRATION_AFTER_1_YEAR, /**< After 1 year */
134 CAL_SCH_EXPIRATION_AFTER_2_YEARS, /**< After 2 years */
135 CAL_SCH_EXPIRATION_AFTER_3_YEARS /**< After 3 years */
139 * This enumeration defines lart type.
143 CAL_ALERT_MELODY = 0, /**< alarm type is melody */
144 CAL_ALERT_MUTE, /**< alarm type is mute */
145 CAL_ALERT_INCREASING_MELODY, /**< alarm type is increasing melody */
146 CAL_ALERT_VIBRATION, /**< alarm type is vibrate */
147 CAL_ALERT_VIBRATION_THEN_MELODY, /**< alarm type is vibrate then melody */
148 CAL_ALERT_VIBMELODY, /**< alarm type is melody with vibrate */
149 CAL_ALERT_VIB_INCREASING_MELODY /**< alarm type is increasing melody */
153 * This enumeration defines alarm volume .
157 CAL_SNOOZE_OFF = 0, /**< snoooze is off */
158 CAL_SNOOZE_1MIN, /**< snoooze time is 1 min */
159 CAL_SNOOZE_3MINS, /**< snoooze time is 3 mins */
160 CAL_SNOOZE_5MINS, /**< snoooze time is 5 mins */
161 CAL_SNOOZE_10MINS, /**< snoooze time is 10 mins */
162 CAL_SNOOZE_15MINS /**< snoooze time is 15 mins */
167 * This enumeration defines alarm snooze count .
171 CAL_SNOOZE_0TIME = 0, /**< snoooze count is 0 time */
172 CAL_SNOOZE_1TIME = 1, /**< snoooze count is 1 time */
173 CAL_SNOOZE_2TIMES = 2, /**< snoooze count is 2 times */
174 CAL_SNOOZE_5TIMES = 5, /**< snoooze count is 5 times */
175 CAL_SNOOZE_10TIMES = 10 /**< snoooze count is 10 times */
176 } cal_snooze_count_t;
179 * This enumeration defines attendee's status .
183 CAL_TZ_FLAG_GMT = 0, /**< gmt time */
184 CAL_TZ_FLAG_LOCAL = 1, /**< calendar local time */
188 * This enumeration defines calendar's visibility .
192 PUBLIC_VISIBILITY = 0,
194 CONFIDENTIAL_VISIBILITY
195 } cal_visibility_type_t;
198 * This enumeration defines event attendee's availability .
203 EVENT_BUSY_UNAVAILABLE_FB,
205 EVENT_BUSY_TENTATIVE_FB,
206 } cal_event_availability_type_t;
210 * This enumeration defines event attendee's role .
214 EVENT_ATTENDEE_REQ_PARTICIPANT_ROLE=0,
215 EVENT_ATTENDEE_OPT_PARTICIPANT_ROLE,
216 EVENT_ATTENDEE_NON_PARTICIPANT_ROLE,
217 EVENT_ATTENDEE_CHAIR_ROLE,
218 } cal_event_attendee_role_type_t;
221 * This enumeration defines event attendee's status.
225 EVENT_ATTENDEE_NEEDS_ACTION_AT_STATUS=0,
226 EVENT_ATTENDEE_ACCEPTED_AT_STATUS,
227 EVENT_ATTENDEE_DECLINED_AT_STATUS,
228 EVENT_ATTENDEE_TENTATIVE_AT_STATUS,
229 EVENT_ATTENDEE_DELEGATED_AT_STATUS,
230 EVENT_ATTENDEE_COMPLETED_AT_STATUS,
231 EVENT_ATTENDEE_IN_PROCESS_AT_STATUS
232 } cal_event_attendee_status_type_t;
238 #define EVENT_ATTENDEE_PENDING_AT_STATUS EVENT_ATTENDEE_NEEDS_ACTION_AT_STATUS
241 * This enumeration defines event attendee's type .
245 EVENT_ATTENDEE_INDIVIDUAL_TYPE=0,
246 EVENT_ATTENDEE_GROUP_TYPE,
247 EVENT_ATTENDEE_RESOURCE_TYPE,
248 EVENT_ATTENDEE_ROOM_TYPE,
249 EVENT_ATTENDEE_UNKNOWN_TYPE
250 } cal_event_attendee_type_t;
254 * This enumeration defines CAL_VALUE_INT_PRIORITY .
258 EVENT_PRIORITY_LOW = 0,
259 EVENT_PRIORITY_NORMAL,
261 } cal_priority_type_t;
264 CALS_TODO_PRIORITY_NONE = 0x01,
265 CALS_TODO_PRIORITY_HIGH = 0x02,
266 CALS_TODO_PRIORITY_MID = 0x04,
267 CALS_TODO_PRIORITY_LOW = 0x08,
271 * This enumeration defines status.
272 * (related with CAL_VALUE_INT_TASK_STATUS)
275 #define CALS_STATUS_NONE CALS_EVENT_STATUS_NONE
278 CALS_EVENT_STATUS_NONE = 0x0001,
279 CALS_EVENT_STATUS_TENTATIVE = 0x0002,
280 CALS_EVENT_STATUS_CONFIRMED = 0x0004,
281 CALS_EVENT_STATUS_CANCELLED = 0x0008,
282 CALS_TODO_STATUS_NONE = 0x0100,
283 CALS_TODO_STATUS_NEEDS_ACTION = 0x0200,
284 CALS_TODO_STATUS_IN_PROCESS = 0x0400,
285 CALS_TODO_STATUS_CANCELLED = 0x0800,
286 CALS_TODO_STATUS_COMPLETED = 0x1000,
290 * This enumeration defines calendar type.
291 * (related with CAL_TABLE_INT_STORE_TYPE)
295 CALS_CALENDAR_TYPE_NONE = 0,
296 CALS_CALENDAR_TYPE_EVENT = 1<<0,
297 CALS_CALENDAR_TYPE_TODO = 1<<1,
298 } cals_calendar_store_type;
301 * This enumeration defines todo list ordering type.
305 CALS_TODO_LIST_ORDER_END_DATE = 0,
306 CALS_TODO_LIST_ORDER_PRIORITY,
307 CALS_TODO_LIST_ORDER_STATUS,
308 } cals_todo_list_order_t;
311 * This enumeration defines calendar sensitivity.
312 * (related with CAL_VALUE_INT_SENSITIVITY)
316 CALS_SENSITIVITY_PUBLIC = 0x0,
317 CALS_SENSITIVITY_PRIVATE,
318 CALS_SENSITIVITY_CONFIDENTIAL,
319 } cals_sensitivity_t;
322 * This enumeration defines updated type
323 * (related with CALS_STRUCT_UPDATED_INT_TYPE)
325 enum cals_updated_type {
326 CALS_UPDATED_TYPE_INSERTED = 0x0,
327 CALS_UPDATED_TYPE_MODIFIED,
328 CALS_UPDATED_TYPE_DELETED,
332 * Flags to specify what fields will be searched by search API
335 CALS_SEARCH_FIELD_NONE = 0,
336 CALS_SEARCH_FIELD_SUMMARY = 1<<0,
337 CALS_SEARCH_FIELD_DESCRIPTION = 1<<2,
338 CALS_SEARCH_FIELD_LOCATION = 1<<3,
339 CALS_SEARCH_FIELD_ATTENDEE = 1<<4,
350 * calendar_svc_struct_new's argument
352 #define CAL_STRUCT_TYPE /**< CAL_STRUCT_TYPE */
353 #define CAL_STRUCT_CALENDAR "calendar" /**< CAL_STRUCT_CALENDAR */
354 #define CAL_STRUCT_SCHEDULE "schedule" /**< CAL_STRUCT_SCHEDULE */
355 #define CAL_STRUCT_TODO "todo" /**< CAL_STRUCT_TASK */
356 #define CAL_STRUCT_TIMEZONE "timezone" /**< CAL_STRUCT_TIMEZONE */
357 #define CAL_STRUCT_UPDATED "updated" /**< CAL_STRUCT_UPDATED */
358 #define CALS_STRUCT_PERIOD_NORMAL_ONOFF "period_normal_onoff"
359 #define CALS_STRUCT_PERIOD_ALLDAY_ONOFF "period_allday_onoff"
360 #define CALS_STRUCT_PERIOD_NORMAL_BASIC "period_normal_basic"
361 #define CALS_STRUCT_PERIOD_ALLDAY_BASIC "period_allday_basic"
362 #define CALS_STRUCT_PERIOD_NORMAL_OSP "period_normal_osp"
363 #define CALS_STRUCT_PERIOD_ALLDAY_OSP "period_allday_osp"
364 #define CALS_STRUCT_PERIOD_NORMAL_LOCATION "period_normal_location"
365 #define CALS_STRUCT_PERIOD_ALLDAY_LOCATION "period_allday_location"
366 #define CALS_STRUCT_PERIOD_NORMAL_ALARM "period_normal_alarm"
368 // id for all data read
369 #define ALL_ACCOUNT_ID 0
370 #define ALL_CALENDAR_ID 0
372 // id for all data without visibility false
373 #define ALL_VISIBILITY_ACCOUNT -2
375 // id for local data read
376 #define LOCAL_ACCOUNT_ID -1
377 #define LOCAL_ALL_CALENDAR -1
379 /* start deprecated */
380 #define DEFAULT_CALENDAR_ID 1
381 /* end deprecated, replace DEFAULT_EVENT_CALENDAR_ID */
383 #define DEFAULT_EVENT_CALENDAR_ID 1
384 #define DEFAULT_TODO_CALENDAR_ID 2
386 // added val 2012.07.30
387 #define CALS_TODO_NO_DUE_DATE INT64_MAX
397 * calendar_svc_struct_xxx()'s argument
399 #define CAL_TABLE_INT_INDEX "index"
400 #define CAL_TABLE_TXT_CALENDAR_ID "calendar_id"
401 #define CAL_TABLE_TXT_UID "uid"
402 #define CAL_TABLE_TXT_LINK "link"
403 #define CAL_TABLE_INT_UPDATED "updated"
404 #define CAL_TABLE_TXT_NAME "name"
405 #define CAL_TABLE_TXT_DESCRIPTION "description"
406 #define CAL_TABLE_TXT_AUTHOR "author"
407 #define CAL_TABLE_TXT_COLOR "color"
408 #define CAL_TABLE_INT_HIDDEN "hidden"
409 #define CAL_TABLE_INT_SELECTED "selected"
410 #define CAL_TABLE_TXT_LOCATION "location"
411 #define CAL_TABLE_INT_LOCALE "locale"
412 #define CAL_TABLE_INT_COUNTRY "country"
413 #define CAL_TABLE_INT_TIME_ZONE "time_zone"
414 #define CAL_TABLE_TXT_TIME_ZONE_LABEL "timezone_label"
415 #define CAL_TABLE_INT_DISPLAY_ALL_TIMEZONES "display_all_timezones"
416 #define CAL_TABLE_INT_DATE_FIELD_ORDER "date_field_order"
417 #define CAL_TABLE_INT_FROMAT_24HOUR_TIME "format_24hour_time"
418 #define CAL_TABLE_INT_WEEK_START "week_start"
419 #define CAL_TABLE_INT_DEFAULT_CAL_MODE "default_cal_mode"
420 #define CAL_TABLE_INT_CUSTOM_CAL_MODE "custom_cal_mode"
421 #define CAL_TABLE_TXT_USER_LOCATION "user_location"
422 #define CAL_TABLE_TXT_WEATHER "weather"
423 #define CAL_TABLE_INT_SHOW_DECLINED_EVENTS "show_declined_events"
424 #define CAL_TABLE_INT_HIDE_INVITATIONS "hide_invitations"
425 #define CAL_TABLE_INT_ALTERNATE_CALENDAR "alternate_calendar"
426 #define CAL_TABLE_INT_VISIBILITY "visibility"
427 #define CAL_TABLE_INT_PROJECTION "projection"
428 #define CAL_TABLE_INT_SEQUENCE "sequence"
429 #define CAL_TABLE_INT_SUPRESS_REPLY_NOTIFICATIONS "suppress_reply_notifications"
430 #define CAL_TABLE_INT_SYNC_EVENT "sync_event"
431 #define CAL_TABLE_INT_TIMES_CLEANED "times_cleaned"
432 #define CAL_TABLE_INT_GUESTS_CAN_MODIFY "guests_can_modify"
433 #define CAL_TABLE_INT_GUESTS_CAN_INVITE_OTHERS "guests_can_invite_others"
434 #define CAL_TABLE_INT_GUESTS_CAN_SEE_GUESTS "guests_can_see_guests"
435 #define CAL_TABLE_INT_ACCESS_LEVEL "access_level"
436 #define CAL_TABLE_INT_SYNC_STATUS "sync_status"
437 #define CAL_TABLE_INT_IS_DELETED "is_deleted"
438 #define CAL_TABLE_INT_ACCOUNT_ID "account_id"
439 #define CAL_TABLE_INT_SENSITIVITY "sensitivity"
440 #define CAL_TABLE_INT_STORE_TYPE "store_type" /**< #cals_calendar_store_type */
450 * calendar_svc_struct_xxx()'s argument
452 #define CALS_STRUCT_UPDATED_INT_VERSION "version" /**< Version of schedule */
453 #define CALS_STRUCT_UPDATED_INT_TYPE "updated_type" /**< Type of schedule update #cals_updated_type */
454 #define CALS_STRUCT_UPDATED_INT_ID "updated_id" /**< id of updated schedule */
465 * calendar_svc_struct_xxx()'s argument
467 #define CAL_VALUE_INT_INDEX "id" /**< Record index */
468 #define CAL_VALUE_INT_ACCOUNT_ID "account_id" /**< account id */
469 #define CAL_VALUE_INT_TYPE "type" /**< Calendar component type */
470 #define CAL_VALUE_TXT_CATEGORIES "categories" /**< Category of schedule */
471 #define CAL_VALUE_TXT_EXDATE "exdate" /**< Exdate */
472 #define CAL_VALUE_TXT_SUMMARY "summary" /**< Summary, appointment, task: subject, birthday:Name */
473 #define CAL_VALUE_TXT_DESCRIPTION "description" /**< Description,appointment, task: description, anniversary,holiday:occasion*/
474 #define CAL_VALUE_TXT_LOCATION "location" /**< Location */
475 #define CAL_VALUE_INT_MISSED "missed" /**< Miss alarm flag */
476 #define CAL_VALUE_INT_TASK_STATUS "task_status" /**< current task status #cals_status_t */
477 #define CAL_VALUE_INT_PRIORITY "priority" /**< Priority */
478 #define CAL_VALUE_INT_TIMEZONE "timezone" /**< deprecated - timezone of task */
479 #define CAL_VALUE_INT_FILE_ID "file_id" /**< file id for attach or alarm tone*/
480 #define CAL_VALUE_INT_CONTACT_ID "contact_id" /**< contact id for birthday in contact list */
481 #define CAL_VALUE_INT_BUSY_STATUS "busy_status" /**< ACS, G : Flag of busy or not */
482 #define CAL_VALUE_INT_SENSITIVITY "sensitivity" /**< iCal:CLASS #cals_sensitivity_t */
483 #define CAL_VALUE_TXT_UID "uid" /**< ACS, G : Unique ID of the meeting item */
484 #define CAL_VALUE_INT_CALENDAR_TYPE "calendar_type" /**< ACS, G : Type(all,phone,google) of calendar */
485 #define CAL_VALUE_TXT_ORGANIZER_NAME "organizer_name" /**< ACS, G : Name of organizer(author) */
486 #define CAL_VALUE_TXT_ORGANIZER_EMAIL "organizer_email" /**< ACS, G : Email of organizer */
487 #define CAL_VALUE_INT_MEETING_STATUS "meeting_status" /**< ACS, G : The status of the meeting. */
488 #define CAL_VALUE_TXT_GCAL_ID "gcal_id" /**< G : Server id of calendar */
489 #define CAL_VALUE_INT_DELETED "deleted" /**< G : Flag for deleted */
490 #define CAL_VALUE_TXT_UPDATED "updated" /**< G : Updated time stamp */
491 #define CAL_VALUE_INT_LOCATION_TYPE "location_type" /**< G : Location type */
492 #define CAL_VALUE_TXT_LOCATION_SUMMARY "location_summary" /**< G : A simple string value that can be used as a representation of this location */
493 #define CAL_VALUE_TXT_ETAG "etag" /**< G : ETAG of this event */
494 #define CAL_VALUE_INT_CALENDAR_ID "calendar_id" /**< G : id to map from calendar table */
495 #define CAL_VALUE_INT_SYNC_STATUS "sync_status" /**< G : Indication for event entry whether added/ modified/ deleted */
496 #define CAL_VALUE_TXT_EDIT_URL "edit_uri" /**< G : EditUri for google calendar */
497 #define CAL_VALUE_TXT_GEDERID "gevent_id" /**< G : Server id of an event */
498 #define CAL_VALUE_INT_DST "dst" /**< dst of event */
499 #define CAL_VALUE_INT_ORIGINAL_EVENT_ID "original_event_id" /**< original event id for recurrency exception */
500 #define CAL_VALUE_INT_CALENDAR_INDEX "calendar_index" /**< specific calendar id - will be remove */
501 #define CAL_VALUE_DBL_LATITUDE "latitude" /**< latitude */
502 #define CAL_VALUE_DBL_LONGITUDE "longitude" /**< longitude */
503 #define CAL_VALUE_INT_EMAIL_ID "email_id" /**< email id */
504 #define CAL_VALUE_INT_AVAILABILITY "availability"
505 #define CAL_VALUE_LLI_CREATED_TIME "created_time"
506 #define CAL_VALUE_LLI_COMPLETED_TIME "completed_time"
507 #define CAL_VALUE_INT_PROGRESS "progress"
508 #define CAL_VALUE_INT_IS_DELETED "is_deleted"/**< In deleting action, this is set 1 and will be deleted after sync */
510 #define CAL_VALUE_INT_CAL_TYPE "cal_type" /**< deprecated */
521 * attendee cal_value's detail field
523 #define CAL_VALUE_LST_ATTENDEE_LIST "attendee_list" /**< attendee's detail information set */
524 #define CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME "attendee_name" /**< attendee_name */
525 #define CAL_VALUE_TXT_ATTENDEE_DETAIL_EMAIL "attendee_email" /**< attendee_email */
526 #define CAL_VALUE_TXT_ATTENDEE_DETAIL_NUMBER "attendee_number" /**< attendee_email */
527 #define CAL_VALUE_INT_ATTENDEE_DETAIL_STATUS "attendee_status" /**< #cal_event_attendee_status_type_t */
528 #define CAL_VALUE_INT_ATTENDEE_DETAIL_TYPE "attendee_type" /**< #cal_event_attendee_type_t */
529 #define CAL_VALUE_INT_ATTENDEE_DETAIL_CT_INDEX "attendee_ct_index" /**< contact db index for reference */
530 #define CAL_VALUE_INT_ATTENDEE_ROLE "attendee_role" /**< #cal_event_attendee_role_type_t */
531 #define CAL_VALUE_INT_ATTENDEE_RSVP "attendee_rsvp"
532 #define CAL_VALUE_TXT_ATTENDEE_GROUP "attendee_group"
533 #define CAL_VALUE_TXT_ATTENDEE_DELEGATOR_URI "attendee_delegator_uri"
534 #define CAL_VALUE_TXT_ATTENDEE_DELEGATE_URI "attendee_delegate_uri"
535 #define CAL_VALUE_TXT_ATTENDEE_UID "attendee_uid"
541 #define CAL_VALUE_LST_ALARM "alarm" /**< exception's detail information set */
542 #define CAL_VALUE_LLI_ALARMS_TIME "alarm_time" /**< alarm time */
543 #define CAL_VALUE_INT_ALARMS_TICK "remind_tick" /**< Alarms before remindTick */
544 #define CAL_VALUE_INT_ALARMS_TICK_UNIT "remind_tick_unit" /**< Remind tick unit */
545 #define CAL_VALUE_TXT_ALARMS_TONE "alarm_tone" /**< Alert Sound File Name */
546 #define CAL_VALUE_TXT_ALARMS_DESCRIPTION "alarm_description" /**< Alert description */
547 #define CAL_VALUE_INT_ALARMS_TYPE "alarm_type" /**< Alert type(see 'cal_alert_type_t') */
548 #define CAL_VALUE_INT_ALARMS_ID "alarm_id" /**< Alarm id */
560 * delete flag in detail list
563 #define CAL_VALUE_INT_DETAIL_DELETE "is_deleted" /**< delete setting in detail list*/
575 * calendar_svc_value_xxx()'s argument for timezone
577 /* type for timezone information save */
579 #define CAL_TZ_VALUE_INT_INDEX "index"
580 #define CAL_TZ_VALUE_INT_TZ_OFFSET "tz_offset_from_gmt"
582 #define CAL_TZ_VALUE_TXT_STD_NAME "standard_name"
583 #define CAL_TZ_VALUE_INT_STD_START_MONTH "std_start_month"
584 #define CAL_TZ_VALUE_INT_STD_START_POSITION_OF_WEEK "std_start_position_of_week"
585 #define CAL_TZ_VALUE_INT_STD_START_DAY "std_start_day"
586 #define CAL_TZ_VALUE_INT_STD_START_HOUR "std_start_hour"
587 #define CAL_TZ_VALUE_INT_STD_BIAS "standard_bias"
589 #define CAL_TZ_VALUE_TXT_DST_NAME "day_light_name"
590 #define CAL_TZ_VALUE_INT_DST_START_MONTH "day_light_start_month"
591 #define CAL_TZ_VALUE_INT_DST_START_POSITION_OF_WEEK "day_light_start_position_of_week"
592 #define CAL_TZ_VALUE_INT_DST_START_DAY "day_light_start_day"
593 #define CAL_TZ_VALUE_INT_DST_START_HOUR "day_light_start_hour"
594 #define CAL_TZ_VALUE_INT_DST_BIAS "day_light_bias"
603 * @ingroup CALENDAR_SVC
604 * @defgroup service_management service_management
606 * calendar service module management
610 * @fn int calendar_svc_connect(void);
611 * This function opens database,it is must be called before other data operaion.
613 * @ingroup service_management
614 * @return This function returns CAL_SUCCESS or error code on failure.
618 * @post calendar_svc_close() should be called when leave.
620 #include <calendar-svc-provider.h>
623 //connect to database
624 calendar_svc_connect();
626 //..do some operation to database
629 calendar_svc_close();
632 * @see calendar_svc_close().
634 int calendar_svc_connect(void);
637 * @fn int calendar_svc_close(void);
638 * This function closes database,it is must be called when leave.
640 * @ingroup service_management
641 * @return This function returns CAL_SUCCESS or error code on failure.
644 * @pre the database connected
647 #include <calendar-svc-provider.h>
650 //connect to database
651 calendar_svc_connect();
653 //..do some operation to database
656 calendar_svc_close();
659 * @see calendar_svc_connect().
661 int calendar_svc_close(void);
664 * @fn int calendar_svc_begin_trans(void);
665 * This function start db transaction,it is coninient for user do many operaion once.
667 * @ingroup service_management
668 * @return This function returns CAL_SUCCESS or error code on failure.
671 * @pre database connected
672 * @post calendar_svc_end_trans() should be called when leave
674 #include <calendar-svc-provider.h>
677 //connect to database
678 calendar_svc_connect();
681 calendar_svc_begin_trans();
683 //..do some operation to database
686 calendar_svc_end_trans();
689 calendar_svc_close();
693 * @see calendar_svc_end_trans().
695 int calendar_svc_begin_trans(void);
698 * @fn int calendar_svc_end_trans(bool is_success);
699 * This function finishes database transaction of calendar service.
700 * If it returns error, the transaction has been rollbacked.
701 * When transction is success, it returns the last contacts version.
703 * @ingroup service_management
704 * @param[in] is_success Commit changes if #true. Otherwise, no changes will be made on the database.
705 * @return CAL_SUCCESS or the last calendar version(when success) on success,
706 * Negative value(#cal_error) on error
709 * @pre database connected and calendar_svc_begin_trans() is called.
712 #include <calendar-svc-provider.h>
715 //connect to database
716 calendar_svc_connect();
719 calendar_svc_begin_trans();
721 //..do some operation to database
724 calendar_svc_end_trans(true);
727 calendar_svc_close();
731 * @see calendar_svc_begin_trans().
733 int calendar_svc_end_trans(bool is_success);
737 * @fn int calendar_svc_subscribe_db_change (const char *data_type,void(*cb)(void *), void *user_data);
738 * This function registers callback function in receiver,it is convenient for user receive noti from database.
740 * @ingroup service_management
741 * @param[in] datatype for subscribe detail db change
742 * @param[in] cb Fuction pointer of calendar notification callback
743 * @param[in] user_data when cb function is called, user_data will be passed.
744 * @return This function returns CAL_SUCCESS or error code on failure.
747 * @pre database connected
750 #include <calendar-svc-provider.h>
753 int received_cb (void *user_data)
755 if(NULL != user_data)
757 printf("enter received_cb:%s\n",(char*)user_data);
764 calendar_svc_connect();
766 char* user_data = "Get a noti!\n";
767 calendar_svc_subscribe_db_change (CAL_STRUCT_SCHEDULE,received_cb, user_data);
769 GMainLoop* loop = g_main_loop_new(NULL,TRUE);
772 calendar_svc_close();
775 * @see calendar_svc_unsubscribe_db_change().
777 int calendar_svc_subscribe_db_change (const char *data_type,void(*cb)(void *), void *user_data);
780 int calendar_svc_subscribe_change (void(*cb)(void *), void *user_data);
784 * @fn int calendar_svc_unsubscribe_db_change (const char *data_type,void(*cb)(void *));
785 * This function deregisters callback function in receiver,it is convenient for user unscribe some receive noti from database.
787 * @ingroup service_management
788 * @param[in] datatype for subscribe detail db change
789 * @param[in] cb Fuction pointer of calendar notification callback
790 * @return This function returns CAL_SUCCESS or error code on failure.
793 * @pre calendar_svc_subscribe_change called
796 #include <calendar-svc-provider.h>
798 int received_cb (void *user_data)
800 if(NULL != user_data)
802 printf("enter received_cb:%s\n",(char*)user_data);
809 calendar_svc_connect();
811 char* user_data = "Get a noti!\n";
812 calendar_svc_unsubscribe_db_change (CAL_STRUCT_SCHEDULE,received_cb, user_data);
814 cal_struct * event = calendar_svc_struct_new(CAL_STRUCT_SCHEDULE);
815 calendar_svc_insert(event);
817 GMainLoop* loop = g_main_loop_new(NULL,TRUE);
818 g_main_loop_run(loop);
823 calendar_svc_close();
824 calendar_svc_unsubscribe_db_change (CAL_STRUCT_SCHEDULE,received_cb);
827 * @see calendar_svc_subscribe_change().
829 int calendar_svc_unsubscribe_db_change (const char *data_type,void(*cb)(void *));
832 int calendar_svc_unsubscribe_change (void(*cb)(void *));
837 * @defgroup event_management event_management
838 * @ingroup CALENDAR_SVC
840 * major data access api
845 * @fn int calendar_svc_insert(cal_struct *record);
846 * This function insert records to database,user can save event through calling it.
848 * @ingroup event_management
849 * @param[in] record calendar data for add
850 * @return This function returns CAL_SUCCESS or error code on failure.
852 * @remarks event should .
853 * @pre database connected
856 #include <calendar-svc-provider.h>
859 //connect to database
860 calendar_svc_connect();
862 //create the variable
863 cal_struct* event = calendar_svc_struct_new("schedule");
866 calendar_svc_insert(event);
869 calendar_svc_close();
872 * @see detail_management module
874 int calendar_svc_insert(cal_struct *record);
879 * @fn int calendar_svc_update(cal_struct *record);
880 * This function updates record to database,it is convenient for user to update some record.
882 * @ingroup event_management
883 * @return This function returns CAL_SUCCESS or error code on failure.
884 * @param[in] record calendar data for update
885 * @return This function returns CAL_SUCCESS or error code on failure.
888 * @pre database connected
891 #include <calendar-svc-provider.h>
894 cal_struct* event = NULL;
897 //connect to database
898 calendar_svc_connect();
900 //get the record whose index is 1
901 calendar_svc_get("schedule",index,NULL,&event);
904 calendar_svc_struct_set_str(event,"summary","weekend");
907 calendar_svc_update(event);
910 calendar_svc_free(&evnet);
913 calendar_svc_close();
916 * @see detail_management module
918 int calendar_svc_update(cal_struct *record);
921 * @fn int calendar_svc_delete(const char *data_type,int index);
922 * This function delete records from database,it is convenient for user to delete some record.
924 * @ingroup event_management
925 * @return This function returns CAL_SUCCESS or error code on failure.
926 * @param[in] data_type sepecific record type
927 * @param[in] index event db index
928 * @return This function returns CAL_SUCCESS or error code on failure.
931 * @pre database connected
934 #include <calendar-svc-provider.h>
939 //connect to database
940 calendar_svc_connect();
942 //delete the record whose index is 1
943 calendar_svc_delete("schedule",index);
946 calendar_svc_free(&evnet);
949 calendar_svc_close();
952 * @see detail_management module
954 int calendar_svc_delete(const char *data_type,int index);
957 * @fn int calendar_svc_delete_all(int account_id,const char *data_type);
958 * This function delete all records from database,it is convenient for user to delete all of records.
959 * local account deletes data immediately but the others set is_deleted parameter 1.
961 * @ingroup event_management
962 * @return This function returns CAL_SUCCESS or error code on failure.
963 * @param[in] account_id account db index
964 * @param[in] data_type detail data type(eg. CAL_STRUCT_CALENDAR,CAL_STRUCT_SCHEDULE, NULL), if null delete all data by account_id
965 * @return This function returns CAL_SUCCESS or error code on failure.
968 * @pre database connected
971 #include <calendar-svc-provider.h>
974 //connect to database
975 calendar_svc_connect();
977 //delete the all records of schudule_table
978 calendar_svc_delete_all(0,"schedule");
981 calendar_svc_close();
984 * @see detail_management module
986 int calendar_svc_delete_all(int account_id,const char *data_type);
989 * @fn int calendar_svc_delete_account(int account_id);
990 * This function delete all records from database,it is convenient for user to delete all of records according to account.
991 * local account deletes data immediately but the others set is_deleted parameter 1.
993 * @ingroup event_management
994 * @return This function returns CAL_SUCCESS or error code on failure.
995 * @param[in] account_id account db index
996 * @return This function returns CAL_SUCCESS or error code on failure.
999 * @pre database connected
1002 #include <calendar-svc-provider.h>
1005 //connect to database
1006 calendar_svc_connect();
1008 //delete the all records of schudule_table
1009 calendar_svc_delete_account(0);
1012 calendar_svc_close();
1015 * @see detail_management module
1018 int calendar_svc_delete_account(int account_id);
1022 * @fn int calendar_svc_clean_after_sync(int calendar_id);
1023 * This function clean deleted(marked) all records from database,which is used to remove data from database after sync operation.
1025 * @ingroup event_management
1026 * @return This function returns CAL_SUCCESS or error code on failure.
1027 * @param[in] account_id calendar id
1028 * @return This function returns CAL_SUCCESS or error code on failure.
1031 * @pre database connected
1034 #include <calendar-svc-provider.h>
1037 //connect to database
1038 calendar_svc_connect();
1040 //delete the all records from schudule_table
1041 calendar_svc_clean_after_sync(0);
1044 calendar_svc_close();
1047 * @see detail_management module
1050 int calendar_svc_clean_after_sync(int calendar_id);
1053 * @fn int calendar_svc_get(const char *data_type,int index,const char *field_list, cal_struct **record);
1054 * This function get records from database,user can get event from database through calling it.
1056 * @ingroup event_management
1057 * @return This function returns inserted contact id or error code on failure.
1058 * @param[in] data_type sepecific record type
1059 * @param[in] index db index
1060 * @param[in] field_list specific field list(eg. "summary,description"), if NULL, all field is returned.
1061 * @param[out] record calendar data , it should be free by calendar_svc_struct_free
1062 * @return This function returns CAL_SUCCESS or error code on failure.
1064 * @remarks event should .
1065 * @pre database connected
1068 #include <calendar-svc-provider.h>
1072 cal_struct* event = NULL;
1074 //connect to database
1075 calendar_svc_connect();
1077 //get the record whose index is 1
1078 calendar_svc_get("schedule",index,NULL, &event);
1081 calendar_svc_struct_free(&event);
1084 calendar_svc_close();
1087 * @see detail_management module
1089 int calendar_svc_get(const char *data_type,int index,const char *field_list, cal_struct **record);
1092 * @fn int calendar_svc_get_count(int account_id,int calendar_id,const char *data_type);
1093 * This function get count of records from database,user can get the count through calling it.
1095 * @ingroup event_management
1096 * @return Integer value, or 0 if no value is obtained
1097 * @param[in] account_id account db index
1098 * @param[in] calendar_id calendar id(will be support phase 2)
1099 * @param[in] data_type data_type(CAL_STRUCT_CALENDAR or CAL_STRUCT_SCHEDULE)
1100 * @return This function returns CAL_SUCCESS or error code on failure.
1102 * @remarks event should .
1103 * @pre database connected
1106 #include <calendar-svc-provider.h>
1111 //connect to database
1112 calendar_svc_connect();
1114 //get the count of all
1115 count = calendar_svc_get_count(0,0,"shchedule");
1118 calendar_svc_close();
1121 * @see detail_management module
1123 int calendar_svc_get_count(int account_id,int calendar_id,const char *data_type);
1125 int calendar_svc_calendar_get_count(int account_id);
1126 int calendar_svc_event_get_count(int calendar_id);
1127 int calendar_svc_todo_get_count(int calendar_id);
1130 * @fn int calendar_svc_get_all(int account_id,int calendar_id,const char *data_type, cal_iter **iter);
1131 * This function get all records from database,it is convenient for user to get all of the reocrds once.
1133 * @ingroup event_management
1134 * @return This function returns CAL_SUCCESS or error code on failure.
1135 * @param[in] account_id account db index
1136 * @param[in] calendar_id calendar id. If account_id is set, the account_id will be ignore.
1137 * @param[in] data_type data_type(CAL_STRUCT_CALENDAR or CAL_STRUCT_SCHEDULE)
1138 * @param[out] iter calendar data
1139 * @return This function returns CAL_SUCCESS or error code on failure.
1141 * @remarks event should .
1142 * @pre database connected
1143 * @post call calendar_svc_iter_remove() when leave
1145 #include <calendar-svc-provider.h>
1148 cal_iter *iter = NULL;
1150 //connect to database
1151 calendar_svc_connect();
1154 calendar_svc_get_all(0,0,"schedule", &iter);
1157 calendar_svc_iter_remove(&iter);
1160 calendar_svc_close();
1163 * @see detail_management module
1165 int calendar_svc_get_all(int account_id,int calendar_id,const char *data_type, cal_iter **iter);
1168 * @fn int calendar_svc_event_get_changes(int calendar_id, int version, cal_iter **iter);
1169 * This function provides the iterator to get all changes later than the version.
1171 * @ingroup event_management
1172 * @return This function returns CAL_SUCCESS or error code on failure.
1173 * @param[in] calendar_id calendar ID
1174 * @param[in] version version number
1175 * @param[out] iter interation struct for list travel
1176 * @return This function returns CAL_SUCCESS or error code on failure.
1179 * @pre database connected
1182 #include <calendar-svc-provider.h>
1191 calendar_svc_event_get_changes(1, 0, &it);
1193 while (calendar_svc_iter_next(it) == CAL_SUCCESS) {
1195 ret = calendar_svc_iter_get_info(it, &cs);
1196 if (ret != CAL_SUCCESS) {
1197 printf("calendar_svc_iter_get_info failed (%d)\n", ret);
1200 id = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_ID);
1201 type = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_TYPE);
1202 ver = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_VERSION);
1203 printf("type = %d id = %d ver = %d\n", id, type, ver);
1204 calendar_svc_struct_free(&cs);
1206 calendar_svc_iter_remove(&it);
1209 * @see detail_management module
1211 int calendar_svc_event_get_changes(int calendar_id, int version, cal_iter **iter);
1214 * @fn int calendar_svc_todo_get_changes(int calendar_id, int version, cal_iter **iter);
1215 * This function provides the iterator to get all changes later than the version.
1217 * @ingroup event_management
1218 * @return This function returns CAL_SUCCESS or error code on failure.
1219 * @param[in] calendar_id calendar ID
1220 * @param[in] version version number
1221 * @param[out] iter interation struct for list travel
1222 * @return This function returns CAL_SUCCESS or error code on failure.
1225 * @pre database connected
1228 #include <calendar-svc-provider.h>
1237 calendar_svc_todo_get_changes(1, 0, &it);
1239 while (calendar_svc_iter_next(it) == CAL_SUCCESS) {
1241 ret = calendar_svc_iter_get_info(it, &cs);
1242 if (ret != CAL_SUCCESS) {
1243 printf("calendar_svc_iter_get_info failed (%d)\n", ret);
1246 id = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_ID);
1247 type = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_TYPE);
1248 ver = calendar_svc_struct_get_int(cs, CALS_STRUCT_UPDATED_INT_VERSION);
1249 printf("type = %d id = %d ver = %d\n", id, type, ver);
1250 calendar_svc_struct_free(&cs);
1252 calendar_svc_iter_remove(&it);
1255 * @see detail_management module
1257 int calendar_svc_todo_get_changes(int calendar_id, int version, cal_iter **iter);
1259 int calendar_svc_convert_id_to_uid(const char *data_type,int index,char **uid);
1262 * @fn int calendar_svc_iter_get_info(cal_iter *iter, cal_struct **row_record);
1263 * This function get cal_value by cal_iter,it is convenient for user to get event from iter.
1265 * @ingroup event_management
1266 * @return This function returns CAL_SUCCESS or error code on failure.
1267 * @param[in] iter interation struct for list travel
1268 * @param[out] row_record detail information
1270 * @remarks row_record should be free with calendar_svc_struct_free
1271 * @pre database connected
1274 #include <calendar-svc-provider.h>
1277 cal_iter *iter = NULL;
1278 cal_struct* evnet = NULL;
1280 //connect to database
1281 calendar_svc_connect();
1284 calendar_svc_get_all(0,0,"schedule", &iter);
1287 calendar_svc_iter_get_info(iter, &event);
1290 calendar_svc_iter_remove(&iter);
1293 calendar_svc_close();
1296 * @see detail_management module
1298 int calendar_svc_iter_get_info(cal_iter *iter, cal_struct **row_record);
1302 * @fn int calendar_svc_iter_next(cal_iter *iter);
1303 * This function get cal_value by cal_iter,it is convenient for user to get record one by one.
1305 * @ingroup event_management
1306 * @return This function returns CAL_SUCCESS or error code on failure.
1307 * @param[in] iter interation struct for list travel
1310 * @pre database connected
1313 #include <calendar-svc-provider.h>
1316 cal_iter *iter = NULL;
1317 cal_struct* evnet = NULL;
1319 //connect to database
1320 calendar_svc_connect();
1323 calendar_svc_get_all(0,0,"schedule", &iter);
1326 calendar_svc_iter_get_info(iter, &event);
1329 calendar_svc_iter_next(iter);
1330 calendar_svc_iter_get_info(iter, &event);
1333 calendar_svc_iter_remove(&iter);
1336 calendar_svc_close();
1339 * @see detail_management module
1341 int calendar_svc_iter_next(cal_iter *iter);
1345 * @fn int calendar_svc_iter_remove(cal_iter **iter);
1346 * This function remove db iteration struct,it is convenient for user to avoid memory leak.
1348 * @ingroup event_management
1349 * @return This function returns CAL_SUCCESS or error code on failure.
1350 * @param[in] iter interation struct for list travel
1353 * @pre database connected
1356 #include <calendar-svc-provider.h>
1359 cal_iter *iter = NULL;
1361 //connect to database
1362 calendar_svc_connect();
1365 calendar_svc_get_all(0,0,"schedule", &iter);
1368 calendar_svc_iter_remove(&iter);
1371 calendar_svc_close();
1374 * @see detail_management module
1376 int calendar_svc_iter_remove(cal_iter **iter);
1379 * @defgroup detail_management detail_management
1380 * @ingroup CALENDAR_SVC
1382 * deatil field access api
1387 * @fn cal_struct * calendar_svc_struct_new(const char *data_type);
1388 * This function alloc calendar struct,it is convenient for user to create an event.
1390 * @ingroup detail_management
1391 * @return This function returns allocated event struct
1392 * @param[in] data_type (eg.CAL_EVENT_TYPE_SCHEDULE,CAL_EVENT_TYPE_CALENDAR..)
1394 * @remarks it should be free with calendar_svc_struct_free
1395 * @pre cal_struct variable is defined.
1399 #include <calendar_svc_provider.h>
1402 //connect to database
1403 calendar_svc_connect();
1406 cal_struct * event = calendar_svc_struct_new("schedule");
1409 calendar_svc_struct_free(&event);
1411 //close the database
1412 calendar_svc_close();
1415 * @see calendar_svc_struct_free().
1417 cal_struct * calendar_svc_struct_new(const char *data_type);
1420 * @fn int calendar_svc_struct_free(cal_struct **record);
1421 * This function is used to free space malloced to cal_struct variable,it is convenient for user to avoid memory leak when using cal_struct.
1423 * @ingroup detail_management
1424 * @param[in] record Point to alloced address
1425 * @return This function returns CAL_SUCCESS or error code on failure.
1426 * @pre cal_struct variable is defined.
1430 #include <calendar_svc_provider.h>
1433 //connect to database
1434 calendar_svc_connect();
1437 cal_struct * event = calendar_svc_struct_new("schedule");
1440 calendar_svc_struct_free(&event);
1442 //close the database
1443 calendar_svc_close();
1446 * @see common, CAL_STRUCT_TYPE , calendar_svc_struct_new.
1448 int calendar_svc_struct_free(cal_struct **record);
1452 * @fn int calendar_svc_struct_get_str(cal_struct* record, const char* field);
1453 * This function gets the point of string value of the calendar service value,it is convenient for user get the value needed without knowing the detail of the struct.
1455 * @ingroup detail_management
1456 * @param[in] record Point to The calendar struct
1457 * @param[in] field The index of the string value in calendar service value.
1458 * @return string value(should not be freed), or NULL if no value is obtained
1459 * @remarks if parent cal_struct is destroyed, return string is not valid.
1460 * @pre cal_struct varibale is defined.
1463 #include <calendar-svc-provider.h>
1466 char* summary = NULL;
1468 cal_struct* event = NULL;
1470 //connect to database
1471 calendar_svc_connect();
1474 calendar_svc_get("schedule",index,NULL,&event);
1477 summary = calendar_svc_struct_get_str(event,CAL_VALUE_TXT_SUMMARY);
1480 calendar_svc_free(&event);
1483 calendar_svc_close();
1486 * @see calendar_svc_struct_set_str().
1488 char *calendar_svc_struct_get_str(cal_struct* record, const char *field);
1491 * @fn int calendar_svc_struct_get_int(cal_struct* record, const char* field);
1492 * This function gets Integer value of the calendar service value,it is convenient for user get the value needed without knowing the detail of the struct.
1494 * @ingroup detail_management
1495 * @param[in] record Point to The calendar struct
1496 * @param[in] field The index of the integer value in calendar service value.
1497 * @return Integer value, or 0 if no value is obtained
1499 * @pre cal_struct varibale is defined.
1502 #include <calendar-svc-provider.h>
1507 cal_struct* event = NULL;
1509 //connect to database
1510 calendar_svc_connect();
1513 calendar_svc_get("schedule",index,NULL,&event);
1516 account_id = calendar_svc_struct_get_int(event,CAL_VALUE_INT_ACCOUNT_ID);
1519 calendar_svc_free(&event);
1522 calendar_svc_close();
1525 * @see calendar_svc_struct_set_int().
1527 int calendar_svc_struct_get_int(cal_struct* record, const char *field);
1531 * @fn double calendar_svc_struct_get_double(cal_struct* record, const char* field);
1532 * This function gets double value of the calendar service value,it is convenient for user get the value needed without knowing the detail of the struct.
1534 * @ingroup detail_management
1535 * @param[in] record Point to The calendar struct
1536 * @param[in] field The index of the integer value in calendar service value.
1537 * @return double value, or 0.0 if no value is obtained
1539 * @pre cal_struct varibale is defined.
1542 #include <calendar-svc-provider.h>
1545 double latitude = 0.0;
1547 cal_struct* event = NULL;
1549 //connect to database
1550 calendar_svc_connect();
1553 calendar_svc_get("schedule",index,NULL,&event);
1555 //get the double value
1556 latitude = calendar_svc_struct_get_double(event,CAL_VALUE_DBL_LATITUDE);
1559 calendar_svc_free(&event);
1562 calendar_svc_close();
1565 * @see calendar_svc_struct_set_double().
1567 double calendar_svc_struct_get_double(cal_struct* record, const char *field);
1571 * @fn int calendar_svc_struct_set_double(cal_struct* record, const char* field,double value);
1572 * This function sets double value of the calendar service value,it is convenient for user set the value without knowing the detail of the struct.
1574 * @ingroup detail_management
1575 * @param[in] record Point to The calendar struct
1576 * @param[in] field The index of the integer value in calendar service value.
1577 * @param[in] value The dobule value to be set.
1578 * @return Integer value, or 0 if no value is obtained
1580 * @pre cal_struct variable is defined.
1581 * @post the corresponding value of cal_struct is set.
1583 #include <calendar-svc-provider.h>
1586 double latitude = 3.14;
1588 cal_struct* event = NULL;
1590 //connect to database
1591 calendar_svc_connect();
1593 //create a cal_struct variable
1594 event = calendar_svc_struct_new("schedule");
1596 //set the double value
1597 calendar_svc_set_double(event,CAL_VALUE_DBL_LATITUDE,latitude);
1600 index = calendar_svc_insert(event);
1603 calendar_svc_struct_free(&event);
1606 calendar_svc_close();
1609 * @see calendar_svc_struct_get_double().
1611 int calendar_svc_struct_set_double(cal_struct* record, const char *field,double value);
1615 * @fn int calendar_svc_struct_set_int(cal_struct* record, const char* field, int intval);
1616 * This function sets integer value to the calendar service value,it is convenient for user set the value without knowing the detail of the struct.
1618 * @ingroup detail_management
1619 * @param[in] record Point to The calendar struct
1620 * @param[in] field The index of the integer value in calendar service value.
1621 * @param[in] intval The integer value to be set.
1622 * @return This function returns CAL_SUCCESS or error code on failure.
1624 * @pre cal_struct variable is defined.
1625 * @post the corresponding value of cal_struct is set.
1627 #include <calendar-svc-provider.h>
1632 cal_struct* event = NULL;
1634 //connect to database
1635 calendar_svc_connect();
1637 //create a cal_struct variable
1638 event = calendar_svc_struct_new("schedule");
1641 calendar_svc_set_int(event,CAL_VALUE_INT_ACCOUNT_ID,account_id);
1644 index = calendar_svc_insert(event);
1647 calendar_svc_struct_free(&event);
1650 calendar_svc_close();
1653 * @see calendar_svc_struct_get_int().
1655 int calendar_svc_struct_set_int(cal_struct* record, const char *field, int intval);
1658 * @fn int calendar_svc_struct_set_str(cal_struct* record, const char* field, const char *strval);
1659 * This function sets string value to the calendar service value,it is convenient for user set the value without knowing the detail of the struct.
1660 * If it is in struct, free old string and copy strval to struct.
1662 * @ingroup detail_management
1663 * @param[in] record Point to The calendar struct
1664 * @param[in] field The index of the string value in calendar service value.
1665 * @param[in] strval The string value to be set.
1666 * @return This function returns CAL_SUCCESS or error code on failure.
1668 * @pre cal_struct variable is defined.
1669 * @post the corresponding value of cal_struct is set.
1671 #include <calendar-svc-provider.h>
1674 char* summary = "party";
1676 cal_struct* event = NULL;
1678 //connect to database
1679 calendar_svc_connect();
1681 //create a cal_struct variable
1682 event = calendar_svc_struct_new("schedule");
1684 //set the string value
1685 calendar_svc_set_str(event,CAL_VALUE_TXT_SUMMARY,summary);
1688 index = calendar_svc_insert(event);
1691 calendar_svc_struct_free(&event);
1694 calendar_svc_close();
1697 * @see calendar_svc_struct_get_str().
1699 int calendar_svc_struct_set_str(cal_struct* record, const char *field, const char *strval);
1703 * @fn int calendar_svc_struct_get_list(cal_struct* record, const char* field, GList** retlist);
1704 * This function gets the point of glib double-linked list in the calendar service struct,it is convenient for user get the value without knowing the detail of the struct.
1706 * @ingroup detail_management
1707 * @param[in] record structure A calendar service struct
1708 * @param[in] field The index of the glib singly-linked list in calendar service struct.
1709 * @param[out] retlist the glib singly-linked list requested with field(should not be freed or removed)
1710 * @return This function returns CAL_SUCCESS or error code on failure.
1711 * @remarks if parent cal_struct is destroyed, retlist is not valid.
1712 * @pre cal_struct variable is defined.
1715 #include <calendar-svc-provider.h>
1720 cal_struct* event = NULL;
1722 //connect to database
1723 calendar_svc_connect();
1726 calendar_svc_get("schedule",index,NULL,&event);
1729 calendar_svc_struct_get_list(event,"attendee_list",&list);
1732 calendar_svc_struct_free(&event);
1735 calendar_svc_close();
1738 * @see calendar_svc_struct_store_list().
1740 int calendar_svc_struct_get_list(cal_struct* record,const char *field, GList** retlist);
1743 * @fn int calendar_svc_struct_store_list(cal_struct* record, const char* field, GList* list)
1744 * This function sets the glib double-linked list to the calendar service struct,it is convenient for user set the value.
1745 * \n Values(cal_value) of the list are moved to the calendar service struct. But the list is copied.
1747 * @ingroup detail_management
1748 * @param[in] record structure A calendar service struct
1749 * @param[in] field The index of the glib singly-linked list in calendar service struct.
1750 * @param[in] list the glib singly-linked list to be set
1751 * @return This function returns CAL_SUCCESS or error code on failure.
1752 * @remarks if parent cal_struct is destroyed, GSList is not valid.
1753 * @pre cal_struct variable is defined.
1756 #include <calendar-svc-provider.h>
1761 cal_struct* event = NULL;
1763 //connect to database
1764 calendar_svc_connect();
1767 event = calendar_svc_struct_new("schedule");
1770 calendar_svc_struct_store_list(event,"attendee_list",list);
1773 calendar_svc_struct_free(&event);
1776 calendar_svc_close();
1779 * @see calendar_svc_struct_get_list().
1781 int calendar_svc_struct_store_list(cal_struct* record,const char *field, GList* list);
1784 * @fn int calendar_svc_value_new(const char* val_type);
1785 * Allocate, initialize and return a new calendar service value,it is convenient for user to create a calendar service value.
1787 * @ingroup detail_management
1788 * @param[in] val_type The type of calendar service value
1789 * @return The pointer of New calendar service value, NULL on error
1794 #include <calendar-svc-provider.h>
1799 cal_value* event = NULL;
1801 //connect to database
1802 calendar_svc_connect();
1805 event = calendar_svc_value_new("attendee_list");
1808 list = g_list_append(list,event);
1809 calendar_svc_struct_store_list(event,"attendee_list",list);
1812 calendar_svc_value_free(&event);
1815 calendar_svc_close();
1818 * @see calendar_svc_value_free().
1820 cal_value* calendar_svc_value_new(const char *val_type);
1823 * @fn int calendar_svc_value_free(cal_value** value);
1824 * A destructor for calendar service value,,it is convenient for user to free the space allocated.
1825 * If it is in struct, return CAL_ERR_ARG_INVALID.
1827 * @ingroup detail_management
1828 * @param[in] value A calendar service value
1829 * @return This function returns CAL_SUCCESS or error code on failure.
1831 * @pre cal_value variable is defined.
1834 #include <calendar-svc-provider.h>
1839 cal_value* event = NULL;
1841 //connect to database
1842 calendar_svc_connect();
1845 event = calendar_svc_value_new("attendee_list");
1848 list = g_list_append(list,event);
1849 calendar_svc_struct_store_list(event,"attendee_list",list);
1852 calendar_svc_value_free(&event);
1855 calendar_svc_close();
1858 * @see calendar_svc_value_new().
1860 int calendar_svc_value_free(cal_value** value);
1863 * @fn int calendar_svc_value_set_int(cal_value* value, const char* field, int intval);
1864 * This function sets integer value to the calendar service value,it is convenient for user set value of cal_value varible.
1866 * @ingroup detail_management
1867 * @param[in] value The calendar service value
1868 * @param[in] field The index of the integer value in calendar service value.
1869 * @param[in] intval The integer value to be set.
1870 * @return This function returns CAL_SUCCESS or error code on failure.
1872 * @pre cal_value variable is defined.
1875 #include <calendar-svc-provider.h>
1880 cal_value* event = NULL;
1882 //connect to database
1883 calendar_svc_connect();
1886 event = calendar_svc_value_new("attendee_list");
1887 calendar_svc_value_set_int(event,"attendee_status",1);
1890 list = g_list_append(list,event);
1891 calendar_svc_struct_store_list(event,"attendee_list",list);
1894 calendar_svc_value_free(&event);
1897 calendar_svc_close();
1900 * @see calendar_svc_value_get_int().
1902 int calendar_svc_value_set_int(cal_value* value, const char *field, int intval);
1904 int calendar_svc_value_set_lli (cal_value *value, const char *field, long long int llival);
1905 long long int calendar_svc_value_get_lli (cal_value *value, const char *field);
1907 * @fn int calendar_svc_value_set_str(cal_value* value, const char* field, const char *strval);
1908 * This function sets string value to the calendar service value,it is convenient for user set value of cal_value varible.
1909 * If it is in struct, free old string and copy strval to struct.
1911 * @ingroup detail_management
1912 * @param[in] value The calendar service value
1913 * @param[in] field The index of the string value in calendar service value.
1914 * @param[in] strval The string value to be set.
1915 * @return This function returns CAL_SUCCESS or error code on failure.
1917 * @pre cal_value variable is defined.
1920 #include <calendar-svc-provider.h>
1925 cal_value* event = NULL;
1927 //connect to database
1928 calendar_svc_connect();
1931 event = calendar_svc_value_new("attendee_list");
1932 calendar_svc_value_set_str(event,"attendee_name","Max");
1935 list = g_list_append(list,event);
1936 calendar_svc_struct_store_list(event,"attendee_list",list);
1939 calendar_svc_value_free(&event);
1942 calendar_svc_close();
1945 * @see calendar_svc_value_get_str().
1947 int calendar_svc_value_set_str(cal_value* value, const char *field, const char *strval);
1951 * @fn int calendar_svc_value_get_int(cal_value* value, const char* field);
1952 * This function gets Integer value of the calendar service value,it is convenient for user get value of cal_value varible.
1954 * @ingroup detail_management
1955 * @param[in] value The calendar service value
1956 * @param[in] field The index of the integer value in calendar service value.
1957 * @return Integer value, or 0 if no value is obtained
1959 * @pre cal_value variable is defined.
1962 #include <calendar-svc-provider.h>
1966 cal_value* event = NULL;
1968 //connect to database
1969 calendar_svc_connect();
1972 event = calendar_svc_value_new(CAL_VALUE_LST_ATTENDEE_LIST);
1974 //get the type value
1975 type = calendar_svc_value_get_int(event,
1976 CAL_VALUE_INT_ATTENDEE_DETAIL_TYPE);
1979 calendar_svc_value_free(&event);
1982 calendar_svc_close();
1985 * @see calendar_svc_value_set_int().
1987 int calendar_svc_value_get_int(cal_value* value, const char *field);
1990 * @fn char* calendar_svc_value_get_str(cal_value* value, const char* field);
1991 * This function gets the point of string value of the calendar service value,it is convenient for user get value of cal_value varible.
1993 * @ingroup detail_management
1994 * @param[in] value The calendar service value
1995 * @param[in] field The index of the string value in calendar service value.
1996 * @return string value(should not be freed), or NULL if no value is obtained
1998 * @pre cal_value variable is defined.
2001 #include <calendar-svc-provider.h>
2004 char* name = "money";
2005 cal_value* event = NULL;
2007 //connect to database
2008 calendar_svc_connect();
2011 event = calendar_svc_value_new(CAL_VALUE_LST_ATTENDEE_LIST);
2013 //get the event_id value
2014 name = calendar_svc_value_get_str(event,
2015 CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME);
2018 calendar_svc_value_free(&event);
2021 calendar_svc_close();
2024 * @see calendar_svc_value_set_str().
2026 char *calendar_svc_value_get_str(cal_value* value, const char *field);
2029 * @fn int calendar_svc_util_convert_event_to_vcs (cal_struct *record,char **raw_data,int *data_size);
2030 * This function converts data (cal_struct(event) to raw_data(vcal format)),it is convenient for user to convert.
2032 * @ingroup utilities
2033 * @param[in] record original record type
2034 * @param[out] raw_data vcalendar event raw data
2035 * @param[out] data_size raw_data buf size
2036 * @return This function returns CAL_SUCCESS or error code on failure.
2041 #include <calendar_svc_provider.h>
2044 char raw_data = NULL;
2047 //connect to database
2048 calendar_svc_connect();
2050 cal_struct* event = NULL;
2053 calendar_svc_get("schedule",1,NULL,&event);
2056 calendar_svc_util_convert_event_to_vcs (event,&raw_data,&data_size);
2058 calendar_svc_struct_free(&event);
2061 calendar_svc_close();
2065 DEPRECATED int calendar_svc_util_convert_event_to_vcs (cal_struct *record,char **raw_data,int *data_size);
2069 * @fn int calendar_svc_find_event_list(int account_id,const char* search_type,const void* search_value, cal_iter **iter);
2070 * This function get records from database by search param,it is convenient for user to get records according to some condition.
2072 * @ingroup event_management
2073 * @return This function returns CAL_SUCCESS or error code on failure.
2074 * @param[in] account_id account db index
2075 * @param[in] search_type event search type(eg. CAL_VALUE_SUMMARY or CAL_VALUE_DESCRIPTION,..)
2076 * @param[in] search_value event search value(eg. "weekly report", etc.. ), it can be integer value(eg. 1 or 2.. etc)
2077 * @param[out] iter interation struct for list travel
2078 * @return This function returns CAL_SUCCESS or error code on failure.
2081 * @pre database connected
2084 #include <calendar-svc-provider.h>
2087 cal_iter *iter = NULL;
2089 //connect to database
2090 calendar_svc_connect();
2092 //find event whose summary including string like "party"
2093 calendar_svc_find_event_list(0,"summary","party", &iter);
2096 calendar_svc_iter_remove(&iter);
2099 calendar_svc_close();
2102 * @see detail_management module
2103 * @deprecated it will replacement calendar_svc_find_list
2105 int calendar_svc_find_event_list(int account_id,const char *search_type,const void* search_value, cal_iter **iter);
2108 * @fn int calendar_svc_event_search(int field, const char *keyword, cal_iter **iter);
2109 * #calendar_svc_event_search searches events including the keyword in given fields.
2111 * @ingroup event_management
2112 * @return This function returns CAL_SUCCESS or error code on failure.
2113 * @param[in] field fields where the keyword is searched. #SEARCHFIELD
2114 * @param[in] keyword keyword to be searched
2115 * @param[out] iter interation struct for list travel
2116 * @return This function returns CAL_SUCCESS or error code on failure.
2119 * @pre database connected
2122 #include <calendar-svc-provider.h>
2132 calendar_svc_connect();
2135 search_field = CALS_SEARCH_FIELD_NONE;
2136 search_field |= CALS_SEARCH_FIELD_SUMMARY;
2137 search_field |= CALS_SEARCH_FIELD_DESCRIPTION;
2138 search_field |= CALS_SEARCH_FIELD_LOCATION;
2139 search_field |= CALS_SEARCH_FIELD_ATTENDEE;
2141 ret = calendar_svc_event_search(search_field, "Hello", &it);
2145 while (calendar_svc_iter_next(it) == CAL_SUCCESS) {
2147 ret = calendar_svc_iter_get_info(it, &cs);
2148 if (ret != CAL_SUCCESS) {
2149 printf("calendar_svc_iter_get_info failed (%d)\n", ret);
2153 id = calendar_svc_struct_get_int(cs, CAL_VALUE_INT_INDEX);
2154 summary = calendar_svc_struct_get_str(cs, CAL_VALUE_TXT_SUMMARY);
2155 desc = calendar_svc_struct_get_str(cs, CAL_VALUE_TXT_DESCRIPTION);
2156 printf("type = %d id = %s desc = %s\n", id, summary, desc);
2157 calendar_svc_struct_free(&cs);
2160 calendar_svc_iter_remove(&it);
2162 calendar_svc_close();
2167 * @see detail_management module
2169 int calendar_svc_event_search(int field, const char *keyword, cal_iter **iter);
2172 * @fn int calendar_svc_smartsearch_excl(const char *keyword, int offset, int limit, cal_iter **iter)
2173 * Search events by keyword with database offset and limit option.
2174 * This function is provided for Smartsearch application exclusively.
2176 * @ingroup event_management
2177 * @return CAL_SUCCESS or negative error code on failure.
2178 * @param[in] field fields where the keyword is searched, #SEARCHFIELD
2179 * @param[in] keyword keyword to be searched
2180 * @param[in] offset offset to omit some searching results
2181 * @param[in] limit limit of the number of results. If negative, no limit is applied.
2182 * @param[out] iter interation struct for list travel
2183 * @return This function returns CAL_SUCCESS or error code on failure.
2186 * @pre database connected
2188 * @see detail_management module
2190 int calendar_svc_smartsearch_excl(const char *keyword, int offset, int limit, cal_iter **iter);
2193 * @fn int calendar_svc_todo_search(int field, const char *keyword, cal_iter **iter);
2194 * #calendar_svc_event_search searches TO-DOs including the keyword in given fields.
2196 * @ingroup event_management
2197 * @return This function returns CAL_SUCCESS or error code on failure.
2198 * @param[in] field fields where the keyword is searched, #SEARCHFIELD
2199 * @param[in] keyword keyword to be searched
2200 * @param[out] iter interation struct for list travel
2201 * @return This function returns CAL_SUCCESS or error code on failure.
2204 * @pre database connected
2207 #include <calendar-svc-provider.h>
2217 calendar_svc_connect();
2220 search_field = CALS_SEARCH_FIELD_NONE;
2221 search_field |= CALS_SEARCH_FIELD_SUMMARY;
2222 search_field |= CALS_SEARCH_FIELD_DESCRIPTION;
2223 search_field |= CALS_SEARCH_FIELD_LOCATION;
2224 search_field |= CALS_SEARCH_FIELD_ATTENDEE;
2226 ret = calendar_svc_todo_search(search_field, "Hello", &it);
2230 while (calendar_svc_iter_next(it) == CAL_SUCCESS) {
2232 ret = calendar_svc_iter_get_info(it, &cs);
2233 if (ret != CAL_SUCCESS) {
2234 printf("calendar_svc_iter_get_info failed (%d)\n", ret);
2238 id = calendar_svc_struct_get_int(cs, CAL_VALUE_INT_INDEX);
2239 summary = calendar_svc_struct_get_str(cs, CAL_VALUE_TXT_SUMMARY);
2240 desc = calendar_svc_struct_get_str(cs, CAL_VALUE_TXT_DESCRIPTION);
2241 printf("type = %d id = %s desc = %s\n", id, summary, desc);
2242 calendar_svc_struct_free(&cs);
2245 calendar_svc_iter_remove(&it);
2247 calendar_svc_close();
2252 * @see detail_management module
2254 int calendar_svc_todo_search(int field, const char *keyword, cal_iter **iter);
2257 * @fn int calendar_svc_read_schedules(const char *stream, GList **schedules);
2258 * This function reads schedules and provides schedule list.
2260 * @ingroup event management
2261 * @param[in] stream vcalendar(ver1.0) icalendar(ver2.0) stream
2262 * @param[out] schedules schedule list which data is cal_struct
2263 * @return This function returns CAL_SUCCESS or error code on failure.
2270 #include <calendar-svc-provider.h>
2276 char *stream = NULL;
2279 cal_struct *cs = NULL;
2280 GList *l, *schedules = NULL;
2284 file = fopen(path, "r");
2286 printf("failed to open\n");
2289 stream = malloc(1024);
2290 while (fgets(buf, sizeof(buf), file)) {
2291 if (len + sizeof(buf) < buf_size) {
2292 len += snprintf(stream + len, strlen(buf) +1, "%s", buf);
2297 new_stream = realloc(stream, buf_size);
2299 stream = new_stream;
2303 printf("out of memory\n");
2306 len += snprintf(stream + len, strlen(buf) +1, "%s", buf);
2311 ret = calendar_svc_read_schedules(stream, &schedules);
2313 printf("Failed to read schedules(errno:%d)\n", ret);
2317 if (schedules == NULL) {
2318 printf("No schedules\n");
2330 vals = calendar_svc_struct_get_str(cs, CAL_VALUE_TXT_SUMMARY);
2331 printf("summary:%s\n", vals);
2335 if (stream) free(stream);
2339 * @see calendar_svc_write_schedules().
2341 int calendar_svc_read_schedules(const char *stream, GList **schedules);
2344 * @fn int calendar_svc_calendar_import(const char *path, int calendar_id);
2345 * This function import vcalendar(ver 1.0), icalendar(ver 2.0) to calendar DB.
2347 * @ingroup event management
2348 * @param[in] path file path
2349 * @param[out] calendar_id calendar id
2350 * @return This function returns CAL_SUCCESS or error code on failure.
2357 #include <calendar-svc-provider.h>
2362 int calendar_id = 1;
2363 char *path = "/opt/media/test.ics";
2365 calendar_svc_connect();
2366 ret = calendar_svc_calendar_import(path, calendar_id);
2367 if (ret != CAL_SUCCESS) {
2368 printf("Failed to import path(%s) to id(%d)\n", path, calendar_id);
2371 calendar_svc_close();
2375 * @see calendar_svc_calendar_export().
2377 int calendar_svc_calendar_import(const char *path, int calendar_id);
2380 * @fn int calendar_svc_write_schedules(GList *schedules, char **stream);
2381 * This function writes schedules to stream.
2383 * @ingroup event management
2384 * @param[in] schedules schedule list which data is cal_struct
2385 * @param[out] stream vcalendar(ver1.0) icalendar(ver2.0) stream
2386 * @return This function returns CAL_SUCCESS or error code on failure.
2393 #include <calendar-svc-provider.h>
2395 int main(int argc, char **argv)
2399 GList *schedules = NULL;
2400 cal_struct *cs = NULL;
2402 cs = calendar_svc_struct_new(CAL_STRUCT_CALENDAR);
2404 printf("Failed to calloc\n");
2407 calendar_svc_struct_set_str(cs, CAL_VALUE_TXT_SUMMARY, "title");
2408 // set data in cs...
2410 schedules = g_list_append(schedules, cs);
2412 ret = calendar_svc_write_schedules(schedules, &stream);
2413 if (ret != CAL_SUCCESS) {
2414 printf("Failed to read schedules(errno:%d)\n", ret);
2418 if (stream == NULL) {
2419 printf("stream is NULL\n");
2423 if (stream) free(stream);
2427 * @see calendar_svc_read_schedules().
2429 int calendar_svc_write_schedules(GList *schedules, char **stream);
2432 * @fn int calendar_svc_calendar_export(int calendar_id, const char *path);
2433 * This function export calendar DB to file.
2435 * @ingroup event management
2436 * @param[in] calendar_id calendar id
2437 * @param[out] path file path
2438 * @return This function returns CAL_SUCCESS or error code on failure.
2445 #include <calendar-svc-provider.h>
2450 int calendar_id = 1;
2451 char *path = "/opt/media/test.ics";
2453 calendar_svc_connect();
2454 r = calendar_svc_calendar_export(calendar_id, path);
2455 if (r != CAL_SUCCESS) {
2456 printf("Failed to export schedules\n");
2460 calendar_svc_close();
2464 * @see calendar_svc_calendar_import().
2466 int calendar_svc_calendar_export(int calendar_id, const char *path);
2468 #define CALS_VALUE_INT_DTSTART_TYPE "dtstart_type"
2469 #define CALS_VALUE_LLI_DTSTART_UTIME "dtstart_utime"
2470 #define CALS_VALUE_INT_DTSTART_YEAR "dtstart_year"
2471 #define CALS_VALUE_INT_DTSTART_MONTH "dtstart_month"
2472 #define CALS_VALUE_INT_DTSTART_MDAY "dtstart_mday"
2473 #define CALS_VALUE_TXT_DTSTART_TZID "dtstart_tzid"
2474 #define CALS_VALUE_INT_DTEND_TYPE "dtend_type"
2475 #define CALS_VALUE_LLI_DTEND_UTIME "dtend_utime"
2476 #define CALS_VALUE_INT_DTEND_YEAR "dtend_year"
2477 #define CALS_VALUE_INT_DTEND_MONTH "dtend_month"
2478 #define CALS_VALUE_INT_DTEND_MDAY "dtend_mday"
2479 #define CALS_VALUE_TXT_DTEND_TZID "dtend_tzid"
2480 #define CALS_VALUE_LLI_LASTMOD "last_mod"
2482 #define CALS_VALUE_INT_RRULE_FREQ "freq"
2483 #define CALS_VALUE_INT_RRULE_ID "rrule_id"
2484 #define CALS_VALUE_INT_RRULE_RANGE_TYPE "range_type" //endless, until, count
2485 #define CALS_VALUE_INT_RRULE_UNTIL_TYPE "until_type" //until by utc, until by local date
2486 #define CALS_VALUE_LLI_RRULE_UNTIL_UTIME "until_utime" //unix time
2487 #define CALS_VALUE_INT_RRULE_UNTIL_YEAR "until_year"
2488 #define CALS_VALUE_INT_RRULE_UNTIL_MONTH "until_month"
2489 #define CALS_VALUE_INT_RRULE_UNTIL_MDAY "until_mday"
2490 #define CALS_VALUE_INT_RRULE_COUNT "count"
2491 #define CALS_VALUE_INT_RRULE_INTERVAL "interval"
2492 #define CALS_VALUE_TXT_RRULE_BYSECOND "bysecond"
2493 #define CALS_VALUE_TXT_RRULE_BYMINUTE "byminute"
2494 #define CALS_VALUE_TXT_RRULE_BYHOUR "byhour"
2495 #define CALS_VALUE_TXT_RRULE_BYDAY "byday"
2496 #define CALS_VALUE_TXT_RRULE_BYMONTHDAY "bymonthday"
2497 #define CALS_VALUE_TXT_RRULE_BYYEARDAY "byyearday"
2498 #define CALS_VALUE_TXT_RRULE_BYWEEKNO "byweekno"
2499 #define CALS_VALUE_TXT_RRULE_BYMONTH "bymonth"
2500 #define CALS_VALUE_TXT_RRULE_BYSETPOS "bysetpos"
2501 #define CALS_VALUE_INT_RRULE_WKST "wkst"
2503 /* 0x00 ~0x06 used cal_struct_type */
2505 CALS_LIST_PERIOD_NORMAL_ONOFF = 0x07,
2506 CALS_LIST_PERIOD_ALLDAY_ONOFF,
2507 CALS_LIST_PERIOD_NORMAL_BASIC,
2508 CALS_LIST_PERIOD_ALLDAY_BASIC,
2509 CALS_LIST_PERIOD_NORMAL_OSP = 0x100,
2510 CALS_LIST_PERIOD_ALLDAY_OSP,
2511 CALS_LIST_PERIOD_NORMAL_LOCATION,
2512 CALS_LIST_PERIOD_ALLDAY_LOCATION,
2513 CALS_LIST_PERIOD_NORMAL_ALARM,
2514 CALS_LIST_PERIOD_ALLDAY_ALARM,
2517 #define CALS_LIST_PERIOD_NORMAL_ONOFF_INT_EVENTID CAL_VALUE_INT_INDEX
2518 #define CALS_LIST_PERIOD_NORMAL_ONOFF_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2519 #define CALS_LIST_PERIOD_NORMAL_ONOFF_LLI_DTSTART_UTIME CALS_VALUE_LLI_DTSTART_UTIME
2520 #define CALS_LIST_PERIOD_NORMAL_ONOFF_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2521 #define CALS_LIST_PERIOD_NORMAL_ONOFF_LLI_DTEND_UTIME CALS_VALUE_LLI_DTEND_UTIME
2523 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_EVENTID CAL_VALUE_INT_INDEX
2524 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2525 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTSTART_YEAR CALS_VALUE_INT_DTSTART_YEAR
2526 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTSTART_MONTH CALS_VALUE_INT_DTSTART_MONTH
2527 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTSTART_MDAY CALS_VALUE_INT_DTSTART_MDAY
2528 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2529 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTEND_YEAR CALS_VALUE_INT_DTEND_YEAR
2530 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTEND_MONTH CALS_VALUE_INT_DTEND_MONTH
2531 #define CALS_LIST_PERIOD_ALLDAY_ONOFF_INT_DTEND_MDAY CALS_VALUE_INT_DTEND_MDAY
2533 #define CALS_LIST_PERIOD_NORMAL_BASIC_INT_EVENTID CAL_VALUE_INT_INDEX
2534 #define CALS_LIST_PERIOD_NORMAL_BASIC_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2535 #define CALS_LIST_PERIOD_NORMAL_BASIC_LLI_DTSTART_UTIME CALS_VALUE_LLI_DTSTART_UTIME
2536 #define CALS_LIST_PERIOD_NORMAL_BASIC_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2537 #define CALS_LIST_PERIOD_NORMAL_BASIC_LLI_DTEND_UTIME CALS_VALUE_LLI_DTEND_UTIME
2538 #define CALS_LIST_PERIOD_NORMAL_BASIC_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2539 #define CALS_LIST_PERIOD_NORMAL_BASIC_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2541 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_EVENTID CAL_VALUE_INT_INDEX
2542 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2543 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTSTART_YEAR CALS_VALUE_INT_DTSTART_YEAR
2544 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTSTART_MONTH CALS_VALUE_INT_DTSTART_MONTH
2545 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTSTART_MDAY CALS_VALUE_INT_DTSTART_MDAY
2546 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2547 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTEND_YEAR CALS_VALUE_INT_DTEND_YEAR
2548 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTEND_MONTH CALS_VALUE_INT_DTEND_MONTH
2549 #define CALS_LIST_PERIOD_ALLDAY_BASIC_INT_DTEND_MDAY CALS_VALUE_INT_DTEND_MDAY
2550 #define CALS_LIST_PERIOD_ALLDAY_BASIC_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2551 #define CALS_LIST_PERIOD_ALLDAY_BASIC_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2553 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_EVENTID CAL_VALUE_INT_INDEX
2554 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2555 #define CALS_LIST_PERIOD_NORMAL_OSP_LLI_DTSTART_UTIME CALS_VALUE_LLI_DTSTART_UTIME
2556 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2557 #define CALS_LIST_PERIOD_NORMAL_OSP_LLI_DTEND_UTIME CALS_VALUE_LLI_DTEND_UTIME
2558 #define CALS_LIST_PERIOD_NORMAL_OSP_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2559 #define CALS_LIST_PERIOD_NORMAL_OSP_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2560 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_CALENDAR_ID CAL_VALUE_INT_CALENDAR_ID
2561 #define CALS_LIST_PERIOD_NORMAL_OSP_TXT_DESCRIPTION CAL_VALUE_TXT_DESCRIPTION
2562 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_BUSY_STATUS CAL_VALUE_INT_BUSY_STATUS
2563 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_STATUS CAL_VALUE_INT_MEETING_STATUS
2564 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_PRIORITY CAL_VALUE_INT_PRIORITY
2565 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_VISIBILITY CAL_VALUE_INT_SENSITIVITY
2566 #define CALS_LIST_PERIOD_NORMAL_OSP_INT_IS_RECURRING CALS_VALUE_INT_RRULE_ID
2568 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_EVENTID CAL_VALUE_INT_INDEX
2569 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2570 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTSTART_YEAR CALS_VALUE_INT_DTSTART_YEAR
2571 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTSTART_MONTH CALS_VALUE_INT_DTSTART_MONTH
2572 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTSTART_MDAY CALS_VALUE_INT_DTSTART_MDAY
2573 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2574 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTEND_YEAR CALS_VALUE_INT_DTEND_YEAR
2575 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTEND_MONTH CALS_VALUE_INT_DTEND_MONTH
2576 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_DTEND_MDAY CALS_VALUE_INT_DTEND_MDAY
2577 #define CALS_LIST_PERIOD_ALLDAY_OSP_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2578 #define CALS_LIST_PERIOD_ALLDAY_OSP_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2579 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_CALENDAR_ID CAL_VALUE_INT_CALENDAR_ID
2580 #define CALS_LIST_PERIOD_ALLDAY_OSP_TXT_DESCRIPTION CAL_VALUE_TXT_DESCRIPTION
2581 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_BUSY_STATUS CAL_VALUE_INT_BUSY_STATUS
2582 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_STATUS CAL_VALUE_INT_MEETING_STATUS
2583 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_PRIORITY CAL_VALUE_INT_PRIORITY
2584 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_VISIBILITY CAL_VALUE_INT_SENSITIVITY
2585 #define CALS_LIST_PERIOD_ALLDAY_OSP_INT_IS_RECURRING CALS_VALUE_INT_RRULE_ID
2587 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_EVENTID CAL_VALUE_INT_INDEX
2588 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2589 #define CALS_LIST_PERIOD_NORMAL_LOCATION_LLI_DTSTART_UTIME CALS_VALUE_LLI_DTSTART_UTIME
2590 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2591 #define CALS_LIST_PERIOD_NORMAL_LOCATION_LLI_DTEND_UTIME CALS_VALUE_LLI_DTEND_UTIME
2592 #define CALS_LIST_PERIOD_NORMAL_LOCATION_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2593 #define CALS_LIST_PERIOD_NORMAL_LOCATION_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2594 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_CALENDAR_ID CAL_VALUE_INT_CALENDAR_ID
2595 #define CALS_LIST_PERIOD_NORMAL_LOCATION_TXT_DESCRIPTION CAL_VALUE_TXT_DESCRIPTION
2596 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_BUSY_STATUS CAL_VALUE_INT_BUSY_STATUS
2597 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_STATUS CAL_VALUE_INT_MEETING_STATUS
2598 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_PRIORITY CAL_VALUE_INT_PRIORITY
2599 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_VISIBILITY CAL_VALUE_INT_SENSITIVITY
2600 #define CALS_LIST_PERIOD_NORMAL_LOCATION_INT_IS_RECURRING CALS_VALUE_INT_RRULE_ID
2601 #define CALS_LIST_PERIOD_NORMAL_LOCATION_DBL_LATITUDE CAL_VALUE_DBL_LATITUDE
2602 #define CALS_LIST_PERIOD_NORMAL_LOCATION_DBL_LONGITUDE CAL_VALUE_DBL_LONGITUDE
2604 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_EVENTID CAL_VALUE_INT_INDEX
2605 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2606 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTSTART_YEAR CALS_VALUE_INT_DTSTART_YEAR
2607 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTSTART_MONTH CALS_VALUE_INT_DTSTART_MONTH
2608 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTSTART_MDAY CALS_VALUE_INT_DTSTART_MDAY
2609 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2610 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTEND_YEAR CALS_VALUE_INT_DTEND_YEAR
2611 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTEND_MONTH CALS_VALUE_INT_DTEND_MONTH
2612 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_DTEND_MDAY CALS_VALUE_INT_DTEND_MDAY
2613 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_TXT_SUMMARY CAL_VALUE_TXT_SUMMARY
2614 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_TXT_LOCATION CAL_VALUE_TXT_LOCATION
2615 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_CALENDAR_ID CAL_VALUE_INT_CALENDAR_ID
2616 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_TXT_DESCRIPTION CAL_VALUE_TXT_DESCRIPTION
2617 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_BUSY_STATUS CAL_VALUE_INT_BUSY_STATUS
2618 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_STATUS CAL_VALUE_INT_MEETING_STATUS
2619 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_PRIORITY CAL_VALUE_INT_PRIORITY
2620 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_VISIBILITY CAL_VALUE_INT_SENSITIVITY
2621 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_INT_IS_RECURRING CALS_VALUE_INT_RRULE_ID
2622 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_DBL_LATITUDE CAL_VALUE_DBL_LATITUDE
2623 #define CALS_LIST_PERIOD_ALLDAY_LOCATION_DBL_LONGITUDE CAL_VALUE_DBL_LONGITUDE
2625 #define CALS_LIST_PERIOD_NORMAL_ALARM_INT_EVENTID CAL_VALUE_INT_INDEX
2626 #define CALS_LIST_PERIOD_NORMAL_ALARM_INT_CALENDAR_ID CAL_VALUE_INT_CALENDAR_ID
2627 #define CALS_LIST_PERIOD_NORMAL_ALARM_INT_DTSTART_TYPE CALS_VALUE_INT_DTSTART_TYPE
2628 #define CALS_LIST_PERIOD_NORMAL_ALARM_LLI_DTSTART_UTIME CALS_VALUE_LLI_DTSTART_UTIME
2629 #define CALS_LIST_PERIOD_NORMAL_ALARM_INT_DTEND_TYPE CALS_VALUE_INT_DTEND_TYPE
2630 #define CALS_LIST_PERIOD_NORMAL_ALARM_LLI_DTEND_UTIME CALS_VALUE_LLI_DTEND_UTIME
2631 #define CALS_LIST_PERIOD_NORMAL_ALARM_LLI_ALARM_UTIME CAL_VALUE_LLI_ALARMS_TIME
2632 #define CALS_LIST_PERIOD_NORMAL_ALARM_INT_ALARM_ID CAL_VALUE_INT_ALARMS_ID
2646 CALS_FREQ_ONCE = 0x0,
2656 enum cals_time_type {
2658 CALS_TIME_LOCALTIME,
2667 int calendar_svc_event_get_normal_list_by_period(int calendar_id, int op_code,
2668 long long int start, long long int end, cal_iter **iter);
2670 int calendar_svc_event_get_allday_list_by_period(int calendar_id, int op_code,
2671 int dtstart_year, int dtstart_mon, int dtstart_day,
2672 int dtend_year, int dtend_mon, int dtend_day, cal_iter **iter);
2674 int calendar_svc_struct_set_lli(cal_struct *record, const char *field, long long int llival);
2676 long long int calendar_svc_struct_get_lli(cal_struct *record, const char *field);
2678 int calendar_svc_todo_get_list_by_period(int calendar_id,
2679 long long int due_from, long long int dueto, int priority, int status, cal_iter **iter);
2680 int calendar_svc_todo_get_count_by_period(int calendar_id,
2681 long long int due_from, long long int dueto, int priority, int status, int *count);
2682 int calendar_svc_event_delete_normal_instance(int event_id, long long int dtstart_utime);
2683 int calendar_svc_event_delete_allday_instance(int event_id, int dtstart_year, int dtstart_month, int dtstart_mday);
2693 CAL_STATUS_FREE = 0, /**< deprecated */
2694 CAL_STATUS_TENTATIVE, /**< deprecated */
2695 CAL_STATUS_BUSY, /**< deprecated */
2696 CAL_STATUS_OUROFOFFICE, /**< deprecated */
2697 CAL_STATUS_CONFIRM, /**< deprecated */
2698 CAL_STATUS_DENIED, /**< deprecated */
2699 } cal_status_type_t;
2701 #endif /* __CALENDAR_SVC_H__ */