aboutsummaryrefslogtreecommitdiff
path: root/libcontextsubscriber/doc/html/contextkitplugin_8h_source.html
blob: 470610c66c35aaccc35930b623560854d444a5ab (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
<!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>libcontextsubscriber: contextkitplugin.h Source File</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><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>contextkitplugin.h</h1><a href="contextkitplugin_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008, 2009 Nokia Corporation.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Contact: Marius Vollmer &lt;marius.vollmer@nokia.com&gt;</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the GNU Lesser General Public License</span>
<a name="l00008"></a>00008 <span class="comment"> * version 2.1 as published by the Free Software Foundation.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * This library is distributed in the hope that it will be useful, but</span>
<a name="l00011"></a>00011 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00013"></a>00013 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00016"></a>00016 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA</span>
<a name="l00018"></a>00018 <span class="comment"> * 02110-1301 USA</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> */</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef CONTEXTKITPLUGIN_H</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define CONTEXTKITPLUGIN_H</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="dbusnamelistener_8h.html">dbusnamelistener.h</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="subscriberinterface_8h.html">subscriberinterface.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="provider_8h.html">provider.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="iproviderplugin_8h.html">iproviderplugin.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;<a class="code" href="asyncdbusinterface_8h.html">asyncdbusinterface.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="timedvalue_8h.html">timedvalue.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;QString&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;QDBusConnection&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;QDBusPendingCallWatcher&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;QDBusObjectPath&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;QSet&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;QVariant&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;QMap&gt;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00040"></a>00040     <a class="code" href="class_context_subscriber_1_1_i_provider_plugin.html" title="Interface for provider plugins.">ContextSubscriber::IProviderPlugin</a>* <a class="code" href="contextkitplugin_8cpp.html#a70307658405a252817d4081fd82eabe9" title="Creates a new instance, the service to connect to has to be passed in constructionString...">contextKitPluginFactory</a>(QString constructionString);
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">namespace </span>ContextSubscriber {
<a name="l00044"></a><a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html">00044</a> <span class="keyword">class </span><a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html">PendingSubscribeWatcher</a> : <span class="keyword">public</span> QDBusPendingCallWatcher
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046     Q_OBJECT;
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">public</span>:
<a name="l00049"></a>00049     <a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#a21b61bbfe9a39063f7b653fee7899943">PendingSubscribeWatcher</a>(<span class="keyword">const</span> QDBusPendingCall &amp;call,
<a name="l00050"></a>00050                             <span class="keyword">const</span> QString &amp;<a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#a24977d3dc1f8ced3ca81648b5bd94dd2">key</a>,
<a name="l00051"></a>00051                             QObject * parent = 0);
<a name="l00052"></a>00052 <span class="keyword">private</span> slots:
<a name="l00053"></a>00053     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#ac20dc315b637a4137d6cc1830ed8e779">onFinished</a>();
<a name="l00054"></a>00054 
<a name="l00055"></a>00055 signals:
<a name="l00056"></a>00056     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#a305b5626247bf297ab33aeefbdbc5f88">subscribeFailed</a>(QString, QString);
<a name="l00057"></a>00057     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#a2ad4c5c689328e78b02ef598994d447c">valueChanged</a>(QString, <a class="code" href="struct_context_subscriber_1_1_timed_value.html">TimedValue</a>);
<a name="l00058"></a>00058     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#ae9e3fd6b453ad968096ae574030bc9b7">subscribeFinished</a>(QString);
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="keyword">private</span>:
<a name="l00061"></a><a class="code" href="class_context_subscriber_1_1_pending_subscribe_watcher.html#a24977d3dc1f8ced3ca81648b5bd94dd2">00061</a>     QString key;
<a name="l00062"></a>00062 };
<a name="l00063"></a>00063 
<a name="l00064"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html">00064</a> <span class="keyword">class </span><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html" title="Implementation of the ContextKit D-Bus protocol.">ContextKitPlugin</a> : <span class="keyword">public</span> <a class="code" href="class_context_subscriber_1_1_i_provider_plugin.html" title="Interface for provider plugins.">IProviderPlugin</a>
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066     Q_OBJECT
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 <span class="keyword">public</span>:
<a name="l00069"></a>00069     <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ab3728dd869ea64e058f4f7c35a4bb067" title="Creates subscriber and manager interface, tries to get a subscriber instance from...">ContextKitPlugin</a>(<span class="keyword">const</span> QDBusConnection bus, <span class="keyword">const</span> QString&amp; <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a80103689b09397c9a399987df806af1c" title="The D-Bus service name of the ContextKit provider connected to.">busName</a>);
<a name="l00070"></a>00070     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#aa45ae69058525f998ed5eb0c275cac75" title="Forwards the subscribe request to the wire.">subscribe</a>(QSet&lt;QString&gt; keys);
<a name="l00071"></a>00071     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a4936904e1483e3f06c86e10d65a39e50" title="Forwards the unsubscribe request to the wire.">unsubscribe</a>(QSet&lt;QString&gt; keys);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 signals:
<a name="l00074"></a>00074 <span class="preprocessor">#ifdef DOXYGEN_ONLY</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>    <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#acb1ad4d2dafa9c137acff2a84916686f" title="Emitted when the GetSubscriber call returns successfully.">ready</a>(); 
<a name="l00076"></a>00076     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a659b0f0fcb7a740975fadc55c670bbf7" title="Emitted when the GetSubscriber call fails or provider not on D-Bus at all.">failed</a>(QString error); 
<a name="l00077"></a>00077     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a4a3fcd522bbb2cc67c5821bcf15ed3d4" title="Emitted when Subscribe call succeeds on D-Bus.">subscribeFinished</a>(QString key); 
<a name="l00078"></a>00078     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a803a4bf54f2017025bc314fc14702513" title="Emitted when Subscribe call fails on D-Bus.">subscribeFailed</a>(QString failedKey, QString error); 
<a name="l00079"></a>00079     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a5603631c4a9e7f6a4cbe05af6dfe5c48" title="Emitted when ValueChanged signal comes on D-Bus.">valueChanged</a>(QString key, QVariant value); 
<a name="l00080"></a>00080 <span class="preprocessor">#endif</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span>
<a name="l00082"></a>00082 <span class="keyword">private</span> slots:
<a name="l00083"></a>00083     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a87a7194ff406805a3b0d38f47d0a0aff">onNewValueChanged</a>(QList&lt;QVariant&gt; value,
<a name="l00084"></a>00084                            quint64 timestamp,
<a name="l00085"></a>00085                            QDBusMessage message);
<a name="l00086"></a>00086     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a119181d213c126458f065a0b10e7e281" title="Forwards value changes from the wire to the upper layer (Provider).">onDBusValuesChanged</a>(QMap&lt;QString, QVariant&gt; values);
<a name="l00087"></a>00087     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a9391a2ed305e25493a611c25ed9aa7a2" title="Starts using the fresh subscriber interface when it is returned by the manager in...">onDBusGetSubscriberFinished</a>(QDBusObjectPath objectPath);
<a name="l00088"></a>00088     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a192e933ca4f023f84de709e84fbe47e7">onDBusGetSubscriberFailed</a>(QDBusError err);
<a name="l00089"></a>00089     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a83385b7cf39ae293e6e06705f952f9a1" title="Signals the Provider that the subscribe is finished.">onDBusSubscribeFinished</a>(QList&lt;QString&gt; keys);
<a name="l00090"></a>00090     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#aca1f1f90efb47950385d5814dadc573d" title="Signals the Provider that the subscribe is failed.">onDBusSubscribeFailed</a>(QList&lt;QString&gt; keys, QString error);
<a name="l00091"></a>00091     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#aef61e0a51dad4988fe264474cb2bdd7d" title="Gets a new subscriber interface from manager when the provider appears.">onProviderAppeared</a>();
<a name="l00092"></a>00092     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0ebafac80dca92564323f78a1fbfa6b7" title="Delete our subscriber interface when the provider goes away.">onProviderDisappeared</a>();
<a name="l00093"></a>00093     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a325ac3f7f3a87587218ee90fb6dd36be">newSubscribe</a>(<span class="keyword">const</span> QString&amp; key);
<a name="l00094"></a>00094 
<a name="l00095"></a>00095 <span class="keyword">private</span>:
<a name="l00096"></a>00096     <span class="keyword">static</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a59577eace322abd960442ad4e86f381b" title="Converts a key name to a protocol level object path.">keyToPath</a>(QString key);
<a name="l00097"></a>00097     <span class="keyword">static</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a3bf2af611eaccdca68e577c01b2a7607" title="Inverse of keyToPath.">pathToKey</a>(QString key);
<a name="l00098"></a>00098 
<a name="l00099"></a>00099     <span class="keywordtype">void</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ad5959b9c2e4976ad24025492bfd9109c">reset</a>();
<a name="l00100"></a>00100 
<a name="l00101"></a>00101     QMap&lt;QString, QVariant&gt;&amp; <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a1f2999785a6f653a95a946bcc09d05ba">mergeNullsWithMap</a>(QMap&lt;QString, QVariant&gt; &amp;map, QStringList nulls) <span class="keyword">const</span>;
<a name="l00102"></a>00102 
<a name="l00103"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0e34a8c4b3dafd66d2a094cf2ee22424">00103</a>     <a class="code" href="class_context_subscriber_1_1_d_bus_name_listener.html" title="Listens for changes in a specific service name on a D-Bus bus, optionally gets the...">DBusNameListener</a> *<a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0e34a8c4b3dafd66d2a094cf2ee22424" title="Listens to provider&amp;#39;s (dis)appearance over DBus.">providerListener</a>; 
<a name="l00104"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ac5cf234581bce7834ff86d57b5bcb331">00104</a>     <a class="code" href="class_context_subscriber_1_1_subscriber_interface.html">SubscriberInterface</a> *<a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ac5cf234581bce7834ff86d57b5bcb331" title="The D-Bus interface for the Subscriber object.">subscriberInterface</a>; 
<a name="l00105"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#afde8f2ee5e10b6625f3b023d6ad3523b">00105</a>     QDBusAbstractInterface *<a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#afde8f2ee5e10b6625f3b023d6ad3523b" title="The D-Bus interface for the Manager object.">managerInterface</a>; 
<a name="l00106"></a>00106 
<a name="l00107"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0be51b23a1acd297bb9155d611d37270">00107</a>     QDBusConnection *<a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0be51b23a1acd297bb9155d611d37270" title="The connection to DBus.">connection</a>; 
<a name="l00108"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a80103689b09397c9a399987df806af1c">00108</a>     QString busName; 
<a name="l00109"></a>00109 
<a name="l00110"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#aae19463cfcd2a2925420e9befaa42783">00110</a>     <span class="keywordtype">bool</span> <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#aae19463cfcd2a2925420e9befaa42783" title="The provider on D-Bus speaks the new protocol only.">newProtocol</a>; 
<a name="l00111"></a>00111 
<a name="l00112"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a73f07ee2c97993ecefe0b0787cc33523">00112</a>     <span class="keyword">static</span> <span class="keyword">const</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a73f07ee2c97993ecefe0b0787cc33523" title="org.freedesktop.ContextKit.Manager">managerIName</a>; 
<a name="l00113"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ac65d96beebc2af0eda5b79462c531836">00113</a>     <span class="keyword">static</span> <span class="keyword">const</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ac65d96beebc2af0eda5b79462c531836" title="org.freedesktop.ContextKit.Subscriber">subscriberIName</a>; 
<a name="l00114"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ad8141ab741a7d60ba3d1e067f0bb290e">00114</a>     <span class="keyword">static</span> <span class="keyword">const</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ad8141ab741a7d60ba3d1e067f0bb290e" title="/org/freedesktop/ContextKit/Manager">managerPath</a>; 
<a name="l00115"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0ec50bd2ac114b96bb7a2b203aa1273a">00115</a>     <span class="keyword">static</span> <span class="keyword">const</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#a0ec50bd2ac114b96bb7a2b203aa1273a" title="org.maemo.contextkit.Property">propertyIName</a>; 
<a name="l00116"></a><a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ab46c98a850ad26f29b8256ace7317ea5">00116</a>     <span class="keyword">static</span> <span class="keyword">const</span> QString <a class="code" href="class_context_subscriber_1_1_context_kit_plugin.html#ab46c98a850ad26f29b8256ace7317ea5" title="/org/maemo/contextkit/">corePrefix</a>; 
<a name="l00117"></a>00117 };
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Mon Nov 9 15:31:10 2009 for libcontextsubscriber 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>