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(); }
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(); }
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); } }