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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
Application programming interface
*********************************
Service basics
==============
Inside Connection Manager there exists one advanced interface to allow the
user interface an easy access to networking details and user chosen
preferences. This is the service list and interface.
The basic idea is that Connection Manager maintains a single flat and sorted
list of all available, preferred or previously used services. A service here
can be either a Ethernet device, a WiFi network, a WiMAX service provider
or a remote Bluetooth device (for example a mobile phone).
This list of service is sorted by Connection Manager and there is no need
for the user interface to implement its own sorting. User decisions will
need to be done via Connection Manager and it is then responsible to update
the order of services in this list.
+---------------------------------------+
| Ethernet |
+---------------------------------------+
| Bluetooth phone |
+---------------------------------------+
| Guest (strength 90, none) |
+---------------------------------------+
| My WiFi AP (strength 80, rsn) |
+---------------------------------------+
| Clear WiMAX (strength 70) |
+---------------------------------------+
| Other AP (strength 70, rsn) |
+---------------------------------------+
| Friends AP (strength 70, wep) |
+---------------------------------------+
| Other WiMAX (strength 50) |
+---------------------------------------+
If none of the services has been used before the sorting order will be done
with these priorities:
1. Ethernet (lower index numbers first)
2. Bluetooth (last used devices first)
3. GSM/UTMS/3G (if SIM card is present, activated and not roaming)
3. WiFi/WiMAX (signal strength first, then prefer WiMAX over WiFi,
then more secure network first)
The Ethernet devices are always sorted first since they are physically built
into the system and will be always present. In cases they are switched off
manually they will not be showing in this list.
Since every Bluetooth device has to be configured/paired first, the user
already made a choice here that these are important. Connection Manager will
only show devices with PAN or DUN profile support. While Bluetooth devices
do have a signal strength, it is mostly unknown since background scanning
in Bluetooth is too expensive. The choice here is to sort the last used
Bluetooth device before the others.
The WiFi and WiMAX networks are treated equally since both provide signal
strength information and networks closer in the proximity should be shown
before others since it is more likely they are selected first. The signal
strength value is normalized to 0-100 (effectively a percentage) and allows
an easy sorting.
If the signal strength is identical then the WiMAX network should be shown
first since it is a licensed spectrum and more reliable. Also the number
of WiMAX networks will be smaller than the number of WiFi since that operates
in an unlicensed spectrum.
WiFi networks with the same signal strength are then sorted by their security
setting. WPA2 encrypted networks should be preferred over WPA/WEP and also
unencrypted ones. After that they will be sorted by the SSID in alphabetical
order.
In the case the WiFi network uses WPS for setup and it is clearly detectable
that a network waits for Connection Manager to connect to it (for example via
a push-to-connect button press on the AP), then this network should be shown
first before any other WiFi or WiMAX network. The reason here is that the
user already made a choice via the access point. However this depends on
technical details if it is possible to detect these situations.
Service order
=============
All unused services will have the internal order number of 0 and then will
be sorted according to the rules above. For Bluetooth the user already made
the decision to setup their device and by that means select it. However
until the first connection attempt it might have been setup for total
different reason (like audio usage) and thus it still counts as unused from
a networking point of view.
Selecting the "My WiFi AP" and successfully connecting to it makes it a
favorite device and it will become an order number bigger than 0. All
order numbers are internally. They are given only to service that are marked
as favorite. For WiFi, WiMAX and Bluetooth a successful connection attempt
makes these services automatically a favorite. For Ethernet the plugging
of a cable makes it a favorite. Disconnecting from a network doesn't remove
the favorite setting. It is a manual operation and is equal to users pressing
delete/remove button.
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=1 - favorite=yes
+---------------------------------------+
| Ethernet | order=0
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
Ethernet is special here since the unplugging of the network cable will
remove the favorite selection.
+---------------------------------------+
| Ethernet with cable | order=1 - favorite=yes
+---------------------------------------+
| Ethernet without cable | order=0 - favorite=no
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
This means that all services with an order > 0 have favorite=yes and all
others have favorite=no setting. The favorite setting is exposed via a
property over the service interface. As mentioned above, the order number
is only used internally.
Within Connection Manager many services can be connected at the same time and
also have an IP assignment. However only one can have the default route. The
service with the default route will always be sorted at the top of the
list.
+---------------------------------------+
| Ethernet | order=2 - connected=yes
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=1 - connected=yes
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
To change the default connection to your access point, the user needs to
manually drag the access point service to the top of the list. Connection
Manager will not take down default routes if there is no reason to do so.
A working connection is considered top priority.
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=2 - connected=yes
+---------------------------------------+
| Ethernet | order=1 - connected=yes
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
Another possible user interaction would be to unplug the Ethernet cable and
in this case the favorite setting will be removed and the service falls back
down in the list.
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=1 - connected=yes
+---------------------------------------+
| Ethernet | order=0
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
If the service on the top of the list changes the default route will be
automatically adjusted as needed. The user can trigger this by disconnecting
from a network, if the network becomes unavailable (out of range) or if the
cable gets unplugged.
As described above, the pure case of disconnecting from a network will not
remove the favorite setting. So previously selected networks are still present
and are sorted above all others.
+---------------------------------------+
| Ethernet | order=2 - connected=yes
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=1 - connected=no
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
Unplugging the Ethernet cable will remove the favorite setting, but due to
the basic ordering of services it will be at the top of the services with an
order number of 0 (directly after all favorite services).
+---------------------------------------+
| My WiFi AP (strength 80, rsn) | order=1 - connected=no
+---------------------------------------+
| Ethernet | order=0 - connected=no
+---------------------------------------+
| Guest (strength 90, none) | order=0
+---------------------------------------+
| |
Service tweaks
==============
The interfaces of Connection Manager will always export all services that are
currently known. The Ethernet devices with no cable plugged are actually not
included in this list. They will only show up once a carrier is detected.
The service interface is not meant for basic device configuration task. So
switching a device on and off (via RFKILL for example) should be done via
the device interface.
Due to limited screen size of small devices and the big amount of WiFi
access points that are deployed right now it might be sensible to not show
certain WiFi networks in the user interface.
The choice to hide a WiFi network from the user interface should be purely
done by the signal strength. The optimal cut-off value here still has to be
determined, but in the end that is a user interface policy.
Service naming
==============
Every service will have a name property that allows the user interface to
display them directly. All names will be already converted into UTF-8. It
derives from the netork details.
In case of WiFi this will be the SSID value. The SSID is a binary array and
will be converted into printable form. Unprintable characters are replaced
with spaces.
For WiMAX networks the provider name like Clear or X-OHM will be used. This
name either comes directly from the network itself or from a provisioning
database of the WiMAX service.
For Bluetooth the device alias is used. The alias is different since it
can be overwritten by the user via the Bluetooth service. The identification
is still done based on its address, but the display name might change. In
most cases the alias is equal to the Bluetooth remote friendly name.
For Ethernet device no name will be provided. The type property will indicate
that this service is Ethernet and then it is up to the user interface to
provide a proper localized name for it.
Service states
==============
Every service can have multiple states that indicate what is currently
going on with it. The choice to have multiple states instead of a simple
connected yes/no value comes from the fact that it is important to let the
user interface name if a service is in process of connecting/disconnecting.
The basic state of every service is "idle". This means that this service
is not in use at all at the moment. It also is not attempting to connect
or do anything else.
The "association" state indicates that this service tries to establish a
low-level connection to the network. For example associating/connecting
with a WiFi access point.
With the "configuration" state the service indicates that it is trying
to retrieve/configure IP settings.
The "ready" state signals a successful connected device. This doesn't mean
it has the default route, but basic IP operations will succeed.
With the "disconnect" state a service indicates that it is going to terminate
the current connection and will return to the "idle" state.
In addition a "failure" state indicates a wrong behavior. It is similar to
the "idle" state since the service is not connected.
+---------------+
| idle |<-------------------------------+
+---------------+ |
| |
| +-------------+ |
+----------------------| failure | |
| service.Connect() +-------------+ |
V A |
+---------------+ | |
| association |-----------------+ |
+---------------+ error | |
| | |
| success | |
V | |
+---------------+ | |
| configuration |-----------------+ |
+---------------+ error |
| |
| success |
V |
+---------------+ |
| ready | |
+---------------+ |
| |
| success |
| |
V |
+---------------+ |
| online |<----------------+ |
+---------------+ | |
| | |
| service.Disconnect() | |
V | |
+---------------+ | |
| disconnect |-----------------+ |
+---------------+ error |
| |
+------------------------------------------+
The different states should no be used by the user interface to trigger
advanced actions. The state transitions are provided for the sole purpose
to give the user feedback on what is currently going on. Especially in
cases where networks are flaky or DHCP servers take a long time these
information are helpful for the user.
Some services might require special authentication procedure like a web
based confirmation. The LoginRequired property should be used to check
for this.
Application basics
==================
All applications should use D-Bus to communicate with Connection Manager. The
main entry point is the manager object. Currently the manager object is
located at "/", but this might change to allow full namespacing of the API
in the future. The manager interface is documented in manager-api.txt and
contains a set of global properties and methods.
A simple way to retrieve all global properties looks like this:
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("net.connman", "/"),
"net.connman.Manager")
properties = manager.GetProperties()
Changing a global property is also pretty simple. For example enabling the
so called offline mode (aka flight mode) it is enough to just set that
property:
manager.SetProperty("OfflineMode", dbus.Boolean(1))
The manager object contains references to profiles, devices, services and
connections. All these references represent other interfaces that allow
detailed control of Connection Manager. The profiles and devices interfaces
are more for advanced features and most applications don't need them at all.
The services are represented as a list of object paths. Every of these object
paths contains a service interface. A service is a global collection for
Ethernet devices, WiFi networks, Bluetooth services, WiMAX providers etc. and
all these different types are treated equally.
Every local Ethernet card will show up as exactly one service. WiFi networks
will be grouped by SSID, mode and security setting. Bluetooth PAN and DUN
service will show up per remote device. For WiMAX the provider name will
be used for grouping different base stations and access providers. This
creates a simple list that can be directly displayed to the users since these
are the exact details users should care about.
properties = manager.GetProperties()
for path in properties["Services"]:
service = dbus.Interface(bus.get_object("net.connman", path),
"net.connman.Service")
service_properties = service.GetProperties()
The service interface is documented in service-api.txt and contains common
properties valid for all services. It also contains method to connect or
disconnect a specific service. This allows users to select a specific service.
Connection Manager can also auto-connect services based on his policies or
via external events (like plugging in an Ethernet cable).
Connecting (or disconnecting) a specific service manually is as simple as
just telling it to actually connect:
service.Connect() or service.Disconnect()
It is possible to connect multiple services if the underlying technology
allows it. For example it would be possible to connect to a WiFi network
and a Bluetooth service at the same time. Trying to connect to a second WiFi
network with the same WiFi hardware would result in an automatic disconnect
of the currently connected network. Connection Manager handles all of this
for the applications in the background. Trying to connect an Ethernet service
will result in an error if no cable is plugged in. All connection attempts
can fail for one reason or another. Application should be able to handle
such errors and will also be notified of changes via signals.
In future versions Connection Manager will interact with an agent to confirm
certain transactions with the user. This functionality is currently not
implemented.
To monitor the current status of a service the state property can be used. It
gives detailed information about the current progress.
properties = service.GetProperties()
print properties["State"]
All state changes are also sent via the PropertyChanged signal on the
service interface. This allows asynchronous monitoring without having to poll
Connection Manager for changes.
|