/** * @file test_setting.cpp * * @brief Settings daemon test plugin. * * @author Ossama Othman @ * * @copyright @par * Copyright 2013 Intel Corporation All Rights Reserved. * @par * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * @par * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * @par * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #include "test_setting_api.hpp" #include "test_setting.hpp" #include #include #include #include test_setting::test_setting() { } test_setting::~test_setting() { } std::string const & test_setting::id() const { static std::string const name("test_setting"); return name; } void test_setting::handle_request(std::string request, ivi::settings::response_callback response) { std::cout << "test_setting received request:\n" << request << std::endl; if (response.type() != id()) { response.send_error("Response type mismatch. Got \"" + response.type() + "\". Expected \"" + id() + "\"."); return; } // Nothing to add to successful response. response.send_response( [](JsonBuilder * /* builder */) {}); } // ----------------------------------------------------------------------- /// Plugin factory/registration function. extern "C" TEST_SETTING_API bool register_settings(ivi::settings::registrar & r) { std::unique_ptr test(new test_setting); return r.register_setting(std::move(test)); } // Local Variables: // mode:c++ // c-basic-offset:2 // indent-tabs-mode: nil // End: