doc: Change bearer name to cellular instead 3G
[platform/upstream/connman.git] / doc / session-api.txt
1 Service         unique name
2 Interface       net.connman.Notification
3 Object path     freely definable
4
5 Methods         void Release()
6
7                         This method gets called when the service daemon
8                         unregisters the session. A counter can use it to do
9                         cleanup tasks. There is no need to unregister the
10                         session, because when this method gets called it has
11                         already been unregistered.
12
13                 void Update(dict settings)
14
15                         Sends an update of changed settings. Only settings
16                         that are changed will be included.
17
18                         Initially on every session creation this method is
19                         called once to inform about the current settings.
20
21
22 Service         net.connman
23 Interface       net.connman.Session
24 Object path     variable
25
26 Methods         void Destroy()
27
28                         Close the current session. This is similar to
29                         DestroySession method on the manager interface. It
30                         is just provided for convenience depending on how
31                         the application wants to track the session.
32
33                 void Connect()
34
35                         If not connected, then attempt to connect this
36                         session.
37
38                         The usage of this method depends a little bit on
39                         the model of the application. Some application
40                         should not try to call Connect on any session at
41                         all. They should just monitor if it becomes online
42                         or gets back offline.
43
44                         Others might require an active connection right now.
45                         So for example email notification should only check
46                         for new emails when a connection is available. However
47                         if the user presses the button for get email or wants
48                         to send an email it should request to get online with
49                         this method.
50
51                         Depending on the bearer settings the current service
52                         is used or a new service will be connected.
53
54                         This method returns immediately after it has been
55                         called. The application is informed through the update
56                         notification about the state of the session.
57
58                         It is also not guaranteed that a session stays online
59                         after this method call. It can be taken offline at any
60                         time. This might happen because of idle timeouts or
61                         other reasons.
62
63                         It is safe to call this method multiple times. The
64                         actual usage will be sorted out for the application.
65
66                 void Disconnect()
67
68                         This method indicates that the current session does
69                         not need a connection anymore.
70
71                         This method returns immediately. The application is
72                         informed through the update notification about the
73                         state of the session.
74
75                 void Change(string name, variant value)
76
77                         Change the value of certain settings. Not all
78                         settings can be changed. Normally this should not
79                         be needed or an extra session should be created.
80                         However in some cases it makes sense to change
81                         a value and trigger different behavior.
82
83                         A change of a setting will cause an update notification
84                         to be sent. Some changes might cause the session to
85                         be moved to offline state.
86
87 Settings        string  Bearer [readonly]
88
89                         This indicates the current bearer that is used
90                         for this session. Or an empty string if no bearer
91                         is available.
92
93                 boolean Online [readonly]
94
95                         This indicates if the connection is online or
96                         offline.
97
98                         This maps to the online service state. And it is
99                         only valid for the selected bearer configuration.
100                         Otherwise it will be reported as offline even if
101                         the global state would be online.
102
103                         In addition the Online settings notification might
104                         not happen right away. Notifications of online state
105                         can be delayed based on the speed of the bearer. It
106                         is done to avoid congestion on bearers like cellular
107                         etc.
108
109                 boolean Priority [readwrite]
110
111                         This allows a session to mark itself as priority or
112                         not. In general application are not allowed to make
113                         themselves more important than others.
114
115                         The priority handling is done internally by usage
116                         and first come, first serve order. By default this
117                         settings is of course false.
118
119                         Internally there can be different priorities for
120                         different application, but these are defined by a
121                         configuration file and not via this interface.
122
123                         An application that calls the method to connect
124                         a session is preferred over other sessions. This
125                         priority value is more for application that want to
126                         push themselves up in the asychronization notification
127                         queue once a bearer becomes online.
128
129                         This actual priority order also depends on the
130                         allowed bearers and other factors. This is setting
131                         is just a little indicator of one application being
132                         notified before another one.
133
134                         For example a streaming session should set the
135                         priority value. As soon as realtime data is involved
136                         then this should be set. An email client should not
137                         set this value.
138
139                 string Name [readonly]
140
141                         The Service name to which the system is connected.
142                         It should only be used for displaying it in the UI
143                         and not for getting hold on session object.
144
145                 array{string} AllowedBearers [readwrite]
146
147                         A list of bearers that can be used for this session.
148                         In general this list should be empty to indicate that
149                         any bearer is acceptable.
150
151                         The order of the entries in AllowedBearers matters.
152                         The services are sorted in the order of the bearer
153                         entries in this list.
154
155                         Also "*" matches any bearer. This is usefull to prefer
156                         certain bearers such as Wifi with a fallback to any
157                         other available bearer.
158
159                 dict IPv4 [readonly]
160
161                         Current IPv4 configuration. This settings is only
162                         valid when online is true as well. Otherwise an
163                         empty dictionary is reported.
164
165                 dict IPv6 [readonly]
166
167                         Current IPv6 configuration. This setting is only
168                         valid when online is true as well. Otherwise an
169                         empty dictionary is reported.
170
171                 boolean AvoidHandover [readwrite]
172
173                         By default this setting is false. It can be used
174                         to indicate that a handover is currently not a good
175                         idea. However no connection is guaranteed. So a
176                         handover can happen anyway. This is just an indication
177                         that the application would like to avoid it right now.
178
179                         It is a bad idea to always enable this settings and
180                         actually it will be reset after a while to avoid
181                         congestion.
182
183                         Main use case it is for application that are currently
184                         doing a specific tasks that it prefers to finish
185                         before allowing handovers again. An example would
186                         be synchronization.
187
188                         Never the less application needs to be aware that
189                         handovers can happen at any time even if this is
190                         set to true.
191
192                 boolean StayConnected [readwrite]
193
194                         This disables the idle timeout for this session. There
195                         is no guarantee and this should be used with care.
196
197                         If the system is not online yet this value is ignored.
198
199                 uint32  PeriodicConnect [readwrite]
200
201                         Indicate that a periodic connection attempt every
202                         n minutes should be made. The minutes value is a
203                         suggestion when to connection. There is no guarantee
204                         that it will be made or will succeed.
205
206                         A value of 0 disable this feature.
207
208                         This feature is interesting for applications that
209                         wanna check status on a regular interval. And instead
210                         of the application waking up and trying to connect,
211                         this can be centralized nicely and multiple wakeups
212                         avoided in case no connection is available.
213
214                         An example application would be an email client that
215                         wants to check for new emails every 10 minutes.
216
217                         On purpose the smallest setting is 1 minute here since
218                         waking up more often and trying to set up a connection
219                         seems rather pointless use case.
220
221                         If an interval step has passed this can be nicely
222                         rescheduled when any connection matching the bearer
223                         settings becomes available becomes available. Using
224                         this feature it is also easy to avoid congestion.
225
226                 uint32  IdleTimeout [readwrite]
227
228                         If the system is idle for given period then it should
229                         go offline.
230
231                         If the timeout is 0, this feature is disabled. If
232                         different values are provided by several session object
233                         the longest interval is taken as timeout value.
234
235                 boolean EmergencyCall [readwrite]
236
237                         Boolean representing the emergency mode of the
238                         modem. The Emergency is true if an emergency call or
239                         related operation is currently active.
240
241                         If the emergency application sets this setting to true
242                         all other session will be informed about the emergency
243                         situation with setting it also to true. Only the
244                         emergency application can set back to false.
245
246                         As long the EmergencyCall is true no new session can
247                         be created.
248
249                         Only one application is supposed to write this setting
250                         and therefore it will be protected by additional
251                         PolicyKit rule so that only the emergency application
252                         can write.
253
254                         The emergency application is expected to call Connect()
255                         after setting this setting true. If the emergency
256                         situation is over the application should call
257                         Disconnect() and also set the EmergencyCall to false
258                         afterward.
259
260                         Note only services matching the AllowedBearers rule
261                         will be considered.
262
263                 string  RoamingPolicy [readwrite]
264
265                         The allowed roaming behavior.
266
267                         Valid policies are "national", "international",
268                         "default", "always" and "forbidden".
269
270                         "national" allows roaming within a country.
271                         "international" allows roaming in a country and
272                         between countries.
273
274                         "default" is used to tell the Session to use
275                         the global roaming setting.
276
277                         "always" will overwrite the default "forbidden"
278                         value which is useful for emergency application.
279                         This value will be protected by additional PolicyKit
280                         rule.
281
282                         Default value is "forbidden".
283
284                 string  Interface [readonly]
285
286                         Interface name used by the service object to connect.
287                         This name can be used for SO_BINDTODEVICE in the
288                         application.
289
290                 uint32  SessionMarker [readonly]
291
292                         The unique session marker can be used to mark all
293                         traffic from the application with the SO_MARK
294                         socket option. In combination of the EmergencyCall
295                         this allows ConnMan to setup the firewall rules
296                         that only traffic from the emergency application
297                         are transmitted.