2 * @file test_setting.cpp
4 * @brief Settings daemon test plugin.
6 * @author Ossama Othman @<ossama.othman@@intel.com@>
9 * Copyright 2013 Intel Corporation All Rights Reserved.
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301 USA
27 #include "test_setting_api.hpp"
28 #include "test_setting.hpp"
29 #include <settingsd/response_callback.hpp>
30 #include <settingsd/registrar.hpp>
36 test_setting::test_setting()
40 test_setting::~test_setting()
45 test_setting::id() const
47 static std::string const name("test_setting");
52 test_setting::handle_request(std::string request,
53 ivi::settings::response_callback response)
55 std::cout << "test_setting received request:\n"
56 << request << std::endl;
58 if (response.type() != id()) {
59 response.send_error("Response type mismatch. Got \""
67 // Nothing to add to successful response.
68 response.send_response(
69 [](JsonBuilder * /* builder */) {});
72 // -----------------------------------------------------------------------
74 /// Plugin factory/registration function.
75 extern "C" TEST_SETTING_API bool
76 register_settings(ivi::settings::registrar & r)
78 std::unique_ptr<ivi::settings::plugin> test(new test_setting);
80 return r.register_setting(std::move(test));
88 // indent-tabs-mode: nil