Files:
This example shows how to write a service plugin for the Service Framework.
The service can be registered by using the function addService(), this takes a path to the XML file that describes the service, bluetoothtransferservice.xml.
To implement a plugin it is necessary to create a new plugin class derived from QObject and QServicePluginInterface. The function QServicePluginInterface::createInstance() is implemented to return the appropriate instantiated object based on the interface name passed into the function. Since there is only one interface name for this example there is no test involved, so we can simply create the object implementing the service and return its pointer.
return new BluetoothTransfer(this);
The implementation of the service BluetoothTransfer is simply a test function for this example. The BluetoothTransfer class is very simple, with only an empty constructor and the sendFile() function
void BluetoothTransfer::sendFile(const QString &path) { qDebug() << "BluetoothTransfer::sendFile()" << path; }