2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef PACKAGE_PACKAGE_INFO_PROVIDER_H_
18 #define PACKAGE_PACKAGE_INFO_PROVIDER_H_
20 #include <pkgmgr-info.h>
22 #include "common/extension.h"
23 #include "common/picojson.h"
24 #include "common/platform_exception.h"
29 class PackageInfoProvider {
31 PackageInfoProvider();
32 virtual ~PackageInfoProvider();
34 /* out["status"] = "success" or "error"
35 * If status is "success", then the result(picojson::value)
36 * will be stored in out["informationArray"].
37 * If status is "error", then the error(picojson::value)
38 * will be stored in out["error"].
40 static void GetPackagesInfo(picojson::object& out);
42 /* out["status"] = "success" or "error"
43 * If status is "success", then the result(picojson::value)
44 * will be stored in out["result"].
45 * If status is "error", then the error(picojson::value)
46 * will be stored in out["error"].
48 static void GetPackageInfo(picojson::object& out);
49 static void GetPackageInfo(const char* package_id, picojson::object& out);
51 static bool ConvertToPackageToObject(const pkgmgrinfo_pkginfo_h info, picojson::object& out);
53 static void GetTotalSize(const std::string& id, picojson::object* out);
54 static void GetDataSize(const std::string& id, picojson::object* out);
57 static bool GetCurrentPackageId(char** package_id);
60 } // namespace package
61 } // namespace extension
63 #endif // PACKAGE_PACKAGE_INFO_PROVIDER_H_