tizen 2.3.1 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Application / EventApplicationAppInfoEventListener.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 #ifndef TIZENAPIS_API_APPLICATION_EVENT_APPLICATION_APP_INFO_EVENT_LISTENER_H_
19 #define TIZENAPIS_API_APPLICATION_EVENT_APPLICATION_APP_INFO_EVENT_LISTENER_H_
20
21 #include <Commons/IEvent.h>
22 #include <dpl/shared_ptr.h>
23 #include <Commons/ListenerEvent.h>
24 #include <Commons/ListenerEventEmitter.h>
25 #include <Commons/Emitters.h>
26 #include "ApplicationInformation.h"
27
28 namespace DeviceAPI {
29 namespace Application {
30
31 class EventApplicationAppInfoEventListener :
32         public WrtDeviceApis::Commons::ListenerEvent<EventApplicationAppInfoEventListener>
33 {
34 public:
35     enum CallbackType
36     {
37         OnError,
38         OnInstalled,
39         OnUpdated,
40         OnUninstalled
41     };
42
43 private:
44     CallbackType m_type;
45
46     std::string m_appId;
47     ApplicationInformationPtr m_appInfo;
48
49 public:
50     void setAppId(const std::string &appId)
51     {
52         LOGD("Entered");
53         m_appId = appId;
54     }
55
56     std::string getAppId() const
57     {
58         LOGD("Entered");
59         return m_appId;
60     }
61
62     void setAppInfo(const ApplicationInformationPtr &appInfo)
63     {
64         LOGD("Entered");
65         m_appInfo = appInfo;
66     }
67
68     ApplicationInformationPtr getAppInfo() const
69     {
70         LOGD("Entered");
71         return m_appInfo;
72     }
73
74     void setType(CallbackType type)
75     {
76         LOGD("Entered");
77         m_type = type;
78     }
79
80     int getType() const
81     {
82         LOGD("Entered");
83         return m_type;
84     }
85
86     EventApplicationAppInfoEventListener() :
87         m_type(OnError),
88         m_appInfo(static_cast<ApplicationInformation*>(NULL))
89     {
90         LOGD("Entered");
91     }
92 };
93
94 typedef DPL::SharedPtr<EventApplicationAppInfoEventListener> EventApplicationAppInfoEventListenerPtr;
95 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventApplicationAppInfoEventListener> EventApplicationAppInfoEventListenerEmitter;
96 typedef DPL::SharedPtr<EventApplicationAppInfoEventListenerEmitter> EventApplicationAppInfoEventListenerEmitterPtr;
97 typedef WrtDeviceApis::Commons::Emitters<EventApplicationAppInfoEventListenerEmitter> EventApplicationAppInfoEventListenerEmitters;
98
99 } // Application
100 } // DeviceAPI
101
102 #endif // TIZENAPIS_API_APPLICATION_EVENT_APPLICATION_APP_INFO_EVENT_LISTENER_H_