123868f9400ff25423d7777f32045d693ce4c6df
[platform/core/context/app-history.git] / src / server / usage-stats / InstallMonitor.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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 __CONTEXT_STATS_APP_INSTALL_MONITOR_H__
18 #define __CONTEXT_STATS_APP_INSTALL_MONITOR_H__
19
20 #include <string>
21 #include <package_manager.h>
22
23 namespace ctx {
24
25         class AppInstallMonitor {
26         private:
27                 package_manager_h __pkgmgrHandle;
28
29                 bool __startMonitoring();
30                 void __stopMonitoring();
31
32                 static std::string __createDeletionQuery(const char* tableName, const char* appId);
33                 static void __packageEventCb(const char *type, const char *package, package_manager_event_type_e eventType, package_manager_event_state_e eventState, int progress, package_manager_error_e error, void *userData);
34                 static bool __appInfoCb(package_info_app_component_type_e compType, const char *appId, void *userData);
35
36         public:
37                 AppInstallMonitor();
38                 ~AppInstallMonitor();
39         };
40
41 }       /* namespace ctx */
42
43 #endif  /* End of __CONTEXT_STATS_APP_INSTALL_MONITOR_H__ */