ButeoSynchronizationFramework
Buteo framework API usage

Table of Contents

Available Buteo APIs

Plugin API

Refer to Writing plugins for Synchronization Framework

Dbus API

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 com.meego.msyncd and at the path /synchronizer. A dbus method can be invoked from cmdline as

dbus-send --session --type=method_call --print-reply --dest=com.meego.msyncd /synchronizer com.meego.msyncd.startSync string:'abc.com'

Following are the signals available in msyncd

Following are the dbus methods of msyncd

time is the time starting which the sync schedule has to be enabled
interval is in minutes is the frequency of sync
days is the days on which the sync has to run
rush 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

libbuteosyncfw API

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

Using Logging API

The logging API has four main calls

  1. FUNCTION_CALL_TRACE can be used to trace the entry and exit of functions
  2. LOG_DEBUG(msg) - outputs a debug level message
  3. LOG_WARNING(msg) - outputs a warning level message
  4. LOG_CRITICAL(msg) - outputs a critical level message
  5. LOG_FATAL(msg) - outputs a fatal level message and aborts the process

Logging can be enabled by using "DEFINES += BUTEO_ENABLE_DEBUG" in the .pro file. By default logging is disabled

Profile Management API

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:

Update a given profile

Following is a code snippet to update a given profile

using namespace Buteo;
...
...
SyncProfile *sp = pm.syncProfile(profileName);
if (sp) {
if (pm.updateProfile(sp).isEmpty()) {
LOG_DEBUG("Update failed for profile " << profileName);
} else
LOG_DEBUG("Profile successfully updated");
}
...
...

Handle sync schedule

ProfileManager can be used to set the schedule of a sync session

using namespace Buteo;
...
...
SyncProfile *sp = pm.syncProfile(profileName);
if (sp) {
SyncSchedule sched = sp->syncSchedule();
if (!sched.isEmpty()) {
sched.setInterval(45);
sched.setRushEnabled(false);
DaySet days;
days << Qt::Tuesday << Qt::Thursday << Qt::Sunday;
sched.setDays(days);
sched.setScheduleEnabled(true);
sp->setSyncSchedule(sched);
} else {
SyncSchedule newSched;
newSched.setInterval(15);
newSched.setTime(new QDateTime());
newSched.setScheduleEnabled(true);
sp->setSyncSchedule(newSched);
}
pm.updateProfile(sp);
}