Added API for enabling tethering
[profile/ivi/settings-daemon.git] / plugins / connman / technology.hpp
1 /**
2  * @file technology.hpp
3  *
4  * @brief Connman technology request handling.
5  *
6  * @author Ossama Othman @<ossama.othman@@intel.com@>
7  *
8  * @copyright @par
9  * Copyright 2013 Intel Corporation All Rights Reserved.
10  * @par
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.
15  * @par
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.
20  * @par
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
25  */
26
27 #ifndef IVI_SETTINGS_CONNMAN_TECHNOLOGY_HPP
28 #define IVI_SETTINGS_CONNMAN_TECHNOLOGY_HPP
29
30 #include "connman.hpp"
31
32 #include <string>
33
34 #include <json-glib/json-glib.h>
35
36
37 namespace ivi
38 {
39   namespace settings
40   {
41     class response_callback;
42     class connman_manager;
43
44     /**
45      * @class technology
46      *
47      * @brief Common technology-based settings functionality.
48      *
49      * This class implements functionality common to all technology-based
50      * settings, such as bluetooth, wifi, date/time, etc.
51      */
52     class technology
53     {
54     public:
55
56       /**
57        * Constructor.
58        *
59        * @param[in] path       The connman technology object path.
60        * @param[in] connection Underlying D-Bus connection.
61        * @param[in] manager    Connman manager proxy.
62        */
63       technology(char const * path,
64                  GDBusConnection * connection,
65                  connman_manager & manager);
66
67       /**
68        * Handle connman technology-specific request.
69        *
70        * @param[in] name     The Connman Technology method name.
71        * @param[in] reader   @c JsonReader object containing desired
72        *                     values.  The value will be in the second
73        *                     array element.
74        * @param[in] response Callback through which results will be
75        *                     sent.
76        */
77       void handle_request(char const * name,
78                           JsonReader * reader,
79                           response_callback & response);
80
81     private:
82
83       /// Get technology "Powered" state.
84       void get_powered(JsonReader * reader,
85                        response_callback & response);
86
87       /// Set technology "Powered" state.
88       void set_powered(JsonReader * reader,
89                        response_callback &response);
90
91
92       /// Set technology to tethering mode
93       void set_tethering(JsonReader * reader,
94                          response_callback &response);
95
96       /**
97        * Scan for services that implement the technology, e.g. WiFi
98        * access points.
99        */
100       void scan(JsonReader * reader,
101                 response_callback & response);
102
103       /**
104        * Get property for this technology.
105        *
106        * @param[in] name     Name of the connman technology property
107        *                     to retrieve.
108        * @param[in] type     The type of property being retrieved.
109        * @param[in] response The response callback through errors will
110        *                     be sent to the caller.
111        *
112        * @returns A @c GVariant containing the retrieved property.
113        */
114       GVariant * get_property(char const * name,
115                               GVariantType const * type,
116                               response_callback & response);
117
118       bool set_property(char const * name,
119                         GVariant * value,
120                         response_callback response,
121                         GError *& error);
122
123     private:
124
125       /// The proxy used to access the connman Technology D-Bus API.
126       connman connman_;
127
128       /// The proxy used to access the connman Manager D-Bus API.
129       connman_manager & manager_;
130
131     };
132
133   }
134 }
135
136
137 #endif  /* IVI_SETTINGS_CONNMAN_TECHNOLOGY_HPP */
138
139
140 // Local Variables:
141 // mode:c++
142 // c-basic-offset:2
143 // indent-tabs-mode: nil
144 // End: