DviProtocolUpnp::DviProtocolUpnp(DviDevice& aDevice) : iDevice(aDevice) , iDvStack(aDevice.GetDvStack()) , iLock("DMUP") , iUpdateCount(0) , iSuppressScheduledEvents(false) { SetAttribute(kAttributeKeyVersionMajor, "1"); SetAttribute(kAttributeKeyVersionMinor, "1"); iLock.Wait(); iServer = &(iDvStack.ServerUpnp()); NetworkAdapterList& adapterList = iDvStack.Env().NetworkAdapterList(); Functor functor = MakeFunctor(*this, &DviProtocolUpnp::HandleInterfaceChange); iCurrentAdapterChangeListenerId = adapterList.AddCurrentChangeListener(functor); iSubnetListChangeListenerId = adapterList.AddSubnetListChangeListener(functor); std::vector<NetworkAdapter*>* subnetList = adapterList.CreateSubnetList(); AutoNetworkAdapterRef ref(iDvStack.Env(), "DviProtocolUpnp ctor"); const NetworkAdapter* current = ref.Adapter(); if (current != NULL) { AddInterface(*current); } else { for (TUint i=0; i<subnetList->size(); i++) { NetworkAdapter* subnet = (*subnetList)[i]; try { AddInterface(*subnet); } catch (NetworkError& ) { // some hosts may have adapters that don't support multicast // we can't differentiate between no support ever and transient failure // (typical on Windows & Mac after hibernation) so just ignore this exception // and trust that we'll get advertised on another interface. char* adapterName = subnet->FullName(); LOG2(kTrace, kError, "DvDevice unable to use adapter %s\n", adapterName); delete adapterName; } } } NetworkAdapterList::DestroySubnetList(subnetList); iAliveTimer = new Timer(iDvStack.Env(), MakeFunctor(*this, &DviProtocolUpnp::SendAliveNotifications), "DviProtocolUpnp"); iLock.Signal(); }
DviProviderSubscriptionLongPoll::DviProviderSubscriptionLongPoll(DviDevice& aDevice) : DvProviderOpenhomeOrgSubscriptionLongPoll1(aDevice) , iDvStack(aDevice.GetDvStack()) , iPropertyUpdateCollection(iDvStack.PropertyUpdateCollection()) , iLock("LPMX") , iShutdown("LPSH", 0) , iExit(false) , iClientCount(0) { EnableActionSubscribe(); EnableActionUnsubscribe(); EnableActionRenew(); EnableActionGetPropertyUpdates(); iShutdown.Signal(); iMaxClientCount = iDvStack.Env().InitParams()->DvNumServerThreads() / 2; ASSERT(iMaxClientCount > 0); UpdateReadySignal empty; for (TUint i=0; i<iMaxClientCount; i++) { iUpdateReady.push_back(empty); } }