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.
19 * @author Kisub Song (kisubs.song@samsung.com)
24 #ifndef _PLATFORM_CONTACT_ADDRESS_BOOK_H_
25 #define _PLATFORM_CONTACT_ADDRESS_BOOK_H_
27 #include <contacts-svc.h>
31 #include <Commons/Emitters.h>
32 #include <API/Contact/IAddressBook.h>
33 #include <API/Contact/IContact.h>
39 class AddressBook : public TizenApis::Api::Contact::IAddressBook
47 explicit AddressBook(TizenApis::Api::Contact::IAddressBook::AddressBookType type);
48 virtual ~AddressBook();
50 virtual std::string getId() const { return m_id; }
51 virtual void setId(const std::string &value) { m_id = value; }
52 virtual std::string getName() const { return m_name; }
53 virtual void setName(const std::string &value) { m_name = value; }
54 virtual bool getReadOnly() const { return m_readOnly; }
55 virtual void setReadOnly(const bool &value) { m_readOnly = value; }
58 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookGetPtr &event);
59 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookAddPtr &event);
60 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookAddBatchPtr &event);
61 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookUpdatePtr &event);
62 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookUpdateBatchPtr &event);
63 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookRemovePtr &event);
64 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookRemoveBatchPtr &event);
65 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookFindPtr &event);
66 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookAddChangeListenerPtr &event);
67 virtual void OnRequestReceived(const TizenApis::Api::Contact::EventAddressBookRemoveChangeListenerPtr &event);
72 TizenApis::Api::Contact::ContactPtr internalGetById(const std::string &contactId);
74 void internalAddContact(const TizenApis::Api::Contact::ContactPtr &newContact);
75 void internalDeleteContactById(int id);
76 DPL::Mutex m_contactEditingMutex;
78 typedef WrtDeviceApis::Commons::Emitters<TizenApis::Api::Contact::EventAddressBookChangeListenerEmitter> AddressBookChangedEmitter;
79 AddressBookChangedEmitter m_addressBookEmitters;
80 DPL::Mutex m_addressBookEmittersMutex;
82 typedef std::map<long, TizenApis::Api::Contact::EventAddressBookChangeListenerEmitter::IdType> WatchIdMap;
83 WatchIdMap m_watchIdMap;
87 static void contactsSvcContactChangedCallback(void *data);
90 void contactsSvcContactChangedCallback();
97 #endif // _PLATFORM_CONTACT_ADDRESS_BOOK_H_