aboutsummaryrefslogtreecommitdiff
path: root/libcontextprovider/doc/html/class_context_provider_1_1_service.html
blob: afa05b629483dcf1ce1e5721a3a3435b9c5d2fbd (plain)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libcontextprovider: ContextProvider::Service Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespace_context_provider.html">ContextProvider</a>::<a class="el" href="class_context_provider_1_1_service.html">Service</a>
  </div>
</div>
<div class="contents">
<h1>ContextProvider::Service Class Reference</h1><!-- doxytag: class="ContextProvider::Service" -->
<p>A <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object is a proxy representing a service on D-Bus that implements the ContextKit interface. The lifespan of the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object is not tied to the real service lifespan. This way a service can be accessed and controlled from different parts of the code.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="service_8h_source.html">service.h</a>&gt;</code></p>

<p><a href="class_context_provider_1_1_service-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d">Service</a> (QDBusConnection connection, QObject *parent=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> proxy object which shares the <em>connection</em> with the provider program.  <a href="#ad9cac0378bb6bc25b65526576a609c6d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a2a7310e48f9592828aea6b3f5fda181e">Service</a> (QDBusConnection::BusType busType, const QString &amp;busName, QObject *parent=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A convenient constructor, where autoStart is always true.  <a href="#a2a7310e48f9592828aea6b3f5fda181e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a8013904e0bb41e4b8ff0b68d4214b853">Service</a> (QDBusConnection::BusType busType, const QString &amp;busName, bool autoStart, QObject *parent=0)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> proxy object for <em>busName</em> on the bus indicated by <em>busType</em>.  <a href="#a8013904e0bb41e4b8ff0b68d4214b853"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a365b50365fd98d8ee7a1b7dd10dd84d2">~Service</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destroys this <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> instance.  <a href="#a365b50365fd98d8ee7a1b7dd10dd84d2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a6434d467cd84a6295bd24572671b5479">start</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Start the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> again after it has been stopped.  <a href="#a6434d467cd84a6295bd24572671b5479"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a25cc85c61a07afe679266fc287da0677">stop</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Stop the service.  <a href="#a25cc85c61a07afe679266fc287da0677"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a471dbe35bbd9583f9404b15158f367dd">restart</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Stop and start the service.  <a href="#a471dbe35bbd9583f9404b15158f367dd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a385b58aef7878b6e33a3989d139f9a4a">setAsDefault</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object as the default one to use when constructing <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects.  <a href="#a385b58aef7878b6e33a3989d139f9a4a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#aee524632842792e9ad80b122eb8600a1">setValue</a> (const QString &amp;key, const QVariant &amp;val)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the value of <em>key</em> to <em>val</em>.  <a href="#aee524632842792e9ad80b122eb8600a1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#ad6bf1d2d8f8c580d4d77e9c4e72fd226">setConnection</a> (const QDBusConnection &amp;connection)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set (override) the QDBusConnection used by the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a>.  <a href="#ad6bf1d2d8f8c580d4d77e9c4e72fd226"></a><br/></td></tr>
<tr><td colspan="2"><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#a386f5a9cf65610cb62143865e5637272">Property</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_service.html#ac3553c08a0c7b57a4c15794caebf1936">::ServiceUnitTest</a></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object is a proxy representing a service on D-Bus that implements the ContextKit interface. The lifespan of the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object is not tied to the real service lifespan. This way a service can be accessed and controlled from different parts of the code. </p>
<p>When you first create a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object with given bus type / bus name parameters the real D-Bus service instance is actually created and started. Future references to this bus type / bus name will give you a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> instance that points to the very same service as the first <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> initialization that started it. In other words, we can say that the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> class represents a proxy interface to the real D-Bus service.</p>
<p>When the last instance of <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> is destroyed, the real service is automatically terminated and destroyed (there is a simple ref counting mechanism involved to guarantee that).</p>
<p>Consider the following examples:</p>
<div class="fragment"><pre class="fragment">    <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a> *s1 = <span class="keyword">new</span> <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a>(QDBusConnection::SessionBus, <span class="stringliteral">&quot;com.example.simple&quot;</span>);
    <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a> *s2 = <span class="keyword">new</span> <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a>(QDBusConnection::SessionBus, <span class="stringliteral">&quot;com.example.simple&quot;</span>);
    <span class="comment">// s1 and s2 represent the same service</span>

    s2-&gt;stop();
    <span class="comment">// Both s1 and s2 are now stopped</span>

    s1-&gt;start();
    <span class="comment">// Both s1 and s2 are now started</span>

    <span class="keyword">delete</span> s1; <span class="comment">// s2 is still valid, service is present</span>
    <span class="keyword">delete</span> s2; <span class="comment">// the &quot;com.example.simple&quot; just disappeared from D-Bus</span>
</pre></div><p>Every <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object must be associated with a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object.</p>
<p>A <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> can be running or stopped. When it is running, it is visible via D-Bus and clients can subscribe to its properties.</p>
<p>It is undefined what happens when you add a <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object to a running service. Likewise, it is undefined what happens when you add a <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> to a <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> while the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> of that <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object is running.</p>
<p>Thus, it is best to create a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object, add all <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects to it immediately, create the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> objects for them, and then enter the main loop.</p>
<p>Libcontextprovider can share the same QDBusConnection that is used in the provider program. In that case, the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> must be created by passing the QDBusConnection. The <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> will not register any service name on the connection. It is advisable to register the service name as late as possible, after initializing all Services and Properties and after registering other objects the provider declares on D-Bus.</p>
<div class="fragment"><pre class="fragment">    <span class="keywordtype">int</span> main(<span class="keywordtype">int</span> <a class="code" href="contextc_8cpp.html#ad1447518f4372828b8435ae82e48499e">argc</a>, <span class="keywordtype">char</span>** <a class="code" href="contextc_8cpp.html#a34d7542664850bdf79197020d3e9532f">argv</a>) {
        QCoreApplication <a class="code" href="contextc_8cpp.html#ab751c4ea835b01f1db167e4fbc8f042d">app</a>(argc, argv);
        QDBusConnection systemBus = QDBusConnection::SystemBus();

        <span class="comment">// D-Bus registrations can happen before or after initializing</span>
        <span class="comment">// the Services and Properties</span>
        connection.registerObject(...);

        <span class="comment">// Now myService will share the connection and won&apos;t register</span>
        <span class="comment">// any service name</span>
        <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a> *myService = <span class="keyword">new</span> <a class="code" href="class_context_provider_1_1_service.html#ad9cac0378bb6bc25b65526576a609c6d" title="Creates a Service proxy object which shares the connection with the provider program...">Service</a>(systemBus);
        <a class="code" href="class_context_provider_1_1_service.html#a386f5a9cf65610cb62143865e5637272">Property</a>* <span class="keyword">property</span> = <span class="keyword">new</span> <a class="code" href="class_context_provider_1_1_service.html#a386f5a9cf65610cb62143865e5637272">Property</a>(myService, <span class="stringliteral">&quot;My.Property&quot;</span>);

        <span class="comment">// Important: registering the service name should be done as</span>
        <span class="comment">// late as possible, to prevent clients from connecting to us</span>
        <span class="comment">// before all objects have been registered.</span>
        connection.registerService(<span class="stringliteral">&quot;my.service.name&quot;</span>);

        <span class="keywordflow">return</span> <a class="code" href="contextc_8cpp.html#ab751c4ea835b01f1db167e4fbc8f042d">app</a>.exec();
    }
</pre></div> <hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad9cac0378bb6bc25b65526576a609c6d"></a><!-- doxytag: member="ContextProvider::Service::Service" ref="ad9cac0378bb6bc25b65526576a609c6d" args="(QDBusConnection connection, QObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Service::Service </td>
          <td>(</td>
          <td class="paramtype">QDBusConnection&nbsp;</td>
          <td class="paramname"> <em>connection</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> proxy object which shares the <em>connection</em> with the provider program. </p>
<p>The <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> will not register any service name on the conneciton. If the service is accessed for the first time it'll be created and set up. If the service with the given parameters already exists the created object represents a controller to a previously-created service. A new <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> will be started when it is constructed. </p>

</div>
</div>
<a class="anchor" id="a2a7310e48f9592828aea6b3f5fda181e"></a><!-- doxytag: member="ContextProvider::Service::Service" ref="a2a7310e48f9592828aea6b3f5fda181e" args="(QDBusConnection::BusType busType, const QString &amp;busName, QObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Service::Service </td>
          <td>(</td>
          <td class="paramtype">QDBusConnection::BusType&nbsp;</td>
          <td class="paramname"> <em>busType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QString &amp;&nbsp;</td>
          <td class="paramname"> <em>busName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A convenient constructor, where autoStart is always true. </p>

</div>
</div>
<a class="anchor" id="a8013904e0bb41e4b8ff0b68d4214b853"></a><!-- doxytag: member="ContextProvider::Service::Service" ref="a8013904e0bb41e4b8ff0b68d4214b853" args="(QDBusConnection::BusType busType, const QString &amp;busName, bool autoStart, QObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Service::Service </td>
          <td>(</td>
          <td class="paramtype">QDBusConnection::BusType&nbsp;</td>
          <td class="paramname"> <em>busType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QString &amp;&nbsp;</td>
          <td class="paramname"> <em>busName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>autoStart</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> proxy object for <em>busName</em> on the bus indicated by <em>busType</em>. </p>
<p>The <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> will register the given <em>busName</em> on D-Bus. If the service is accessed for the first time it'll be created and set up. If the service with the given parameters already exists the created object represents a controller to a previously-created service. A new <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> will be started when it is constructed if <em>autoStart</em> is true (which is the default). </p>

</div>
</div>
<a class="anchor" id="a365b50365fd98d8ee7a1b7dd10dd84d2"></a><!-- doxytag: member="ContextProvider::Service::~Service" ref="a365b50365fd98d8ee7a1b7dd10dd84d2" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Service::~Service </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destroys this <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> instance. </p>
<p>The actual service on D-Bus is destroyed and stopped if this object is a last instance pointing at the actual service with the given constructor parameters (QDBusConnection or bus type and bus name). </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a471dbe35bbd9583f9404b15158f367dd"></a><!-- doxytag: member="ContextProvider::Service::restart" ref="a471dbe35bbd9583f9404b15158f367dd" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Service::restart </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Stop and start the service. </p>
<p>This function cannot be used when the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> shares a QDBusConnection with the provider program. When that is the case, you must stop the service, unregister the D-Bus bus name, register it again (to force clients of context properties to resubscribe), and finally start the service again. </p>

</div>
</div>
<a class="anchor" id="a385b58aef7878b6e33a3989d139f9a4a"></a><!-- doxytag: member="ContextProvider::Service::setAsDefault" ref="a385b58aef7878b6e33a3989d139f9a4a" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Service::setAsDefault </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> object as the default one to use when constructing <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects. </p>

</div>
</div>
<a class="anchor" id="ad6bf1d2d8f8c580d4d77e9c4e72fd226"></a><!-- doxytag: member="ContextProvider::Service::setConnection" ref="ad6bf1d2d8f8c580d4d77e9c4e72fd226" args="(const QDBusConnection &amp;connection)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Service::setConnection </td>
          <td>(</td>
          <td class="paramtype">const QDBusConnection &amp;&nbsp;</td>
          <td class="paramname"> <em>connection</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set (override) the QDBusConnection used by the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a>. </p>
<p>Deprecated; use constructor with QDBusConnection parameter instead. </p>

</div>
</div>
<a class="anchor" id="aee524632842792e9ad80b122eb8600a1"></a><!-- doxytag: member="ContextProvider::Service::setValue" ref="aee524632842792e9ad80b122eb8600a1" args="(const QString &amp;key, const QVariant &amp;val)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Service::setValue </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QVariant &amp;&nbsp;</td>
          <td class="paramname"> <em>val</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the value of <em>key</em> to <em>val</em>. </p>
<p>A property named <em>key</em> must have been registered already, by creating a <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object for it. </p>

</div>
</div>
<a class="anchor" id="a6434d467cd84a6295bd24572671b5479"></a><!-- doxytag: member="ContextProvider::Service::start" ref="a6434d467cd84a6295bd24572671b5479" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ContextProvider::Service::start </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Start the <a class="el" href="class_context_provider_1_1_service.html" title="A Service object is a proxy representing a service on D-Bus that implements the ContextKit...">Service</a> again after it has been stopped. </p>
<p>In the case of shared connection, the objects will be registered to D-Bus. In the case of non-shared connection, also the service name will be registered on D-Bus. Returns true on success, false otherwise. </p>

</div>
</div>
<a class="anchor" id="a25cc85c61a07afe679266fc287da0677"></a><!-- doxytag: member="ContextProvider::Service::stop" ref="a25cc85c61a07afe679266fc287da0677" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Service::stop </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Stop the service. </p>
<p>In the case of shared connection, this will cause the related objects to be unregistered, but the bus name will still be on D-Bus. In the case of non-shared connection, this will cause the service to disappear from D-Bus completely. </p>

</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="ac3553c08a0c7b57a4c15794caebf1936"></a><!-- doxytag: member="ContextProvider::Service::::ServiceUnitTest" ref="ac3553c08a0c7b57a4c15794caebf1936" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class ::ServiceUnitTest<code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a386f5a9cf65610cb62143865e5637272"></a><!-- doxytag: member="ContextProvider::Service::Property" ref="a386f5a9cf65610cb62143865e5637272" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="class_context_provider_1_1_property.html">Property</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="service_8h_source.html">service.h</a></li>
<li><a class="el" href="service_8cpp.html">service.cpp</a></li>
</ul>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Oct 19 14:19:52 2009 for libcontextprovider by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>