4afc69ca10f58f51fadde9ae6f0c328b9bb5b58a
[framework/web/wrt-plugins-common.git] / src / modules / API / Contact / IAddressBook.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file        IAddressBook.cpp
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @version     0.1
20  */
21
22 #include "IAddressBook.h"
23 #include <Commons/ThreadPool.h>
24
25 namespace WrtDeviceApis {
26 namespace Contact {
27 namespace Api {
28
29 IAddressBookObject::IAddressBookObject(BookType type) :
30     //initialize all receivers to work on CONTACT_THREAD thread
31     Commons::EventRequestReceiver<EventAddContact>(
32         Commons::ThreadEnum::CONTACT_THREAD),
33     Commons::EventRequestReceiver<EventUpdateContact>(
34         Commons::ThreadEnum::CONTACT_THREAD),
35     Commons::EventRequestReceiver<EventFindContacts>(
36         Commons::ThreadEnum::CONTACT_THREAD),
37     Commons::EventRequestReceiver<EventDeleteContact>(
38         Commons::ThreadEnum::CONTACT_THREAD),
39     Commons::EventRequestReceiver<EventGetAddressBookItemCount>(
40         Commons::ThreadEnum::CONTACT_THREAD),
41     Commons::EventRequestReceiver<EventAddGroup>(
42         Commons::ThreadEnum::CONTACT_THREAD),
43     Commons::EventRequestReceiver<EventDeleteGroup>(
44         Commons::ThreadEnum::CONTACT_THREAD),
45     Commons::EventRequestReceiver<EventFindGroup>(
46         Commons::ThreadEnum::CONTACT_THREAD),
47     Commons::EventRequestReceiver<EventExportVCard>(
48         Commons::ThreadEnum::CONTACT_THREAD),
49     m_bookType(type)
50 {
51     //Nothing to do
52     LogDebug("entered");
53 }
54
55 IAddressBookObject::~IAddressBookObject()
56 {
57     //Nothing to do
58     LogDebug("entered");
59 }
60
61 IAddressBookObject::BookType IAddressBookObject::getType() const
62 {
63     //return address book type: sim or device
64     return m_bookType;
65 }
66
67 void IAddressBookObject::addContact(const EventAddContactPtr &event)
68 {
69     Commons::EventRequestReceiver< EventAddContact >::PostRequest(event);
70 }
71
72 void IAddressBookObject::updateContact(const EventUpdateContactPtr &event)
73 {
74     Commons::EventRequestReceiver< EventUpdateContact >::PostRequest(event);
75 }
76
77 void IAddressBookObject::deleteContact(const EventDeleteContactPtr &event)
78 {
79     Commons::EventRequestReceiver< EventDeleteContact >::PostRequest(event);
80 }
81
82 void IAddressBookObject::findContacts(const EventFindContactsPtr &event)
83 {
84     Commons::EventRequestReceiver< EventFindContacts >::PostRequest(event);
85 }
86
87 void IAddressBookObject::getNumberOfContact(
88         const EventGetAddressBookItemCountPtr &event)
89 {
90     Commons::EventRequestReceiver< EventGetAddressBookItemCount >::PostRequest(
91         event);
92 }
93
94 void IAddressBookObject::addGroup(const EventAddGroupPtr &event)
95 {
96     Commons::EventRequestReceiver< EventAddGroup >::PostRequest(event);
97 }
98
99 void IAddressBookObject::deleteGroup(const EventDeleteGroupPtr &event)
100 {
101     Commons::EventRequestReceiver< EventDeleteGroup >::PostRequest(event);
102 }
103
104 void IAddressBookObject::findGroup(const EventFindGroupPtr &event)
105 {
106     Commons::EventRequestReceiver< EventFindGroup >::PostRequest(event);
107 }
108
109 void IAddressBookObject::exportToVCard(const EventExportVCardPtr &event)
110 {
111     Commons::EventRequestReceiver< EventExportVCard >::PostRequest(event);
112 }
113
114 }
115 }
116 }