From da9d177514fe438edd8262226cdc770df6c9eb82 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Fri, 30 Aug 2019 11:40:23 -0400 Subject: Initial check in Initial check in of contents of the original repository: git://github.com/AGLExport/agl-service-navigation as of commit 1f1ffc92fcc882aa5e885badbc91a3384f5d77b1. Bug-AGL: SPEC-2787 Signed-off-by: Scott Murray Change-Id: I02d008ee73cdfd88f1e7587ee57101187b9c4d6d (cherry picked from commit f14ecdd52975ae365af5ed32648bf55dddacb8d9) --- libnavi/include/RequestManage.h | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 libnavi/include/RequestManage.h (limited to 'libnavi/include/RequestManage.h') diff --git a/libnavi/include/RequestManage.h b/libnavi/include/RequestManage.h new file mode 100644 index 0000000..05ffcdf --- /dev/null +++ b/libnavi/include/RequestManage.h @@ -0,0 +1,64 @@ +// Copyright 2017 AISIN AW CO.,LTD + +#pragma once + +#include +#include +#include + +extern "C" { + #include + #include +} + +#include "RequestManageListener.h" + +/** +* @brief Class for request +*/ +class RequestManage +{ +public: + pthread_cond_t cond; + pthread_mutex_t mutex; + + struct afb_wsj1* wsj1; + std::string* requestURL; + struct afb_wsj1_itf wsj1_itf; + +private: + RequestManageListener* listener; + int request_cnt; + uint32_t sessionHandle; + uint32_t routeHandle; + + // Function called from thread + static void* BinderThread(void* param); + + // Callback function + void OnReply(struct afb_wsj1_msg *msg); + void OnHangup(struct afb_wsj1 *wsj1); + void OnCallStatic(const char *api, const char *verb, struct afb_wsj1_msg *msg); + void OnEventStatic(const char *event, struct afb_wsj1_msg *msg); + + static void OnReplyStatic(void *closure, struct afb_wsj1_msg *msg); + static void OnHangupStatic(void *closure, struct afb_wsj1 *wsj1); + static void OnCallStatic(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg); + static void OnEventStatic(void *closure, const char *event, struct afb_wsj1_msg *msg); + +// ================================================================================================== +// public +// ================================================================================================== +public: + RequestManage(); + ~RequestManage(); + + bool Connect(const char* api_url, RequestManageListener* listener); + bool IsConnect(); + bool CallBinderAPI(const char *api, const char *verb, const char *object); + void SetSessionHandle(uint32_t session); + uint32_t GetSessionHandle(); + void SetRouteHandle(uint32_t route); + uint32_t GetRouteHandle(); +}; + -- cgit 1.2.3-korg