Exemplo n.º 1
0
void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs(iEnv.OsCtx()) > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    Brh source;
    Brh sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.Bytes() == 0) {
        ASSERT(iExpectedSink.Bytes() == 0);
    }
    else {
        if (iExpectedSink.Bytes() == 0) {
            sink.TransferTo(iExpectedSink);
        }
        else {
            //ASSERT(sink == iExpectedSink);
            // can't use the above assertion.  aVia Media Renderer sometimes responds with two copies of its supported protocols
        }
    }
    iLock.Signal();
}
Exemplo n.º 2
0
void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs() > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    Brh source;
    Brh sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.Bytes() == 0) {
        ASSERT(iExpectedSink.Bytes() == 0);
    }
    else {
        if (iExpectedSink.Bytes() == 0) {
            sink.TransferTo(iExpectedSink);
        }
        else {
            ASSERT(sink == iExpectedSink);
        }
    }
    iLock.Signal();
}
Exemplo n.º 3
0
void CpiSubscription::SetSid(Brh& aSid)
{
    Mutex& lock = iDevice.GetCpStack().Env().Mutex();
    lock.Wait();
    aSid.TransferTo(iSid);
    lock.Signal();
}
Exemplo n.º 4
0
DviSubscription::DviSubscription(DvStack& aDvStack, DviDevice& aDevice, IPropertyWriterFactory& aWriterFactory,
                                 IDviSubscriptionUserData* aUserData, Brh& aSid, TUint& aDurationSecs)
    : iDvStack(aDvStack)
    , iLock("MDSB")
    , iRefCount(1)
    , iDevice(aDevice)
    , iWriterFactory(aWriterFactory)
    , iUserData(aUserData)
    , iService(NULL)
    , iSequenceNumber(0)
{
    iDevice.AddWeakRef();
    aSid.TransferTo(iSid);
    iWriterFactory.NotifySubscriptionCreated(iSid);
    Functor functor = MakeFunctor(*this, &DviSubscription::Expired);
    iTimer = new Timer(iDvStack.Env(), functor);
    DoRenew(aDurationSecs);
    iDvStack.Env().AddObject(this);
}
Exemplo n.º 5
0
void DeviceListTI::Poll()
{
    Timer timer(iEnv, MakeFunctor(*this, &DeviceListTI::TimerExpired));
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    Brh tmp;
    const TUint count = (TUint)iList.size();
    for (TUint i=0; i<count; i++) {
        CpDevice* device = iList[i];
        TUint countBefore = gActionCount;
        Print("Device ");
        Print(device->Udn());
        iConnMgr = new CpProxyUpnpOrgConnectionManager1(*device);
        iStopTimeMs = Os::TimeInMs(iEnv.OsCtx()) + kDevicePollMs;
        timer.FireIn(kDevicePollMs);
        for (TUint j=0; j<iEnv.InitParams()->NumActionInvokerThreads(); j++) {
            iConnMgr->BeginGetProtocolInfo(callback);
        }
        iPollStop.Wait();
        Print("    %u\n", gActionCount - countBefore);
        delete iConnMgr;
        iExpectedSink.TransferTo(tmp);
    }
}
Exemplo n.º 6
0
void DviProtocolUpnpAdapterSpecificData::SetDeviceXml(Brh& aXml)
{
    aXml.TransferTo(iDeviceXml);
}