Пример #1
0
bool HAvTransportAdapterPrivate::getPositionInfo(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    HPositionInfo info;
    if (op.returnValue() == UpnpSuccess)
    {
        const HActionArguments& outArgs = op.outputArguments();

        quint32 track = outArgs.value("Track").toUInt();
        HDuration trackDuration = outArgs.value("TrackDuration").toString();
        QString trackMd = outArgs.value("TrackMetaData").toString();
        QUrl trackUri = outArgs.value("TrackURI").toString();
        HDuration relTime = outArgs.value("RelTime").toString();
        HDuration absTime = outArgs.value("AbsTime").toString();
        qint32 relCountPos = outArgs.value("RelCount").toInt();
        quint32 absCountPos = outArgs.value("AbsCount").toUInt();

        info = HPositionInfo(
                   track, trackDuration, trackMd, trackUri, relTime, absTime,
                   relCountPos, absCountPos);
    }
    emit q->getPositionInfoCompleted(q, takeOp(op, info));

    return false;
}
Пример #2
0
bool HAvTransportAdapterPrivate::getMediaInfo_ext(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    HMediaInfo mediaInfo;
    if (op.returnValue() == UpnpSuccess)
    {
        const HActionArguments& outArgs = op.outputArguments();

        QString currentType = outArgs.value("CurrentType").toString();
        quint32 nrTracks = outArgs.value("NrTracks").toUInt();
        HDuration duration = outArgs.value("MediaDuration").toString();
        QUrl curUri = outArgs.value("CurrentURI").toUrl();
        QString curUriMetadata = outArgs.value("CurrentURIMetaData").toString();
        QUrl nextUri = outArgs.value("NextURI").toUrl();
        QString nextUriMetadata = outArgs.value("NextURIMetaData").toString();
        HStorageMedium playMedium = outArgs.value("PlayMedium").toString();
        HStorageMedium recMedium  = outArgs.value("RecordMedium").toString();
        HRecordMediumWriteStatus ws = outArgs.value("WriteStatus").toString();

        mediaInfo = HMediaInfo(
                        nrTracks, duration, curUri, curUriMetadata, nextUri, nextUriMetadata,
                        playMedium, recMedium, ws,
                        HMediaInfo::mediaCategoryFromString(currentType));
    }
    emit q->getMediaInfo_extCompleted(q, takeOp(op, mediaInfo));

    return false;
}
Пример #3
0
void ObjectCache::attemptResolution( const HClientActionOp &op )
{
    HActionArguments output = op.outputArguments();
    // NOTE disconnection is important
    bool ok = disconnect( m_cpt, SIGNAL( browseResult( const Herqq::Upnp::HClientActionOp & ) ),
                          this, SLOT( attemptResolution( const Herqq::Upnp::HClientActionOp & ) ) );
    Q_ASSERT( ok );
    Q_UNUSED( ok );
    if( !output[QLatin1String("Result")].isValid() ) {
        emit m_cpt->error( KIO::ERR_SLAVE_DEFINED, "Resolution error" );
        return;
    }

    DIDL::Parser parser;
    connect( &parser, SIGNAL(itemParsed(DIDL::Item *)),
                       this, SLOT(slotResolveId(DIDL::Item *)) );
    connect( &parser, SIGNAL(containerParsed(DIDL::Container *)),
             this, SLOT(slotResolveId(DIDL::Container *)) );

    parser.parse( output[QLatin1String("Result")].value().toString() );

    // we block because devices ( atleast MediaTomb )
    // seem to block continous TCP connections after some time
    // this interval might need modification
    block(500);

    // TODO have some kind of slot to stop the parser as 
    // soon as we find our guy, so that the rest of the
    // document isn't parsed.

    // if we didn't find the ID, no point in continuing
    if( !m_resolve.object ) {
        kDebug() << "NULL RESOLUTION";
        emit pathResolved( 0 );
        return;
    }
    else {
        QString pathToInsert = ( m_resolve.segment + QDir::separator() + m_resolve.object->title() );
        m_reverseCache.insert( pathToInsert, m_resolve.object );
        m_idToPathCache.insert( m_resolve.object->id(), new QString( pathToInsert ) );
        // TODO: if we already have the id, should we just update the
        // ContainerUpdateIDs
// TODO no more QPairs
        m_resolve.pathIndex = SEP_POS( m_resolve.fullPath, pathToInsert.length() );
        // ignore trailing slashes
        if( m_resolve.pathIndex == m_resolve.fullPath.length()-1 ) {
            m_resolve.pathIndex = -1;
        }
    }

    // if we are done, emit the relevant Object
    // otherwise recurse with a new (m_)resolve :)
    if( m_resolve.pathIndex == -1 )
        emit pathResolved( m_resolve.object );
    else
        resolvePathToObjectInternal();

}
Пример #4
0
bool HAvTransportAdapterPrivate::getCurrentTransportActions(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    QSet<HTransportAction> actions;
    if (op.returnValue() == UpnpSuccess)
    {
        QStringList slist = op.outputArguments().value("Actions").toString().split(",");

        foreach(const QString& action, slist)
        {
            HTransportAction ta(action);
            if (ta.isValid())
            {
                actions.insert(ta);
            }
        }
bool HRenderingControlAdapterPrivate::getLoudness(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    bool loudnessOn = op.outputArguments().value("CurrentLoudness").toBool();
    emit q->getLoudnessCompleted(q, takeOp(op, loudnessOn));

    return false;
}
bool HRenderingControlAdapterPrivate::getVolumeDB(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    qint16 currentVolumeDb = op.outputArguments().value("CurrentVolume").toInt();
    emit q->getVolumeDBCompleted(q, takeOp(op, currentVolumeDb));

    return false;
}
bool HRenderingControlAdapterPrivate::getMute(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    bool currentlyMuted = op.outputArguments().value("CurrentMute").toBool();
    emit q->getMuteCompleted(q, takeOp(op, currentlyMuted));

    return false;
}
Пример #8
0
bool HAvTransportAdapterPrivate::getTransportSettings(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    HTransportSettings settings;
    if (op.returnValue() == UpnpSuccess)
    {
        const HActionArguments& outArgs = op.outputArguments();

        HPlayMode pm = outArgs.value("PlayMode").toString();
        QString rqMode = outArgs.value("RecQualityMode").toString();

        settings = HTransportSettings(pm, rqMode);
    }
    emit q->getTransportSettingsCompleted(q, takeOp(op, settings));

    return false;
}
Пример #9
0
bool HAvTransportAdapterPrivate::getTransportInfo(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    HTransportInfo info;
    if (op.returnValue() == UpnpSuccess)
    {
        const HActionArguments& outArgs = op.outputArguments();

        QString state = outArgs.value("CurrentTransportState").toString();
        QString status = outArgs.value("CurrentTransportStatus").toString();
        QString speed = outArgs.value("CurrentSpeed").toString();

        info = HTransportInfo(state, status, speed);
    }
    emit q->getTransportInfoCompleted(q, takeOp(op, info));

    return false;
}
bool HRenderingControlAdapterPrivate::setStateVariables(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    QStringList stateVariableList =
        op.outputArguments().value("StateVariableList").toString().split(",");

    emit q->setStateVariablesCompleted(q, takeOp(op, stateVariableList));

    return false;
}
bool HRenderingControlAdapterPrivate::getBlueVideoGain(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    quint16 currentBlueVideoGain =
        op.outputArguments().value("CurrentBlueVideoGain").toUInt();

    emit q->getBlueVideoGainCompleted(q, takeOp(op, currentBlueVideoGain));

    return false;
}
bool HRenderingControlAdapterPrivate::getColorTemperature(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    quint16 currentColorTemperature =
        op.outputArguments().value("CurrentColorTemperature").toUInt();

    emit q->getColorTemperatureCompleted(q, takeOp(op, currentColorTemperature));

    return false;
}
bool HRenderingControlAdapterPrivate::getStateVariables(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    QString stateVariableValuePairs =
        op.outputArguments().value("StateVariableValuePairs").toString();

    emit q->getStateVariablesCompleted(q, takeOp(op, stateVariableValuePairs));

    return false;
}
bool HRenderingControlAdapterPrivate::getSharpness(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    quint16 currentSharpness =
        op.outputArguments().value("CurrentSharpness").toUInt();

    emit q->getSharpnessCompleted(q, takeOp(op, currentSharpness));

    return false;
}
Пример #15
0
bool HAvTransportAdapterPrivate::getDeviceCapabilities(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HAvTransportAdapter);

    HDeviceCapabilities capabilities;
    if (op.returnValue() == UpnpSuccess)
    {
        const HActionArguments& outArgs = op.outputArguments();

        QStringList pmedia = outArgs.value("PlayMedia").toString().split(",");
        QStringList rmedia = outArgs.value("RecMedia").toString().split(",");
        QStringList rqMode = outArgs.value("RecQualityModes").toString().split(",");

        capabilities =
            HDeviceCapabilities(pmedia.toSet(), rmedia.toSet(), rqMode.toSet());
    }
    emit q->getDeviceCapabilitiesCompleted(q, takeOp(op, capabilities));

    return false;
}
bool HRenderingControlAdapterPrivate::getGreenVideoBlackLevel(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    quint16 currentGreenVideoBlackLevel =
        op.outputArguments().value("CurrentGreenVideoBlackLevel").toUInt();

    emit q->getGreenVideoBlackLevelCompleted(
        q, takeOp(op, currentGreenVideoBlackLevel));

    return false;
}
bool HRenderingControlAdapterPrivate::getVerticalKeystone(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    quint16 currentVerticalKeyStone =
        op.outputArguments().value("CurrentVerticalKeystone").toUInt();

    emit q->getVerticalKeystoneCompleted(
        q, takeOp(op, currentVerticalKeyStone));

    return false;
}
bool HRenderingControlAdapterPrivate::getVolumeDBRange(
    HClientAction*, const HClientActionOp& op)
{
    H_Q(HRenderingControlAdapter);

    qint32 minValue = op.outputArguments().value("MinValue").toInt();
    qint32 maxValue = op.outputArguments().value("MaxValue").toInt();

    HVolumeDbRangeResult result(minValue, maxValue);

    emit q->getVolumeDBRangeCompleted(q, takeOp(op, result));

    return false;
}
Пример #19
0
void ObjectCache::attemptIdToPathResolution( const HClientActionOp &op )
{
    HActionArguments output = op.outputArguments();
    // NOTE disconnection is important
    bool ok = disconnect( m_cpt, SIGNAL( browseResult( const Herqq::Upnp::HClientActionOp & ) ),
                          this, SLOT( attemptIdToPathResolution( const Herqq::Upnp::HClientActionOp & ) ) );
    Q_ASSERT( ok );
    Q_UNUSED( ok );
    if( !output["Result"].isValid() ) {
        emit m_cpt->error( KIO::ERR_SLAVE_DEFINED, "ID to Path Resolution error" );
        return;
    }
    kDebug() << "In attempt for" << m_idResolve.currentId << "got"<< output["Result"].value().toString();

    DIDL::Parser parser;
    connect( &parser, SIGNAL(itemParsed(DIDL::Item *)),
                       this, SLOT(slotBuildPathForId(DIDL::Item *)) );
    connect( &parser, SIGNAL(containerParsed(DIDL::Container *)),
             this, SLOT(slotBuildPathForId(DIDL::Container *)) );

    parser.parse( output[QLatin1String("Result")].value().toString() );

    // we block because devices ( atleast MediaTomb )
    // seem to block continous TCP connections after some time
    // this interval might need modification
    block(500);

// TODO fill stuff here

    // if we are done, emit the relevant Object
    // otherwise recurse with a new (m_)resolve :)
    if( m_idResolve.currentId == QLatin1String("0") ) {
        emit idToPathResolved( m_idResolve.id, QLatin1Char('/') + m_idResolve.fullPath );
        m_idToPathRequestsInProgress = false;
        kDebug() << "Done with one resolve, continuing";
        if( !m_idToPathRequests.empty() )
            resolveNextIdToPath();
    }
    else {
        kDebug() << "Now calling recursive";
        resolveIdToPathInternal();
    }
}