2 * Copyright (c) 2018 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_CLIENTMANAGER_H
18 #define HOMESCREEN_CLIENTMANAGER_H
24 #include <unordered_map>
25 #include "hs-helper.h"
26 #include "hs-client.h"
28 typedef struct HS_ClientCtxt
31 HS_ClientCtxt(const char *appid)
38 class HS_ClientManager {
41 ~HS_ClientManager() = default;
42 HS_ClientManager(HS_ClientManager const &) = delete;
43 HS_ClientManager &operator=(HS_ClientManager const &) = delete;
44 HS_ClientManager(HS_ClientManager &&) = delete;
45 HS_ClientManager &operator=(HS_ClientManager &&) = delete;
47 static HS_ClientManager* instance(void);
49 HS_Client* find(std::string appid);
50 HS_Client* getClient(afb_req req, std::string appid);
51 std::vector<HS_Client*> getAllClient(void);
52 void removeClientCtxt(void *data);
55 HS_ClientCtxt* createClientCtxt(afb_req req, std::string appid);
56 HS_Client* addClient(afb_req req, std::string appid);
57 void removeClient(std::string appid);
60 static HS_ClientManager* me;
61 std::unordered_map<std::string, HS_Client*> client_list;
62 std::unordered_map<std::string, HS_ClientCtxt*> appid2ctxt;
66 #endif // HOMESCREEN_CLIENTMANAGER_H