Merge lp:~unity-api-team/indicator-network/connectivity-service-mobile-data-management into lp:indicator-network

Proposed by Antti Kaijanmäki
Status: Merged
Approved by: Pete Woods
Approved revision: 586
Merged at revision: 598
Proposed branch: lp:~unity-api-team/indicator-network/connectivity-service-mobile-data-management
Merge into: lp:indicator-network
Diff against target: 2816 lines (+2373/-3)
34 files modified
CMakeLists.txt (+2/-0)
data/com.ubuntu.connectivity1.Modem.xml (+9/-0)
data/com.ubuntu.connectivity1.Private.xml (+8/-0)
data/com.ubuntu.connectivity1.Sim.xml (+16/-0)
scripts/CMakeLists.txt (+5/-0)
scripts/disable-mobile-data.sh (+8/-0)
scripts/enable-mobile-data.sh (+8/-0)
scripts/get-mobile-data-enabled.sh (+6/-0)
scripts/get-modems.sh (+6/-0)
scripts/get-sim-for-mobile-data.sh (+7/-0)
scripts/get-sims.sh (+6/-0)
scripts/monitor-private-properties.sh (+7/-0)
scripts/set-sim-for-mobile-data.sh (+9/-0)
src/indicator/CMakeLists.txt (+22/-0)
src/indicator/connectivity-service/connectivity-service.cpp (+175/-0)
src/indicator/connectivity-service/connectivity-service.h (+17/-0)
src/indicator/connectivity-service/dbus-modem.cpp (+98/-0)
src/indicator/connectivity-service/dbus-modem.h (+83/-0)
src/indicator/connectivity-service/dbus-sim.cpp (+148/-0)
src/indicator/connectivity-service/dbus-sim.h (+103/-0)
src/indicator/nmofono/connectivity-service-settings.cpp (+148/-0)
src/indicator/nmofono/connectivity-service-settings.h (+67/-0)
src/indicator/nmofono/manager-impl.cpp (+210/-1)
src/indicator/nmofono/manager-impl.h (+12/-0)
src/indicator/nmofono/manager.h (+26/-0)
src/indicator/nmofono/wwan/modem.cpp (+63/-2)
src/indicator/nmofono/wwan/modem.h (+10/-0)
src/indicator/nmofono/wwan/qofono-sim-wrapper.cpp (+252/-0)
src/indicator/nmofono/wwan/qofono-sim-wrapper.h (+77/-0)
src/indicator/nmofono/wwan/sim-manager.cpp (+261/-0)
src/indicator/nmofono/wwan/sim-manager.h (+57/-0)
src/indicator/nmofono/wwan/sim.cpp (+309/-0)
src/indicator/nmofono/wwan/sim.h (+125/-0)
src/qdbus-stubs/dbus-types.h (+13/-0)
To merge this branch: bzr merge lp:~unity-api-team/indicator-network/connectivity-service-mobile-data-management
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Indicator Applet Developers Pending
Review via email: mp+293081@code.launchpad.net

Commit message

New Connectivity Service Private API for managing mobile data and SIM cards.

Description of the change

