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