TIVI-1924: Initial commit of IVI settings daemon.
[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 #include "connman_manager.hpp"
32
33 #include <json-glib/json-glib.h>
34
35
36 namespace ivi
37 {
38   namespace settings
39   {
40     class response_callback;
41
42     /**
43      * @class technology
44      *
45      * @brief Common technology-based settings functionality.
46      *
47      * This class implements functionality common to all technology-based
48      * settings, such as bluetooth, wifi, date/time, etc.
49      */
50     class technology
51     {
52     public:
53
54       /**
55        * Constructor.
56        *
57        * @param[in] tech The connman technology, e.g. "bluetooth".
58        */
59       technology(std::string tech);
60
61       /// Handle requests common to all connman technologies.
62       void handle_request(std::string request,
63                           response_callback response);
64
65     private:
66
67       /// Get technology "Powered" state.
68       void get_powered(JsonReader * reader,
69                        response_callback response);
70
71       /// Set technology "Powered" state.
72       void set_powered(JsonReader * reader,
73                        response_callback response);
74
75       /**
76        * Scan for services that implement the technology, e.g. WiFi
77        * access points.
78        */
79       void scan(JsonReader * reader,
80                 response_callback response);
81
82       /**
83        * Connect to service whose object path is found in the JSON
84        * request.
85        */
86       void connect(JsonReader * reader,
87                    response_callback response);
88
89       /**
90        * Disconnect from service whose object path is found in the
91        * JSON request.
92        */
93       void disconnect(JsonReader * reader,
94                       response_callback response);
95
96       /// Send list of services to caller.
97       void send_services(response_callback response,
98                          GError *& error);
99
100       /**
101        * Get property for this technology.
102        *
103        * @param[in] name     Name of the connman technology property
104        *                     to retrieve.
105        * @param[in] type     The type of property being retrieved.
106        * @param[in] response The response callback through errors will
107        *                     be sent to the caller.
108        *
109        * @returns A @c GVariant containing the retrieved property.
110        */
111       GVariant * get_property(char const * name,
112                               GVariantType const * type,
113                               response_callback response);
114
115     private:
116
117       /// The proxy used to access the connman Technology D-Bus API.
118       connman connman_;
119
120       /// The proxy used to access the connman Manager D-Bus API.
121       connman_manager manager_;
122
123       /// Technology name, e.g. "bluetooth" or "wifi".
124       std::string const technology_;
125
126     };
127
128   }
129 }
130
131
132 #endif  /* IVI_SETTINGS_CONNMAN_TECHNOLOGY_HPP */
133
134
135 // Local Variables:
136 // mode:c++
137 // c-basic-offset:2
138 // indent-tabs-mode: nil
139 // End: