57375a8863d215d3fcd90ae6f4056495fbb9dfed
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Application / EventLaunchService.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef TIZENAPIS_API_EVENT_LAUNCH_SERVICE_H_
18 #define TIZENAPIS_API_EVENT_LAUNCH_SERVICE_H_
19
20
21
22 #include <Commons/IEvent.h>
23 #include <dpl/shared_ptr.h>
24 #include "ApplicationServiceRequest.h"
25 #include "ApplicationServiceReply.h"
26 #include "ApplicationServiceExtraData.h"
27
28 namespace TizenApis {
29 namespace Api {
30 namespace Application {
31
32 class EventLaunchService: public WrtDeviceApis::Commons::IEvent<EventLaunchService> {
33
34 private:
35         ApplicationServiceRequestPtr m_request;
36         ApplicationServiceReplyPtr m_reply;
37         int callbackType;
38
39 public:
40         /* EVENT TYPE */
41         static const int APPLICATION_SERVICE_UNKNOWN = 0;
42         static const int APPLICATION_SERVICE_CALLBACK = 1;
43         static const int APPLICATION_SERVICE_REPLY_SUCCESS_CALLBACK = 2;
44         static const int APPLICATION_SERVICE_REPLY_FAIL_CALLBACK = 3;
45         static const int APPLICATION_SERVICE_REPLY_CANCEL_CALLBACK = 4; 
46 public: 
47         void addExtraDataToReply(std::string &key, std::string &value){
48                 
49                 ApplicationServiceExtraDataPtr extraData(new ApplicationServiceExtraData());
50                 extraData->setKey(key);
51                 extraData->setValue(value);
52                 if( !m_reply )
53                 {
54                         ApplicationServiceReplyPtr reply(new ApplicationServiceReply());
55                         
56                         ApplicationServiceExtraDataArrayPtr extraDataArray(new ApplicationServiceExtraDataArray());
57                         reply->setExtraDataArray(extraDataArray);
58                         setServiceReply(reply);
59                 }
60                 m_reply->addExtraData(extraData);
61         }
62         
63
64         void setServiceRequest(ApplicationServiceRequestPtr &appservice){
65                 m_request = appservice;
66         }
67
68         ApplicationServiceRequestPtr getServiceRequest() const{
69                 return m_request;
70         }
71
72         void setServiceReply(ApplicationServiceReplyPtr &serviceReply){
73                 m_reply = serviceReply;
74         }
75         ApplicationServiceReplyPtr getServiceReply() const{
76                 return m_reply;
77         }
78         void setCallbackType(int callbacktype){
79                 callbackType = callbacktype;
80         }
81         int getCallbackType() const{
82                 return callbackType;
83         }       
84         EventLaunchService() 
85         {
86         }               
87 };
88
89 typedef DPL::SharedPtr<EventLaunchService> EventLaunchServicePtr;
90
91 } // Application
92 } // Api
93 } // TizenApis
94
95 #endif