int main(int argc, char** argv) { QCoreApplication app(argc, argv); QRemoteServiceRegister *serviceRegister = new QRemoteServiceRegister(); QRemoteServiceRegister::Entry entry; entry = serviceRegister->createEntry<QHtmlService>(QString::fromLatin1(serviceName), QString::fromLatin1(interfaceName), QString::fromLatin1(version)); entry.setInstantiationType(QRemoteServiceRegister::GlobalInstance); serviceRegister->publishEntries(QString::fromLatin1(ident)); // this will start the server and keep it running QObject *htmlService = QServiceManager().loadInterface(QString::fromLatin1(interfaceName)); if (htmlService == NULL) exit(0); const int returnCode = app.exec(); delete htmlService; delete serviceRegister; return returnCode; }
QTM_USE_NAMESPACE /* * This is a test service which provides an interface for testing * the OOP service mechanism provided by Qt Mobility Service Framework. * This main function of sfwtest service publishes * its entires/services. */ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QRemoteServiceRegister *serviceRegisterSfwTest = new QRemoteServiceRegister(); QRemoteServiceRegister::Entry serviceUriHandler = serviceRegisterSfwTest->createEntry< SfwTestService> ("SfwTestService", "com.nokia.qt.SfwTest", "1.0"); serviceUriHandler.setInstantiationType(QRemoteServiceRegister::GlobalInstance); serviceRegisterSfwTest->publishEntries("sfwtest"); serviceRegisterSfwTest->setQuitOnLastInstanceClosed(false); return a.exec(); }