17b6c776d01cbff935e608b653318ec751cff3a0
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / Application / Application.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
18 #ifndef TIZENAPIS_PLATFORM_APPLICATION_H_
19 #define TIZENAPIS_PLATFORM_APPLICATION_H_
20
21 #include <map>
22 #include <API/Application/IApplication.h>
23 #include <API/Application/ApplicationFactory.h>
24 #include <API/Application/EventListInstalledApplications.h>
25 #include <API/Application/EventGetApplication.h>
26 #include <API/Application/EventInstalledApplicationChanged.h>
27 #include <API/Application/EventLaunchService.h>
28
29 #include <app_manager.h>
30 #include <app_service.h> 
31 using namespace TizenApis::Api::Application;
32
33 namespace TizenApis {
34 namespace Platform {
35 namespace Application {
36
37 class Application: public IApplication {
38     friend class ApplicationFactory;
39
40 public:
41         Application();
42         virtual ~Application();
43         virtual void listApplications(const EventListInstalledApplicationsPtr& event);
44         virtual void getApplicationInformation(const EventGetApplicationPtr& event);
45         virtual long addApplicationListChangeListener(const EventInstalledApplicationChangedEmitterPtr& emitter);
46         virtual void removeApplicationListChangeListener(const EventInstalledApplicationChangedEmitter::IdType id);
47         virtual void launchService(const EventLaunchServicePtr& event); 
48         void launchServiceManualAnswer(service_h request, service_h reply, service_result_e result);            
49         void InstalledApplicationChanged(app_manger_event_type_e event_type,const char *package);
50
51 protected:
52         virtual void OnRequestReceived(const EventListInstalledApplicationsPtr& event);
53         virtual void OnRequestReceived(const EventGetApplicationPtr& event);
54         virtual void OnRequestReceived(const EventLaunchServicePtr& event);     
55  
56 private:
57         void initialize();
58
59         DPL::Mutex m_initializationMutex;
60         bool m_initialized;
61         Api::Application::EventLaunchServicePtr m_eventLaunchServicePtr;        
62         EventInstalledApplicationChangedEmitterPtr m_installedApplicationsEmitterPtr;
63 };
64
65 }
66 }
67 }
68
69 #endif