diff options
Diffstat (limited to 'mobile_src/Contact/AddressBookController.h')
-rw-r--r-- | mobile_src/Contact/AddressBookController.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/mobile_src/Contact/AddressBookController.h b/mobile_src/Contact/AddressBookController.h new file mode 100644 index 0000000..a65db8c --- /dev/null +++ b/mobile_src/Contact/AddressBookController.h @@ -0,0 +1,88 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file AddressBookController.h + * @version 0.1 + * @brief + */ + +#ifndef _TIZEN_CONTACT_ADDRESS_BOOK_CONTROLLER_H_ +#define _TIZEN_CONTACT_ADDRESS_BOOK_CONTROLLER_H_ + +#include <dpl/shared_ptr.h> +#include <Commons/EventReceiver.h> +#include <Commons/EventListener.h> +#include <CommonsJavaScript/PrivateObject.h> +#include <CommonsJavaScript/JSPendingOperationPrivateObject.h> +#include <CommonsJavaScript/JSPendingOperation.h> +#include <Security.h> +#include "IAddressBook.h" + +namespace DeviceAPI { +namespace Contact { + +typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<AddressBookPtr, + WrtDeviceApis::CommonsJavaScript::NoOwnership> AddressBookPrivObject; + +typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventAddressBookAddBatch> EventAddressBookAddBatchEventAnswerReceiver; +typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventAddressBookUpdateBatch> EventAddressBookUpdateBatchEventAnswerReceiver; +typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventAddressBookRemoveBatch> EventAddressBookRemoveBatchEventAnswerReceiver; +typedef WrtDeviceApis::Commons::EventAnswerReceiver<EventAddressBookFind> EventAddressBookFindEventAnswerReceiver; +typedef WrtDeviceApis::Commons::EventListener<EventAddressBookChangeListener> EventAddressBookChangeListenerListener; + +class AddressBookController : + public EventAddressBookAddBatchEventAnswerReceiver, + public EventAddressBookUpdateBatchEventAnswerReceiver, + public EventAddressBookRemoveBatchEventAnswerReceiver, + public EventAddressBookFindEventAnswerReceiver, + public EventAddressBookChangeListenerListener, + public DeviceAPI::Common::SecurityAccessor, + public AddressBookPrivObject +{ +public: + AddressBookController(JSContextRef context, + AddressBookPtr addressBook); + virtual ~AddressBookController(); +protected: + void OnAnswerReceived(const EventAddressBookAddBatchPtr &event); + void OnAnswerReceived(const EventAddressBookUpdateBatchPtr &event); + void OnAnswerReceived(const EventAddressBookRemoveBatchPtr &event); + void OnAnswerReceived(const EventAddressBookFindPtr &event); + void onAnswerReceived(const EventAddressBookChangeListenerPtr &event); +}; + +typedef DPL::SharedPtr<AddressBookController> AddressBookControllerPtr; + +//common part +class AddressBookAsyncAnswerHandler +{ +public: + static void addBatch(const EventAddressBookAddBatchPtr &event); + static void updateBatch(const EventAddressBookUpdateBatchPtr &event); + static void removeBatch(const EventAddressBookRemoveBatchPtr &event); + static void find(const EventAddressBookFindPtr &event); + static void changeListenerError(const EventAddressBookChangeListenerPtr &event); + static void changeListenerContactAdded(const EventAddressBookChangeListenerPtr &event); + static void changeListenerContactUpdated(const EventAddressBookChangeListenerPtr &event); + static void changeListenerContactRemoved(const EventAddressBookChangeListenerPtr &event); +}; + +} // Contact +} // DeviceAPI + +#endif // _TIZEN_CONTACT_ADDRESS_BOOK_CONTROLLER_H_ |