2
* Copyright © 2012-2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
19
#ifndef OFONO_NM_CONNECTIVITY_MANAGER_H_
20
#define OFONO_NM_CONNECTIVITY_MANAGER_H_
22
#include <com/ubuntu/location/connectivity/manager.h>
24
#include <com/ubuntu/location/logging.h>
26
#include "cached_radio_cell.h"
27
#include "cached_wireless_network.h"
31
#include <core/dbus/bus.h>
32
#include <core/dbus/object.h>
33
#include <core/dbus/property.h>
34
#include <core/dbus/service.h>
35
#include <core/dbus/types/object_path.h>
36
#include <core/dbus/types/struct.h>
37
#include <core/dbus/types/stl/map.h>
38
#include <core/dbus/types/stl/string.h>
39
#include <core/dbus/types/stl/tuple.h>
40
#include <core/dbus/types/stl/vector.h>
42
#include <core/dbus/asio/executor.h>
44
#include "../set_name_for_thread.h"
48
namespace dbus = core::dbus;
52
struct OfonoNmConnectivityManager : public com::ubuntu::location::connectivity::Manager
54
const core::Property<com::ubuntu::location::connectivity::State>& state() const override;
56
void request_scan_for_wireless_networks() override;
58
const core::Signal<>& wireless_network_scan_finished() const override;
59
const core::Signal<com::ubuntu::location::connectivity::WirelessNetwork::Ptr>& wireless_network_added() const override;
60
const core::Signal<com::ubuntu::location::connectivity::WirelessNetwork::Ptr>& wireless_network_removed() const override;
62
void enumerate_visible_wireless_networks(const std::function<void(const com::ubuntu::location::connectivity::WirelessNetwork::Ptr&)>& f) const override;
64
const core::Signal<com::ubuntu::location::connectivity::RadioCell::Ptr>& connected_cell_added() const override;
65
const core::Signal<com::ubuntu::location::connectivity::RadioCell::Ptr>& connected_cell_removed() const override;
67
void enumerate_connected_radio_cells(const std::function<void(const com::ubuntu::location::connectivity::RadioCell::Ptr&)>& f) const override;
74
void setup_radio_stack_access();
75
void on_modem_added(const core::dbus::types::ObjectPath& path);
76
void on_modem_removed(const core::dbus::types::ObjectPath& path);
77
void on_modem_interfaces_changed(const core::dbus::types::ObjectPath& path, const std::vector<std::string>& interfaces);
79
void setup_network_stack_access();
80
void on_access_point_added(const core::dbus::types::ObjectPath& ap_path, const core::dbus::types::ObjectPath& device_path);
81
void on_access_point_removed(const core::dbus::types::ObjectPath& ap_path);
83
core::dbus::Bus::Ptr system_bus;
84
core::dbus::Executor::Ptr executor;
88
org::freedesktop::NetworkManager::Ptr network_manager;
89
org::Ofono::Manager::Ptr modem_manager;
93
mutable std::mutex guard;
94
std::map<core::dbus::types::ObjectPath, CachedRadioCell::Ptr> cells;
95
std::map<core::dbus::types::ObjectPath, org::Ofono::Manager::Modem> modems;
96
std::map<core::dbus::types::ObjectPath, CachedWirelessNetwork::Ptr> wifis;
97
std::map<core::dbus::types::ObjectPath, org::freedesktop::NetworkManager::Device> wireless_devices;
102
core::Signal<> wireless_network_scan_finished;
103
core::Signal<com::ubuntu::location::connectivity::RadioCell::Ptr> connected_cell_added;
104
core::Signal<com::ubuntu::location::connectivity::RadioCell::Ptr> connected_cell_removed;
105
core::Signal<com::ubuntu::location::connectivity::WirelessNetwork::Ptr> wireless_network_added;
106
core::Signal<com::ubuntu::location::connectivity::WirelessNetwork::Ptr> wireless_network_removed;
109
core::Property<com::ubuntu::location::connectivity::State> state;
114
#endif // OFONO_NM_CONNECTIVITY_MANAGER_H_