Exemplo n.º 1
0
qint32 HTestService::registerAction(
    const HActionArguments& /*inArgs*/, HActionArguments* /*outArgs*/)
{
    // Simple implementation of the Register service:
    // modifies an evented state variable, which causes events to be sent to
    // all registered listeners.

    bool ok = false;
    HServerStateVariable* sv = stateVariables().value("RegisteredClientCount");

    Q_ASSERT(sv);
    // fetch the state variable we want to modify

    quint32 count = sv->value().toUInt(&ok);
    Q_ASSERT(ok);
    // check its current value

    ok = sv->setValue(++count);
    Q_ASSERT(ok);
    // and increment it

    emit actionInvoked(
        "Register",
        QString("Register invoked %1 times.").arg(QString::number(count)));

    // This signal is sent so that the user interface can react to this
    // particular invocation somehow.

    return UpnpSuccess;
}
void HConnectionManagerService::setSinkProtocolInfo(const HProtocolInfos& arg)
{
    m_sinkProtocolInfo = arg;

    QString sinkProtocolInfos = strToCsvString(m_sinkProtocolInfo);
    HServerStateVariable* sv = stateVariables().value("SinkProtocolInfo");
    bool ok = sv->setValue(sinkProtocolInfos);
    Q_ASSERT(ok);
    Q_UNUSED(ok)
}