/usr/share/doc/buteo-syncfw-doc/api-usage.html is in libbuteosyncfw5-doc 0.7.21+16.04.20151216.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>ButeoSynchronizationFramework: Buteo framework API usage</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">ButeoSynchronizationFramework
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Buteo framework API usage </div> </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#buteo-apis">Available Buteo APIs</a></li>
<li class="level1"><a href="#plugin-api">Plugin API</a></li>
<li class="level1"><a href="#dbus-api">Dbus API</a></li>
<li class="level1"><a href="#libbuteosyncfw-api">libbuteosyncfw API</a><ul><li class="level2"><a href="#logging">Using Logging API</a></li>
<li class="level2"><a href="#profile-api">Profile Management API</a><ul><li class="level3"><a href="#update-profile">Update a given profile</a></li>
<li class="level3"><a href="#sync-schedule">Handle sync schedule</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="textblock"><h1><a class="anchor" id="buteo-apis"></a>
Available Buteo APIs</h1>
<ul>
<li>Plugin API</li>
<li>msycnd Dbus API</li>
<li>libbuteosyncfw API</li>
</ul>
<h1><a class="anchor" id="plugin-api"></a>
Plugin API</h1>
<p>Refer to <a class="el" href="plugin-guide.html">Writing plugins for Synchronization Framework</a></p>
<h1><a class="anchor" id="dbus-api"></a>
Dbus API</h1>
<p>The dbus API can be used by application to get the live data from msyncd. Both signals as well as methods are provided. msyncd listens on the bus <b>com.meego.msyncd</b> and at the path <b>/synchronizer</b>. A dbus method can be invoked from cmdline as </p><div class="fragment"><div class="line">dbus-send --session --type=method_call --print-reply --dest=<a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1meego.html">meego</a>.msyncd /synchronizer <a class="code" href="namespacecom.html">com</a>.<a class="code" href="namespacecom_1_1meego.html">meego</a>.msyncd.startSync <span class="keywordtype">string</span>:<span class="stringliteral">'abc.com'</span></div>
</div><!-- fragment --><p>Following are the signals available in msyncd</p>
<ul>
<li>Signal to give status of an ongoing sync session <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"syncStatus"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileName"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aStatus"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aMessage"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aMoreDetails"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate the transfer progress (of the number of items transfered and the kind of items) <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"transferProgress"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileName"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aTransferDatabase"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aTransferType"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aMimeType"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aCommittedItems"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate if a profile has changed <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"signalProfileChanged"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileName"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aChangeType"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileAsXml"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate a backup operation in progress. If a backup service is ongoing then msyncd does not start sync until the backup is complete. This signal can be use to keep track of an ongoing backup operation <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"backupInProgress"</span>></div>
<div class="line"></signal></div>
</div><!-- fragment --> -Signal to indicate that a backup operation is done <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"backupDone"</span>></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate that restore operation is in progress <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"restoreInProgress"</span>></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate that the restoration process is completed <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"restoreDone"</span>></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate that the results of the just finished sync operation are available <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"resultsAvailable"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileName"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aResultsAsXml"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
<li>Signal to indicate that the status of the sync operation has changed. The status could be that the state has changed from in progress to failed with also the failed reason <div class="fragment"><div class="line"><signal name=<span class="stringliteral">"statusChanged"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aAccountId"</span> type=<span class="stringliteral">"u"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aNewStatus"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aFailedReason"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aPrevSyncTime"</span> type=<span class="stringliteral">"x"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aNextSyncTime"</span> type=<span class="stringliteral">"x"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></signal></div>
</div><!-- fragment --></li>
</ul>
<p>Following are the dbus methods of msyncd</p><ul>
<li>Method to start sync given a profile name. The profile name is the name of the Sync profile XML file. The startSync operation is valid only for client plugins <div class="fragment"><div class="line"><method name=<span class="stringliteral">"startSync"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to cancel an ongoing sync. The profile id has to be specific to cancel an ongoing sync operation <div class="fragment"><div class="line"><method name=<span class="stringliteral">"abortSync"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <annotation name=<span class="stringliteral">"org.freedesktop.DBus.Method.NoReply"</span> value=<span class="stringliteral">"true"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to remove a profile. A profile can be removed if it is not longer required, like for example, removing a sync account <div class="fragment"><div class="line"><method name=<span class="stringliteral">"removeProfile"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to update a given sync profile. The profile to be updated should be in the form of an XML and the XML object should be sent so that it can be updated. If the updation fails, then false is returned, else true <div class="fragment"><div class="line"><method name=<span class="stringliteral">"updateProfile"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileAsXml"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to request storages to be loaded. This is useful if a plugin makes use of existing storage plugins (contacts, calendar, notes) to perform the sync operation. If a plugin has its own way to manage the interaction with plugins, then this method need to be used <div class="fragment"><div class="line"><method name=<span class="stringliteral">"requestStorages"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aStorageNames"</span> type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to release a storage that has already been requested using "requestStorage" method <div class="fragment"><div class="line"><method name=<span class="stringliteral">"releaseStorages"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aStorageNames"</span> type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <annotation name=<span class="stringliteral">"org.freedesktop.DBus.Method.NoReply"</span> value=<span class="stringliteral">"true"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to check if connectivity for a specific type is avialable. Currently supported type: USB=0, Bluetooth=1 and Network=2 <div class="fragment"><div class="line"><method name=<span class="stringliteral">"isConnectivityAvailable"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"connectivityType"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to get a list of all running sync sessions <div class="fragment"><div class="line"><method name=<span class="stringliteral">"runningSyncs"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to get the current state of backup/restore. True=backup/restore ongoing, false otherwise <div class="fragment"><div class="line"><method name=<span class="stringliteral">"getBackUpRestoreState"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to set the sync schedule <div class="fragment"><div class="line"><method name=<span class="stringliteral">"setSyncSchedule"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"b"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aScheduleAsXml"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --> The format of the sync schedule is: <div class="fragment"><div class="line"><span class="stringliteral">"<schedule time="</span>12:34:56<span class="stringliteral">" interval="</span>30<span class="stringliteral">" days="</span>1,2,3,4,5,6<span class="stringliteral">">"</span></div>
<div class="line"> <span class="stringliteral">"<rush enabled="</span><span class="keyword">true</span><span class="stringliteral">" interval="</span>15<span class="stringliteral">""</span></div>
<div class="line"> <span class="stringliteral">"begin="</span>08:00:00<span class="stringliteral">" end="</span>16:00:00<span class="stringliteral">" days="</span>1,4,5<span class="stringliteral">"/>"</span></div>
<div class="line"><span class="stringliteral">"</schedule>"</span></div>
</div><!-- fragment --></li>
</ul>
<p><em><b>time</b> </em>is the time starting which the sync schedule has to be enabled <br />
<em><b>interval</b> </em>is in minutes is the frequency of sync <br />
<em><b>days</b> </em>is the days on which the sync has to run <br />
<em><b>rush</b> </em>is the sync setting for peak hours of the day. The idea is to run sync at a higher frequency in rush days than in the normal days. The rush begin time and end time and the rush days can be specified <br />
</p><ul>
<li>Method to save the sync results. This method can be used to persist the sync results given a profile id /code <method name="saveSyncResults"> <arg type="b" direction="out"> <arg name="aProfileId" type="s" direction="in"> <arg name="aSyncResults" type="s" direction="in"> </method> /endcode</li>
<li>Method to get the sync results of the last finished sync session. The sync results are returned as an XML string, which then has to be parsed to retrieve the results. One can use the SyncResults class of libbuteosycnfw to handle any of the XML data received <div class="fragment"><div class="line"><method name=<span class="stringliteral">"getLastSyncResult"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>A profile can be made a hidden so as not be be displayed in a UI. This method fetches the profiles that have been marked as visible <div class="fragment"><div class="line"><method name=<span class="stringliteral">"allVisibleSyncProfiles"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to fetch a sync profile object given a profile id. The profile is returned in XML and the SyncProfile class of libbuteosyncfw can be used to parse the sync profile <div class="fragment"><div class="line"><method name=<span class="stringliteral">"syncProfile"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aProfileId"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to fetch a specific sync profile based on a key. The key can be anything like sync direction, the URL of the target service etc. If there are multiple profiles matching the key, then all of them are returned <div class="fragment"><div class="line"><method name=<span class="stringliteral">"syncProfilesByKey"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aKey"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aValue"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to fetch a sync profile given a type of sync. The type can be client, server, storage <div class="fragment"><div class="line"><method name=<span class="stringliteral">"syncProfilesByType"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"as"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aType"</span> type=<span class="stringliteral">"s"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to start a sync session with an account Id. This is useful if Buteo is integrated with AccountS&SSO. The account id is passed to start the sync <div class="fragment"><div class="line"><method name=<span class="stringliteral">"start"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aAccountId"</span> type=<span class="stringliteral">"u"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <annotation name=<span class="stringliteral">"org.freedesktop.DBus.Method.NoReply"</span> value=<span class="stringliteral">"true"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to stop a sync given an account id <div class="fragment"><div class="line"><method name=<span class="stringliteral">"stop"</span>></div>
<div class="line"> <arg name=<span class="stringliteral">"aAccountId"</span> type=<span class="stringliteral">"u"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <annotation name=<span class="stringliteral">"org.freedesktop.DBus.Method.NoReply"</span> value=<span class="stringliteral">"true"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to return the list of account id of all the ongoing sync sessions. This method is useful when Buteo is integrated with Accounts&SSO <div class="fragment"><div class="line"><method name=<span class="stringliteral">"syncingAccounts"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"au"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <annotation name=<span class="stringliteral">"com.trolltech.QtDBus.QtTypeName.Out0"</span> value=<span class="stringliteral">"QList&lt;uint&gt;"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
<li>Method to return the status of a sync given an account id. This method is useful if Buteo is integrated with Accounts&SSO <div class="fragment"><div class="line"><method name=<span class="stringliteral">"status"</span>></div>
<div class="line"> <arg type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aAccountId"</span> type=<span class="stringliteral">"u"</span> direction=<span class="stringliteral">"in"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aFailedReason"</span> type=<span class="stringliteral">"i"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aPrevSyncTime"</span> type=<span class="stringliteral">"x"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"> <arg name=<span class="stringliteral">"aNextSyncTime"</span> type=<span class="stringliteral">"x"</span> direction=<span class="stringliteral">"out"</span>/></div>
<div class="line"></method></div>
</div><!-- fragment --></li>
</ul>
<h1><a class="anchor" id="libbuteosyncfw-api"></a>
libbuteosyncfw API</h1>
<p>If one needs to use the API of the syncfw, then you can do so by using the library libbuteosyncfw. The main use of this library is to use the plugin API and the profile API. The profile API provides an easy way to manage the sync profiles. Following is the main API available in this library</p><ul>
<li>Logging</li>
<li>Profile management</li>
<li>Plugin management</li>
<li>A dbus library interface for client apps, like GUIs</li>
</ul>
<h2><a class="anchor" id="logging"></a>
Using Logging API</h2>
<p>The logging API has four main calls</p><ol type="1">
<li>FUNCTION_CALL_TRACE can be used to trace the entry and exit of functions</li>
<li>LOG_DEBUG(msg) - outputs a debug level message</li>
<li>LOG_WARNING(msg) - outputs a warning level message</li>
<li>LOG_CRITICAL(msg) - outputs a critical level message</li>
<li>LOG_FATAL(msg) - outputs a fatal level message and aborts the process</li>
</ol>
<p>Logging can be enabled by using "DEFINES += BUTEO_ENABLE_DEBUG" in the .pro file. By default logging is disabled</p>
<h2><a class="anchor" id="profile-api"></a>
Profile Management API</h2>
<p>Profile management API can be used to manage the profile information. For example, it can be used to retrive profiles, create profiles from a template, update profiles and save them back, fetch the results of the last sync, fetch the logs of the sync results etc. The main class that handle profile management are:</p><ul>
<li><a class="el" href="classButeo_1_1ProfileManager.html" title="ProfileManager is responsible for storing and retrieving the profiles. ">Buteo::ProfileManager</a>,</li>
<li><a class="el" href="classButeo_1_1Profile.html" title="This class represents a single profile, a collection of settings or data releated to some entity...">Buteo::Profile</a>,</li>
<li><a class="el" href="classButeo_1_1SyncProfile.html" title="A top level synchronization profile. ">Buteo::SyncProfile</a>,</li>
<li><a class="el" href="classButeo_1_1SyncSchedule.html" title="Class for handling sync schedule settings. ">Buteo::SyncSchedule</a>,</li>
<li><a class="el" href="classButeo_1_1SyncResults.html" title="Contains information about a completed synchronization session. ">Buteo::SyncResults</a>,</li>
<li><a class="el" href="classButeo_1_1StorageProfile.html" title="Storage Profile Class. ">Buteo::StorageProfile</a>,</li>
<li><a class="el" href="classButeo_1_1SyncLog.html" title="History of completed synchronization sessions and their results. ">Buteo::SyncLog</a></li>
</ul>
<h3><a class="anchor" id="update-profile"></a>
Update a given profile</h3>
<p>Following is a code snippet to update a given profile </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespaceButeo.html">Buteo</a>;</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line"><a class="code" href="classButeo_1_1ProfileManager.html">ProfileManager</a> pm;</div>
<div class="line"><a class="code" href="classButeo_1_1SyncProfile.html">SyncProfile</a> *sp = pm.<a class="code" href="classButeo_1_1ProfileManager.html#a69831ac859de6c3f6d3bbb53596fcf5c">syncProfile</a>(profileName);</div>
<div class="line"><span class="keywordflow">if</span> (sp) {</div>
<div class="line"> sp-><a class="code" href="classButeo_1_1SyncProfile.html#aed0e0f1cf65641a0308b55364d9aeb45">setSyncDirection</a>(<a class="code" href="classButeo_1_1SyncProfile.html#a7a33abfbaffe441984d26b25044e5e9ba760a45e089a0e8c3a19eda77e26e09f8">SyncProfile::SYNC_DIRECTION_FROM_REMOTE</a>);</div>
<div class="line"> <span class="keywordflow">if</span> (pm.<a class="code" href="classButeo_1_1ProfileManager.html#a51a5d40107547a35c5de014bac866914">updateProfile</a>(sp).isEmpty()) {</div>
<div class="line"> LOG_DEBUG(<span class="stringliteral">"Update failed for profile "</span> << profileName);</div>
<div class="line"> } <span class="keywordflow">else</span></div>
<div class="line"> LOG_DEBUG(<span class="stringliteral">"Profile successfully updated"</span>);</div>
<div class="line">}</div>
<div class="line">...</div>
<div class="line">...</div>
</div><!-- fragment --><h3><a class="anchor" id="sync-schedule"></a>
Handle sync schedule</h3>
<p>ProfileManager can be used to set the schedule of a sync session </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespaceButeo.html">Buteo</a>;</div>
<div class="line">...</div>
<div class="line">...</div>
<div class="line"><a class="code" href="classButeo_1_1ProfileManager.html">ProfileManager</a> pm;</div>
<div class="line"><a class="code" href="classButeo_1_1SyncProfile.html">SyncProfile</a> *sp = pm.<a class="code" href="classButeo_1_1ProfileManager.html#a69831ac859de6c3f6d3bbb53596fcf5c">syncProfile</a>(profileName);</div>
<div class="line"></div>
<div class="line"><span class="keywordflow">if</span> (sp) {</div>
<div class="line"> <a class="code" href="classButeo_1_1SyncSchedule.html">SyncSchedule</a> sched = sp-><a class="code" href="classButeo_1_1SyncProfile.html#a0eb62316e39f05265058bae11a5e99a8">syncSchedule</a>();</div>
<div class="line"> <span class="keywordflow">if</span> (!sched.isEmpty()) {</div>
<div class="line"> sched.<a class="code" href="classButeo_1_1SyncSchedule.html#a6f10ad763cb9b342fdfb1283d7207772">setInterval</a>(45);</div>
<div class="line"> sched.<a class="code" href="classButeo_1_1SyncSchedule.html#af4b6ec6481cdd8c2a8bf73281a5bec6f">setRushEnabled</a>(<span class="keyword">false</span>);</div>
<div class="line"> DaySet days;</div>
<div class="line"> days << Qt::Tuesday << Qt::Thursday << Qt::Sunday;</div>
<div class="line"> sched.<a class="code" href="classButeo_1_1SyncSchedule.html#a93d4258487466f3a351903788209de78">setDays</a>(days);</div>
<div class="line"> sched.<a class="code" href="classButeo_1_1SyncSchedule.html#a6590f927ccfb74640cf37da8356da35e">setScheduleEnabled</a>(<span class="keyword">true</span>); </div>
<div class="line"> sp-><a class="code" href="classButeo_1_1SyncProfile.html#ad84f43031146427df47306302bdf07a2">setSyncSchedule</a>(sched);</div>
<div class="line"> } <span class="keywordflow">else</span> {</div>
<div class="line"> <a class="code" href="classButeo_1_1SyncSchedule.html">SyncSchedule</a> newSched;</div>
<div class="line"> newSched.<a class="code" href="classButeo_1_1SyncSchedule.html#a6f10ad763cb9b342fdfb1283d7207772">setInterval</a>(15);</div>
<div class="line"> newSched.<a class="code" href="classButeo_1_1SyncSchedule.html#a5adea2d4c27b93f26353503b599e12e8">setTime</a>(<span class="keyword">new</span> QDateTime());</div>
<div class="line"> newSched.<a class="code" href="classButeo_1_1SyncSchedule.html#a6590f927ccfb74640cf37da8356da35e">setScheduleEnabled</a>(<span class="keyword">true</span>);</div>
<div class="line"> sp-><a class="code" href="classButeo_1_1SyncProfile.html#ad84f43031146427df47306302bdf07a2">setSyncSchedule</a>(newSched);</div>
<div class="line"> }</div>
<div class="line"> pm.<a class="code" href="classButeo_1_1ProfileManager.html#a51a5d40107547a35c5de014bac866914">updateProfile</a>(sp);</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Dec 16 2015 19:19:26 for ButeoSynchronizationFramework by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|