636c6b9742ff0ffdd37b06f13920a7a2885ac377
[profile/ivi/settings-daemon.git] / plugins / connman / clock.hpp
1 /**
2  * @file clock.hpp
3  *
4  * @brief Clock settings plugin.
5  *
6  * Connman-based clock settings plugin.
7  *
8  * @author Ossama Othman @<ossama.othman@@intel.com@>
9  *
10  * @copyright @par
11  * Copyright 2012, 2013 Intel Corporation All Rights Reserved.
12  * @par
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation;
16  * version 2.1 of the License.
17  * @par
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Lesser General Public License for more details.
22  * @par
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this library; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
26  * Boston, MA  02110-1301  USA
27  *
28  * @note This header is internal.  Settings provider plugin implementors
29  *       should write their own library/symbol export macros as
30  *       needed.
31  */
32
33
34 #ifndef IVI_SETTINGS_CONNMAN_CLOCK_HPP
35 #define IVI_SETTINGS_CONNMAN_CLOCK_HPP
36
37 #include "connman.hpp"
38 #include <settingsd/plugin.hpp>
39
40 #include <json-glib/json-glib.h>
41
42
43 namespace ivi
44 {
45   namespace settings
46   {
47     class response_callback;
48
49     /**
50      * @class clock
51      *
52      * @brief Connman-based clock settings.
53      *
54      * This class implements all connman-based clock settings.
55      */
56     class clock : public plugin
57     {
58     public:
59
60       /// Constructor.
61       clock(GDBusConnection * connection, event_callback const & e);
62
63       /// Destructor.
64       virtual ~clock();
65
66       /**
67        * @name Settings Plugin API
68        *
69        * Interface defined by the @c ivi::settings::plugin abstract
70        * base class.
71        *
72        * @see settingsd/plugin.hpp
73        */
74       //@{
75       virtual std::string const & id() const;
76       virtual void handle_request(std::string request,
77                                   response_callback response);
78       //@}
79
80     private:
81
82       /// Set the time.
83       bool set_time(JsonReader * reader,
84                     response_callback response,
85                     GError *& error);
86
87       /// Set the timezone.
88       bool set_timezone(JsonReader * reader,
89                         response_callback response,
90                         GError *& error);
91
92       /// Set time or timezone updates to manual or auto.
93       bool set_updates(char const * name,
94                        JsonReader * reader,
95                        response_callback response,
96                        GError *& error);
97
98       /**
99        * Check if the TimeUpdates or TimezoneUpdate property is set
100        * to "auto".
101        */
102       void is_updates_auto(char const * name,
103                            JsonReader * reader,
104                            response_callback response,
105                            GError *& error);
106
107       /// Set the clock property.
108       bool set_property(char const * name,
109                         GVariant * value,
110                         response_callback response,
111                         GError *& error);
112
113       /// Get the clock property.
114       GVariant * get_property(char const * name,
115                               GError *& error) const;
116
117     private:
118
119       /// Underlying connman proxy.
120       connman connman_;
121
122     };
123
124   }
125 }
126
127
128 #endif  /* IVI_SETTINGS_CONNMAN_CLOCK_HPP */
129
130
131 // Local Variables:
132 // mode:c++
133 // c-basic-offset:2
134 // indent-tabs-mode: nil
135 // End:
136