2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <dpl/log/log.h>
22 #include <Commons/Exception.h>
23 #include "MediaWrapper.h"
24 #include "Mediacontent.h"
26 using namespace WrtPlugins::Api;
30 namespace WrtPlugins {
32 MediaWrapper::MediaWrapper() :
33 m_platformEvent(NULL),
37 m_abstractEvent = CalendarEventPtr(new CalendarEvent());
38 if (!m_abstractEvent) {
39 ThrowMsg(Commons::UnknownException, "abstract object is not created");
43 MediaWrapper::MediaWrapper(media_info_h media) :
44 m_platformEvent(NULL),
45 m_abstractEvent(event)
50 MediaWrapper::MediaWrapper()
56 void EventWrapper::displayAbstractEvent()
58 m_abstractEvent->display();
61 void EventWrapper::displayPlatformEvent()
63 LogDebug("event id: " << calendar_svc_struct_get_int(m_platformEvent,
64 CAL_VALUE_INT_INDEX));
65 LogDebug("event start time: " << calendar_svc_struct_get_time(
66 m_platformEvent, CAL_VALUE_GMT_START_DATE_TIME,
68 LogDebug("event end time: " << calendar_svc_struct_get_time(m_platformEvent,
69 CAL_VALUE_GMT_END_DATE_TIME,
71 LogDebug("event location: " << calendar_svc_struct_get_str(m_platformEvent,
72 CAL_VALUE_TXT_LOCATION));
73 LogDebug("event summary: " << calendar_svc_struct_get_str(m_platformEvent,
74 CAL_VALUE_TXT_SUMMARY));
75 LogDebug("event description: " << calendar_svc_struct_get_str(
76 m_platformEvent, CAL_VALUE_TXT_DESCRIPTION));
78 LogDebug("event isAllDay: " << calendar_svc_struct_get_int(
79 m_platformEvent, CAL_VALUE_INT_ALL_DAY_EVENT));
80 LogDebug("event organizer: " << calendar_svc_struct_get_str(m_platformEvent,
81 CAL_VALUE_TXT_ORGANIZER_NAME));
82 LogDebug("event lastModifiedDate: " << calendar_svc_struct_get_time(
83 m_platformEvent, CAL_VALUE_GMT_LAST_MODIFIED_TIME,
85 LogDebug("event visibility: " << calendar_svc_struct_get_int(
86 m_platformEvent, CAL_VALUE_INT_SENSITIVITY));
87 LogDebug("event availability: " << calendar_svc_struct_get_int(
88 m_platformEvent, CAL_VALUE_INT_BUSY_STATUS));
90 GList *categoryList = NULL;
91 if (CAL_SUCCESS != calendar_svc_struct_get_list(m_platformEvent,
92 CAL_VALUE_LST_MEETING_CATEGORY,
94 LogError("cannot read category list");
97 cal_value* category = NULL;
98 for (; categoryList; categoryList = g_list_next(categoryList)) {
99 category = static_cast<cal_value*>(categoryList->data);
100 char* categoryName = calendar_svc_value_get_str(category, "category_name");
101 if (NULL == categoryName) {
102 LogError("cannot read category name");
105 LogDebug("event categories: " << categoryName);
108 LogDebug("event uid: " << calendar_svc_struct_get_str(m_platformEvent,
110 LogDebug("event recurrenceId: " << calendar_svc_struct_get_time(
111 m_platformEvent, CAL_VALUE_GMT_START_DATE_TIME, CAL_TZ_FLAG_GMT));
113 GList *attendees = NULL;
114 if (CAL_SUCCESS != calendar_svc_struct_get_list(m_platformEvent,
115 CAL_VALUE_LST_ATTENDEE_LIST,
117 LogError("cannot read attendee list");
120 cal_value* attendee = NULL;
121 for (; attendees; attendees = g_list_next(attendees)) {
122 attendee = static_cast<cal_value*>(attendees->data);
123 char* attendeeName = calendar_svc_value_get_str(attendee, CAL_VALUE_TXT_ATTENDEE_DETAIL_NAME);
124 if (NULL == attendeeName) {
125 LogError("cannot read attendee name");
128 LogDebug("event attendees: " << attendeeName);
131 LogDebug("event repeat frequency: " << calendar_svc_struct_get_int(
132 m_platformEvent, CAL_VALUE_INT_REPEAT_TERM));