#define HOMESCREEN_CLIENTMANAGER_H
#include <string>
-#include <vector>
#include <mutex>
#include <memory>
#include <unordered_map>
static HS_ClientManager* instance(void);
int init(void);
- HS_Client* find(std::string appid);
- HS_Client* getClient(afb_req req, std::string appid);
- std::vector<HS_Client*> getAllClient(void);
- void removeClientCtxt(void *data);
+ int handleRequest(afb_req_t request, const char *verb, const char *appid = nullptr);
+ int pushEvent(const char *event, struct json_object *param, std::string appid = "");
+ void removeClientCtxt(void *data); // don't use, internal only
+ void setStartupAppidAndArea(const std::pair<std::string, std::string> pair) {startup_appid = pair.first;startup_area = pair.second;}
private:
- HS_ClientCtxt* createClientCtxt(afb_req req, std::string appid);
- HS_Client* addClient(afb_req req, std::string appid);
+ HS_ClientCtxt* createClientCtxt(afb_req_t req, std::string appid);
+ HS_Client* addClient(afb_req_t req, std::string appid);
void removeClient(std::string appid);
+ void checkRegisterApp(afb_api_t api, const std::string &appid);
private:
static HS_ClientManager* me;
std::unordered_map<std::string, HS_Client*> client_list;
std::unordered_map<std::string, HS_ClientCtxt*> appid2ctxt;
std::mutex mtx;
+ std::string startup_appid, startup_area;
};
#endif // HOMESCREEN_CLIENTMANAGER_H
\ No newline at end of file