2 * Copyright (c) 2019 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_VUIADAPTER_H
18 #define HOMESCREEN_VUIADAPTER_H
23 #include "hs-helper.h"
24 #include "hs-clientmanager.h"
26 class Vui_ModuleBase {
28 explicit Vui_ModuleBase(std::string uid) : m_uid(uid) {}
29 virtual ~Vui_ModuleBase() {}
30 virtual void init(afb_api_t api) = 0;
31 virtual int onEvent(afb_api_t api, const char *event, struct json_object *object) = 0;
32 std::string mouduleId(void) {return m_uid;}
38 class Vui_Navigation : public Vui_ModuleBase, public listener_interface {
40 explicit Vui_Navigation(std::string uid) : Vui_ModuleBase(uid), listener_interface(uid) {}
41 ~Vui_Navigation() = default;
43 virtual void init(afb_api_t api);
44 virtual int onEvent(afb_api_t api, const char *event, struct json_object *object);
45 virtual void notify(afb_api_t api, std::string appid = "");
48 void set_destination(afb_api_t api, struct json_object *object);
49 void cancel_navigation(afb_api_t api, struct json_object *object);
50 void set_destination2poi(afb_api_t api);
51 void start_navigation(afb_api_t api);
53 typedef void (Vui_Navigation::*func_handler)(afb_api_t, struct json_object *object);
54 static const std::map<std::string, func_handler> func_list;
55 std::pair<double, double> m_dest;
56 std::pair<bool, bool> m_start_flg;
61 HS_VuiAdapter() = default;
62 ~HS_VuiAdapter() = default;
63 HS_VuiAdapter(HS_VuiAdapter const &) = delete;
64 HS_VuiAdapter &operator=(HS_VuiAdapter const &) = delete;
65 HS_VuiAdapter(HS_VuiAdapter &&) = delete;
66 HS_VuiAdapter &operator=(HS_VuiAdapter &&) = delete;
68 static HS_VuiAdapter* instance(void);
69 void init(afb_api_t api);
70 int onEvent(afb_api_t api, const char *event, struct json_object *object);
73 static HS_VuiAdapter* me;
74 std::map<std::string, Vui_ModuleBase*> module_list;
77 #endif // HOMESCREEN_VUIADAPTER_H