2 * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
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 HOMESCREEN_APPINFO_H
18 #define HOMESCREEN_APPINFO_H
25 #include <unordered_map>
26 #include "hs-helper.h"
33 std::string detail; // detail json_object string
36 std::string getProperty(std::string key) const;
41 HS_AppInfo() = default;
43 HS_AppInfo(HS_AppInfo const &) = delete;
44 HS_AppInfo &operator=(HS_AppInfo const &) = delete;
45 HS_AppInfo(HS_AppInfo &&) = delete;
46 HS_AppInfo &operator=(HS_AppInfo &&) = delete;
48 static HS_AppInfo* instance(void);
49 int init(afb_api_t api);
50 int onEvent(afb_api_t api, const char *event, struct json_object *object);
52 void getRunnables(struct json_object **object);
53 std::string getAppProperty(const std::string appid, std::string key) const;
54 std::string checkAppId(const std::string &appid);
57 int updateAppDetailList(afb_api_t api, struct json_object *object);
58 void createAppDetailList(struct json_object *object);
59 std::string parseAppDetail(struct json_object *object, AppDetail &info) const;
60 void addAppDetail(struct json_object *object);
61 void removeAppDetail(std::string appid);
62 struct json_object* retrieveRunnables(struct json_object *obj_runnables, std::string id);
63 void pushAppListChangedEvent(const char *oper, struct json_object *object);
64 std::string id2appid(const std::string &id) const;
65 bool isPeripheryApp(const char *appid) const;
67 // applications can't display on launcher
68 const std::vector<const char*> periphery_app_list {
75 typedef int (HS_AppInfo::*func_handler)(afb_api_t, struct json_object*);
76 static const std::unordered_map<std::string, func_handler> concerned_event_list;
79 static HS_AppInfo* me;
80 HS_AfmMainProxy* afmmain = nullptr;
81 std::unordered_map<std::string, std::string> appid2name;
82 std::unordered_map<std::string, std::string> name2appid;
83 std::unordered_map<std::string, AppDetail> app_detail_list;
87 #endif // HOMESCREEN_APPINFO_H