2 * Copyright 2018 Samsung Electronics Co., Ltd
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 SWITCHES_PAGE_HPP
18 #define SWITCHES_PAGE_HPP
20 #include "AddSwitchPage.hpp"
21 #include "AppContext.hpp"
23 #include "Genlist.hpp"
24 #include "RemoveSwitchPage.hpp"
25 #include "UpdateSwitchPage.hpp"
28 * View displaying already configured switches and allowing
29 * to start configuration of new switch.
31 * @param ad global context of application
34 * replace classical callbacks with lambda expressions
39 using back_cb = void (*)(void *ad); // TODO: probably remove
41 void attachCallback(back_cb callback, void *data);
42 static void addSwitchCb(
44 const std::string &switch_id,
45 const std::string &switch_action,
46 const std::string &switch_name);
49 void updateSwitchesList();
50 void createSwitchesGroup();
51 static void switchUpdatedCb(
53 const std::string &switch_id,
54 const std::string &switch_action,
55 const std::string &switch_name);
56 static void switchRemovedCb(
58 const std::string &switch_id,
59 const std::string &switch_action,
60 const std::string &switch_name);
63 Button *removeSwitchesPageBtn_ = nullptr;
64 back_cb universal_switch_switches_back = nullptr;
65 void *universal_switch_switches_back_data = nullptr;
66 Genlist *switches_ = nullptr;
67 std::unique_ptr<RemoveSwitchPage> removeSwitchPage_;
68 std::unique_ptr<AddSwitchPage> addSwitchPage_;
69 std::unique_ptr<UpdateSwitchPage> updateSwitchPage_;