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.
16 #ifndef HOMESCREEN_PERIPHERY_H
17 #define HOMESCREEN_PERIPHERY_H
19 #include <unordered_set>
20 #include <unordered_map>
21 #include "hs-helper.h"
25 virtual int init(afb_api_t api) = 0;
26 virtual void onEvent(afb_api_t api, const char *event, struct json_object *object) = 0;
29 class HS_Restriction : public HS_Periphery {
31 HS_Restriction() = default;
32 ~HS_Restriction() = default;
34 int init(afb_api_t api);
35 void onEvent(afb_api_t api, const char *event, struct json_object *object);
38 const std::unordered_set<const char*> concerned_event_list {
39 "windowmanager/RestrictionOn",
40 "windowmanager/RestrictionOff"
42 inline bool isConcernedEvent(const char* event) const {
43 return (concerned_event_list.find(event) != concerned_event_list.end()) ? true : false;
46 void restrictionOn(afb_api_t api, struct json_object *object);
47 void restrictionOff(afb_api_t api, struct json_object *object);
49 std::string m_appid = "restriction";
52 class HS_PeripheryManager {
54 HS_PeripheryManager() = default;
55 ~HS_PeripheryManager() = default;
57 int init(afb_api_t api);
58 static HS_PeripheryManager* instance(void);
59 void onEvent(afb_api_t api, const char *event, struct json_object *object);
61 inline bool isPeripheryApp(const char* name) const {
62 return (periphery_app_list.find(name) != periphery_app_list.end()) ? true : false;
66 const std::unordered_set<const char*> periphery_app_list {
73 static HS_PeripheryManager* me;
74 std::unordered_map<std::string, HS_Periphery*> periphery_list;
75 // HS_Restriction m_restriction;
78 #endif // HOMESCREEN_PERIPHERY_H