New Connectivity Service Private API for managing mobile data and SIM cards.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-02-15 09:31:38 +0000
+++ CMakeLists.txt 2016-05-16 07:44:17 +0000
@@ -139,3 +139,5 @@
139)139)
140140
141endif()141endif()
142
143add_subdirectory(scripts)
142144
=== added file 'data/com.ubuntu.connectivity1.Modem.xml'
--- data/com.ubuntu.connectivity1.Modem.xml 1970-01-01 00:00:00 +0000
+++ data/com.ubuntu.connectivity1.Modem.xml 2016-05-16 07:44:17 +0000
@@ -0,0 +1,9 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<node>
4 <interface name="com.ubuntu.connectivity1.Modem">
5 <property name="Index" type="i" access="read" />
6 <property name="Serial" type="s" access="read" />
7 <property name="Sim" type="o" access="read" />
8 </interface>
9</node>
010
=== modified file 'data/com.ubuntu.connectivity1.Private.xml'
--- data/com.ubuntu.connectivity1.Private.xml 2015-12-04 13:18:04 +0000
+++ data/com.ubuntu.connectivity1.Private.xml 2016-05-16 07:44:17 +0000
@@ -52,6 +52,14 @@
52 52
53 <property name="VpnConnections" type="ao" access="read"/>53 <property name="VpnConnections" type="ao" access="read"/>
5454
55 <property name="MobileDataEnabled" type="b" access="readwrite"/>
56
57 <property name="SimForMobileData" type="o" access="readwrite"/>
58
59 <property name="Modems" type="ao" access="read"/>
60
61 <property name="Sims" type="ao" access="read"/>
62
55 <signal name="ReportError">63 <signal name="ReportError">
56 <arg type="i" direction="out" name="reason"/>64 <arg type="i" direction="out" name="reason"/>
57 </signal>65 </signal>
5866
=== added file 'data/com.ubuntu.connectivity1.Sim.xml'
--- data/com.ubuntu.connectivity1.Sim.xml 1970-01-01 00:00:00 +0000
+++ data/com.ubuntu.connectivity1.Sim.xml 2016-05-16 07:44:17 +0000
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<node>
4 <interface name="com.ubuntu.connectivity1.Sim">
5 <property name="Imsi" type="s" access="read" />
6 <property name="PrimaryPhoneNumber" type="s" access="read" />
7 <property name="Locked" type="b" access="read" />
8 <property name="Present" type="b" access="read" />
9 <property name="Mcc" type="s" access="read" />
10 <property name="Mnc" type="s" access="read" />
11 <property name="PreferredLanguages" type="as" access="read" />
12 <property name="DataRoamingEnabled" type="b" access="readwrite" />
13
14 <method name="Unlock" />
15 </interface>
16</node>
017
=== added directory 'scripts'
=== added file 'scripts/CMakeLists.txt'
--- scripts/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ scripts/CMakeLists.txt 2016-05-16 07:44:17 +0000
@@ -0,0 +1,5 @@
1
2file(GLOB_RECURSE SCRIPT_FILES
3 ${CMAKE_CURRENT_SOURCE_DIR}/*.sh
4)
5add_custom_target(scriptfiles SOURCES ${SCRIPT_FILES})
06
=== added file 'scripts/disable-mobile-data.sh'
--- scripts/disable-mobile-data.sh 1970-01-01 00:00:00 +0000
+++ scripts/disable-mobile-data.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,8 @@
1dbus-send --session --print-reply \
2 --dest=com.ubuntu.connectivity1 \
3 /com/ubuntu/connectivity1/Private \
4 org.freedesktop.DBus.Properties.Set \
5 string:com.ubuntu.connectivity1.Private \
6 string:MobileDataEnabled \
7 variant:boolean:false
8sh get-mobile-data-enabled.sh
09
=== added file 'scripts/enable-mobile-data.sh'
--- scripts/enable-mobile-data.sh 1970-01-01 00:00:00 +0000
+++ scripts/enable-mobile-data.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,8 @@
1dbus-send --session --print-reply \
2 --dest=com.ubuntu.connectivity1 \
3 /com/ubuntu/connectivity1/Private \
4 org.freedesktop.DBus.Properties.Set \
5 string:com.ubuntu.connectivity1.Private \
6 string:MobileDataEnabled \
7 variant:boolean:true
8sh get-mobile-data-enabled.sh
09
=== added file 'scripts/get-mobile-data-enabled.sh'
--- scripts/get-mobile-data-enabled.sh 1970-01-01 00:00:00 +0000
+++ scripts/get-mobile-data-enabled.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,6 @@
1dbus-send --session --print-reply \
2 --dest=com.ubuntu.connectivity1 \
3 /com/ubuntu/connectivity1/Private \
4 org.freedesktop.DBus.Properties.Get \
5 string:com.ubuntu.connectivity1.Private \
6 string:MobileDataEnabled
07
=== added file 'scripts/get-modems.sh'
--- scripts/get-modems.sh 1970-01-01 00:00:00 +0000
+++ scripts/get-modems.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,6 @@
1dbus-send --session --print-reply \
2 --dest=com.ubuntu.connectivity1 \
3 /com/ubuntu/connectivity1/Private \
4 org.freedesktop.DBus.Properties.Get \
5 string:com.ubuntu.connectivity1.Private \
6 string:Modems
07
=== added file 'scripts/get-sim-for-mobile-data.sh'
--- scripts/get-sim-for-mobile-data.sh 1970-01-01 00:00:00 +0000
+++ scripts/get-sim-for-mobile-data.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,7 @@
1#!/bin/sh
2dbus-send --session --print-reply \
3 --dest=com.ubuntu.connectivity1 \
4 /com/ubuntu/connectivity1/Private \
5 org.freedesktop.DBus.Properties.Get \
6 string:com.ubuntu.connectivity1.Private \
7 string:SimForMobileData
08
=== added file 'scripts/get-sims.sh'
--- scripts/get-sims.sh 1970-01-01 00:00:00 +0000
+++ scripts/get-sims.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,6 @@
1dbus-send --session --print-reply \
2 --dest=com.ubuntu.connectivity1 \
3 /com/ubuntu/connectivity1/Private \
4 org.freedesktop.DBus.Properties.Get \
5 string:com.ubuntu.connectivity1.Private \
6 string:Sims
07
=== added file 'scripts/monitor-private-properties.sh'
--- scripts/monitor-private-properties.sh 1970-01-01 00:00:00 +0000
+++ scripts/monitor-private-properties.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,7 @@
1dbus-monitor --session \
2 "type=signal,
3 sender='com.ubuntu.connectivity1',
4 path=/com/ubuntu/connectivity1/Private,
5 interface=org.freedesktop.DBus.Properties,
6 member=PropertiesChanged"
7
08
=== added file 'scripts/set-sim-for-mobile-data.sh'
--- scripts/set-sim-for-mobile-data.sh 1970-01-01 00:00:00 +0000
+++ scripts/set-sim-for-mobile-data.sh 2016-05-16 07:44:17 +0000
@@ -0,0 +1,9 @@
1#!/bin/sh
2dbus-send --session --print-reply \
3 --dest=com.ubuntu.connectivity1 \
4 /com/ubuntu/connectivity1/Private \
5 org.freedesktop.DBus.Properties.Set \
6 string:com.ubuntu.connectivity1.Private \
7 string:SimForMobileData \
8 variant:objpath:$1
9/bin/sh ./get-sim-for-mobile-data.sh
010
=== modified file 'src/indicator/CMakeLists.txt'
--- src/indicator/CMakeLists.txt 2016-02-15 09:31:38 +0000
+++ src/indicator/CMakeLists.txt 2016-05-16 07:44:17 +0000
@@ -20,6 +20,7 @@
20set(NETWORK_SERVICE_SOURCES20set(NETWORK_SERVICE_SOURCES
21 ${NETWORK_SERVICE_HEADERS}21 ${NETWORK_SERVICE_HEADERS}
2222
23 nmofono/connectivity-service-settings.cpp
23 nmofono/hotspot-manager.cpp24 nmofono/hotspot-manager.cpp
24 nmofono/kill-switch.cpp25 nmofono/kill-switch.cpp
25 nmofono/manager.cpp26 nmofono/manager.cpp
@@ -32,6 +33,9 @@
32 nmofono/wifi/grouped-access-point.cpp33 nmofono/wifi/grouped-access-point.cpp
33 nmofono/wifi/wifi-link-impl.cpp34 nmofono/wifi/wifi-link-impl.cpp
34 nmofono/wwan/modem.cpp35 nmofono/wwan/modem.cpp
36 nmofono/wwan/sim.cpp
37 nmofono/wwan/sim-manager.cpp
38 nmofono/wwan/qofono-sim-wrapper.cpp
35 nmofono/vpn/openvpn-connection.cpp39 nmofono/vpn/openvpn-connection.cpp
36 nmofono/vpn/pptp-connection.cpp40 nmofono/vpn/pptp-connection.cpp
37 nmofono/vpn/vpn-connection.cpp41 nmofono/vpn/vpn-connection.cpp
@@ -53,6 +57,8 @@
53 connectivity-service/dbus-openvpn-connection.cpp57 connectivity-service/dbus-openvpn-connection.cpp
54 connectivity-service/dbus-pptp-connection.cpp58 connectivity-service/dbus-pptp-connection.cpp
55 connectivity-service/dbus-vpn-connection.cpp59 connectivity-service/dbus-vpn-connection.cpp
60 connectivity-service/dbus-modem.cpp
61 connectivity-service/dbus-sim.cpp
5662
57 menuitems/access-point-item.cpp63 menuitems/access-point-item.cpp
58 menuitems/switch-item.cpp64 menuitems/switch-item.cpp
@@ -73,6 +79,22 @@
7379
74qt5_add_dbus_adaptor(80qt5_add_dbus_adaptor(
75 NETWORK_SERVICE_SOURCES81 NETWORK_SERVICE_SOURCES
82 "${DATA_DIR}/com.ubuntu.connectivity1.Modem.xml"
83 connectivity-service/dbus-modem.h
84 connectivity_service::DBusModem
85 ModemAdaptor
86)
87
88qt5_add_dbus_adaptor(
89 NETWORK_SERVICE_SOURCES
90 "${DATA_DIR}/com.ubuntu.connectivity1.Sim.xml"
91 connectivity-service/dbus-sim.h
92 connectivity_service::DBusSim
93 SimAdaptor
94)
95
96qt5_add_dbus_adaptor(
97 NETWORK_SERVICE_SOURCES
76 "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml"98 "${DATA_DIR}/com.ubuntu.connectivity1.Private.xml"
77 connectivity-service/connectivity-service.h99 connectivity-service/connectivity-service.h
78 connectivity_service::PrivateService100 connectivity_service::PrivateService
79101
=== modified file 'src/indicator/connectivity-service/connectivity-service.cpp'
--- src/indicator/connectivity-service/connectivity-service.cpp 2016-01-14 11:40:59 +0000
+++ src/indicator/connectivity-service/connectivity-service.cpp 2016-05-16 07:44:17 +0000
@@ -19,6 +19,8 @@
19 */19 */
2020
21#include <connectivity-service/connectivity-service.h>21#include <connectivity-service/connectivity-service.h>
22#include <connectivity-service/dbus-modem.h>
23#include <connectivity-service/dbus-sim.h>
22#include <connectivity-service/dbus-vpn-connection.h>24#include <connectivity-service/dbus-vpn-connection.h>
23#include <connectivity-service/dbus-openvpn-connection.h>25#include <connectivity-service/dbus-openvpn-connection.h>
24#include <connectivity-service/dbus-pptp-connection.h>26#include <connectivity-service/dbus-pptp-connection.h>
@@ -48,6 +50,9 @@
4850
49 QMap<QDBusObjectPath, DBusVpnConnection::SPtr> m_vpnConnections;51 QMap<QDBusObjectPath, DBusVpnConnection::SPtr> m_vpnConnections;
5052
53 QMap<QString, DBusModem::SPtr> m_modems;
54 QMap<QString, DBusSim::SPtr> m_sims;
55
51 shared_ptr<PrivateService> m_privateService;56 shared_ptr<PrivateService> m_privateService;
5257
53 QStringList m_limitations;58 QStringList m_limitations;
@@ -166,6 +171,102 @@
166 });171 });
167 }172 }
168173
174 void mobileDataEnabledUpdated(bool value)
175 {
176 Q_UNUSED(value)
177 notifyPrivateProperties({
178 "MobileDataEnabled"
179 });
180 }
181
182 void simForMobileDataUpdated()
183 {
184 notifyPrivateProperties({
185 "SimForMobileData"
186 });
187 }
188
189 void updateSims()
190 {
191 auto current_imsis = m_sims.keys().toSet();
192 QMap<QString, nmofono::wwan::Sim::Ptr> sims;
193 for (auto i : m_manager->sims())
194 {
195 sims[i->imsi()] = i;
196 }
197 auto toAdd(sims.keys().toSet());
198 toAdd.subtract(current_imsis);
199
200 auto toRemove(current_imsis);
201 toRemove.subtract(sims.keys().toSet());
202
203 for (auto imsi : toRemove)
204 {
205 m_sims.remove(imsi);
206 }
207
208 for (auto imsi : toAdd)
209 {
210 DBusSim::SPtr dbussim = make_shared<DBusSim>(sims[imsi], m_connection);
211 m_sims[imsi] = dbussim;
212 }
213
214 notifyPrivateProperties({
215 "Sims"
216 });
217 }
218
219 void updateModems()
220 {
221 auto current_serials = m_modems.keys().toSet();
222 QMap<QString, nmofono::wwan::Modem::Ptr> modems;
223 for (auto i : m_manager->modems())
224 {
225 modems[i->serial()] = i;
226 }
227 auto toAdd(modems.keys().toSet());
228 toAdd.subtract(current_serials);
229
230 auto toRemove(current_serials);
231 toRemove.subtract(modems.keys().toSet());
232
233 for (auto serial : toRemove)
234 {
235 m_modems.remove(serial);
236 }
237
238 for (auto serial : toAdd)
239 {
240 wwan::Modem::Ptr m = modems[serial];
241
242 DBusModem::SPtr dbusmodem = make_shared<DBusModem>(m, m_connection);
243 m_modems[serial] = dbusmodem;
244 updateModemSimPath(dbusmodem, m->sim());
245 connect(m.get(), &wwan::Modem::simUpdated, this, &Private::modemSimUpdated);
246 }
247 notifyPrivateProperties({
248 "Modems"
249 });
250 }
251
252 void modemSimUpdated()
253 {
254 auto modem_raw = qobject_cast<wwan::Modem*>(sender());
255 updateModemSimPath(m_modems[modem_raw->serial()], modem_raw->sim());
256 }
257
258 void updateModemSimPath(DBusModem::SPtr modem, wwan::Sim::Ptr sim)
259 {
260 if (!sim)
261 {
262 modem->setSim(QDBusObjectPath("/"));
263 }
264 else
265 {
266 modem->setSim(m_sims[sim->imsi()]->path());
267 }
268 }
269
169 void updateNetworkingStatus()270 void updateNetworkingStatus()
170 {271 {
171 QStringList changed;272 QStringList changed;
@@ -293,10 +394,17 @@
293 connect(d->m_manager.get(), &Manager::hotspotAuthChanged, d.get(), &Private::hotspotAuthUpdated);394 connect(d->m_manager.get(), &Manager::hotspotAuthChanged, d.get(), &Private::hotspotAuthUpdated);
294 connect(d->m_manager.get(), &Manager::hotspotStoredChanged, d.get(), &Private::hotspotStoredUpdated);395 connect(d->m_manager.get(), &Manager::hotspotStoredChanged, d.get(), &Private::hotspotStoredUpdated);
295396
397 connect(d->m_manager.get(), &Manager::mobileDataEnabledChanged, d.get(), &Private::mobileDataEnabledUpdated);
398 connect(d->m_manager.get(), &Manager::simsChanged, d.get(), &Private::updateSims);
399 connect(d->m_manager.get(), &Manager::modemsChanged, d.get(), &Private::updateModems);
400 connect(d->m_manager.get(), &Manager::simForMobileDataChanged, d.get(), &Private::simForMobileDataUpdated);
401
296 connect(d->m_manager.get(), &Manager::reportError, d->m_privateService.get(), &PrivateService::ReportError);402 connect(d->m_manager.get(), &Manager::reportError, d->m_privateService.get(), &PrivateService::ReportError);
297403
298 connect(d->m_vpnManager.get(), &vpn::VpnManager::connectionsChanged, d.get(), &Private::updateVpnList);404 connect(d->m_vpnManager.get(), &vpn::VpnManager::connectionsChanged, d.get(), &Private::updateVpnList);
299405
406 d->updateSims();
407 d->updateModems();
300 d->updateNetworkingStatus();408 d->updateNetworkingStatus();
301 d->updateVpnList();409 d->updateVpnList();
302410
@@ -508,6 +616,73 @@
508 return paths;616 return paths;
509}617}
510618
619bool PrivateService::mobileDataEnabled() const
620{
621 return p.d->m_manager->mobileDataEnabled();
622}
623
624void PrivateService::setMobileDataEnabled(bool enabled)
625{
626 p.d->m_manager->setMobileDataEnabled(enabled);
627}
628
629QDBusObjectPath PrivateService::simForMobileData() const
630{
631 wwan::Sim::Ptr sim = p.d->m_manager->simForMobileData();
632 if (!sim)
633 {
634 return QDBusObjectPath("/");
635 }
636
637 Q_ASSERT(p.d->m_sims.contains(sim->imsi()));
638 return p.d->m_sims[sim->imsi()]->path();
639}
640
641void PrivateService::setSimForMobileData(const QDBusObjectPath &path)
642{
643 if (path.path() == "/")
644 {
645 p.d->m_manager->setSimForMobileData(wwan::Sim::Ptr());
646 return;
647 }
648
649 bool found = false;
650 for (DBusSim::SPtr dbussim: p.d->m_sims)
651 {
652 if (dbussim->path() == path)
653 {
654 found = true;
655 p.d->m_manager->setSimForMobileData(dbussim->sim());
656 }
657 }
658
659 if (!found)
660 {
661 sendErrorReply(QDBusError::UnknownObject);
662 }
663}
664
665QList<QDBusObjectPath> PrivateService::modems() const
666{
667 auto list = QList<QDBusObjectPath>();
668 for (DBusModem::SPtr modem : p.d->m_modems)
669 {
670 list << modem->path();
671 }
672 return list;
673}
674
675QList<QDBusObjectPath> PrivateService::sims() const
676{
677 QList<QDBusObjectPath> paths;
678
679 for (auto dbussim : p.d->m_sims)
680 {
681 paths.append(dbussim->path());
682 }
683 return paths;
684}
685
511}686}
512687
513#include "connectivity-service.moc"688#include "connectivity-service.moc"
514689
=== modified file 'src/indicator/connectivity-service/connectivity-service.h'
--- src/indicator/connectivity-service/connectivity-service.h 2015-12-04 13:18:04 +0000
+++ src/indicator/connectivity-service/connectivity-service.h 2016-05-16 07:44:17 +0000
@@ -109,6 +109,18 @@
109 Q_PROPERTY(QList<QDBusObjectPath> VpnConnections READ vpnConnections)109 Q_PROPERTY(QList<QDBusObjectPath> VpnConnections READ vpnConnections)
110 QList<QDBusObjectPath> vpnConnections() const;110 QList<QDBusObjectPath> vpnConnections() const;
111111
112 Q_PROPERTY(bool MobileDataEnabled READ mobileDataEnabled WRITE setMobileDataEnabled)
113 bool mobileDataEnabled() const;
114
115 Q_PROPERTY(QDBusObjectPath SimForMobileData READ simForMobileData WRITE setSimForMobileData)
116 QDBusObjectPath simForMobileData() const;
117
118 Q_PROPERTY(QList<QDBusObjectPath> Modems READ modems)
119 QList<QDBusObjectPath> modems() const;
120
121 Q_PROPERTY(QList<QDBusObjectPath> Sims READ sims)
122 QList<QDBusObjectPath> sims() const;
123
112protected Q_SLOTS:124protected Q_SLOTS:
113 void UnlockAllModems();125 void UnlockAllModems();
114126
@@ -132,6 +144,11 @@
132144
133 void RemoveVpnConnection(const QDBusObjectPath &path);145 void RemoveVpnConnection(const QDBusObjectPath &path);
134146
147 void setMobileDataEnabled(bool enabled);
148
149 void setSimForMobileData(const QDBusObjectPath &path);
150
151
135Q_SIGNALS:152Q_SIGNALS:
136 void ReportError(int reason);153 void ReportError(int reason);
137154
138155
=== added file 'src/indicator/connectivity-service/dbus-modem.cpp'
--- src/indicator/connectivity-service/dbus-modem.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-modem.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <connectivity-service/dbus-modem.h>
21#include <ModemAdaptor.h>
22#include <dbus-types.h>
23#include <util/dbus-utils.h>
24
25using namespace std;
26using namespace nmofono::wwan;
27
28namespace connectivity_service
29{
30
31DBusModem::DBusModem(Modem::Ptr modem,
32 const QDBusConnection& connection) :
33 m_modem(modem),
34 m_connection(connection)
35{
36 m_path.setPath(DBusTypes::modemPath(m_modem->serial()));
37
38 new ModemAdaptor(this);
39
40 registerDBusObject();
41}
42
43DBusModem::~DBusModem()
44{
45}
46
47void DBusModem::registerDBusObject()
48{
49 if (!m_connection.registerObject(m_path.path(), this))
50 {
51 qWarning() << "Unable to register Modem object" << m_path.path();
52 }
53}
54
55void DBusModem::notifyProperties(const QStringList& propertyNames)
56{
57 DBusUtils::notifyPropertyChanged(
58 m_connection,
59 *this,
60 m_path.path(),
61 ModemAdaptor::staticMetaObject.classInfo(ModemAdaptor::staticMetaObject.indexOfClassInfo("D-Bus Interface")).value(),
62 propertyNames
63 );
64}
65
66QDBusObjectPath DBusModem::sim() const
67{
68 return m_simpath;
69}
70
71void DBusModem::setSim(QDBusObjectPath path)
72{
73 if (m_simpath == path)
74 {
75 return;
76 }
77 m_simpath = path;
78 notifyProperties({"Sim"});
79}
80
81int DBusModem::index() const
82{
83 return m_modem->index();
84}
85
86
87QString DBusModem::serial() const
88{
89 return m_modem->serial();
90}
91
92QDBusObjectPath
93DBusModem::path() const
94{
95 return m_path;
96}
97
98}
099
=== added file 'src/indicator/connectivity-service/dbus-modem.h'
--- src/indicator/connectivity-service/dbus-modem.h 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-modem.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,83 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <nmofono/wwan/modem.h>
23
24#include <QDBusConnection>
25#include <QDBusContext>
26#include <QDBusObjectPath>
27#include <QObject>
28#include <QString>
29
30#include <unity/util/DefinesPtrs.h>
31
32class ModemAdaptor;
33
34namespace connectivity_service
35{
36
37class DBusModem: public QObject, protected QDBusContext
38{
39 Q_OBJECT
40 Q_DISABLE_COPY(DBusModem)
41
42 friend ModemAdaptor;
43
44public:
45 UNITY_DEFINES_PTRS(DBusModem);
46
47 DBusModem(nmofono::wwan::Modem::Ptr modem, const QDBusConnection& connection);
48
49 virtual ~DBusModem();
50
51 Q_PROPERTY(int Index READ index)
52 int index() const;
53
54 Q_PROPERTY(QString Serial READ serial)
55 QString serial() const;
56
57 Q_PROPERTY(QDBusObjectPath Sim READ sim)
58 QDBusObjectPath sim() const;
59
60 void setSim(QDBusObjectPath path);
61
62 QDBusObjectPath path() const;
63
64Q_SIGNALS:
65
66protected Q_SLOTS:
67
68private:
69 void notifyProperties(const QStringList& propertyNames);
70
71protected:
72 void registerDBusObject();
73
74 nmofono::wwan::Modem::Ptr m_modem;
75
76 QDBusConnection m_connection;
77
78 QDBusObjectPath m_path;
79 QDBusObjectPath m_simpath;
80
81};
82
83}
084
=== added file 'src/indicator/connectivity-service/dbus-sim.cpp'
--- src/indicator/connectivity-service/dbus-sim.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-sim.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <connectivity-service/dbus-sim.h>
21#include <SimAdaptor.h>
22#include <dbus-types.h>
23#include <util/dbus-utils.h>
24
25#include <QDebug>
26
27using namespace std;
28using namespace nmofono::wwan;
29
30namespace connectivity_service
31{
32
33DBusSim::DBusSim(Sim::Ptr sim,
34 const QDBusConnection& connection) :
35 m_sim(sim),
36 m_connection(connection)
37{
38 m_path.setPath(DBusTypes::simPath(m_sim->imsi()));
39
40 new SimAdaptor(this);
41
42 registerDBusObject();
43
44 connect(sim.get(), &Sim::lockedChanged, this, &DBusSim::lockedChanged);
45 connect(sim.get(), &Sim::presentChanged, this, &DBusSim::presentChanged);
46 connect(sim.get(), &Sim::dataRoamingEnabledChanged, this, &DBusSim::dataRoamingEnabledChanged);
47}
48
49DBusSim::~DBusSim()
50{
51}
52
53QDBusObjectPath DBusSim::path() const
54{
55 return m_path;
56}
57
58void DBusSim::registerDBusObject()
59{
60 if (!m_connection.registerObject(m_path.path(), this))
61 {
62 qWarning() << "Unable to register SIM object" << m_path.path();
63 }
64}
65
66void DBusSim::notifyProperties(const QStringList& propertyNames)
67{
68 DBusUtils::notifyPropertyChanged(
69 m_connection,
70 *this,
71 m_path.path(),
72 SimAdaptor::staticMetaObject.classInfo(SimAdaptor::staticMetaObject.indexOfClassInfo("D-Bus Interface")).value(),
73 propertyNames
74 );
75}
76
77QString DBusSim::imsi() const
78{
79 return m_sim->imsi();
80}
81
82QString DBusSim::primaryPhoneNumber() const
83{
84 return m_sim->primaryPhoneNumber();
85}
86
87bool DBusSim::locked() const
88{
89 return m_sim->locked();
90}
91
92bool DBusSim::present() const
93{
94 return m_sim->present();
95}
96
97QString DBusSim::mcc() const
98{
99 return m_sim->mcc();
100}
101
102QString DBusSim::mnc() const
103{
104 return m_sim->mnc();
105}
106
107QStringList DBusSim::preferredLanguages() const
108{
109 return m_sim->preferredLanguages();
110}
111
112bool DBusSim::dataRoamingEnabled() const
113{
114 return m_sim->dataRoamingEnabled();
115}
116
117void DBusSim::setDataRoamingEnabled(bool value) const
118{
119 m_sim->setDataRoamingEnabled(value);
120}
121
122void DBusSim::Unlock()
123{
124 m_sim->unlock();
125}
126
127void DBusSim::lockedChanged()
128{
129 notifyProperties({"Locked"});
130}
131
132void DBusSim::presentChanged()
133{
134 notifyProperties({"Present"});
135}
136
137void DBusSim::dataRoamingEnabledChanged()
138{
139 notifyProperties({"DataRoamingEnabled"});
140}
141
142nmofono::wwan::Sim::Ptr DBusSim::sim() const
143{
144 return m_sim;
145}
146
147
148}
0149
=== added file 'src/indicator/connectivity-service/dbus-sim.h'
--- src/indicator/connectivity-service/dbus-sim.h 1970-01-01 00:00:00 +0000
+++ src/indicator/connectivity-service/dbus-sim.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <nmofono/wwan/sim.h>
23
24#include <QDBusConnection>
25#include <QDBusContext>
26#include <QDBusObjectPath>
27#include <QObject>
28#include <QString>
29
30#include <unity/util/DefinesPtrs.h>
31
32class SimAdaptor;
33
34namespace connectivity_service
35{
36
37class DBusSim: public QObject, protected QDBusContext
38{
39 Q_OBJECT
40 Q_DISABLE_COPY(DBusSim)
41
42 friend SimAdaptor;
43
44public:
45 UNITY_DEFINES_PTRS(DBusSim);
46
47 DBusSim(nmofono::wwan::Sim::Ptr sim, const QDBusConnection& connection);
48
49 virtual ~DBusSim();
50
51 Q_PROPERTY(QString Imsi READ imsi)
52 QString imsi() const;
53
54 Q_PROPERTY(QString PrimaryPhoneNumber READ primaryPhoneNumber)
55 QString primaryPhoneNumber() const;
56
57 Q_PROPERTY(bool Locked READ locked)
58 bool locked() const;
59
60 Q_PROPERTY(bool Present READ present)
61 bool present() const;
62
63 Q_PROPERTY(QString Mcc READ mcc)
64 QString mcc() const;
65
66 Q_PROPERTY(QString Mnc READ mnc)
67 QString mnc() const;
68
69 Q_PROPERTY(QStringList PreferredLanguages READ preferredLanguages)
70 QStringList preferredLanguages() const;
71
72 Q_PROPERTY(bool DataRoamingEnabled READ dataRoamingEnabled WRITE setDataRoamingEnabled)
73 bool dataRoamingEnabled() const;
74 void setDataRoamingEnabled(bool value) const;
75
76 QDBusObjectPath path() const;
77
78 nmofono::wwan::Sim::Ptr sim() const;
79
80Q_SIGNALS:
81
82protected Q_SLOTS:
83
84 void Unlock();
85
86 void lockedChanged();
87 void presentChanged();
88 void dataRoamingEnabledChanged();
89
90private:
91 void notifyProperties(const QStringList& propertyNames);
92
93protected:
94 void registerDBusObject();
95
96 nmofono::wwan::Sim::Ptr m_sim;
97
98 QDBusConnection m_connection;
99
100 QDBusObjectPath m_path;
101};
102
103}
0104
=== added file 'src/indicator/nmofono/connectivity-service-settings.cpp'
--- src/indicator/nmofono/connectivity-service-settings.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/connectivity-service-settings.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,148 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <nmofono/connectivity-service-settings.h>
21
22using namespace nmofono;
23
24class ConnectivityServiceSettings::Private : public QObject
25{
26 Q_OBJECT
27public:
28
29 ConnectivityServiceSettings &p;
30 QSettings *m_settings;
31
32 Private(ConnectivityServiceSettings &parent)
33 : p(parent)
34 {
35 m_settings = new QSettings(QSettings::IniFormat,
36 QSettings::UserScope,
37 "Ubuntu",
38 "connectivityservice",
39 this);
40 }
41
42 virtual ~Private()
43 {
44
45 }
46
47public Q_SLOTS:
48
49Q_SIGNALS:
50
51};
52
53ConnectivityServiceSettings::ConnectivityServiceSettings(QObject *parent)
54 : QObject(parent),
55 d{new Private(*this)}
56{
57
58}
59
60ConnectivityServiceSettings::~ConnectivityServiceSettings()
61{
62
63}
64
65QVariant ConnectivityServiceSettings::mobileDataEnabled()
66{
67 return d->m_settings->value("MobileDataEnabled");
68}
69void ConnectivityServiceSettings::setMobileDataEnabled(bool value)
70{
71 d->m_settings->setValue("MobileDataEnabled", value);
72 d->m_settings->sync();
73}
74
75QVariant ConnectivityServiceSettings::simForMobileData()
76{
77 return d->m_settings->value("SimForMobileData");
78}
79void ConnectivityServiceSettings::setSimForMobileData(const QString &imsi)
80{
81 d->m_settings->setValue("SimForMobileData", imsi);
82 d->m_settings->sync();
83}
84
85QStringList ConnectivityServiceSettings::knownSims()
86{
87 QVariant ret;
88 ret = d->m_settings->value("KnownSims");
89 if (ret.isNull())
90 {
91 /* This is the first time we are running on a system.
92 */
93 setKnownSims(QStringList());
94 return QStringList();
95 }
96
97 return ret.toStringList();
98}
99
100void ConnectivityServiceSettings::setKnownSims(const QStringList &list)
101{
102 d->m_settings->setValue("KnownSims", QVariant(list));
103 d->m_settings->sync();
104}
105
106wwan::Sim::Ptr ConnectivityServiceSettings::createSimFromSettings(const QString &imsi)
107{
108 d->m_settings->beginGroup(QString("Sims/%1/").arg(imsi));
109 QVariant primaryPhoneNumber_var = d->m_settings->value("PrimaryPhoneNumber");
110 QVariant mcc_var = d->m_settings->value("Mcc");
111 QVariant mnc_var = d->m_settings->value("Mnc");
112 QVariant preferredLanguages_var = d->m_settings->value("PreferredLanguages");
113 QVariant dataRoamingEnabled_var = d->m_settings->value("DataRoamingEnabled");
114 d->m_settings->endGroup();
115
116 if (imsi.isNull() ||
117 primaryPhoneNumber_var.isNull() ||
118 mcc_var.isNull() ||
119 mnc_var.isNull() ||
120 preferredLanguages_var.isNull() ||
121 dataRoamingEnabled_var.isNull())
122 {
123 qWarning() << "Corrupt settings for SIM: " << imsi;
124 d->m_settings->remove(QString("Sims/%1/").arg(imsi));
125 return wwan::Sim::Ptr();
126 }
127
128 return wwan::Sim::Ptr(new wwan::Sim(imsi,
129 primaryPhoneNumber_var.toString(),
130 mcc_var.toString(),
131 mnc_var.toString(),
132 preferredLanguages_var.toStringList(),
133 dataRoamingEnabled_var.toBool()));
134}
135
136void ConnectivityServiceSettings::saveSimToSettings(wwan::Sim::Ptr sim)
137{
138 d->m_settings->beginGroup(QString("Sims/%1/").arg(sim->imsi()));
139 d->m_settings->setValue("PrimaryPhoneNumber", QVariant(sim->primaryPhoneNumber()));
140 d->m_settings->setValue("Mcc", sim->mcc());
141 d->m_settings->setValue("Mnc", sim->mnc());
142 d->m_settings->setValue("PreferredLanguages", QVariant(sim->preferredLanguages()));
143 d->m_settings->setValue("DataRoamingEnabled", sim->dataRoamingEnabled());
144 d->m_settings->endGroup();
145 d->m_settings->sync();
146}
147
148#include "connectivity-service-settings.moc"
0149
=== added file 'src/indicator/nmofono/connectivity-service-settings.h'
--- src/indicator/nmofono/connectivity-service-settings.h 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/connectivity-service-settings.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QSettings>
24#include <QString>
25
26#include <nmofono/wwan/sim.h>
27
28#include <memory>
29
30
31namespace nmofono
32{
33
34class ConnectivityServiceSettings : public QObject
35{
36 Q_OBJECT
37
38 class Private;
39 std::shared_ptr<Private> d;
40
41public:
42
43 typedef std::shared_ptr<ConnectivityServiceSettings> Ptr;
44 typedef std::weak_ptr<ConnectivityServiceSettings> WeakPtr;
45
46 ConnectivityServiceSettings(QObject *parent = 0);
47 virtual ~ConnectivityServiceSettings();
48
49 QVariant mobileDataEnabled();
50 void setMobileDataEnabled(bool value);
51
52 QVariant simForMobileData();
53 void setSimForMobileData(const QString &imsi);
54
55 QStringList knownSims();
56 void setKnownSims(const QStringList &list);
57
58 wwan::Sim::Ptr createSimFromSettings(const QString &imsi);
59 void saveSimToSettings(wwan::Sim::Ptr sim);
60
61public Q_SLOTS:
62
63Q_SIGNALS:
64
65};
66
67}
068
=== modified file 'src/indicator/nmofono/manager-impl.cpp'
--- src/indicator/nmofono/manager-impl.cpp 2016-04-06 09:30:45 +0000
+++ src/indicator/nmofono/manager-impl.cpp 2016-05-16 07:44:17 +0000
@@ -19,7 +19,9 @@
19 */19 */
2020
21#include <nmofono/manager-impl.h>21#include <nmofono/manager-impl.h>
22#include <nmofono/connectivity-service-settings.h>
22#include <nmofono/wifi/wifi-link-impl.h>23#include <nmofono/wifi/wifi-link-impl.h>
24#include <nmofono/wwan/sim-manager.h>
23#include <NetworkManagerActiveConnectionInterface.h>25#include <NetworkManagerActiveConnectionInterface.h>
24#include <NetworkManagerDeviceInterface.h>26#include <NetworkManagerDeviceInterface.h>
25#include <NetworkManagerInterface.h>27#include <NetworkManagerInterface.h>
@@ -30,6 +32,7 @@
30#include <qofono-qt5/qofonomanager.h>32#include <qofono-qt5/qofonomanager.h>
31#include <qofono-qt5/qofonomodem.h>33#include <qofono-qt5/qofonomodem.h>
32#undef slots34#undef slots
35#include <ofono/dbus.h>
3336
34#include <notify-cpp/notification-manager.h>37#include <notify-cpp/notification-manager.h>
35#include <notify-cpp/snapdecision/sim-unlock.h>38#include <notify-cpp/snapdecision/sim-unlock.h>
@@ -39,6 +42,7 @@
39#include <QMap>42#include <QMap>
40#include <QList>43#include <QList>
41#include <QRegularExpression>44#include <QRegularExpression>
45#include <QSettings>
42#include <NetworkManager.h>46#include <NetworkManager.h>
43#include <QDebug>47#include <QDebug>
44#include <algorithm>48#include <algorithm>
@@ -76,9 +80,110 @@
7680
77 HotspotManager::SPtr m_hotspotManager;81 HotspotManager::SPtr m_hotspotManager;
7882
83 bool m_mobileDataEnabled = false;
84 bool m_mobileDataEnabledPending = false;
85
86 wwan::Sim::Ptr m_simForMobileData;
87 bool m_simForMobileDataPending = false;
88
89 QList<wwan::Modem::Ptr> m_modems;
90 QList<wwan::Sim::Ptr> m_sims;
91
92 wwan::SimManager::Ptr m_simManager;
93
94 ConnectivityServiceSettings::Ptr m_settings;
95
79 Private(Manager& parent) :96 Private(Manager& parent) :
80 p(parent)97 p(parent)
81 {98 {
99 m_settings = std::make_shared<ConnectivityServiceSettings>();
100
101 m_simManager = make_shared<wwan::SimManager>(m_settings);
102 m_sims = m_simManager->knownSims();
103 connect(m_simManager.get(), &wwan::SimManager::simAdded, this, &Private::simAdded);
104
105 QVariant ret = m_settings->mobileDataEnabled();
106 if (ret.isNull())
107 {
108 /* This is the first time we are running on a system.
109 *
110 * We need to figure out the status of mobile data from looking
111 * at the individual modems.
112 */
113 m_mobileDataEnabledPending = true;
114 m_settings->setMobileDataEnabled(false);
115 }
116 else
117 {
118 m_mobileDataEnabled = ret.toBool();
119 }
120
121 ret = m_settings->simForMobileData();
122 if (ret.isNull())
123 {
124 /* This is the first time we are running on a system.
125 *
126 * We need to figure out the SIM used for mobile data
127 * from the individual modems.
128 */
129 m_simForMobileDataPending = true;
130 m_settings->setSimForMobileData(QString());
131 }
132 else
133 {
134 QString imsi = ret.toString();
135 wwan::Sim::Ptr sim;
136 for(auto i = m_sims.begin(); i != m_sims.end(); i++)
137 {
138 if ((*i)->imsi() == imsi) {
139 sim = *i;
140 break;
141 }
142 }
143 m_simForMobileData = sim;
144 }
145
146 }
147
148 void matchModemsAndSims()
149 {
150 for (wwan::Modem::Ptr modem: m_modems)
151 {
152 bool match = false;
153 for(wwan::Sim::Ptr sim : m_sims)
154 {
155 if (sim->ofonoPath() == modem->ofonoPath())
156 {
157 match = true;
158 modem->setSim(sim);
159 break;
160 }
161 }
162 if (!match)
163 {
164 modem->setSim(wwan::Sim::Ptr());
165 }
166 }
167 }
168
169 void simAdded(wwan::Sim::Ptr sim)
170 {
171 m_sims.append(sim);
172 matchModemsAndSims();
173 Q_EMIT p.simsChanged();
174 }
175
176 void modemReady()
177 {
178 wwan::Modem *modem_raw = qobject_cast<wwan::Modem*>(sender());
179 if (!modem_raw)
180 {
181 Q_ASSERT(0);
182 return;
183 }
184 m_modems.append(m_ofonoLinks[modem_raw->name()]);
185 matchModemsAndSims();
186 Q_EMIT p.modemsChanged();
82 }187 }
83188
84 void setUnstoppableOperationHappening(bool happening)189 void setUnstoppableOperationHappening(bool happening)
@@ -192,6 +297,8 @@
192 m_pendingUnlocks.removeOne(modem);297 m_pendingUnlocks.removeOne(modem);
193 disconnect(modem.get(), &wwan::Modem::readyToUnlock, this, &Private::modemReadyToUnlock);298 disconnect(modem.get(), &wwan::Modem::readyToUnlock, this, &Private::modemReadyToUnlock);
194 }299 }
300 m_modems.removeAll(modem);
301 Q_EMIT p.modemsChanged();
195 }302 }
196303
197 for (const auto& path : toAdd)304 for (const auto& path : toAdd)
@@ -202,6 +309,7 @@
202 auto modem = make_shared<wwan::Modem>(modemInterface);309 auto modem = make_shared<wwan::Modem>(modemInterface);
203 m_ofonoLinks[path] = modem;310 m_ofonoLinks[path] = modem;
204 connect(modem.get(), &wwan::Modem::readyToUnlock, this, &Private::modemReadyToUnlock);311 connect(modem.get(), &wwan::Modem::readyToUnlock, this, &Private::modemReadyToUnlock);
312 connect(modem.get(), &wwan::Modem::ready, this, &Private::modemReady);
205 }313 }
206314
207 Q_EMIT p.linksUpdated();315 Q_EMIT p.linksUpdated();
@@ -209,6 +317,67 @@
209317
210 updateModemAvailable();318 updateModemAvailable();
211 }319 }
320
321 void setMobileDataEnabled(bool value) {
322 if (m_mobileDataEnabled == value)
323 {
324 return;
325 }
326
327 m_settings->setMobileDataEnabled(value);
328 m_mobileDataEnabled = value;
329 Q_EMIT p.mobileDataEnabledChanged(value);
330
331 if (m_mobileDataEnabled)
332 {
333 for (wwan::Modem::Ptr modem : m_modems)
334 {
335 if (modem->sim() && modem->sim() == m_simForMobileData)
336 {
337 modem->sim()->setMobileDataEnabled(true);
338 }
339 }
340 }
341 else
342 {
343 for (wwan::Modem::Ptr modem : m_modems)
344 {
345 if (modem->sim()) {
346 modem->sim()->setMobileDataEnabled(false);
347 }
348 }
349 }
350 }
351
352 void setSimForMobileData(wwan::Sim::Ptr sim) {
353 if (m_simForMobileData == sim)
354 {
355 return;
356 }
357
358 if (m_simForMobileData)
359 {
360 m_simForMobileData->setMobileDataEnabled(false);
361 }
362
363 if (!sim)
364 {
365 m_settings->setSimForMobileData("");
366 }
367 else
368 {
369 m_settings->setSimForMobileData(sim->imsi());
370 }
371
372
373 m_simForMobileData = sim;
374 if (m_simForMobileData)
375 {
376 m_simForMobileData->setMobileDataEnabled(p.mobileDataEnabled());
377 }
378
379 Q_EMIT p.simForMobileDataChanged();
380 }
212};381};
213382
214void383void
@@ -506,7 +675,8 @@
506bool675bool
507ManagerImpl::roaming() const676ManagerImpl::roaming() const
508{677{
509 for (auto modem : d->m_ofonoLinks) {678 for (auto modem : d->m_ofonoLinks)
679 {
510 if (modem->modemStatus() == wwan::Modem::ModemStatus::roaming) {680 if (modem->modemStatus() == wwan::Modem::ModemStatus::roaming) {
511 return true;681 return true;
512 }682 }
@@ -522,7 +692,9 @@
522 if (!d->m_ofonoLinks.values().contains(modem)692 if (!d->m_ofonoLinks.values().contains(modem)
523 || d->m_unlockDialog->modem() == modem693 || d->m_unlockDialog->modem() == modem
524 || count(d->m_pendingUnlocks.begin(), d->m_pendingUnlocks.end(), modem) != 0)694 || count(d->m_pendingUnlocks.begin(), d->m_pendingUnlocks.end(), modem) != 0)
695 {
525 return;696 return;
697 }
526698
527 if (d->m_unlockDialog->state() == SimUnlockDialog::State::ready699 if (d->m_unlockDialog->state() == SimUnlockDialog::State::ready
528 && (d->m_pendingUnlocks.size() == 0))700 && (d->m_pendingUnlocks.size() == 0))
@@ -652,6 +824,43 @@
652 d->m_hotspotManager->setAuth(auth);824 d->m_hotspotManager->setAuth(auth);
653}825}
654826
827bool
828ManagerImpl::mobileDataEnabled() const
829{
830 return d->m_mobileDataEnabled;
831}
832
833void
834ManagerImpl::setMobileDataEnabled(bool value)
835{
836 d->setMobileDataEnabled(value);
837}
838
839wwan::Sim::Ptr
840ManagerImpl::simForMobileData() const
841{
842 return d->m_simForMobileData;
843}
844
845void
846ManagerImpl::setSimForMobileData(wwan::Sim::Ptr sim)
847{
848 d->setSimForMobileData(sim);
849}
850
851QList<wwan::Modem::Ptr>
852ManagerImpl::modems() const
853{
854 return d->m_modems;
855}
856
857QList<wwan::Sim::Ptr>
858ManagerImpl::sims() const
859{
860 return d->m_sims;
861}
862
863
655}864}
656865
657#include "manager-impl.moc"866#include "manager-impl.moc"
658867
=== modified file 'src/indicator/nmofono/manager-impl.h'
--- src/indicator/nmofono/manager-impl.h 2015-10-06 10:19:30 +0000
+++ src/indicator/nmofono/manager-impl.h 2016-05-16 07:44:17 +0000
@@ -91,6 +91,14 @@
9191
92 QString hotspotAuth() const override;92 QString hotspotAuth() const override;
9393
94 bool mobileDataEnabled() const override;
95
96 wwan::Sim::Ptr simForMobileData() const override;
97
98 QList<wwan::Modem::Ptr> modems() const override;
99
100 QList<wwan::Sim::Ptr> sims() const override;
101
94 void setHotspotEnabled(bool) override;102 void setHotspotEnabled(bool) override;
95103
96 void setHotspotSsid(const QByteArray&) override;104 void setHotspotSsid(const QByteArray&) override;
@@ -101,6 +109,10 @@
101109
102 void setHotspotAuth(const QString&) override;110 void setHotspotAuth(const QString&) override;
103111
112 void setMobileDataEnabled(bool) override;
113
114 void setSimForMobileData(wwan::Sim::Ptr) override;
115
104private Q_SLOTS:116private Q_SLOTS:
105 void device_added(const QDBusObjectPath &path);117 void device_added(const QDBusObjectPath &path);
106 void device_removed(const QDBusObjectPath &path);118 void device_removed(const QDBusObjectPath &path);
107119
=== modified file 'src/indicator/nmofono/manager.h'
--- src/indicator/nmofono/manager.h 2015-09-15 12:35:22 +0000
+++ src/indicator/nmofono/manager.h 2016-05-16 07:44:17 +0000
@@ -23,6 +23,7 @@
23#include <nmofono/link.h>23#include <nmofono/link.h>
24#include <nmofono/wifi/wifi-link.h>24#include <nmofono/wifi/wifi-link.h>
25#include <nmofono/wwan/modem.h>25#include <nmofono/wwan/modem.h>
26#include <nmofono/wwan/sim.h>
2627
27#include <memory>28#include <memory>
28#include <QSet>29#include <QSet>
@@ -143,6 +144,19 @@
143 Q_PROPERTY(QString hotspotAuth READ hotspotAuth WRITE setHotspotAuth NOTIFY hotspotAuthChanged)144 Q_PROPERTY(QString hotspotAuth READ hotspotAuth WRITE setHotspotAuth NOTIFY hotspotAuthChanged)
144 virtual QString hotspotAuth() const = 0;145 virtual QString hotspotAuth() const = 0;
145146
147 Q_PROPERTY(bool mobileDataEnabled READ mobileDataEnabled WRITE setMobileDataEnabled NOTIFY mobileDataEnabledChanged)
148 virtual bool mobileDataEnabled() const = 0;
149
150 Q_PROPERTY(wwan::Sim::Ptr simForMobileData READ simForMobileData WRITE setSimForMobileData NOTIFY simForMobileDataChanged)
151 virtual wwan::Sim::Ptr simForMobileData() const = 0;
152
153 Q_PROPERTY(QList<wwan::Modem::Ptr> modems READ modems NOTIFY modemsChanged)
154 virtual QList<wwan::Modem::Ptr> modems() const = 0;
155
156 Q_PROPERTY(QList<wwan::Sim::Ptr> sims READ sims NOTIFY simsChanged)
157 virtual QList<wwan::Sim::Ptr> sims() const = 0;
158
159
146Q_SIGNALS:160Q_SIGNALS:
147 void flightModeUpdated(bool);161 void flightModeUpdated(bool);
148162
@@ -174,6 +188,14 @@
174188
175 void unstoppableOperationHappeningUpdated(bool);189 void unstoppableOperationHappeningUpdated(bool);
176190
191 void mobileDataEnabledChanged(bool);
192
193 void simForMobileDataChanged();
194
195 void modemsChanged();
196
197 void simsChanged();
198
177public Q_SLOTS:199public Q_SLOTS:
178 virtual void setWifiEnabled(bool) = 0;200 virtual void setWifiEnabled(bool) = 0;
179201
@@ -189,6 +211,10 @@
189211
190 virtual void setHotspotAuth(const QString&) = 0;212 virtual void setHotspotAuth(const QString&) = 0;
191213
214 virtual void setMobileDataEnabled(bool) = 0;
215
216 virtual void setSimForMobileData(wwan::Sim::Ptr) = 0;
217
192protected:218protected:
193 /**219 /**
194 * @brief The default constructor is protected.220 * @brief The default constructor is protected.
195221
=== modified file 'src/indicator/nmofono/wwan/modem.cpp'
--- src/indicator/nmofono/wwan/modem.cpp 2015-08-05 15:14:28 +0000
+++ src/indicator/nmofono/wwan/modem.cpp 2016-05-16 07:44:17 +0000
@@ -96,6 +96,10 @@
96 bool m_requiredPinSet = false;96 bool m_requiredPinSet = false;
97 bool m_retriesSet = false;97 bool m_retriesSet = false;
9898
99 QString m_serial;
100 bool m_serialSet = false;
101 bool m_readyFired = false;
102
99 QString m_operatorName;103 QString m_operatorName;
100 Modem::ModemStatus m_status;104 Modem::ModemStatus m_status;
101 int8_t m_strength;105 int8_t m_strength;
@@ -108,6 +112,8 @@
108112
109 QSet<QString> m_interfaces;113 QSet<QString> m_interfaces;
110114
115 Sim::Ptr m_sim;
116
111 shared_ptr<QOfonoConnectionManager> m_connectionManager;117 shared_ptr<QOfonoConnectionManager> m_connectionManager;
112 shared_ptr<QOfonoNetworkRegistration> m_networkRegistration;118 shared_ptr<QOfonoNetworkRegistration> m_networkRegistration;
113 shared_ptr<QOfonoSimManager> m_simManager;119 shared_ptr<QOfonoSimManager> m_simManager;
@@ -125,6 +131,9 @@
125 connect(m_ofonoModem.get(), &QOfonoModem::interfacesChanged, this, &Private::interfacesChanged);131 connect(m_ofonoModem.get(), &QOfonoModem::interfacesChanged, this, &Private::interfacesChanged);
126 interfacesChanged(m_ofonoModem->interfaces());132 interfacesChanged(m_ofonoModem->interfaces());
127133
134 connect(m_ofonoModem.get(), &QOfonoModem::serialChanged, this, &Private::serialChanged);
135 serialChanged(m_ofonoModem->serial());
136
128 /// @todo hook up with system-settings to allow changing the identifier.137 /// @todo hook up with system-settings to allow changing the identifier.
129 /// for now just provide the defaults138 /// for now just provide the defaults
130 auto path = m_ofonoModem->modemPath();139 auto path = m_ofonoModem->modemPath();
@@ -154,6 +163,28 @@
154 m_shouldTriggerUnlock = false;163 m_shouldTriggerUnlock = false;
155 Q_EMIT p.readyToUnlock(p.name());164 Q_EMIT p.readyToUnlock(p.name());
156 }165 }
166
167 if (m_serialSet && !m_readyFired)
168 {
169 m_readyFired = true;
170 Q_EMIT p.ready();
171 }
172 }
173
174 void serialChanged(const QString &value) {
175 if (m_serial == value)
176 {
177 return;
178 }
179 if (m_serialSet)
180 {
181 qWarning() << "Unexpected update on SERIAL: " << m_serial << ", " << value;
182 }
183
184 m_serial = value;
185 m_serialSet = true;
186
187 update();
157 }188 }
158189
159 void connectionManagerChanged(shared_ptr<QOfonoConnectionManager> conmgr)190 void connectionManagerChanged(shared_ptr<QOfonoConnectionManager> conmgr)
@@ -662,6 +693,12 @@
662QString693QString
663Modem::name() const694Modem::name() const
664{695{
696 return ofonoPath();
697}
698
699QString
700Modem::ofonoPath() const
701{
665 return d->m_ofonoModem->modemPath();702 return d->m_ofonoModem->modemPath();
666}703}
667704
@@ -725,8 +762,32 @@
725{762{
726 d->m_shouldTriggerUnlock = true;763 d->m_shouldTriggerUnlock = true;
727}764}
728}765
729766Sim::Ptr Modem::sim() const
767{
768 return d->m_sim;
769}
770
771void
772Modem::setSim(Sim::Ptr sim)
773{
774 if (d->m_sim == sim)
775 {
776 return;
777 }
778 d->m_sim = sim;
779 Q_EMIT simUpdated();
780}
781
782QString
783Modem::serial() const
784{
785 return d->m_serial;
786}
787
788
789
790}
730}791}
731792
732#include "modem.moc"793#include "modem.moc"
733794
=== modified file 'src/indicator/nmofono/wwan/modem.h'
--- src/indicator/nmofono/wwan/modem.h 2015-08-05 15:14:28 +0000
+++ src/indicator/nmofono/wwan/modem.h 2016-05-16 07:44:17 +0000
@@ -21,6 +21,8 @@
2121
22#include <nmofono/wwan/wwan-link.h>22#include <nmofono/wwan/wwan-link.h>
2323
24#include <nmofono/wwan/sim.h>
25
24#include <map>26#include <map>
25#include <memory>27#include <memory>
2628
@@ -127,8 +129,12 @@
127 const QString &simIdentifier() const;129 const QString &simIdentifier() const;
128130
129 int index() const;131 int index() const;
132 Sim::Ptr sim() const;
133 void setSim(Sim::Ptr sim);
134 QString serial() const;
130135
131 QString name() const override;136 QString name() const override;
137 QString ofonoPath() const;
132138
133 WwanType wwanType() const override;139 WwanType wwanType() const override;
134140
@@ -176,6 +182,10 @@
176 void resetPinFailed(const QString& error);182 void resetPinFailed(const QString& error);
177183
178 bool readyToUnlock(const QString& name);184 bool readyToUnlock(const QString& name);
185
186 void simUpdated();
187
188 void ready();
179};189};
180190
181}191}
182192
=== added file 'src/indicator/nmofono/wwan/qofono-sim-wrapper.cpp'
--- src/indicator/nmofono/wwan/qofono-sim-wrapper.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/qofono-sim-wrapper.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,252 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <nmofono/wwan/qofono-sim-wrapper.h>
21
22#include <ofono/dbus.h>
23
24using namespace std;
25
26namespace nmofono
27{
28namespace wwan
29{
30namespace
31{
32
33}
34
35class QOfonoSimWrapper::Private : public QObject, public std::enable_shared_from_this<Private>
36{
37 Q_OBJECT
38
39public:
40
41 QOfonoSimWrapper& p;
42 shared_ptr<QOfonoSimManager> m_simManager;
43
44 QString m_imsi;
45 QStringList m_phoneNumbers;
46 QString m_mcc;
47 QString m_mnc;
48 QStringList m_preferredLanguages;
49
50 bool m_present = false;
51
52 bool m_imsiSet = false;
53 bool m_phoneNumbersSet = false;
54 bool m_mccSet = false;
55 bool m_mncSet = false;
56 bool m_preferredLanguagesSet = false;
57
58
59 Private(QOfonoSimWrapper& parent, shared_ptr<QOfonoSimManager> simmgr)
60 : p(parent), m_simManager{simmgr}
61 {
62 connect(simmgr.get(), &QOfonoSimManager::presenceChanged, this, &Private::presentChanged);
63 connect(simmgr.get(), &QOfonoSimManager::subscriberIdentityChanged, this, &Private::imsiChanged);
64 connect(simmgr.get(), &QOfonoSimManager::mobileCountryCodeChanged, this, &Private::mccChanged);
65 connect(simmgr.get(), &QOfonoSimManager::mobileNetworkCodeChanged, this, &Private::mncChanged);
66 connect(simmgr.get(), &QOfonoSimManager::subscriberNumbersChanged, this, &Private::phoneNumbersChanged);
67 connect(simmgr.get(), &QOfonoSimManager::preferredLanguagesChanged, this, &Private::preferredLanguagesChanged);
68 }
69
70public Q_SLOTS:
71
72 void presentChanged(bool value)
73 {
74 if (m_present == value)
75 {
76 return;
77 }
78 m_present = value;
79 if (!m_present)
80 {
81 m_imsiSet = false;
82 m_phoneNumbersSet = false;
83 m_mccSet = false;
84 m_mncSet = false;
85 m_preferredLanguagesSet = false;
86 Q_EMIT p.readyChanged(false);
87 }
88 Q_EMIT p.presentChanged(value);
89 }
90
91 void imsiChanged(const QString &value)
92 {
93 if (value.isEmpty())
94 {
95 return;
96 }
97
98 if (m_imsiSet)
99 {
100 qWarning() << "Unexpected update on IMSI: " << m_imsi << ", " << value;
101 }
102
103 m_imsi = value;
104 m_imsiSet = true;
105 if (p.ready())
106 {
107 Q_EMIT p.readyChanged(true);
108 }
109 }
110
111 void mccChanged(const QString &value)
112 {
113 if (value.isEmpty())
114 {
115 return;
116 }
117
118 if (m_mccSet)
119 {
120 qWarning() << "Unexpected update on MCC: " << m_mcc << ", " << value;
121 }
122
123
124 m_mcc = value;
125 m_mccSet = true;
126 if (p.ready())
127 {
128 Q_EMIT p.readyChanged(true);
129 }
130 }
131
132 void mncChanged(const QString &value)
133 {
134 if (value.isEmpty())
135 {
136 return;
137 }
138
139 if (m_mncSet)
140 {
141 qWarning() << "Unexpected update on MNC: " << m_mnc << ", " << value;
142 }
143
144 m_mnc = value;
145 m_mncSet = true;
146 if (p.ready())
147 {
148 Q_EMIT p.readyChanged(true);
149 }
150 }
151
152 void phoneNumbersChanged(const QStringList &value)
153 {
154 if (value.isEmpty())
155 {
156 return;
157 }
158
159 if (m_phoneNumbersSet)
160 {
161 qWarning() << "Unexpected update on Phone Numbers: " << m_phoneNumbers << ", " << value;
162 }
163
164
165 m_phoneNumbers = value;
166 m_phoneNumbersSet = true;
167 if (p.ready())
168 {
169 Q_EMIT p.readyChanged(true);
170 }
171 }
172
173 void preferredLanguagesChanged(const QStringList &value)
174 {
175 if (value.isEmpty())
176 {
177 return;
178 }
179
180 if (m_preferredLanguagesSet)
181 {
182 qWarning() << "Unexpected update on Preferred Languages: " << m_preferredLanguages << ", " << value;
183 }
184
185
186 m_preferredLanguages = value;
187 m_preferredLanguagesSet = true;
188 if (p.ready())
189 {
190 Q_EMIT p.readyChanged(true);
191 }
192 }
193};
194
195
196
197QOfonoSimWrapper::QOfonoSimWrapper(std::shared_ptr<QOfonoSimManager> simmgr)
198 : d{new Private(*this, simmgr)}
199{
200}
201
202QOfonoSimWrapper::~QOfonoSimWrapper()
203{}
204
205QString QOfonoSimWrapper::imsi() const
206{
207 return d->m_imsi;
208}
209
210bool QOfonoSimWrapper::present() const
211{
212 return d->m_present;
213}
214
215QString QOfonoSimWrapper::mcc() const
216{
217 return d->m_mcc;
218}
219
220QString QOfonoSimWrapper::mnc() const
221{
222 return d->m_mnc;
223}
224
225QStringList QOfonoSimWrapper::phoneNumbers() const
226{
227 return d->m_phoneNumbers;
228}
229
230QStringList QOfonoSimWrapper::preferredLanguages() const
231{
232 return d->m_preferredLanguages;
233}
234
235bool QOfonoSimWrapper::ready() const {
236 return d->m_imsiSet &&
237 d->m_phoneNumbersSet &&
238 d->m_mccSet &&
239 d->m_mncSet &&
240 d->m_preferredLanguagesSet;
241}
242
243std::shared_ptr<QOfonoSimManager> QOfonoSimWrapper::ofonoSimManager() const
244{
245 return d->m_simManager;
246}
247
248
249}
250}
251
252#include "qofono-sim-wrapper.moc"
0253
=== added file 'src/indicator/nmofono/wwan/qofono-sim-wrapper.h'
--- src/indicator/nmofono/wwan/qofono-sim-wrapper.h 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/qofono-sim-wrapper.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QSettings>
24
25#include <memory>
26
27#define slots
28#include <qofono-qt5/qofonomodem.h>
29#include <qofono-qt5/qofonosimmanager.h>
30#undef slots
31
32class QOfonoModem;
33
34namespace nmofono
35{
36class ManagerImpl;
37
38namespace wwan
39{
40
41class QOfonoSimWrapper : public QObject
42{
43 Q_OBJECT
44
45 class Private;
46 std::shared_ptr<Private> d;
47
48public:
49
50 typedef std::shared_ptr<QOfonoSimWrapper> Ptr;
51 typedef std::weak_ptr<QOfonoSimWrapper> WeakPtr;
52
53 QOfonoSimWrapper() = delete;
54
55
56 QOfonoSimWrapper(std::shared_ptr<QOfonoSimManager> simmgr);
57 ~QOfonoSimWrapper();
58
59 QString imsi() const;
60 bool present() const;
61 QString mcc() const;
62 QString mnc() const;
63 QStringList phoneNumbers() const;
64 QStringList preferredLanguages() const;
65 bool ready() const;
66
67 std::shared_ptr<QOfonoSimManager> ofonoSimManager() const;
68
69
70Q_SIGNALS:
71
72 void presentChanged(bool value);
73 void readyChanged(bool value);
74};
75
76}
77}
078
=== added file 'src/indicator/nmofono/wwan/sim-manager.cpp'
--- src/indicator/nmofono/wwan/sim-manager.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/sim-manager.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,261 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <nmofono/wwan/sim-manager.h>
21
22#include <nmofono/wwan/qofono-sim-wrapper.h>
23
24#define slots
25#include <qofono-qt5/qofonomanager.h>
26#include <qofono-qt5/qofonomodem.h>
27#include <qofono-qt5/qofonosimmanager.h>
28#undef slots
29#include <ofono/dbus.h>
30
31using namespace std;
32
33namespace nmofono
34{
35namespace wwan
36{
37namespace
38{
39
40}
41
42class SimManager::Private : public QObject, public std::enable_shared_from_this<Private>
43{
44 Q_OBJECT
45
46public:
47
48 SimManager& p;
49
50 QMap<QString, Sim::Ptr> m_knownSims;
51
52 shared_ptr<QOfonoManager> m_ofono;
53 QMap<QString, shared_ptr<QOfonoModem>> m_ofonoModems;
54 QMap<QString, QOfonoSimWrapper::Ptr> m_wrappers;
55
56 ConnectivityServiceSettings::Ptr m_settings;
57
58 Private(SimManager& parent, ConnectivityServiceSettings::Ptr settings)
59 : p(parent),
60 m_settings(settings)
61 {
62 QStringList imsis = m_settings->knownSims();
63 for(auto imsi : imsis) {
64 auto sim = m_settings->createSimFromSettings(imsi);
65 connect(sim.get(), &Sim::dataRoamingEnabledChanged, this, &Private::simDataRoamingEnabledChanged);
66 if (!sim)
67 {
68 continue;
69 }
70 m_knownSims[sim->imsi()] = sim;
71 }
72
73 m_ofono = make_shared<QOfonoManager>();
74 connect(m_ofono.get(), &QOfonoManager::modemsChanged, this, &Private::modemsChanged);
75 modemsChanged(m_ofono->modems());
76 }
77
78public Q_SLOTS:
79
80 void modemsChanged(const QStringList& value)
81 {
82 QSet<QString> modemPaths(value.toSet());
83 QSet<QString> currentModemPaths(m_ofonoModems.keys().toSet());
84
85 auto toRemove = currentModemPaths;
86 toRemove.subtract(modemPaths);
87
88 auto toAdd = modemPaths;
89 toAdd.subtract(currentModemPaths);
90
91 for (const auto& path : toRemove)
92 {
93 if (!m_ofonoModems.contains(path))
94 {
95 qWarning() << __PRETTY_FUNCTION__ << ": trying to remove unknown modem: " << path;
96 continue;
97 }
98 auto modem = m_ofonoModems.take(path);
99 if (m_wrappers.contains(path))
100 {
101 auto wrapper = m_wrappers[path];
102 if (m_knownSims.contains(wrapper->imsi()))
103 {
104 auto sim = m_knownSims[wrapper->imsi()];
105 sim->setOfonoSimManager(std::shared_ptr<QOfonoSimManager>());
106 }
107 m_wrappers.remove(path);
108 }
109 }
110
111 for (const auto& path : toAdd)
112 {
113 auto modem = make_shared<QOfonoModem>();
114 modem->setModemPath(path);
115
116 if (m_ofonoModems.contains(path))
117 {
118 qWarning() << __PRETTY_FUNCTION__ << ": trying to add already existing modem: " << path;
119 continue;
120 }
121 m_ofonoModems[path] = modem;
122
123 connect(modem.get(), &QOfonoModem::interfacesChanged, this, &Private::modemInterfacesChanged);
124 modem->interfacesChanged(modem->interfaces());
125 }
126 }
127
128 void modemInterfacesChanged() {
129 QOfonoModem *modem = qobject_cast<QOfonoModem*>(sender());
130 if (!modem)
131 {
132 Q_ASSERT(0);
133 return;
134 }
135
136 QSet<QString> interfaces(modem->interfaces().toSet());
137 if (interfaces.contains(OFONO_SIM_MANAGER_INTERFACE))
138 {
139 if (!m_wrappers.contains(modem->modemPath()))
140 {
141 auto simmgr = make_shared<QOfonoSimManager>();
142 simmgr->setModemPath(modem->modemPath());
143
144 auto wrapper = make_shared<wwan::QOfonoSimWrapper>(simmgr);
145
146 connect(wrapper.get(), &wwan::QOfonoSimWrapper::presentChanged, this, &Private::ofonoSimPresentChanged);
147 connect(wrapper.get(), &wwan::QOfonoSimWrapper::readyChanged, this, &Private::ofonoSimReady);
148
149 m_wrappers[modem->modemPath()] = wrapper;
150 }
151
152 } else {
153 if (m_wrappers.contains(modem->modemPath()))
154 {
155 auto wrapper = m_wrappers[modem->modemPath()];
156 if (m_knownSims.contains(wrapper->imsi()))
157 {
158 auto sim = m_knownSims[wrapper->imsi()];
159 sim->setOfonoSimManager(std::shared_ptr<QOfonoSimManager>());
160 }
161 m_wrappers.remove(modem->modemPath());
162 }
163 }
164 }
165
166 void ofonoSimPresentChanged(bool present)
167 {
168 auto wrapper = qobject_cast<QOfonoSimWrapper*>(sender());
169 if (!wrapper)
170 {
171 Q_ASSERT(0);
172 return;
173 }
174
175 if (!present)
176 {
177 if (m_knownSims.contains(wrapper->imsi()))
178 {
179 auto sim = m_knownSims[wrapper->imsi()];
180 sim->setOfonoSimManager(std::shared_ptr<QOfonoSimManager>());
181 }
182 }
183 }
184
185 void ofonoSimReady(bool value)
186 {
187 if (!value)
188 {
189 // handled in present changed
190 return;
191 }
192
193 auto wrapper = qobject_cast<wwan::QOfonoSimWrapper*>(sender());
194 if (!wrapper)
195 {
196 Q_ASSERT(0);
197 return;
198 }
199
200 bool found = false;
201 for (auto i : m_knownSims.values())
202 {
203 if (wrapper->imsi() == i->imsi())
204 {
205 found = true;
206 i->setOfonoSimManager(wrapper->ofonoSimManager());
207 break;
208 }
209 }
210 if (!found)
211 {
212 auto sim = Sim::fromQOfonoSimWrapper(wrapper);
213 connect(sim.get(), &Sim::dataRoamingEnabledChanged, this, &Private::simDataRoamingEnabledChanged);
214 m_settings->saveSimToSettings(sim);
215 m_knownSims[sim->imsi()] = sim;
216 m_settings->setKnownSims(m_knownSims.keys());
217 Q_EMIT p.simAdded(sim);
218 }
219 }
220
221 void simDataRoamingEnabledChanged(bool value)
222 {
223 Q_UNUSED(value)
224
225 auto sim_raw = qobject_cast<Sim*>(sender());
226 if (!sim_raw)
227 {
228 Q_ASSERT(0);
229 return;
230 }
231 auto sim = m_knownSims[sim_raw->imsi()];
232 if (!sim)
233 {
234 Q_ASSERT(0);
235 return;
236 }
237 m_settings->saveSimToSettings(sim);
238 }
239
240};
241
242
243
244SimManager::SimManager(ConnectivityServiceSettings::Ptr settings)
245 : d{new Private(*this, settings)}
246{
247}
248
249SimManager::~SimManager()
250{}
251
252QList<Sim::Ptr>
253SimManager::knownSims() const
254{
255 return d->m_knownSims.values();
256}
257
258}
259}
260
261#include "sim-manager.moc"
0262
=== added file 'src/indicator/nmofono/wwan/sim-manager.h'
--- src/indicator/nmofono/wwan/sim-manager.h 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/sim-manager.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QSettings>
24
25#include <memory>
26
27#include "sim.h"
28#include <nmofono/connectivity-service-settings.h>
29
30namespace nmofono
31{
32namespace wwan
33{
34
35class SimManager : public QObject
36{
37 Q_OBJECT
38
39 class Private;
40 std::shared_ptr<Private> d;
41
42public:
43
44 typedef std::shared_ptr<SimManager> Ptr;
45 typedef std::weak_ptr<SimManager> WeakPtr;
46
47 SimManager(ConnectivityServiceSettings::Ptr settings);
48 ~SimManager();
49
50 QList<Sim::Ptr> knownSims() const;
51
52Q_SIGNALS:
53 void simAdded(Sim::Ptr sim);
54};
55
56}
57}
058
=== added file 'src/indicator/nmofono/wwan/sim.cpp'
--- src/indicator/nmofono/wwan/sim.cpp 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/sim.cpp 2016-05-16 07:44:17 +0000
@@ -0,0 +1,309 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <nmofono/wwan/sim.h>
21
22#include <ofono/dbus.h>
23
24#define slots
25#include <qofono-qt5/qofonoconnectionmanager.h>
26#undef slots
27
28using namespace std;
29
30namespace nmofono
31{
32namespace wwan
33{
34namespace
35{
36
37}
38
39Sim::Ptr Sim::fromQOfonoSimWrapper(const QOfonoSimWrapper *wrapper)
40{
41 auto sim = Sim::Ptr(new Sim(wrapper->imsi(),
42 wrapper->phoneNumbers().first(), // default to the first number
43 wrapper->mcc(),
44 wrapper->mnc(),
45 wrapper->preferredLanguages(),
46 false));
47 sim->setOfonoSimManager(wrapper->ofonoSimManager());
48 return sim;
49}
50
51class Sim::Private : public QObject, public std::enable_shared_from_this<Private>
52{
53 Q_OBJECT
54
55public:
56
57 Sim& p;
58
59 int m_index = -1;
60
61 QString m_simIdentifier;
62
63 shared_ptr<QOfonoSimManager> m_simManager;
64 shared_ptr<QOfonoConnectionManager> m_connManager;
65
66 QSet<QString> m_interfaces;
67
68 QString m_imsi;
69 QString m_primaryPhoneNumber;
70 QString m_mcc;
71 QString m_mnc;
72 QStringList m_preferredLanguages;
73 bool m_dataRoamingEnabled;
74 bool m_mobileDataEnabled = false;
75
76 bool m_locked = false;
77
78 Private(Sim &parent)
79 : p(parent)
80 {
81 }
82
83 Private(Sim& parent, shared_ptr<QOfonoSimManager> simmgr)
84 : p(parent)
85 {
86 simManagerChanged(simmgr);
87
88
89 /// @todo hook up with system-settings to allow changing the identifier.
90 if (m_simIdentifier.isEmpty())
91 {
92 setSimIdentifier(m_primaryPhoneNumber);
93 }
94 }
95
96public Q_SLOTS:
97
98
99 void simManagerChanged(shared_ptr<QOfonoSimManager> simmgr)
100 {
101 if (m_simManager == simmgr)
102 {
103 return;
104 }
105
106 m_simManager = simmgr;
107 update();
108
109 Q_EMIT p.presentChanged(m_simManager.get() != nullptr);
110 }
111
112 void connManagerChanged(shared_ptr<QOfonoConnectionManager> connmgr)
113 {
114 if (m_connManager == connmgr)
115 {
116 return;
117 }
118
119 m_connManager = connmgr;
120 if (m_connManager)
121 {
122 connect(m_connManager.get(),
123 &QOfonoConnectionManager::poweredChanged, this,
124 &Private::update);
125 connect(m_connManager.get(),
126 &QOfonoConnectionManager::roamingAllowedChanged, this,
127 &Private::update);
128
129 m_connManager->setPowered(m_mobileDataEnabled);
130 m_connManager->setRoamingAllowed(m_dataRoamingEnabled);
131 }
132
133 update();
134 }
135
136 void update()
137 {
138 if (m_connManager)
139 {
140 bool powered = m_connManager->powered();
141 bool roamingAllowed = m_connManager->roamingAllowed();
142
143 /*
144 * Connectivity Service is the policy manager for the system.
145 * If ofono has different settings force them back to stored values.
146 */
147 if (m_mobileDataEnabled != powered)
148 {
149 m_connManager->setPowered(m_mobileDataEnabled);
150 }
151 if (m_dataRoamingEnabled != roamingAllowed)
152 {
153 m_connManager->setRoamingAllowed(m_dataRoamingEnabled);
154 }
155 }
156 else
157 {
158 /* empty */
159 }
160 }
161
162 void setSimIdentifier(const QString& simIdentifier)
163 {
164 if (m_simIdentifier == simIdentifier)
165 {
166 return;
167 }
168
169 m_simIdentifier = simIdentifier;
170 Q_EMIT p.simIdentifierUpdated(m_simIdentifier);
171 }
172
173 void setOfono(std::shared_ptr<QOfonoSimManager> simmgr)
174 {
175 simManagerChanged(simmgr);
176 if (simmgr)
177 {
178 m_connManager = std::make_shared<QOfonoConnectionManager>(this);
179 m_connManager->setModemPath(simmgr->modemPath());
180 connManagerChanged(m_connManager);
181 }
182 else
183 {
184 m_connManager = std::shared_ptr<QOfonoConnectionManager>();
185 connManagerChanged(m_connManager);
186 }
187 }
188
189
190};
191
192Sim::Sim(const QString &imsi,
193 const QString &primaryPhoneNumber,
194 const QString &mcc,
195 const QString &mnc,
196 const QStringList &preferredLanguages,
197 bool dataRoamingEnabled)
198 : d{new Private(*this)}
199{
200 d->m_imsi = imsi;
201 d->m_primaryPhoneNumber = primaryPhoneNumber;
202 d->m_mcc = mcc;
203 d->m_mnc = mnc;
204 d->m_preferredLanguages = preferredLanguages;
205 d->m_dataRoamingEnabled = dataRoamingEnabled;
206}
207
208Sim::~Sim()
209{}
210
211const QString&
212Sim::simIdentifier() const
213{
214 return d->m_simIdentifier;
215}
216
217QString Sim::imsi() const
218{
219 return d->m_imsi;
220}
221
222QString Sim::primaryPhoneNumber() const
223{
224 return d->m_primaryPhoneNumber;
225}
226
227bool Sim::locked() const
228{
229 return d->m_locked;
230}
231
232bool Sim::present() const
233{
234 return d->m_simManager.get() != nullptr;
235}
236
237QString Sim::mcc() const
238{
239 return d->m_mcc;
240}
241
242QString Sim::mnc() const
243{
244 return d->m_mnc;
245}
246
247QList<QString> Sim::preferredLanguages() const
248{
249 return d->m_preferredLanguages;
250}
251
252bool Sim::dataRoamingEnabled() const
253{
254 return d->m_dataRoamingEnabled;
255}
256
257void Sim::setDataRoamingEnabled(bool value)
258{
259 if (d->m_dataRoamingEnabled == value)
260 {
261 return;
262 }
263 d->m_dataRoamingEnabled = value;
264 Q_EMIT dataRoamingEnabledChanged(value);
265}
266
267bool Sim::mobileDataEnabled() const
268{
269 return d->m_mobileDataEnabled;
270}
271
272void Sim::setMobileDataEnabled(bool value)
273{
274 if (d->m_mobileDataEnabled == value)
275 {
276 return;
277 }
278 d->m_mobileDataEnabled = value;
279 if (d->m_connManager)
280 {
281 d->m_connManager->setPowered(d->m_mobileDataEnabled);
282 }
283 Q_EMIT mobileDataEnabledChanged(value);
284}
285
286void Sim::unlock()
287{
288
289}
290
291QString Sim::ofonoPath() const
292{
293 if (d->m_simManager)
294 {
295 return d->m_simManager->objectPath();
296 }
297 return QString();
298}
299
300void Sim::setOfonoSimManager(std::shared_ptr<QOfonoSimManager> simmgr)
301{
302 d->setOfono(simmgr);
303}
304
305
306}
307}
308
309#include "sim.moc"
0310
=== added file 'src/indicator/nmofono/wwan/sim.h'
--- src/indicator/nmofono/wwan/sim.h 1970-01-01 00:00:00 +0000
+++ src/indicator/nmofono/wwan/sim.h 2016-05-16 07:44:17 +0000
@@ -0,0 +1,125 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QSettings>
24
25#include <memory>
26
27#define slots
28#include <qofono-qt5/qofonomodem.h>
29#include <qofono-qt5/qofonosimmanager.h>
30#undef slots
31
32#include <nmofono/wwan/qofono-sim-wrapper.h>
33
34class QOfonoModem;
35
36namespace nmofono
37{
38class ManagerImpl;
39class ConnectivityServiceSettings;
40
41namespace wwan
42{
43
44class Sim : public QObject
45{
46 Q_OBJECT
47
48 class Private;
49 std::shared_ptr<Private> d;
50
51 friend class nmofono::ConnectivityServiceSettings;
52
53public:
54
55 typedef std::shared_ptr<Sim> Ptr;
56 typedef std::weak_ptr<Sim> WeakPtr;
57
58 Sim() = delete;
59
60 static Sim::Ptr fromQOfonoSimWrapper(const QOfonoSimWrapper *wrapper);
61
62private:
63 Sim(const QString &imsi,
64 const QString &primaryPhoneNumber,
65 const QString &mcc,
66 const QString &mnc,
67 const QStringList &preferredLanguages,
68 bool dataRoamingEnabled);
69
70public:
71 ~Sim();
72 void setOfonoSimManager(std::shared_ptr<QOfonoSimManager> simmgr);
73
74 Q_PROPERTY(QString simIdentifier READ simIdentifier NOTIFY simIdentifierUpdated)
75 const QString &simIdentifier() const;
76
77 Q_PROPERTY(QString imsi READ imsi CONSTANT)
78 QString imsi() const;
79
80 Q_PROPERTY(QString primaryPhoneNumber READ primaryPhoneNumber CONSTANT)
81 QString primaryPhoneNumber() const;
82
83 Q_PROPERTY(bool locked READ locked NOTIFY lockedChanged)
84 bool locked() const;
85
86 Q_PROPERTY(bool present READ present NOTIFY presentChanged)
87 bool present() const;
88
89 Q_PROPERTY(QString mcc READ mcc CONSTANT)
90 QString mcc() const;
91
92 Q_PROPERTY(QString mnc READ mnc CONSTANT)
93 QString mnc() const;
94
95 Q_PROPERTY(QList<QString> preferredLanguages READ preferredLanguages CONSTANT)
96 QList<QString> preferredLanguages() const;
97
98 Q_PROPERTY(bool dataRoamingEnabled READ dataRoamingEnabled WRITE setDataRoamingEnabled NOTIFY dataRoamingEnabledChanged)
99 bool dataRoamingEnabled() const;
100 void setDataRoamingEnabled(bool value);
101
102 Q_PROPERTY(bool mobileDataEnabled READ mobileDataEnabled WRITE setMobileDataEnabled NOTIFY mobileDataEnabledChanged)
103 bool mobileDataEnabled() const;
104 void setMobileDataEnabled(bool value);
105
106 QString ofonoPath() const;
107
108public Q_SLOTS:
109 void unlock();
110
111Q_SIGNALS:
112
113 void simIdentifierUpdated(const QString &);
114
115 void lockedChanged(bool value);
116
117 void presentChanged(bool value);
118
119 void dataRoamingEnabledChanged(bool value);
120
121 void mobileDataEnabledChanged(bool value);
122};
123
124}
125}
0126
=== modified file 'src/qdbus-stubs/dbus-types.h'
--- src/qdbus-stubs/dbus-types.h 2015-11-20 13:14:50 +0000
+++ src/qdbus-stubs/dbus-types.h 2016-05-16 07:44:17 +0000
@@ -47,6 +47,19 @@
47 return path.arg(counter++);47 return path.arg(counter++);
48 }48 }
4949
50 inline QString modemPath(const QString &serial)
51 {
52 static QString path{"/com/ubuntu/connectivity1/modem/%1"};
53 return path.arg(serial);
54 }
55
56 inline QString simPath(const QString &imsi)
57 {
58 static QString path{"/com/ubuntu/connectivity1/sim/%1"};
59 return path.arg(imsi);
60 }
61
62
50 static constexpr char const* WPASUPPLICANT_DBUS_NAME = "fi.w1.wpa_supplicant1";63 static constexpr char const* WPASUPPLICANT_DBUS_NAME = "fi.w1.wpa_supplicant1";
5164
52 static constexpr char const* WPASUPPLICANT_DBUS_INTERFACE = "fi.w1.wpa_supplicant1";65 static constexpr char const* WPASUPPLICANT_DBUS_INTERFACE = "fi.w1.wpa_supplicant1";

Subscribers

People subscribed via source and target branches