2 * @file event_callback.hpp
4 * @brief Settings event callback header.
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
28 #ifndef IVI_SETTINGS_EVENT_CALLBACK_HPP
29 #define IVI_SETTINGS_EVENT_CALLBACK_HPP
31 #include <settingsd/settings_api.hpp>
32 #include <settingsd/send_callback.hpp>
44 * @class event_callback event_callback.hpp <settingsd/event_callback.hpp>
46 * @brief Callback that handles sending event to Settings app.
48 * A @c event_callback sends a JSON formatted event string
49 * to the Settings app. It is up to the specific settings plugin
50 * to decide what goes in to the event.
52 class SETTINGS_API event_callback
57 event_callback(manager & m);
60 * Send event to Settings app.
62 * The settings daemon requires that plugins use the json-glib
63 * library to build JSON event strings. Plugins will pass a
64 * callback function @a event_builder that uses to the
65 * json-glib high level "builder" API to append the event to the
66 * JSON event string. Plugins should take care to only use the
67 * builder functions that add members and their corresponding
68 * values. They should not attempt to start or end the top
69 * level JSON object. That will be automatically handled by
72 * @param[in] event_builder Callback function that appends JSON
73 * formatted event data.
76 std::function<void(JsonBuilder *)> event_builder) const;
81 * Begin the JSON formatted event to the Settings app
84 * The appropriate "header" information will be prepended to the
87 unique_ptr<JsonBuilder> begin_event() const;
90 * End the JSON formatted event to the Settings app request.
92 void end_event(unique_ptr<JsonBuilder> const & builder) const;
97 * Settings manager used to send event to clients over
98 * corresponding WebSockets.
107 #endif /* IVI_SETTINGS_EVENT_CALLBACK_HPP */
113 // indent-tabs-mode: nil