Writing plugins for Synchronization Framework

# Kinds of plugins that Buteo supports

1. Client plugins Plugins which act as clients to services running outside the machine (device/PC/ tablet) domain. These plugins are loaded whenever there is a need for starting sync and are unloaded once done. More than one client plugin can be loaded at any point of time, provided that they deal with different kinds of storages (contacts, calendar, notes etc.)
2. Server plugins Server plugins are alive forever and act as server for clients that would like to connect to the server. A typical example of a server plugin is a SyncML server plugin that acts as a server for an external client
3. Storage plugins A storage plugin enables a generic API for accessing the data from the device databases, like Contacts, File system, Calendar etc. These plugins can then be used across multiple protocols like Dropbox, Google services, Caldav etc.

# Creating a plugin

See the DummyClient and DummyServer classes in unittests/dummyplugins for plugin examples.

# Device sync with libsyncml

libsyncml is a desktop based sync engine that support sync using SyncML protocol URL: https://libsyncml.opensync.org/ It comes with a cmdline tool syncml-ds-tool to perform sync. Following instructions help in performing the sync over bluetooth and USB

Buteo works with libsyncml over USB as well as bluetooth. These instructions are w.r.t the sailfish OS, but as and when more Linux based OS's are supported, these instructions will be extended

## Sync over USB

1. Connect the Sailfish based device to your PC over USB.
2. Select the MTP mode when asked for a USB mode selection
3. From the PC (Ubuntu or a version supporting libsyncml), install libsyncml-utils (in debian, 'sudo apt-get install libsyncml-utils)
4. Run the following sync command for USB:
   sudo syncml-ds-tool -u 1 --identifier "PC Suite" --sync text/x-vcard Contacts
   Note: The command has to run as 'sudo', else you will have to add the USB device into your udev list
5. The above command should fetch all the contacts in the Sailfish phone to your PC and dump the output to the screen. For more options of syncml-ds-tool, look at its help or the libsyncml website

## Sync over bluetooth

1. Pair your bluetooth enabled PC/laptop with Sailfish based device. Also enable the bluetooth options of "connect automatically" and "trust"
2. Find out the bluetooth address of the sailfish based device by running the hcitool.
   hcitool scan
3. Run the following sync command:
   syncml-ds-tool -b <bluetooth address> 26 --identifier "PC Suite" --sync text/x-vcard Contacts
   26 is the channel number of the SyncML bluetooth profile Replace <bluetooth address> with the bluetooth address of your sailfish device (something like B4:EE:D4:F6:19:E7)
4. The above command should fetch all the contacts in the Sailfish device to your PC and dump the output to the screen.

## Synchronization of Contacts between Sailfish and N9

1. In N9, go to Settings -> Sync & Backup -> Sync -> Add new sync target (+ below)
2. Choose the Sailfish device in the list of bluetooth devices
3. Start sync