Пример #1
0
/*!
    Unregisters the DBus object
*/
void ObjectEndPoint::unregisterObjectDBus(const QRemoteServiceRegister::Entry& entry, const QUuid& id)
{
    uint hash = qHash(id.toString());
    QString objPath = QLatin1Char('/') + entry.interfaceName() + QLatin1Char('/') + entry.version() +
        QLatin1Char('/') + QString::number(hash);
    objPath.replace(QLatin1Char('.'), QLatin1Char('/'));
    QDBusConnection::sessionBus().unregisterObject(objPath, QDBusConnection::UnregisterTree);
}
/*!
    Unregisters the DBus object
*/
void ObjectEndPoint::unregisterObjectDBus(const QRemoteServiceRegister::Entry& entry, const QUuid& id)
{
    uint hash = qHash(id.toString());
    QString objPath = "/" + entry.interfaceName() + "/" + entry.version() +
        "/" + QString::number(hash);
    objPath.replace(QString("."), QString("/"));
    connection->unregisterObject(objPath, QDBusConnection::UnregisterTree);
}
Пример #3
0
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;
}
Пример #4
0
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();
}