2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <package-manager.h>
19 #include <pkgmgr-info.h>
22 #include "PackageInformation.h"
23 #include "PackageUtil.h"
28 PackageInformation::PackageInformation() :
29 m_isInitialized(false)
33 PackageInformation::~PackageInformation()
37 void PackageInformation::initializePackageInfo()
39 LOGD("Enter : %s", m_id.c_str());
41 pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
43 LOGE("Fail to create pkgmgr client");
45 int ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, pc, NULL, m_id.c_str(), NULL, NULL, NULL);
47 LOGE("Fail to get total size");
52 ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_DATA_SIZE, pc, NULL, m_id.c_str(), NULL, NULL, NULL);
54 LOGE("Fail to get data size");
59 ret = pkgmgr_client_free(pc);
60 if(ret != PMINFO_R_OK){
61 LOGE("ret : %d , %s", ret, PackageUtil::getPkginfoErrorMessage(ret).c_str());
67 m_isInitialized = true;