X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fhs-client.h;h=cbf2f33ff9a7c7baaae5f66928baf064b07441cb;hb=refs%2Ftags%2F9.0.0;hp=035f3c485c7932380035a972ea67ff9cb1fc9a63;hpb=ea459cc8988c3e664c3f9d56d3a9929775d8b57b;p=apps%2Fagl-service-homescreen.git diff --git a/src/hs-client.h b/src/hs-client.h index 035f3c4..cbf2f33 100644 --- a/src/hs-client.h +++ b/src/hs-client.h @@ -18,31 +18,44 @@ #define HOMESCREEN_CLIENT_H #include +#include #include #include "hs-helper.h" class HS_Client { public: - HS_Client(struct afb_req request, const char* id) : HS_Client(request, std::string(id)){} - HS_Client(struct afb_req request, std::string id); + HS_Client(afb_req_t request, const char* id) : HS_Client(request, std::string(id)){} + HS_Client(afb_req_t request, std::string id); HS_Client(HS_Client&) = delete; HS_Client &operator=(HS_Client&) = delete; ~HS_Client(); - int tap_shortcut(const char* appname); - int on_screen_message (struct afb_req request, const char* message); - int on_screen_reply (struct afb_req request, const char* message); - int subscribe(struct afb_req request, const char* event); - int unsubscribe(struct afb_req request, const char* event); + int handleRequest(afb_req_t request, const char *verb); + int pushEvent(const char *event, struct json_object *param); private: + int tap_shortcut(afb_req_t request); + int on_screen_message (afb_req_t request); + int on_screen_reply (afb_req_t request); + int showWindow(afb_req_t request); + int hideWindow(afb_req_t request); + int replyShowWindow(afb_req_t request); + int subscribe(afb_req_t request); + int unsubscribe(afb_req_t request); + int showNotification(afb_req_t request); + int showInformation(afb_req_t request); + + typedef int (HS_Client::*func_handler)(afb_req_t); + static const std::unordered_map func_list; bool checkEvent(const char* event); + bool isSupportEvent(const char* event); private: std::string my_id; - struct afb_event my_event; - std::unordered_map event_list; + afb_event_t my_event; + bool subscription = false; + std::unordered_set event_list; };