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.
17 * @file LogEntryWrapper.cpp
18 * @author Lukasz Marek (l.marek@samsung.com)
23 #include <dpl/log/log.h>
25 #include "LogEntryWrapper.h"
26 #include "commons/Exception.h"
28 using namespace WrtPlugins::Api;
30 namespace WrtPlugins {
32 LogEntryWrapper::LogEntryWrapper(CTSvalue *log) :
33 m_logEntry(new LogEntry())
36 convertPlatformStructToAbstractStruct(log);
39 LogEntryWrapper::~LogEntryWrapper()
44 bool LogEntryWrapper::matchFilters(const LogFilterPtr &filter)
48 Throw(WrtPlugins::Commons::NullPointerException);
53 if (filter->getIdIsSet() && filter->getIdFilter() != m_logEntry->getId()) {
56 if (filter->getStartTimeIsSet() &&
57 (filter->getStartTimeMinFilter() > m_logEntry->getStartTime() ||
58 filter->getStartTimeMaxFilter() < m_logEntry->getStartTime()))
62 if (filter->getDurationIsSet() &&
63 (filter->getDurationMinFilter() > m_logEntry->getDuration() ||
64 filter->getDurationMaxFilter() < m_logEntry->getDuration()))
68 if (filter->getPhoneNumberIsSet() &&
69 !pcrecpp::RE(filter->getPhoneNumberFilter()).FullMatch(m_logEntry->
74 if (filter->getDescriptionIsSet() &&
75 !pcrecpp::RE(filter->getDescriptionFilter()).FullMatch(m_logEntry->
80 if (filter->getFolderIsSet() &&
81 !filter->checkIfFolderIsSet(m_logEntry->getFolder()))
84 } else if (m_logEntry->getFolder() == LogEntry::INVALID_FOLDER) {
90 bool LogEntryWrapper::convertPlatformStructToAbstractStruct(CTSvalue *log)
100 contacts_svc_value_get_str(log, CTS_LIST_PLOG_NUMBER_STR);
102 LogDebug("phone number " << charVal);
103 m_logEntry->setPhoneNumber(charVal);
105 charVal = contacts_svc_value_get_str(log, CTS_LIST_PLOG_SHORTMSG_STR);
107 m_logEntry->setDescription(charVal);
109 m_logEntry->setDuration(
110 contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT));
112 contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT));
113 m_logEntry->setStartTime(
114 contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TIME_INT));
116 contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT));
117 LogDebug("id " << contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT));
118 switch (contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TYPE_INT)) {
119 case CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN:
120 case CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN:
121 case CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN:
122 case CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN:
123 m_logEntry->setFolder(LogEntry::MISSED_CALLS_FOLDER);
125 case CTS_PLOG_TYPE_VIDEO_INCOMMING:
126 case CTS_PLOG_TYPE_VOICE_INCOMMING:
127 m_logEntry->setFolder(LogEntry::RECEIVED_CALLS_FOLDER);
129 case CTS_PLOG_TYPE_VIDEO_OUTGOING:
130 case CTS_PLOG_TYPE_VOICE_OUTGOING:
131 m_logEntry->setFolder(LogEntry::INITIATED_CALLS_FOLDER);
134 LogDebug("Invalid folder");
135 m_logEntry->setFolder(LogEntry::INVALID_FOLDER);
141 Api::LogEntryPtr LogEntryWrapper::getAbstractCall() const