Update AppControl for handling arguments of ResponseEventArg
[platform/framework/native/appfw.git] / src / app / FApp_AppControlEventArg.h
1 //
2 // Open Service Platform
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        FApp_AppControlEventArg.h
20  * @brief       This is the header file of _AppControlEventArg class.
21  */
22
23 #ifndef _FAPP_INTERNAL_APP_CONTROL_EVENT_ARG_H_
24 #define _FAPP_INTERNAL_APP_CONTROL_EVENT_ARG_H_
25
26 #include <FBaseObject.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
29 #include <FBaseRtIEventArg.h>
30
31 namespace Tizen { namespace Base { namespace Collection {
32 class IList;
33 class IMap;
34 }}}
35
36 namespace Tizen { namespace App
37 {
38
39 class _AppArg;
40 class IAppControlResponseListener;
41
42 /**
43  * @enum        AppControlResposeType
44  */
45 enum _AppControlResponseType
46 {
47         _APPCONTROL_RESPONSETYPE_START,
48         _APPCONTROL_RESPONSETYPE_COMPLETE
49 };
50
51 /**
52  * @class               _AppControlEventArg
53  * @brief
54  */
55 class _AppControlEventArg
56         : public Tizen::Base::Object
57         , public Tizen::Base::Runtime::IEventArg
58 {
59 public:
60         _AppControlEventArg(int reqId, _AppArg* p, int res)
61                 : __reqId(reqId)
62                 , __pArg(p)
63                 , __result(res)
64         {
65         }
66
67         virtual ~_AppControlEventArg(void);
68
69         int GetRequestId(void) const
70         {
71                 return __reqId;
72         }
73
74         _AppArg* GetAppArg(void) const
75         {
76                 return __pArg;
77         }
78
79         int GetResult(void) const
80         {
81                 return __result;
82         }
83
84 private:
85         _AppControlEventArg(const _AppControlEventArg& rhs);
86
87         _AppControlEventArg& operator =(const _AppControlEventArg& rhs);
88
89 private:
90         int __reqId;
91         _AppArg* __pArg;
92         int __result;
93 }; // _AppControlEventArg
94
95 /**
96  * @class               _NativeAppControlEventArg
97  * @brief
98  */
99 class _NativeAppControlEventArg
100         : public Tizen::Base::Object
101         , public Tizen::Base::Runtime::IEventArg
102 {
103 public:
104         _NativeAppControlEventArg(int reqId, int res, Tizen::Base::Collection::IMap* pArgs);
105
106         virtual ~_NativeAppControlEventArg(void);
107
108         int GetRequestId(void) const
109         {
110                 return __reqId;
111         }
112
113         int GetResult(void) const
114         {
115                 return __result;
116         }
117
118         const Tizen::Base::Collection::IMap* GetArgs(void) const
119         {
120                 return __pArgs;
121         }
122
123 private:
124         int __reqId;
125         int __result;
126         Tizen::Base::Collection::IMap* __pArgs;
127 }; // _NativeAppControlEventArg
128
129 /**
130  * @class               _AppControlStartEventArg
131  * @brief
132  */
133 class _AppControlStartEventArg
134         : public Tizen::Base::Object
135         , public Tizen::Base::Runtime::IEventArg
136 {
137 public:
138         _AppControlStartEventArg(int reqId, const AppId& appId, const Tizen::Base::String& operationId)
139                 : __reqId(reqId)
140                 , __appId(appId)
141                 , __operationId(operationId)
142         {
143         }
144
145         virtual ~_AppControlStartEventArg(void)
146         {
147         }
148
149         int GetRequestId(void) const
150         {
151                 return __reqId;
152         }
153
154         AppId GetAppId(void) const
155         {
156                 return __appId;
157         }
158
159         Tizen::Base::String GetOperationId(void) const
160         {
161                 return __operationId;
162         }
163
164 private:
165         _AppControlStartEventArg(const _AppControlStartEventArg& rhs);
166
167         _AppControlStartEventArg& operator =(const _AppControlStartEventArg& rhs);
168
169 private:
170         int __reqId;
171         AppId __appId;
172         Tizen::Base::String __operationId;
173 }; // _AppControlStartEventArg
174
175 /**
176  * @class               _AppControlResponseEventArg
177  * @brief
178  */
179 class _AppControlResponseEventArg
180         : public Tizen::Base::Object
181         , public Tizen::Base::Runtime::IEventArg
182 {
183 public:
184         _AppControlResponseEventArg(IAppControlResponseListener* pResponseListener, _AppControlResponseType type, const AppId& appId, const Tizen::Base::String& operationId, result res, AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData, int reqId)
185                 : __pResponseListener(pResponseListener)
186                 , __type(type)
187                 , __appId(appId.GetPointer())
188                 , __operationId(operationId.GetPointer())
189                 , __res(res)
190                 , __appControlResult(appControlResult)
191                 , __pExtraData(pExtraData)
192                 , __reqId(reqId)
193         {
194         }
195
196         virtual ~_AppControlResponseEventArg(void)
197         {
198                 delete __pExtraData;
199         }
200
201         IAppControlResponseListener* GetListener(void) const
202         {
203                 return __pResponseListener;
204         }
205
206         _AppControlResponseType GetType(void) const
207         {
208                 return __type;
209         }
210
211         const AppId& GetAppId(void) const
212         {
213                 return __appId;
214         }
215
216         const Tizen::Base::String& GetOperationId(void) const
217         {
218                 return __operationId;
219         }
220
221         result GetResult(void) const
222         {
223                 return __res;
224         }
225
226         AppCtrlResult GetAppControlResult(void) const
227         {
228                 return __appControlResult;
229         }
230
231         const Tizen::Base::Collection::IMap* GetExtraData(void) const
232         {
233                 return __pExtraData;
234         }
235
236         int GetRequestId(void) const
237         {
238                 return __reqId;
239         }
240
241 private:
242         _AppControlResponseEventArg(const _AppControlResponseEventArg& rhs);
243
244         _AppControlResponseEventArg& operator =(const _AppControlResponseEventArg& rhs);
245
246 private:
247         IAppControlResponseListener* __pResponseListener;
248         _AppControlResponseType __type;
249         const AppId __appId;
250         const Tizen::Base::String __operationId;
251         result __res;
252         AppCtrlResult __appControlResult;
253         const Tizen::Base::Collection::IMap* __pExtraData;
254         int __reqId;
255 }; // _AppControlEventArg
256
257 } } // Tizen::App
258
259 #endif // _FAPP_INTERNAL_APP_CONTROL_EVENT_ARG_H_