2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef WRTPLUGINS_PLATFORM_MESSAGING_SERVICE_H_
19 #define WRTPLUGINS_PLATFORM_MESSAGING_SERVICE_H_
22 #include <dpl/generic_event.h>
23 #include <dpl/shared_ptr.h>
24 #include <dpl/noncopyable.h>
26 #include "IMessagingService.h"
27 #include "EventMessagingService.h"
29 //#include <Commons/Emitters.h>
34 //DECLARE_GENERIC_EVENT_0(JobDoneEvent) //for manual answer (async call)
35 //=============================================================================
36 class MessagingService:
37 public IMessagingService
41 virtual ~MessagingService();
43 //virtual void createMessage(const EventMessagingServicePtr& event);
44 void setMessagingServiceType(int type);
45 void setMessagingServiceName(const std::string& name);
46 void setMessagingServiceId(int serviceId);
48 virtual int sync(const IMessagingServicePtr& messagingService, const int limit);
49 virtual void syncCancel(int handle);
50 virtual int syncFolder(const IMessagingServicePtr& messagingService, const int folder_id, const int limit);
51 virtual void syncFolderCancel(int handle);
53 virtual void cancelOperation(int opId, int handle, int eventType, IMessagePtr& message);
55 int createOpId(int type);
56 int getHandleFromOpId(int opId);
57 int getOpTypeFromOpId(int opId);
58 IMessagePtr getMessageFromOpId(int opId);
59 EventMessagingServicePtr getEventFromOpId(int opId);
60 EventMessagingServicePtr getEventFromHandle(int handle);
62 void setHandleToOpId(int opId, int handle);
63 void setMessageToOpId(int opId, IMessagePtr& message);
64 void setEventToOpId(int opId, EventMessagingServicePtr& event);
65 int deleteOpId(int opId);
68 //virtual void OnRequestReceived(const EventMessagingServicePtr& event);
72 int create_messaging_service();
76 //EventGetMessagingServicePtr plugin_event;
79 MessagingServiceManager_ERROR_NONE = 0,
80 MessagingServiceManager_ERROR_INVALID_PARAMETER = 1,
81 MessagingServiceManager_ERROR_PLATFORM_SERVICE_NOT_AVAILABLE = 2,
82 MessagingServiceManager_ERROR_UNKNOWN = 3,
85 struct MessagingServiceOpData
90 EventMessagingServicePtr event;
92 explicit MessagingServiceOpData(int handle, int type) :
101 typedef std::map<int, MessagingServiceOpData> OpRequests;
102 typedef OpRequests::iterator OpRequestsIterator;
104 OpRequests m_opRequests; // create operation
111 #endif /* WRTPLUGINS_PLATFORM_MESSAGING_SERVICE_H_ */