X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fhs-vuiadapter.h;fp=src%2Fhs-vuiadapter.h;h=6bf47b0d85cc3b18856705911070b62726365295;hb=3f110d22406e836a7fa8878b00d4b1784ae31a55;hp=0000000000000000000000000000000000000000;hpb=6721f3fbd9d3e5de3b41ce1859ae6034da474a8d;p=apps%2Fagl-service-homescreen.git diff --git a/src/hs-vuiadapter.h b/src/hs-vuiadapter.h new file mode 100644 index 0000000..6bf47b0 --- /dev/null +++ b/src/hs-vuiadapter.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HOMESCREEN_VUIADAPTER_H +#define HOMESCREEN_VUIADAPTER_H + +#include +#include +#include +#include "hs-helper.h" +#include "hs-clientmanager.h" + +class Vui_ModuleBase { +public: + explicit Vui_ModuleBase(std::string uid) : m_uid(uid) {} + virtual ~Vui_ModuleBase() {} + virtual void init(afb_api_t api) = 0; + virtual int onEvent(afb_api_t api, const char *event, struct json_object *object) = 0; + std::string mouduleId(void) {return m_uid;} + +private: + std::string m_uid; +}; + +class Vui_Navigation : public Vui_ModuleBase, public listener_interface { +public: + explicit Vui_Navigation(std::string uid) : Vui_ModuleBase(uid), listener_interface(uid) {} + ~Vui_Navigation() = default; + + virtual void init(afb_api_t api); + virtual int onEvent(afb_api_t api, const char *event, struct json_object *object); + virtual void notify(afb_api_t api, std::string appid = ""); + +private: + void set_destination(afb_api_t api, struct json_object *object); + void cancel_navigation(afb_api_t api, struct json_object *object); + void set_destination2poi(afb_api_t api); + void start_navigation(afb_api_t api); + + typedef void (Vui_Navigation::*func_handler)(afb_api_t, struct json_object *object); + static const std::map func_list; + std::pair m_dest; + std::pair m_start_flg; +}; + +class HS_VuiAdapter { +public: + HS_VuiAdapter() = default; + ~HS_VuiAdapter() = default; + HS_VuiAdapter(HS_VuiAdapter const &) = delete; + HS_VuiAdapter &operator=(HS_VuiAdapter const &) = delete; + HS_VuiAdapter(HS_VuiAdapter &&) = delete; + HS_VuiAdapter &operator=(HS_VuiAdapter &&) = delete; + + static HS_VuiAdapter* instance(void); + void init(afb_api_t api); + int onEvent(afb_api_t api, const char *event, struct json_object *object); + +private: + static HS_VuiAdapter* me; + std::map module_list; +}; + +#endif // HOMESCREEN_VUIADAPTER_H \ No newline at end of file