wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / MessagePort / ILocalMessagePort.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        ILocalMessagePort.h
20  * @author      Kisub Song (kisubs.song@samsung.com)
21  * @version     0.1
22  * @brief
23  */
24
25 #ifndef _API_MESSAGE_PORT_ILOCAL_MESSAGE_PORT_H_
26 #define _API_MESSAGE_PORT_ILOCAL_MESSAGE_PORT_H_
27
28 #include <dpl/shared_ptr.h>
29 #include <Commons/EventReceiver.h>
30 #include "EventLocalMessagePortAddMessagePortListener.h"
31 #include "EventLocalMessagePortRemoveMessagePortListener.h"
32 #include "IRemoteMessagePort.h"
33 #include "MessagePortDataItem.h"
34
35 namespace DeviceAPI {
36 namespace MessagePort {
37
38 class ILocalMessagePort;
39 typedef DPL::SharedPtr<ILocalMessagePort> LocalMessagePortPtr;
40
41 class ILocalMessagePort :
42                 public WrtDeviceApis::Commons::EventRequestReceiver< EventLocalMessagePortAddMessagePortListener >,
43                 public WrtDeviceApis::Commons::EventRequestReceiver< EventLocalMessagePortRemoveMessagePortListener >
44 {
45 public:
46         ILocalMessagePort();
47         virtual ~ILocalMessagePort();
48
49         virtual void addMessagePortListener(const EventLocalMessagePortAddMessagePortListenerPtr &event);
50         virtual void removeMessagePortListener(const EventLocalMessagePortRemoveMessagePortListenerPtr &event);
51
52         virtual std::string getMessagePortName() const = 0;
53         virtual void        setMessagePortName(const std::string &value) = 0;
54         virtual bool        getIsTrusted() const = 0;
55         virtual void        setIsTrusted(const bool &value) = 0;
56
57         virtual void OnMessageReceived(MessagePortDataItemMapPtr &data, RemoteMessagePortPtr &remoteMessagePort) = 0;
58
59 protected:
60         virtual void OnRequestReceived(const EventLocalMessagePortAddMessagePortListenerPtr &event) = 0;
61         virtual void OnRequestReceived(const EventLocalMessagePortRemoveMessagePortListenerPtr &event) = 0;
62 };
63
64 } // MessagePort
65 } // DeviceAPI
66
67 #endif // _API_MESSAGE_PORT_ILOCAL_MESSAGE_PORT_H_